and replace them with class="directory" [1][2] [1] http://docbook.org/tdg/en/html/filename.html [2] http://www.freebsd.org/doc/en/books/fdp-primer/sgml-markup-docbook.html#AEN1799 (4.2.5.5) Approved by: trhodes, gabor (mentor)
88 lines
2.9 KiB
Text
88 lines
2.9 KiB
Text
<!--
|
|
The FreeBSD Documentation Project
|
|
|
|
$FreeBSD$
|
|
-->
|
|
|
|
<chapter id="kernelbuild">
|
|
<title>Building and Installing a &os; Kernel</title>
|
|
|
|
<para>Being a kernel developer requires understanding of the kernel
|
|
build process. To debug the &os; kernel it is required to be able
|
|
to build one. There are two known ways to do so:</para>
|
|
|
|
<itemizedlist>
|
|
<listitem>
|
|
<para>The <quote>Traditional</quote> Way</para>
|
|
</listitem>
|
|
|
|
<listitem>
|
|
<para>The <quote>New</quote> Way</para>
|
|
</listitem>
|
|
</itemizedlist>
|
|
|
|
<note>
|
|
<para>It is supposed that the reader of this chapter is familiar
|
|
with the information described in the <ulink
|
|
url="../handbook/kernelconfig-building.html">Building and
|
|
Installing a Custom Kernel</ulink> chapter of the &os;
|
|
Handbook. If this is not the case, please read through the above
|
|
mentioned chapter to understand how the build process
|
|
works.</para>
|
|
</note>
|
|
|
|
<sect1 id="kernelbuild-traditional">
|
|
<title>Building a Kernel the <quote>Traditional</quote> Way</title>
|
|
|
|
<para>Up to version 4.X of &os; this was the recommended way to
|
|
build a new kernel. It can still be used on newer versions
|
|
(instead of the <quote>buildkernel</quote> target of the toplevel
|
|
<filename class="directory">/usr/src/</filename> makefiles).
|
|
Building the kernel this way may be useful when working on the
|
|
kernel code and it may actually be faster than the
|
|
<quote>New</quote> procedure when only a single option or two were
|
|
tweaked in the kernel configuration file. On the other hand, it
|
|
might lead to unexpected kernel build breakage when used by
|
|
beginners on newer versions of &os;.</para>
|
|
|
|
<procedure>
|
|
<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 into the build directory. &man.config.8; will
|
|
print the name of this directory after being run as
|
|
above.</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>
|
|
</sect1>
|
|
|
|
<sect1 id="kernelbuild-new">
|
|
<title>Building a Kernel the <quote>New</quote> Way</title>
|
|
|
|
<para>This procedure is well supported and recommended under the
|
|
latest &os; releases and is documented in the <ulink
|
|
url="../handbook/kernelconfig-building.html">Building and
|
|
Installing a Custom Kernel</ulink> chapter of the &os;
|
|
Handbook.</para>
|
|
</sect1>
|
|
</chapter>
|