View | Details | Raw Unified | Return to bug 24148
Collapse All | Expand All

(-)chapter.sgml (-21 / +49 lines)
Lines 57-63 Link Here
57
57
58
  <sect1 id="kernelconfig-building">
58
  <sect1 id="kernelconfig-building">
59
    <title>Building and Installing a Custom Kernel</title>
59
    <title>Building and Installing a Custom Kernel</title>
60
    <para>There are two methods for building a new kernel. Which method
61
      you use depends on whether or not you are doing a build world. If
62
      you don't know what a "build world" you can safely ignore that method.
63
      If you are just modifying your kernel, then you want the standard 
64
      method.  The steps for each method are quite different and will
65
      be outlined below.</para>
60
66
67
  <sect1 id="kernelconfig-building">
68
    <title>Directory structure</title>
61
    <para>First, let us take a quick tour of the kernel build directory.
69
    <para>First, let us take a quick tour of the kernel build directory.
62
      All directories mentioned will be relative to the main
70
      All directories mentioned will be relative to the main
63
      <filename>/usr/src/sys</filename> directory, which is also
71
      <filename>/usr/src/sys</filename> directory, which is also
Lines 77-93 Link Here
77
      directory structure, with each supported device, filesystem, and
85
      directory structure, with each supported device, filesystem, and
78
      option in its own subdirectory.</para>
86
      option in its own subdirectory.</para>
79
87
80
    <note>
88
  <sect1 id="kernelconfig-building">
81
      <para>If there is <emphasis>not</emphasis> a
89
   <title>Obtaining the kernel source</title>
82
	<filename>/usr/src/sys</filename> directory on your system, then
90
   <para>If there is <emphasis>not</emphasis> a
83
	the kernel source has not been been installed.  The easiest way to
91
     <filename>/usr/src/sys</filename> directory on your system, then
84
	do this is by running <command>/stand/sysinstall</command> as
92
     the kernel source has not been been installed.  The easiest way to
85
	<username>root</username>, choosing <literal>Configure</literal>,
93
     do this is by running <command>/stand/sysinstall</command> as
86
	then <literal>Distributions</literal>, then
94
     <username>root</username>, choosing <literal>Configure</literal>,
87
	<literal>src</literal>, then <literal>sys</literal>.</para>
95
     then <literal>Distributions</literal>, then
88
    </note>
96
     <literal>src</literal>, then <literal>sys</literal>.</para>
89
97
90
    <para>Next, move to the
98
  <sect1 id="kernelconfig-building">
99
   <title>Modifying the kernel configuration file</title>
100
   <para>The installed kernel sources include the configuration file for 
101
     the GENERIC kernel. This file is named, oddly enough,  
102
     <filename>GENERIC</filename>. Do not modify this file. By convention, 
103
     the kernel configuration file name is all upper case. Also included 
104
     with the kernel source is LINT. This file contains all the 
105
     kernel configuration options which are possible.  Most options have
106
     a description of what the option is for and any dependencies. Like
107
     <filename>GENERIC</filename>, this file should not be modified.</para>
108
109
   <para>The first step is configuring your kernel is the creation of your
110
     kernel configuration file. We will use <filename>GENERIC</filename>
111
     as the starting point. Move to the
91
      <filename><replaceable>arch</replaceable>/conf</filename> directory
112
      <filename><replaceable>arch</replaceable>/conf</filename> directory
92
      and copy the <filename>GENERIC</filename> configuration file to the
113
      and copy the <filename>GENERIC</filename> configuration file to the
93
      name you want to give your kernel.  For example:</para>
114
      name you want to give your kernel.  For example:</para>
Lines 95-101 Link Here
95
    <screen>&prompt.root; <userinput>cd /usr/src/sys/i386/conf</userinput>
116
    <screen>&prompt.root; <userinput>cd /usr/src/sys/i386/conf</userinput>
96
&prompt.root; <userinput>cp GENERIC MYKERNEL</userinput></screen>
117
&prompt.root; <userinput>cp GENERIC MYKERNEL</userinput></screen>
97
118
98
    <para>Traditionally, this name is in all capital letters and, if you
