mirror of
https://git.linuxfromscratch.org/lfs.git
synced 2025-06-20 20:29:21 +01:00
217 lines
8.0 KiB
XML
217 lines
8.0 KiB
XML
<?xml version="1.0" encoding="ISO-8859-1"?>
|
|
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
|
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
|
<!ENTITY % general-entities SYSTEM "../general.ent">
|
|
%general-entities;
|
|
]>
|
|
|
|
<sect1 id="ch-tools-kernel" role="wrap">
|
|
<?dbhtml filename="kernel.html"?>
|
|
|
|
<sect1info condition="script">
|
|
<productname>kernel</productname>
|
|
<productnumber>&linux-version;</productnumber>
|
|
<address>&linux-url;</address>
|
|
</sect1info>
|
|
|
|
<title>Linux-&linux-version;</title>
|
|
|
|
<indexterm zone="ch-tools-kernel">
|
|
<primary sortas="a-Linux">Linux</primary>
|
|
<secondary>tools</secondary>
|
|
</indexterm>
|
|
|
|
<sect2 role="package">
|
|
<title/>
|
|
|
|
<para>The Linux package contains the Linux kernel.</para>
|
|
|
|
<segmentedlist>
|
|
<segtitle>&buildtime;</segtitle>
|
|
<segtitle>&diskspace;</segtitle>
|
|
|
|
<seglistitem>
|
|
<seg>&linux-tmp-sbu;</seg>
|
|
<seg>&linux-tmp-du;</seg>
|
|
</seglistitem>
|
|
</segmentedlist>
|
|
|
|
</sect2>
|
|
|
|
<sect2 role="installation">
|
|
<title>Installation of the kernel</title>
|
|
|
|
<para>Building the kernel involves a few steps—configuration,
|
|
compilation, and installation. Read the <filename>README</filename> file
|
|
in the kernel source tree for alternative methods to the way this book
|
|
configures the kernel.</para>
|
|
|
|
<para>Prepare for compilation by running the following command:</para>
|
|
|
|
<screen><userinput remap="pre">make mrproper</userinput></screen>
|
|
|
|
<para>This ensures that the kernel tree is absolutely clean. The
|
|
kernel team recommends that this command be issued prior to each
|
|
kernel compilation. Do not rely on the source tree being clean after
|
|
un-tarring.</para>
|
|
|
|
<para>There are several ways to configure the kernel options. Usually,
|
|
This is done through a menu-driven interface, for example:</para>
|
|
|
|
<screen role="nodump"><userinput>make ARCH=<replaceable>x86</replaceable> CROSS_COMPILE=$LFS_TGT- menuconfig</userinput></screen>
|
|
|
|
<variablelist>
|
|
<title>The meaning of make environment variables:</title>
|
|
|
|
<varlistentry>
|
|
<term><command>ARCH=x86</command></term>
|
|
<listitem>
|
|
<para>Configure the kernel for running on the target machine.
|
|
Replace <replaceable>x86</replaceable> with a value suitable
|
|
for your target machine if it's not a 32-bit or 64-bit x86.</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
<term><command>CROSS_COMPILE=$LFS_TGT-</command></term>
|
|
<listitem>
|
|
<para>Build the kernel with Binutils and GCC built in
|
|
<xref linkend='chapter-cross-tools'/>.</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
<term><command>menuconfig</command></term>
|
|
<listitem>
|
|
<para>This launches an ncurses menu-driven interface. For other
|
|
(graphical) interfaces, type <command>make help</command>.</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
<term>(optional) <parameter>LANG=<host_LANG_value> LC_ALL=</parameter></term>
|
|
<listitem>
|
|
<para>This establishes the locale setting to the one used on the
|
|
host. This may be needed for a proper menuconfig ncurses interface
|
|
line drawing on a UTF-8 linux text console.</para>
|
|
|
|
<para>If used, be sure to replace
|
|
<replaceable><host_LANG_value></replaceable> by the value of
|
|
the <envar>$LANG</envar> variable from your host. You can
|
|
alternatively use instead the host's value of <envar>$LC_ALL</envar>
|
|
or <envar>$LC_CTYPE</envar>.</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
<note>
|
|
|
|
<para>A good starting place for setting up the kernel configuration is to
|
|
run <command>make ARCH=x86 CROSS_COMPILE=$LFS_TGT- defconfig</command>. This will set the base
|
|
configuration to a good state that takes your target system architecture
|
|
into account.</para>
|
|
|
|
</note>
|
|
|
|
<para>Read <xref linkend='ch-bootable-kernel'/> for more information
|
|
about kernel configuration. You should enable or disable some kernel
|
|
configuration options now:</para>
|
|
|
|
<variablelist>
|
|
<title>Kernel configuration options and explanation:</title>
|
|
|
|
<varlistentry>
|
|
<term>Set <parameter>CONFIG_MODULES=n</parameter></term>
|
|
<listitem>
|
|
<para>Modular kernel needs <command>modprobe</command> tool from
|
|
<application>Kmod</application> to load modules, which is not
|
|
installed in the temporary system.</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
<term>Set <parameter>CONFIG_EXTRA_FIRMWARE="<replaceable>a.bin b.bin</replaceable>"</parameter></term>
|
|
<listitem>
|
|
<para>Build firmware blobs into the kernel. Some drivers may
|
|
require the firmwares to be in-kernel if the driver is not built
|
|
as module.</para>
|
|
<note>
|
|
<para>
|
|
The kernel binaries with third-party blobs are not
|
|
distributable. If you distribute such a kernel binary to
|
|
others, you may violate GPL. It's recommended to remove the
|
|
temporary kernel image after you've successfully boot your LFS
|
|
system with the new kernel image, which will be installed in
|
|
<xref linkend="ch-bootable-kernel"/>.
|
|
</para>
|
|
</note>
|
|
</listitem>
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
<term>Set <parameter>CONFIG_EXTRA_FIRMWARE_DIR="<replaceable>$LFS</replaceable>/lib/firmware"</parameter></term>
|
|
<listitem>
|
|
<para>The building system will search
|
|
<filename class="directory">/lib/firmware</filename> for firmware
|
|
blobs in <parameter>CONFIG_EXTRA_FIRMWARE</parameter>. Note that
|
|
you'll need to install the needed firmwares into
|
|
<filename class="directory">$LFS/lib/firmware</filename> first,
|
|
and manually replace <envar>$LFS</envar> with the value in
|
|
configuration. The firmwares in
|
|
<filename class="directory">$LFS/lib/filename</filename> will be
|
|
copied to the target machine along with the system, so kernel and
|
|
kernel modules which will be built in
|
|
<xref linkend="ch-bootable-kernel"/> can load them without
|
|
<parameter>CONFIG_EXTRA_FIRMWARE</parameter>.</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
<term>Set <parameter>CONFIG_EXT2=y</parameter>,
|
|
<parameter>CONFIG_EXT4=y</parameter>,
|
|
and <parameter>CONFIG_VFAT_FS=y</parameter></term>
|
|
<listitem>
|
|
<para>They are needed to access the filesystems we'll make for the
|
|
target system.</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
<term>
|
|
Set <parameter>CONFIG_MODULE_SIG=n</parameter>,
|
|
<parameter>CONFIG_SECURITY=n</parameter>,
|
|
<parameter>CONFIG_STACK_VALIDATION=n</parameter>,
|
|
<parameter>CONFIG_SYSTEM_TRUSTED_KEYRING=n</parameter>,
|
|
and <parameter>CONFIG_SYSTEM_REVOCATION_LIST=n</parameter>
|
|
</term>
|
|
<listitem>
|
|
<para>They are unneeded for the temporary kernel, and they need
|
|
additional dependencies which may be unavailable on the host
|
|
distro. You can enable them building the kernel for the final LFS
|
|
system in Chapter 10 if you need these features.</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
|
|
<para>Compile the kernel image:</para>
|
|
|
|
<screen><userinput remap="make">make ARCH=x86 CROSS_COMPILE=$LFS_TGT-</userinput></screen>
|
|
|
|
<para>Install the kernel image into the
|
|
<filename class="directory">$LFS/boot</filename> directory:</para>
|
|
|
|
<screen><userinput remap="install">install -vm644 arch/x86/boot/bzImage $LFS/boot/vmlinuz</userinput></screen>
|
|
|
|
</sect2>
|
|
|
|
<sect2 role="content">
|
|
<title/>
|
|
|
|
<para>Details on this package are located in
|
|
<xref linkend="contents-kernel" role="."/></para>
|
|
|
|
</sect2>
|
|
|
|
</sect1>
|