[3f8be484] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
[aa18ac0] | 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
[3f8be484] | 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 |
|
---|
[43daa01] | 11 | <title>Linux-&linux-version;</title>
|
---|
[3f8be484] | 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 |
|
---|
[573ee7a] | 39 | <note os="kc"><para>A good starting place for setting up the kernel
|
---|
| 40 | configuration is to run <command>make defconfig</command>. This will set the base configuration to a good state that takes your current system
|
---|
| 41 | architecture into account.</para>
|
---|
[eaeb8faf] | 42 |
|
---|
[573ee7a] | 43 | <para>Be sure to enable or disable following features or the system might
|
---|
[7aa6cc3] | 44 | not work correctly or boot at all:</para>
|
---|
[eaeb8faf] | 45 |
|
---|
[2a0d4ab] | 46 | <screen role="nodump">Device Drivers --->
|
---|
[eaeb8faf] | 47 | Generic Driver Options --->
|
---|
| 48 | () path to uevent helper
|
---|
| 49 | [*] Maintain a devtmpfs filesystem to mount at /dev
|
---|
[2a0d4ab] | 50 | [ ] Fallback user-helper invocation for firmware loading</screen></note>
|
---|
[eaeb8faf] | 51 |
|
---|
[573ee7a] | 52 | <note os="kd"><para>While "The IPv6 Protocol" is not strictly required, it
|
---|
[ca8dde0] | 53 | is highly recommended by the Systemd developers. "EFI Variable support" and
|
---|
[7aa6cc3] | 54 | "EFI GUID Partition support" are for UEFI systems.</para></note>
|
---|
[eaeb8faf] | 55 |
|
---|
[77e81f1] | 56 | <para os="h">Configure the kernel via a menu-driven interface.
|
---|
[573ee7a] | 57 | CBLFS has some information regarding particular kernel configuration
|
---|
| 58 | requirements of packages outside of CLFS at <ulink
|
---|
[0d4607d] | 59 | url="&cblfs-root;"/>:</para>
|
---|
[3f8be484] | 60 |
|
---|
| 61 | <screen os="i"><userinput>make menuconfig</userinput></screen>
|
---|
| 62 |
|
---|
| 63 | <para os="j">Alternatively, <command>make oldconfig</command> may be more
|
---|
| 64 | appropriate in some situations. See the <filename>README</filename>
|
---|
| 65 | file for more information.</para>
|
---|
| 66 |
|
---|
| 67 | <para os="k">If desired, skip kernel configuration by copying the kernel
|
---|
| 68 | config file, <filename>.config</filename>, from the host system
|
---|
| 69 | (assuming it is available) to the root directory of the unpacked kernel
|
---|
| 70 | sources. However, we do not recommend this option. It is often better
|
---|
| 71 | to explore all the configuration menus and create the kernel configuration
|
---|
| 72 | from scratch.</para>
|
---|
| 73 |
|
---|
| 74 | <para os="m">Compile the kernel image and modules:</para>
|
---|
| 75 |
|
---|
| 76 | <screen os="n"><userinput>make</userinput></screen>
|
---|
| 77 |
|
---|
| 78 | <para os="o">If using kernel modules, an
|
---|
| 79 | <filename>/etc/modprobe.conf</filename> file may be needed.
|
---|
| 80 | Information pertaining to modules and kernel configuration is
|
---|
| 81 | located in the kernel documentation in the <filename
|
---|
| 82 | class="directory">Documentation</filename> directory of the kernel
|
---|
| 83 | sources tree. Also, <filename>modprobe.conf(5)</filename> may
|
---|
| 84 | be of interest.</para>
|
---|
| 85 |
|
---|
| 86 | <para os="p">Be very careful when reading other documentation relating to
|
---|
| 87 | kernel modules because it usually applies to 2.4.x kernels only. As
|
---|
| 88 | far as we know, kernel configuration issues specific to Hotplug and
|
---|
[97bc24b] | 89 | Eudev are not documented. The problem is that Eudev will create a device
|
---|
[3f8be484] | 90 | node only if Hotplug or a user-written script inserts the corresponding
|
---|
| 91 | module into the kernel, and not all modules are detectable by Hotplug.
|
---|
| 92 | Note that statements like the one below in the
|
---|
[97bc24b] | 93 | <filename>/etc/modprobe.conf</filename> file do not work with Eudev:</para>
|
---|
[3f8be484] | 94 |
|
---|
| 95 | <screen os="q"><literal>alias char-major-XXX some-module</literal></screen>
|
---|
| 96 |
|
---|
[97bc24b] | 97 | <para os="r">Because of the complications with Eudev and modules,
|
---|
[3f8be484] | 98 | we strongly recommend starting with a completely non-modular kernel
|
---|
[97bc24b] | 99 | configuration, especially if this is the first time using Eudev.</para>
|
---|
[3f8be484] | 100 |
|
---|
| 101 | <para os="s">Install the modules, if the kernel configuration uses
|
---|
| 102 | them:</para>
|
---|
| 103 |
|
---|
| 104 | <screen os="t"><userinput>make modules_install</userinput></screen>
|
---|
| 105 |
|
---|
[22211c7] | 106 | <para os="s2">Install the firmware, if the kernel configuration uses
|
---|
| 107 | them:</para>
|
---|
| 108 |
|
---|
| 109 | <screen os="t2"><userinput>make firmware_install</userinput></screen>
|
---|
| 110 |
|
---|
[3f8be484] | 111 | <para os="u">After kernel compilation is complete, additional steps are
|
---|
| 112 | required to complete the installation. Some files need to be copied to
|
---|
| 113 | the <filename class="directory">/boot</filename> directory.</para>
|
---|
| 114 |
|
---|
| 115 | <para os="v">Issue the following command to install the kernel:</para>
|
---|
| 116 |
|
---|
[34be04a6] | 117 | <screen><userinput>cp -v arch/i386/boot/bzImage /boot/vmlinuz-clfs-&linux-version;</userinput></screen>
|
---|
[3f8be484] | 118 |
|
---|
| 119 | <para os="w"><filename>System.map</filename> is a symbol file for the kernel.
|
---|
| 120 | It maps the function entry points of every function in the kernel API,
|
---|
| 121 | as well as the addresses of the kernel data structures for the running
|
---|
| 122 | kernel. Issue the following command to install the map file:</para>
|
---|
| 123 |
|
---|
[e51ba26] | 124 | <screen os="w1"><userinput>cp -v System.map /boot/System.map-&linux-version;</userinput></screen>
|
---|
[3f8be484] | 125 |
|
---|
| 126 | <para os="x">The kernel configuration file <filename>.config</filename>
|
---|
| 127 | produced by the <command>make menuconfig</command> step above contains
|
---|
| 128 | all the configuration selections for the kernel that was just compiled.
|
---|
| 129 | It is a good idea to keep this file for future reference:</para>
|
---|
| 130 |
|
---|
[e51ba26] | 131 | <screen os="x1"><userinput>cp -v .config /boot/config-&linux-version;</userinput></screen>
|
---|
[3f8be484] | 132 |
|
---|
| 133 | <para os="y">It is important to note that the files in the kernel source
|
---|
| 134 | directory are not owned by <systemitem class="username">root</systemitem>.
|
---|
| 135 | Whenever a package is unpacked as user <systemitem
|
---|
[a7fa075] | 136 | class="username">root</systemitem> (like we do inside the final-system
|
---|
| 137 | build environment), the files have the user and group IDs of whatever
|
---|
[3f8be484] | 138 | they were on the packager's computer. This is usually not a problem
|
---|
| 139 | for any other package to be installed because the source tree is
|
---|
| 140 | removed after the installation. However, the Linux source tree is
|
---|
[a7fa075] | 141 | often retained for a long time. Because of this, there is a chance
|
---|
[3f8be484] | 142 | that whatever user ID the packager used will be assigned to somebody
|
---|
| 143 | on the machine. That person would then have write access to the kernel
|
---|
| 144 | source.</para>
|
---|
| 145 |
|
---|
[43daa01] | 146 | <para os="y1">If the kernel source tree is going to retained, run
|
---|
[3f8be484] | 147 | <command>chown -R 0:0</command> on the <filename
|
---|
[43daa01] | 148 | class="directory">linux-&linux-version;</filename> directory to
|
---|
[3f8be484] | 149 | ensure all files are owned by user <systemitem
|
---|
| 150 | class="username">root</systemitem>.</para>
|
---|
| 151 |
|
---|
| 152 | <warning os="z">
|
---|
| 153 | <para>Some kernel documentation recommends creating a symlink from
|
---|
| 154 | <filename class="symlink">/usr/src/linux</filename> pointing to the
|
---|
| 155 | kernel source directory. This is specific to kernels prior to the
|
---|
[fb40919] | 156 | 2.6 series and <emphasis>must not</emphasis> be created on a CLFS
|
---|
[3f8be484] | 157 | system as it can cause problems for packages you may wish to build
|
---|
[fb40919] | 158 | once your base CLFS system is complete.</para>
|
---|
[3f8be484] | 159 |
|
---|
| 160 | <para>Also, the headers in the system's <filename
|
---|
| 161 | class="directory">include</filename> directory should
|
---|
| 162 | <emphasis>always</emphasis> be the ones against which Glibc was
|
---|
[b169dfe] | 163 | compiled and should <emphasis>never</emphasis> be replaced by headers
|
---|
| 164 | from a different kernel version.</para>
|
---|
[3f8be484] | 165 | </warning>
|
---|
| 166 |
|
---|
| 167 | </sect2>
|
---|
| 168 |
|
---|
| 169 | <sect2 id="contents-kernel" role="content">
|
---|
| 170 | <title>Contents of Linux</title>
|
---|
| 171 |
|
---|
| 172 | <segmentedlist>
|
---|
| 173 | <segtitle>Installed files</segtitle>
|
---|
[61ad0b7f] | 174 | <segtitle>Installed directory</segtitle>
|
---|
[3f8be484] | 175 |
|
---|
| 176 | <seglistitem>
|
---|
[3f76cac] | 177 | <seg>config-[linux-version], clfskernel-[linux-version],
|
---|
[3f8be484] | 178 | and System.map-[linux-version]</seg>
|
---|
[61ad0b7f] | 179 | <seg>/lib/modules</seg>
|
---|
[3f8be484] | 180 | </seglistitem>
|
---|
| 181 | </segmentedlist>
|
---|
| 182 |
|
---|
| 183 | <variablelist>
|
---|
| 184 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
| 185 | <?dbfo list-presentation="list"?>
|
---|
| 186 | <?dbhtml list-presentation="table"?>
|
---|
| 187 |
|
---|
| 188 | <varlistentry id="config">
|
---|
| 189 | <term><filename>config-[linux-version]</filename></term>
|
---|
| 190 | <listitem>
|
---|
| 191 | <para>Contains all the configuration selections for the kernel</para>
|
---|
| 192 | <indexterm zone="ch-bootable-kernel config">
|
---|
| 193 | <primary sortas="e-/boot/config">/boot/config-[linux-version]</primary>
|
---|
| 194 | </indexterm>
|
---|
| 195 | </listitem>
|
---|
| 196 | </varlistentry>
|
---|
| 197 |
|
---|
[3f76cac] | 198 | <varlistentry id="clfskernel">
|
---|
| 199 | <term><filename>clfskernel-[linux-version]</filename></term>
|
---|
[3f8be484] | 200 | <listitem>
|
---|
| 201 | <para>The engine of the Linux system. When turning on the
|
---|
| 202 | computer, the kernel is the first part of the operating system
|
---|
| 203 | that gets loaded. It detects and initializes all components of
|
---|
| 204 | the computer's hardware, then makes these components available
|
---|
| 205 | as a tree of files to the software and turns a single CPU into
|
---|
| 206 | a multitasking machine capable of running scores of programs
|
---|
| 207 | seemingly at the same time.</para>
|
---|
[3f76cac] | 208 | <indexterm zone="ch-bootable-kernel clfskernel">
|
---|
| 209 | <primary sortas="b-clfskernel">clfskernel-[linux-version]</primary>
|
---|
[3f8be484] | 210 | </indexterm>
|
---|
| 211 | </listitem>
|
---|
| 212 | </varlistentry>
|
---|
| 213 |
|
---|
| 214 | <varlistentry id="System.map">
|
---|
| 215 | <term><filename>System.map-[linux-version]</filename></term>
|
---|
| 216 | <listitem>
|
---|
| 217 | <para>A list of addresses and symbols; it maps the entry points
|
---|
| 218 | and addresses of all the functions and data structures in the
|
---|
| 219 | kernel</para>
|
---|
| 220 | <indexterm zone="ch-bootable-kernel System.map">
|
---|
| 221 | <primary sortas="e-/boot/System.map">/boot/System.map-[linux-version]</primary>
|
---|
| 222 | </indexterm>
|
---|
| 223 | </listitem>
|
---|
| 224 | </varlistentry>
|
---|
| 225 |
|
---|
| 226 | </variablelist>
|
---|
| 227 |
|
---|
| 228 | </sect2>
|
---|
| 229 |
|
---|
| 230 | </sect1>
|
---|