[bf8c11f] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
| 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
|
---|
| 4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 | ]>
|
---|
| 7 |
|
---|
| 8 | <sect1 id="ch-bootable-kernel" role="wrap">
|
---|
| 9 | <?dbhtml filename="kernel.html"?>
|
---|
| 10 |
|
---|
[930f404] | 11 | <title>Linux-&linux-version;</title>
|
---|
[bf8c11f] | 12 |
|
---|
| 13 | <indexterm zone="ch-bootable-kernel">
|
---|
| 14 | <primary sortas="a-Linux">Linux</primary>
|
---|
| 15 | </indexterm>
|
---|
| 16 |
|
---|
| 17 | <sect2 role="package"><title/>
|
---|
| 18 | <para>The Linux package contains the Linux kernel.</para>
|
---|
| 19 |
|
---|
| 20 | <segmentedlist>
|
---|
| 21 | <segtitle>&dependencies;</segtitle>
|
---|
| 22 |
|
---|
| 23 | <seglistitem>
|
---|
| 24 | <seg>Bash, Binutils, Coreutils, Findutils, GCC, Glibc, Grep,
|
---|
[0636f6c] | 25 | Gzip, Kbd, Make, Module-Init-Tools, Perl, and Sed</seg>
|
---|
[bf8c11f] | 26 | </seglistitem>
|
---|
| 27 | </segmentedlist>
|
---|
| 28 |
|
---|
| 29 | </sect2>
|
---|
| 30 |
|
---|
| 31 | <sect2 role="installation">
|
---|
| 32 | <title>Installation of the kernel</title>
|
---|
| 33 |
|
---|
[04ef3790] | 34 | <para os="p1">Util-linux does not compute the checksum of a sun disklabel
|
---|
| 35 | properly with gcc-&gcc-version;. The following patch fixes this issue:</para>
|
---|
| 36 |
|
---|
[2d5272d] | 37 | <screen os="p2"><userinput>patch -Np1 -i ../&linux-sun_disklabel_fix-patch;</userinput></screen>
|
---|
[04ef3790] | 38 |
|
---|
[bf8c11f] | 39 | <para os="a">Building the kernel involves a few steps—configuration,
|
---|
| 40 | compilation, and installation. Read the <filename>README</filename>
|
---|
| 41 | file in the kernel source tree for alternative methods to the way this
|
---|
| 42 | book configures the kernel.</para>
|
---|
| 43 |
|
---|
| 44 | <para os="b">Prepare for compilation by running the following command:</para>
|
---|
| 45 |
|
---|
| 46 | <screen os="c"><userinput>make mrproper</userinput></screen>
|
---|
| 47 |
|
---|
| 48 | <para os="d">This ensures that the kernel tree is absolutely clean. The
|
---|
| 49 | kernel team recommends that this command be issued prior to each
|
---|
| 50 | kernel compilation. Do not rely on the source tree being clean after
|
---|
| 51 | un-tarring.</para>
|
---|
| 52 |
|
---|
| 53 | <para os="e">If, in <xref linkend="ch-scripts-console" role=","/> it was
|
---|
| 54 | decided to compile the keymap into the kernel, issue the command
|
---|
| 55 | below:</para>
|
---|
| 56 |
|
---|
| 57 | <screen os="f"><userinput>loadkeys -m /usr/share/kbd/keymaps/<replaceable>[path to keymap]</replaceable> > \
|
---|
| 58 | drivers/char/defkeymap.c</userinput></screen>
|
---|
| 59 |
|
---|
| 60 | <para os="g">For example, if using a Dutch keyboard, use
|
---|
| 61 | <filename>/usr/share/kbd/keymaps/i386/qwerty/nl.map.gz</filename>.</para>
|
---|
| 62 |
|
---|
[e1e8f31] | 63 | <para os="h">Configure the kernel via a menu-driven interface.
|
---|
| 64 | Please note that the udev bootscript requires "rtc" and "tmpfs" to be
|
---|
| 65 | enabled and built into the kernel, not as modules. BLFS has
|
---|
[bf8c11f] | 66 | some information regarding particular kernel configuration requirements of
|
---|
| 67 | packages outside of LFS at <ulink
|
---|
| 68 | url="&blfs-root;view/svn/longindex.html#kernel-config-index"/>:</para>
|
---|
| 69 |
|
---|
| 70 | <screen os="i"><userinput>make menuconfig</userinput></screen>
|
---|
| 71 |
|
---|
| 72 | <para os="j">Alternatively, <command>make oldconfig</command> may be more
|
---|
| 73 | appropriate in some situations. See the <filename>README</filename>
|
---|
| 74 | file for more information.</para>
|
---|
| 75 |
|
---|
| 76 | <para os="k">If desired, skip kernel configuration by copying the kernel
|
---|
| 77 | config file, <filename>.config</filename>, from the host system
|
---|
| 78 | (assuming it is available) to the root directory of the unpacked kernel
|
---|
| 79 | sources. However, we do not recommend this option. It is often better
|
---|
| 80 | to explore all the configuration menus and create the kernel configuration
|
---|
| 81 | from scratch.</para>
|
---|
| 82 |
|
---|
| 83 | <para os="m">Compile the kernel image and modules:</para>
|
---|
| 84 |
|
---|
| 85 | <screen os="n"><userinput>make</userinput></screen>
|
---|
| 86 |
|
---|
| 87 | <para os="o">If using kernel modules, an
|
---|
| 88 | <filename>/etc/modprobe.conf</filename> file may be needed.
|
---|
| 89 | Information pertaining to modules and kernel configuration is
|
---|
| 90 | located in the kernel documentation in the <filename
|
---|
| 91 | class="directory">Documentation</filename> directory of the kernel
|
---|
| 92 | sources tree. Also, <filename>modprobe.conf(5)</filename> may
|
---|
| 93 | be of interest.</para>
|
---|
| 94 |
|
---|
| 95 | <para os="p">Be very careful when reading other documentation relating to
|
---|
| 96 | kernel modules because it usually applies to 2.4.x kernels only. As
|
---|
| 97 | far as we know, kernel configuration issues specific to Hotplug and
|
---|
| 98 | Udev are not documented. The problem is that Udev will create a device
|
---|
| 99 | node only if Hotplug or a user-written script inserts the corresponding
|
---|
| 100 | module into the kernel, and not all modules are detectable by Hotplug.
|
---|
| 101 | Note that statements like the one below in the
|
---|
| 102 | <filename>/etc/modprobe.conf</filename> file do not work with Udev:</para>
|
---|
| 103 |
|
---|
| 104 | <screen os="q"><literal>alias char-major-XXX some-module</literal></screen>
|
---|
| 105 |
|
---|
| 106 | <para os="r">Because of the complications with Hotplug, Udev, and modules,
|
---|
| 107 | we strongly recommend starting with a completely non-modular kernel
|
---|
| 108 | configuration, especially if this is the first time using Udev.</para>
|
---|
| 109 |
|
---|
| 110 | <para os="s">Install the modules, if the kernel configuration uses
|
---|
| 111 | them:</para>
|
---|
| 112 |
|
---|
| 113 | <screen os="t"><userinput>make modules_install</userinput></screen>
|
---|
| 114 |
|
---|
| 115 | <para os="u">After kernel compilation is complete, additional steps are
|
---|
| 116 | required to complete the installation. Some files need to be copied to
|
---|
| 117 | the <filename class="directory">/boot</filename> directory.</para>
|
---|
| 118 |
|
---|
| 119 | <para os="v">Issue the following command to install the kernel:</para>
|
---|
| 120 |
|
---|
[930f404] | 121 | <screen><userinput>cp arch/i386/boot/bzImage /boot/lfskernel-&linux-version;</userinput></screen>
|
---|
[bf8c11f] | 122 |
|
---|
| 123 | <para os="w"><filename>System.map</filename> is a symbol file for the kernel.
|
---|
| 124 | It maps the function entry points of every function in the kernel API,
|
---|
| 125 | as well as the addresses of the kernel data structures for the running
|
---|
| 126 | kernel. Issue the following command to install the map file:</para>
|
---|
| 127 |
|
---|
[930f404] | 128 | <screen os="w1"><userinput>cp System.map /boot/System.map-&linux-version;</userinput></screen>
|
---|
[bf8c11f] | 129 |
|
---|
| 130 | <para os="x">The kernel configuration file <filename>.config</filename>
|
---|
| 131 | produced by the <command>make menuconfig</command> step above contains
|
---|
| 132 | all the configuration selections for the kernel that was just compiled.
|
---|
| 133 | It is a good idea to keep this file for future reference:</para>
|
---|
| 134 |
|
---|
[930f404] | 135 | <screen os="x1"><userinput>cp .config /boot/config-&linux-version;</userinput></screen>
|
---|
[bf8c11f] | 136 |
|
---|
| 137 | <para os="y">It is important to note that the files in the kernel source
|
---|
| 138 | directory are not owned by <systemitem class="username">root</systemitem>.
|
---|
| 139 | Whenever a package is unpacked as user <systemitem
|
---|
| 140 | class="username">root</systemitem> (like we did
|
---|
| 141 | inside chroot), the files have the user and group IDs of whatever
|
---|
| 142 | they were on the packager's computer. This is usually not a problem
|
---|
| 143 | for any other package to be installed because the source tree is
|
---|
| 144 | removed after the installation. However, the Linux source tree is
|
---|
| 145 | often retained for a long time. Because of this, there is a chance
|
---|
| 146 | that whatever user ID the packager used will be assigned to somebody
|
---|
| 147 | on the machine. That person would then have write access to the kernel
|
---|
| 148 | source.</para>
|
---|
| 149 |
|
---|
[930f404] | 150 | <para os="y1">If the kernel source tree is going to retained, run
|
---|
[bf8c11f] | 151 | <command>chown -R 0:0</command> on the <filename
|
---|
[930f404] | 152 | class="directory">linux-&linux-version;</filename> directory to
|
---|
[bf8c11f] | 153 | ensure all files are owned by user <systemitem
|
---|
| 154 | class="username">root</systemitem>.</para>
|
---|
| 155 |
|
---|
| 156 | <warning os="z">
|
---|
| 157 | <para>Some kernel documentation recommends creating a symlink from
|
---|
| 158 | <filename class="symlink">/usr/src/linux</filename> pointing to the
|
---|
| 159 | kernel source directory. This is specific to kernels prior to the
|
---|
| 160 | 2.6 series and <emphasis>must not</emphasis> be created on an LFS
|
---|
| 161 | system as it can cause problems for packages you may wish to build
|
---|
| 162 | once your base LFS system is complete.</para>
|
---|
| 163 |
|
---|
| 164 | <para>Also, the headers in the system's <filename
|
---|
| 165 | class="directory">include</filename> directory should
|
---|
| 166 | <emphasis>always</emphasis> be the ones against which Glibc was
|
---|
| 167 | compiled, that is, the ones from the Linux-Libc-Headers package,
|
---|
| 168 | and therefore, should <emphasis>never</emphasis> be replaced by
|
---|
| 169 | the kernel headers.</para>
|
---|
| 170 | </warning>
|
---|
| 171 |
|
---|
| 172 | </sect2>
|
---|
| 173 |
|
---|
| 174 | <sect2 id="contents-kernel" role="content">
|
---|
| 175 | <title>Contents of Linux</title>
|
---|
| 176 |
|
---|
| 177 | <segmentedlist>
|
---|
| 178 | <segtitle>Installed files</segtitle>
|
---|
| 179 |
|
---|
| 180 | <seglistitem>
|
---|
| 181 | <seg>config-[linux-version], lfskernel-[linux-version],
|
---|
| 182 | and System.map-[linux-version]</seg>
|
---|
| 183 | </seglistitem>
|
---|
| 184 | </segmentedlist>
|
---|
| 185 |
|
---|
| 186 | <variablelist>
|
---|
| 187 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
| 188 | <?dbfo list-presentation="list"?>
|
---|
| 189 | <?dbhtml list-presentation="table"?>
|
---|
| 190 |
|
---|
| 191 | <varlistentry id="config">
|
---|
| 192 | <term><filename>config-[linux-version]</filename></term>
|
---|
| 193 | <listitem>
|
---|
| 194 | <para>Contains all the configuration selections for the kernel</para>
|
---|
| 195 | <indexterm zone="ch-bootable-kernel config">
|
---|
| 196 | <primary sortas="e-/boot/config">/boot/config-[linux-version]</primary>
|
---|
| 197 | </indexterm>
|
---|
| 198 | </listitem>
|
---|
| 199 | </varlistentry>
|
---|
| 200 |
|
---|
| 201 | <varlistentry id="lfskernel">
|
---|
| 202 | <term><filename>lfskernel-[linux-version]</filename></term>
|
---|
| 203 | <listitem>
|
---|
| 204 | <para>The engine of the Linux system. When turning on the
|
---|
| 205 | computer, the kernel is the first part of the operating system
|
---|
| 206 | that gets loaded. It detects and initializes all components of
|
---|
| 207 | the computer's hardware, then makes these components available
|
---|
| 208 | as a tree of files to the software and turns a single CPU into
|
---|
| 209 | a multitasking machine capable of running scores of programs
|
---|
| 210 | seemingly at the same time.</para>
|
---|
| 211 | <indexterm zone="ch-bootable-kernel lfskernel">
|
---|
| 212 | <primary sortas="b-lfskernel">lfskernel-[linux-version]</primary>
|
---|
| 213 | </indexterm>
|
---|
| 214 | </listitem>
|
---|
| 215 | </varlistentry>
|
---|
| 216 |
|
---|
| 217 | <varlistentry id="System.map">
|
---|
| 218 | <term><filename>System.map-[linux-version]</filename></term>
|
---|
| 219 | <listitem>
|
---|
| 220 | <para>A list of addresses and symbols; it maps the entry points
|
---|
| 221 | and addresses of all the functions and data structures in the
|
---|
| 222 | kernel</para>
|
---|
| 223 | <indexterm zone="ch-bootable-kernel System.map">
|
---|
| 224 | <primary sortas="e-/boot/System.map">/boot/System.map-[linux-version]</primary>
|
---|
| 225 | </indexterm>
|
---|
| 226 | </listitem>
|
---|
| 227 | </varlistentry>
|
---|
| 228 |
|
---|
| 229 | </variablelist>
|
---|
| 230 |
|
---|
| 231 | </sect2>
|
---|
| 232 |
|
---|
| 233 | </sect1>
|
---|