2004-05-03 11:59:46 +01:00
|
|
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
2007-03-21 18:42:58 +00:00
|
|
|
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
|
|
|
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
2004-05-03 11:59:46 +01:00
|
|
|
<!ENTITY % general-entities SYSTEM "../general.ent">
|
|
|
|
%general-entities;
|
|
|
|
]>
|
2005-12-18 13:44:24 +00:00
|
|
|
|
2005-02-19 22:16:42 +00:00
|
|
|
<sect1 id="ch-bootable-kernel" role="wrap">
|
2005-12-18 13:44:24 +00:00
|
|
|
<?dbhtml filename="kernel.html"?>
|
|
|
|
|
2007-09-07 20:16:43 +01:00
|
|
|
<sect1info condition="script">
|
|
|
|
<productname>linux</productname>
|
|
|
|
<productnumber>&linux-version;</productnumber>
|
|
|
|
<address>&linux-url;</address>
|
|
|
|
</sect1info>
|
|
|
|
|
2005-12-18 13:44:24 +00:00
|
|
|
<title>Linux-&linux-version;</title>
|
|
|
|
|
|
|
|
<indexterm zone="ch-bootable-kernel">
|
|
|
|
<primary sortas="a-Linux">Linux</primary>
|
|
|
|
</indexterm>
|
|
|
|
|
|
|
|
<sect2 role="package">
|
|
|
|
<title/>
|
|
|
|
|
|
|
|
<para>The Linux package contains the Linux kernel.</para>
|
2004-05-03 11:59:46 +01:00
|
|
|
|
2005-12-18 13:44:24 +00:00
|
|
|
<segmentedlist>
|
|
|
|
<segtitle>&buildtime;</segtitle>
|
|
|
|
<segtitle>&diskspace;</segtitle>
|
2001-01-24 00:31:17 +00:00
|
|
|
|
2005-12-18 13:44:24 +00:00
|
|
|
<seglistitem>
|
2006-05-14 21:16:56 +01:00
|
|
|
<seg>&linux-ch8-sbu;</seg>
|
|
|
|
<seg>&linux-ch8-du;</seg>
|
2005-12-18 13:44:24 +00:00
|
|
|
</seglistitem>
|
|
|
|
</segmentedlist>
|
2004-05-16 01:08:42 +01:00
|
|
|
|
2005-12-18 13:44:24 +00:00
|
|
|
</sect2>
|
2004-02-05 22:17:48 +00:00
|
|
|
|
2005-12-18 13:44:24 +00:00
|
|
|
<sect2 role="installation">
|
|
|
|
<title>Installation of the kernel</title>
|
2005-02-19 22:16:42 +00:00
|
|
|
|
2005-12-18 13:44:24 +00:00
|
|
|
<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>
|
2004-06-15 17:14:43 +01:00
|
|
|
|
2007-09-18 22:11:00 +01:00
|
|
|
<screen><userinput remap="pre">make mrproper</userinput></screen>
|
2004-06-15 17:14:43 +01:00
|
|
|
|
2005-12-18 13:44:24 +00:00
|
|
|
<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>
|
2005-01-30 12:51:22 +00:00
|
|
|
|
2006-01-06 01:59:08 +00:00
|
|
|
<!-- Support for compiling a keymap into the kernel is deliberately removed -->
|
2005-02-19 22:16:42 +00:00
|
|
|
|
2009-05-29 06:23:41 +01:00
|
|
|
<para>Configure the kernel via a menu-driven interface. For general
|
|
|
|
information on kernel configuration see <ulink
|
2012-01-16 18:34:31 +00:00
|
|
|
url="&hints-root;kernel-configuration.txt"/>. BLFS has some information
|
2009-05-29 06:23:41 +01:00
|
|
|
regarding particular kernel configuration requirements of packages outside
|
|
|
|
of LFS at <ulink
|
2013-05-28 01:17:45 +01:00
|
|
|
url="&blfs-root;view/svn/longindex.html#kernel-config-index"/>. Additional
|
|
|
|
information about configuring and building the kernel can be found at
|
|
|
|
<ulink url="http://www.kroah.com/lkn/"/> </para>
|
2012-01-16 18:34:31 +00:00
|
|
|
|
2013-07-21 00:01:24 +01:00
|
|
|
<note><para>A good starting place for setting up the kernel configuration
|
|
|
|
is to run <command>make defconfig</command>. This will set the base
|
|
|
|
configuration to a good state that takes your current system architecture
|
|
|
|
into account.</para>
|
|
|
|
|
2014-04-03 22:52:09 +01:00
|
|
|
<para>Be sure to enable or disable following features:</para>
|
|
|
|
|
2014-05-11 01:58:48 +01:00
|
|
|
<screen role="nodump">
|
2014-04-03 22:52:09 +01:00
|
|
|
Device Drivers --->
|
2012-01-16 18:34:31 +00:00
|
|
|
Generic Driver Options --->
|
2014-06-26 19:54:38 +01:00
|
|
|
() path to uevent helper [CONFIG_UEVENT_HELPER_PATH]
|
|
|
|
[*] Maintain a devtmpfs filesystem to mount at /dev [CONFIG_DEVTMPFS]</screen></note>
|
2014-05-15 21:17:02 +01:00
|
|
|
|
|
|
|
<para>There are several other options that may be desired depending
|
2014-06-26 19:54:38 +01:00
|
|
|
on the requirements for the system. For a list of options needed
|
2014-05-15 21:17:02 +01:00
|
|
|
for BLFS packages, see the <ulink
|
|
|
|
url="&lfs-root;blfs/view/&short-version;/longindex.html#kernel-config-index">BLFS
|
|
|
|
Index of Kernel Settings</ulink>
|
|
|
|
(&lfs-root;blfs/view/&short-version;/longindex.html#kernel-config-index).</para>
|
2014-05-11 01:58:48 +01:00
|
|
|
|
|
|
|
<variablelist>
|
|
|
|
<title>The rationale for the above configuration items:</title>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>path to uevent helper</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>Having an entry in this space will interfere with device
|
|
|
|
management when using udev/eudev. </para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>Maintain a devtmpfs</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>This will create automated device nodes which are populated by the
|
|
|
|
kernel, even without udev running. Udev then runs on top of this,
|
|
|
|
managing permissions and adding symlinks. This configuration
|
|
|
|
itme is required for all users of udev/eudev. </para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
</variablelist>
|
2004-02-05 22:17:48 +00:00
|
|
|
|
2007-06-06 18:28:25 +01:00
|
|
|
<screen role="nodump"><userinput>make LANG=<replaceable><host_LANG_value></replaceable> LC_ALL= menuconfig</userinput></screen>
|
|
|
|
|
|
|
|
<variablelist>
|
|
|
|
<title>The meaning of the make parameters:</title>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>LANG=<host_LANG_value> LC_ALL=</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>This establishes the locale setting to the one used on the host.
|
|
|
|
This is needed for a proper menuconfig ncurses interface line
|
|
|
|
drawing on UTF-8 linux text console.</para>
|
|
|
|
|
|
|
|
<para>Be sure to replace <replaceable><host_LANG_value></replaceable>
|
|
|
|
by the value of the <envar>$LANG</envar> variable from your host.
|
2007-06-06 18:53:39 +01:00
|
|
|
If not set, you could use instead the host's value of <envar>$LC_ALL</envar>
|
2007-06-06 18:28:25 +01:00
|
|
|
or <envar>$LC_CTYPE</envar>.</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
</variablelist>
|
2004-02-05 22:17:48 +00:00
|
|
|
|
2005-12-18 13:44:24 +00:00
|
|
|
<para>Alternatively, <command>make oldconfig</command> may be more
|
|
|
|
appropriate in some situations. See the <filename>README</filename>
|
|
|
|
file for more information.</para>
|
|
|
|
|
|
|
|
<para>If desired, skip kernel configuration by copying the kernel
|
|
|
|
config file, <filename>.config</filename>, from the host system
|
|
|
|
(assuming it is available) to the unpacked <filename
|
|
|
|
class="directory">linux-&linux-version;</filename> directory. However,
|
|
|
|
we do not recommend this option. It is often better to explore all the
|
|
|
|
configuration menus and create the kernel configuration from
|
|
|
|
scratch.</para>
|
|
|
|
|
|
|
|
<para>Compile the kernel image and modules:</para>
|
2004-02-05 22:17:48 +00:00
|
|
|
|
2007-09-18 22:11:00 +01:00
|
|
|
<screen><userinput remap="make">make</userinput></screen>
|
2004-02-05 22:17:48 +00:00
|
|
|
|
2010-01-27 04:55:48 +00:00
|
|
|
<para>If using kernel modules, module configuration in <filename
|
|
|
|
class="directory">/etc/modprobe.d</filename> may be required.
|
|
|
|
Information pertaining to modules and kernel configuration is
|
|
|
|
located in <xref linkend="ch-scripts-udev"/> and in the kernel
|
|
|
|
documentation in the <filename
|
2005-12-18 13:44:24 +00:00
|
|
|
class="directory">linux-&linux-version;/Documentation</filename> directory.
|
|
|
|
Also, <filename>modprobe.conf(5)</filename> may be of interest.</para>
|
2005-07-02 19:29:36 +01:00
|
|
|
|
2005-12-18 13:44:24 +00:00
|
|
|
<para>Install the modules, if the kernel configuration uses them:</para>
|
2004-02-05 22:17:48 +00:00
|
|
|
|
2007-09-18 22:11:00 +01:00
|
|
|
<screen><userinput remap="install">make modules_install</userinput></screen>
|
2004-02-05 22:17:48 +00:00
|
|
|
|
2005-12-18 13:44:24 +00:00
|
|
|
<para>After kernel compilation is complete, additional steps are
|
|
|
|
required to complete the installation. Some files need to be copied to
|
|
|
|
the <filename class="directory">/boot</filename> directory.</para>
|
2005-02-19 22:16:42 +00:00
|
|
|
|
2009-10-29 05:41:46 +00:00
|
|
|
<para>The path to the kernel image may vary depending on the platform being
|
|
|
|
used. The filename below can be changed to suit your taste, but the stem of
|
2011-08-31 03:07:21 +01:00
|
|
|
the filename should be <emphasis>vmlinuz</emphasis> to be compatible with
|
2009-10-29 05:41:46 +00:00
|
|
|
the automatic setup of the boot process described in the next section. The
|
|
|
|
following command assumes an x86 architecture:</para>
|
2004-02-05 22:17:48 +00:00
|
|
|
|
2011-08-31 03:07:21 +01:00
|
|
|
<screen><userinput remap="install">cp -v arch/x86/boot/bzImage /boot/vmlinuz-&linux-version;-lfs-&version;</userinput></screen>
|
2004-02-05 22:17:48 +00:00
|
|
|
|
2005-12-18 13:44:24 +00:00
|
|
|
<para><filename>System.map</filename> is a symbol file for the kernel.
|
|
|
|
It maps the function entry points of every function in the kernel API,
|
|
|
|
as well as the addresses of the kernel data structures for the running
|
2013-02-11 20:09:22 +00:00
|
|
|
kernel. It is used as a resource when investigating kernel problems.
|
2010-02-19 22:53:37 +00:00
|
|
|
Issue the following command to install the map file:</para>
|
2005-02-19 22:16:42 +00:00
|
|
|
|
2007-09-18 22:11:00 +01:00
|
|
|
<screen><userinput remap="install">cp -v System.map /boot/System.map-&linux-version;</userinput></screen>
|
2004-02-05 22:17:48 +00:00
|
|
|
|
2005-12-18 13:44:24 +00:00
|
|
|
<para>The kernel configuration file <filename>.config</filename>
|
|
|
|
produced by the <command>make menuconfig</command> step
|
|
|
|
above contains all the configuration selections for the kernel
|
|
|
|
that was just compiled. It is a good idea to keep this file for future
|
|
|
|
reference:</para>
|
2005-02-19 22:16:42 +00:00
|
|
|
|
2007-09-18 22:11:00 +01:00
|
|
|
<screen><userinput remap="install">cp -v .config /boot/config-&linux-version;</userinput></screen>
|
2004-02-05 22:17:48 +00:00
|
|
|
|
2006-01-23 20:49:24 +00:00
|
|
|
<para>Install the documentation for the Linux kernel:</para>
|
|
|
|
|
2007-09-18 22:11:00 +01:00
|
|
|
<screen><userinput remap="install">install -d /usr/share/doc/linux-&linux-version;
|
2006-08-03 20:29:29 +01:00
|
|
|
cp -r Documentation/* /usr/share/doc/linux-&linux-version;</userinput></screen>
|
2006-01-23 20:49:24 +00:00
|
|
|
|
2005-12-18 13:44:24 +00:00
|
|
|
<para>It is important to note that the files in the kernel source
|
|
|
|
directory are not owned by <emphasis>root</emphasis>. Whenever a
|
|
|
|
package is unpacked as user <emphasis>root</emphasis> (like we did
|
|
|
|
inside chroot), the files have the user and group IDs of whatever
|
|
|
|
they were on the packager's computer. This is usually not a problem
|
|
|
|
for any other package to be installed because the source tree is
|
|
|
|
removed after the installation. However, the Linux source tree is
|
|
|
|
often retained for a long time. Because of this, there is a chance
|
|
|
|
that whatever user ID the packager used will be assigned to somebody
|
|
|
|
on the machine. That person would then have write access to the kernel
|
|
|
|
source.</para>
|
|
|
|
|
|
|
|
<para>If the kernel source tree is going to be retained, run
|
|
|
|
<command>chown -R 0:0</command> on the <filename
|
|
|
|
class="directory">linux-&linux-version;</filename> directory to ensure
|
|
|
|
all files are owned by user <emphasis>root</emphasis>.</para>
|
|
|
|
|
|
|
|
<warning>
|
|
|
|
<para>Some kernel documentation recommends creating a symlink from
|
|
|
|
<filename class="symlink">/usr/src/linux</filename> pointing to the kernel
|
|
|
|
source directory. This is specific to kernels prior to the 2.6 series and
|
|
|
|
<emphasis>must not</emphasis> be created on an LFS system as it can cause
|
|
|
|
problems for packages you may wish to build once your base LFS system is
|
|
|
|
complete.</para>
|
2007-06-05 18:44:47 +01:00
|
|
|
</warning>
|
2005-12-18 13:44:24 +00:00
|
|
|
|
2007-06-05 18:44:47 +01:00
|
|
|
<warning>
|
2014-02-21 22:02:35 +00:00
|
|
|
<para>The headers in the system's <filename
|
|
|
|
class="directory">include</filename> directory (<filename
|
|
|
|
class="directory">/usr/include</filename>) should
|
2005-12-18 13:44:24 +00:00
|
|
|
<emphasis>always</emphasis> be the ones against which Glibc was compiled,
|
2014-02-21 22:02:35 +00:00
|
|
|
that is, the sanitised headers installed in <xref
|
|
|
|
linkend="ch-system-linux-headers"/>. Therefore, they should
|
|
|
|
<emphasis>never</emphasis> be replaced by either the raw kernel headers
|
|
|
|
or any other kernel sanitized headers.</para>
|
2005-12-18 13:44:24 +00:00
|
|
|
</warning>
|
|
|
|
|
|
|
|
</sect2>
|
|
|
|
|
2009-05-16 22:29:05 +01:00
|
|
|
<sect2 id="conf-modprobe" role="configuration">
|
|
|
|
<title>Configuring Linux Module Load Order</title>
|
|
|
|
|
|
|
|
<indexterm zone="conf-modprobe">
|
2010-01-27 04:55:48 +00:00
|
|
|
<primary sortas="e-/etc/modprobe.d/usb.conf">/etc/modprobe.d/usb.conf</primary>
|
2009-05-16 22:29:05 +01:00
|
|
|
</indexterm>
|
|
|
|
|
2013-01-11 19:12:41 +00:00
|
|
|
<para>Most of the time Linux modules are loaded automatically, but
|
|
|
|
sometimes it needs some specific direction. The program that loads
|
|
|
|
modules, <command>modprobe</command> or <command>insmod</command>, uses
|
|
|
|
<filename>/etc/modprobe.d/usb.conf</filename> for this purpose. This file
|
|
|
|
needs to be created so that if the USB drivers (ehci_hcd, ohci_hcd and
|
|
|
|
uhci_hcd) have been built as modules, they will be loaded in the correct
|
|
|
|
order; ehci_hcd needs to be loaded prior to ohci_hcd and uhci_hcd in order
|
|
|
|
to avoid a warning being output at boot time.</para>
|
2009-05-16 22:29:05 +01:00
|
|
|
|
2010-01-27 04:55:48 +00:00
|
|
|
<para>Create a new file <filename>/etc/modprobe.d/usb.conf</filename> by running
|
2009-05-16 22:29:05 +01:00
|
|
|
the following:</para>
|
|
|
|
|
2010-01-28 22:12:29 +00:00
|
|
|
<screen><userinput>install -v -m755 -d /etc/modprobe.d
|
2010-01-27 04:55:48 +00:00
|
|
|
cat > /etc/modprobe.d/usb.conf << "EOF"
|
|
|
|
<literal># Begin /etc/modprobe.d/usb.conf
|
2009-05-16 22:29:05 +01:00
|
|
|
|
|
|
|
install ohci_hcd /sbin/modprobe ehci_hcd ; /sbin/modprobe -i ohci_hcd ; true
|
|
|
|
install uhci_hcd /sbin/modprobe ehci_hcd ; /sbin/modprobe -i uhci_hcd ; true
|
|
|
|
|
2010-01-27 04:55:48 +00:00
|
|
|
# End /etc/modprobe.d/usb.conf</literal>
|
2009-05-16 22:29:05 +01:00
|
|
|
EOF</userinput></screen>
|
|
|
|
|
|
|
|
</sect2>
|
|
|
|
|
2005-12-18 13:44:24 +00:00
|
|
|
<sect2 id="contents-kernel" role="content">
|
|
|
|
<title>Contents of Linux</title>
|
|
|
|
|
|
|
|
<segmentedlist>
|
|
|
|
<segtitle>Installed files</segtitle>
|
2010-05-23 18:18:52 +01:00
|
|
|
<segtitle>Installed directories</segtitle>
|
2005-12-18 13:44:24 +00:00
|
|
|
|
|
|
|
<seglistitem>
|
2013-02-11 20:09:22 +00:00
|
|
|
<seg>config-&linux-version;,
|
2013-08-20 14:35:51 +01:00
|
|
|
vmlinuz-&linux-version;-lfs-&version;, and
|
2005-12-18 13:44:24 +00:00
|
|
|
System.map-&linux-version;</seg>
|
2010-05-23 18:18:52 +01:00
|
|
|
<seg>/lib/modules, /usr/share/doc/linux-&linux-version;</seg>
|
2005-12-18 13:44:24 +00:00
|
|
|
</seglistitem>
|
|
|
|
</segmentedlist>
|
|
|
|
|
|
|
|
<variablelist>
|
|
|
|
<bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
|
|
|
<?dbfo list-presentation="list"?>
|
|
|
|
<?dbhtml list-presentation="table"?>
|
|
|
|
|
|
|
|
<varlistentry id="config">
|
|
|
|
<term><filename>config-&linux-version;</filename></term>
|
|
|
|
<listitem>
|
|
|
|
<para>Contains all the configuration selections for the kernel</para>
|
|
|
|
<indexterm zone="ch-bootable-kernel config">
|
|
|
|
<primary sortas="e-/boot/config">/boot/config-&linux-version;</primary>
|
|
|
|
</indexterm>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry id="lfskernel">
|
2013-08-20 13:55:18 +01:00
|
|
|
<term><filename>vmlinuz-&linux-version;-lfs-&version;</filename></term>
|
2005-12-18 13:44:24 +00:00
|
|
|
<listitem>
|
|
|
|
<para>The engine of the Linux system. When turning on the computer,
|
|
|
|
the kernel is the first part of the operating system that gets loaded.
|
|
|
|
It detects and initializes all components of the computer's hardware,
|
|
|
|
then makes these components available as a tree of files to the
|
|
|
|
software and turns a single CPU into a multitasking machine capable
|
|
|
|
of running scores of programs seemingly at the same time</para>
|
|
|
|
<indexterm zone="ch-bootable-kernel lfskernel">
|
|
|
|
<primary sortas="b-lfskernel">lfskernel-&linux-version;</primary>
|
|
|
|
</indexterm>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry id="System.map">
|
|
|
|
<term><filename>System.map-&linux-version;</filename></term>
|
|
|
|
<listitem>
|
|
|
|
<para>A list of addresses and symbols; it maps the entry points and
|
|
|
|
addresses of all the functions and data structures in the
|
|
|
|
kernel</para>
|
|
|
|
<indexterm zone="ch-bootable-kernel System.map">
|
|
|
|
<primary sortas="e-/boot/System.map">/boot/System.map-&linux-version;</primary>
|
|
|
|
</indexterm>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
</variablelist>
|
|
|
|
|
|
|
|
</sect2>
|
2004-05-03 11:59:46 +01:00
|
|
|
|
2001-01-24 00:31:17 +00:00
|
|
|
</sect1>
|