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