119
    <para>As mentioned above, this name is in all capital letters and, if you
99
      are maintaining multiple FreeBSD machines with different hardware,
120
      are maintaining multiple FreeBSD machines with different hardware,
100
      it is a good idea to name it after your machine's hostname.  We will
121
      it is a good idea to name it after your machine's hostname.  We will
101
      call it <filename>MYKERNEL</filename> for the purpose of this
122
      call it <filename>MYKERNEL</filename> for the purpose of this
Lines 138-149 Link Here
138
        for those information than the handbook.</para>
159
        for those information than the handbook.</para>
139
    </note>
160
    </note>
140
161
141
    <para>When you are finished, type the following to compile and install
162
  <sect1 id="kernelconfig-building">
142
      your kernel if you are using FreeBSD prior FreeBSD 4.0 and don't
163
    <title>Compiling your kernel</title>
143
      want to upgrade to FreeBSD 4.0 or higher with this step,
164
    <para>This section contains the default kernel compilation instructions.
144
      or if you are using a release-version of FreeBSD and your
165
      If you are upgrading from -RELEASE to -STABLE, using FreeBSD 4.0 or
145
      <filename>/usr/src/</filename> directory only contains the
166
      above, then the instructions on this section are for you. If you are 
146
      <filename>sys/</filename> sub-directory.</para>
167
      using before FreeBSD 4.0 and are not upgrading to FreeBSD 4.0 or above,
168
      then this section is for you. Otherwise you should read the instructions 
169
      from the next section to see if they apply to your situation.</para>
147
170
148
    <note>
171
    <note>
149
      <para>If you are trying to upgrade your kernel from an older version
172
      <para>If you are trying to upgrade your kernel from an older version
Lines 160-165 Link Here
160
&prompt.root; <userinput>make</userinput>
183
&prompt.root; <userinput>make</userinput>
161
&prompt.root; <userinput>make install</userinput></screen>
184
&prompt.root; <userinput>make install</userinput></screen>
162
185
186
  <sect1 id="kernelconfig-building">
187
    <title>Alternative compilation instructions</title>
163
    <para>If you have just upgraded to a newer version of 4.X or
188
    <para>If you have just upgraded to a newer version of 4.X or
164
      higher (ie from 3.X to 4-STABLE, or even from 4-STABLE to a
189
      higher (ie from 3.X to 4-STABLE, or even from 4-STABLE to a
165
      later version of 4-STABLE), make sure you have <link
190
      later version of 4-STABLE), make sure you have <link
Lines 173-181 Link Here
173
    <para>If you have <emphasis>not</emphasis> upgraded your source
198
    <para>If you have <emphasis>not</emphasis> upgraded your source
174
      tree in any way (you have not run <application>CVSup</application>, 
199
      tree in any way (you have not run <application>CVSup</application>, 
175
      <application>CTM</application>, or used 
200
      <application>CTM</application>, or used 
176
      <application>anoncvs</application>), then you should use the 
201
      <application>anoncvs</application>), then you should use the instructions
177
      <command>config</command>, <command>make depend</command>, 
202
      from the previous section.  However, if all you did was install
178
      <command>make</command>, <command>make install</command> sequence.</para>
203
      the kernel source using cvsup, then the instructions in the previous
204
      section should be used.</para>
179
205
180
    <warning>
206
    <warning>
181
      <para>If you have upgraded your sources since your last kernel
207
      <para>If you have upgraded your sources since your last kernel
Lines 188-193 Link Here
188
	sources!</emphasis></para>
214
	sources!</emphasis></para>
189
    </warning>
215
    </warning>
190
    
216
    
217
  <sect1 id="kernelconfig-building">    
218
    <title>Kernel installation</title>
191
    <para>The new kernel will be copied to the root directory as
219
    <para>The new kernel will be copied to the root directory as
192
      <filename>/kernel</filename> and the old kernel will be moved to
220
      <filename>/kernel</filename> and the old kernel will be moved to
193
      <filename>/kernel.old</filename>.  Now, shutdown the system and
221
      <filename>/kernel.old</filename>.  Now, shutdown the system and

Return to bug 24148