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