Apply the magic pixie dust of understanding to the "make the kernel" build
process (and the choice of procedure).
This commit is contained in:
parent
89356761a6
commit
a44322ee3f
Notes:
svn2git
2020-12-08 03:00:23 +00:00
svn path=/head/; revision=9749
1 changed files with 97 additions and 38 deletions
|
@ -1,7 +1,7 @@
|
|||
<!--
|
||||
The FreeBSD Documentation Project
|
||||
|
||||
$FreeBSD: doc/en_US.ISO8859-1/books/handbook/kernelconfig/chapter.sgml,v 1.45 2001/06/26 17:46:16 murray Exp $
|
||||
$FreeBSD: doc/en_US.ISO8859-1/books/handbook/kernelconfig/chapter.sgml,v 1.46 2001/06/26 20:10:25 murray Exp $
|
||||
-->
|
||||
|
||||
<chapter id="kernelconfig">
|
||||
|
@ -109,6 +109,26 @@
|
|||
call it <filename>MYKERNEL</filename> for the purpose of this
|
||||
example.</para>
|
||||
|
||||
<tip>
|
||||
<para>Storing your kernel config file directly under
|
||||
<filename>/usr/src</filename> can be a bad idea. If you are
|
||||
experiencing problems it can be tempting to just delete
|
||||
<filename>/usr/src</filename> and start again. Five seconds after
|
||||
you do that you realise that you have deleted your custom kernel
|
||||
config file.</para>
|
||||
|
||||
<para>You might want to keep your kernel config file elsewhere, and then
|
||||
create a symbolic link to the file in the <filename>i386</filename>
|
||||
directory.</para>
|
||||
|
||||
<para>For example:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>cd /usr/src/sys/i386/conf</userinput>
|
||||
&prompt.root; <userinput>mkdir /root/kernels</userinput>
|
||||
&prompt.root; <userinput>cp GENERIC /root/kernels/<replaceable>MYKERNEL</replaceable></userinput>
|
||||
&prompt.root; <userinput>ln -s /root/kernels/<replaceable>MYKERNEL</replaceable></userinput></screen>
|
||||
</tip>
|
||||
|
||||
<note>
|
||||
<para>You must execute these and all of the following commands under
|
||||
the root account or you will get <errortype>permission
|
||||
|
@ -147,38 +167,87 @@
|
|||
for those information than the handbook.</para>
|
||||
</note>
|
||||
|
||||
<para>When you are finished, type the following to compile and install
|
||||
your kernel if you are using FreeBSD prior FreeBSD 4.0 and don't
|
||||
want to upgrade to FreeBSD 4.0 or higher with this step,
|
||||
or if you are using a release-version of FreeBSD and your
|
||||
<filename>/usr/src/</filename> directory only contains the
|
||||
<filename>sys/</filename> sub-directory.</para>
|
||||
<para>You must now compile the source code for the kernel. There are two
|
||||
procedures you can use to do this, and the one you will use depends on
|
||||
why you are rebuilding the kernel, and the version of FreeBSD you are
|
||||
running.</para>
|
||||
|
||||
<note>
|
||||
<para>If you are trying to upgrade your kernel from an older version
|
||||
of FreeBSD, you will probably have to get a new version of
|
||||
&man.config.8; from the same place you got the new kernel sources.
|
||||
It is located in <filename>/usr/src/usr.sbin</filename>, so you
|
||||
will need to download those sources as well. Re-build and install
|
||||
it before running the next commands.</para>
|
||||
</note>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>If you have installed <emphasis>only</emphasis> the kernel
|
||||
source code, use procedure 1.</para>
|
||||
</listitem>
|
||||
|
||||
<screen>&prompt.root; <userinput>/usr/sbin/config MYKERNEL</userinput>
|
||||
&prompt.root; <userinput>cd ../../compile/MYKERNEL</userinput>
|
||||
&prompt.root; <userinput>make depend</userinput>
|
||||
&prompt.root; <userinput>make</userinput>
|
||||
&prompt.root; <userinput>make install</userinput></screen>
|
||||
<listitem>
|
||||
<para>If you are running a FreeBSD version prior to 4.0, and you are
|
||||
<emphasis>not</emphasis> upgrading to FreeBSD 4.0 or higher using
|
||||
the <quote>make world</quote> procedure, use procedure 1.</para>
|
||||
</listitem>
|
||||
|
||||
<para>If you have just upgraded to a newer version of 4.X or
|
||||
higher (ie from 3.X to 4-STABLE, or even from 4-STABLE to a
|
||||
later version of 4-STABLE), make sure you have <link
|
||||
linkend="cutting-edge">built the world</link>, and then run the
|
||||
following commands:</para>
|
||||
<listitem>
|
||||
<para>If you are building a new kernel without updating the source
|
||||
code (perhaps just to add a new option, such as
|
||||
<literal>IPFIREWALL</literal>) you can use either procedure.</para>
|
||||
</listitem>
|
||||
|
||||
<screen>&prompt.root; <userinput>cd /usr/src</userinput>
|
||||
&prompt.root; <userinput>make buildkernel KERNCONF=MYKERNEL</userinput>
|
||||
&prompt.root; <userinput>make installkernel KERNCONF=MYKERNEL</userinput></screen>
|
||||
<listitem>
|
||||
<para>If you are rebuilding the kernel as part of a <quote>make
|
||||
world</quote> process, use procedure 2.</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
<procedure>
|
||||
<title>Procedure 1. Building a kernel the the <quote>traditional</quote> way</title>
|
||||
|
||||
<step>
|
||||
<para>Run &man.config.8; to generate the kernel source code.</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>/usr/sbin/config <replaceable>MYKERNEL</replaceable></userinput></screen>
|
||||
</step>
|
||||
|
||||
<step>
|
||||
<para>Change in to the build directory.</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>cd ../../compile/<replaceable>MYKERNEL</replaceable></userinput></screen>
|
||||
</step>
|
||||
|
||||
<step>
|
||||
<para>Compile the kernel.</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>make depend</userinput>
|
||||
&prompt.root; <userinput>make</userinput></screen>
|
||||
</step>
|
||||
|
||||
<step>
|
||||
<para>Install the new kernel.</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>make install</userinput></screen>
|
||||
</step>
|
||||
</procedure>
|
||||
|
||||
<procedure>
|
||||
<title>Procedure 2. Building a kernel the <quote>new</quote>
|
||||
way</title>
|
||||
|
||||
<step>
|
||||
<para>Change to the <filename>/usr/src</filename> directory</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>cd /usr/src</userinput></screen>
|
||||
</step>
|
||||
|
||||
<step>
|
||||
<para>Compile the kernel.</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>make buildkernel KERNCONF=<replaceable>MYKERNEL</replaceable></userinput></screen>
|
||||
</step>
|
||||
|
||||
<step>
|
||||
<para>Install the new kernel.</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>make installkernel KERNCONF=MYKERNEL</userinput></screen>
|
||||
</step>
|
||||
</procedure>
|
||||
|
||||
<note>
|
||||
<para>In FreeBSD 4.2 and older you must replace
|
||||
<literal>KERCONF=</literal> with <literal>KERNEL=</literal>.
|
||||
|
@ -201,16 +270,6 @@
|
|||
<command>config</command>, <command>make depend</command>,
|
||||
<command>make</command>, <command>make install</command> sequence.</para>
|
||||
|
||||
<warning>
|
||||
<para>If you have upgraded your sources since your last kernel
|
||||
build, you <emphasis>must</emphasis> use the <command>make
|
||||
buildkernel</command> method to build your kernel. Otherwise,
|
||||
old utilities will be used to build the kernel, which will
|
||||
probably fail. <emphasis>Do not use the
|
||||
<command>config</command>/<command>make</command> sequence to
|
||||
build your kernel if you have updated the
|
||||
sources!</emphasis></para>
|
||||
</warning>
|
||||
<indexterm><primary>kernel.old</primary></indexterm>
|
||||
|
||||
<para>The new kernel will be copied to the root directory as
|
||||
|
|
Loading…
Reference in a new issue