86 lines
3 KiB
XML
86 lines
3 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!--
|
|
The FreeBSD Documentation Project
|
|
|
|
$FreeBSD$
|
|
-->
|
|
<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0" xml: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 <link xlink:href="../handbook/kernelconfig-building.html">Building and
|
|
Installing a Custom Kernel</link> 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 xml: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>/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 xml: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 <link xlink:href="../handbook/kernelconfig-building.html">Building and
|
|
Installing a Custom Kernel</link> chapter of the &os;
|
|
Handbook.</para>
|
|
</sect1>
|
|
</chapter>
|