[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 |
|
---|
[7349750] | 11 | <title>Linux-&linux-version2;</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 |
|
---|
[3a9a339a] | 30 | <para os="p1">Apply the latest Linux sublevel patch:</para>
|
---|
| 31 |
|
---|
| 32 | <screen os="p2"><userinput>xzcat ../&linux-sublevel-patch; | patch -Np1 -i -</userinput></screen>
|
---|
| 33 |
|
---|
[3f8be484] | 34 | <para os="b">Prepare for compilation by running the following command:</para>
|
---|
| 35 |
|
---|
| 36 | <screen os="c"><userinput>make mrproper</userinput></screen>
|
---|
| 37 |
|
---|
| 38 | <para os="d">This ensures that the kernel tree is absolutely clean. The
|
---|
| 39 | kernel team recommends that this command be issued prior to each
|
---|
| 40 | kernel compilation. Do not rely on the source tree being clean after
|
---|
| 41 | un-tarring.</para>
|
---|
| 42 |
|
---|
[573ee7a] | 43 | <note os="kc"><para>A good starting place for setting up the kernel
|
---|
| 44 | configuration is to run <command>make defconfig</command>. This will set the base configuration to a good state that takes your current system
|
---|
| 45 | architecture into account.</para>
|
---|
[eaeb8faf] | 46 |
|
---|
[573ee7a] | 47 | <para>Be sure to enable or disable following features or the system might
|
---|
[7aa6cc3] | 48 | not work correctly or boot at all:</para>
|
---|
[eaeb8faf] | 49 |
|
---|
[2a0d4ab] | 50 | <screen role="nodump">Device Drivers --->
|
---|
[eaeb8faf] | 51 | Generic Driver Options --->
|
---|
| 52 | () path to uevent helper
|
---|
| 53 | [*] Maintain a devtmpfs filesystem to mount at /dev
|
---|
[2a0d4ab] | 54 | [ ] Fallback user-helper invocation for firmware loading</screen></note>
|
---|
[eaeb8faf] | 55 |
|
---|
[2264482] | 56 | <note os="kd"><para>"EFI Variable support" and
|
---|
[7aa6cc3] | 57 | "EFI GUID Partition support" are for UEFI systems.</para></note>
|
---|
[eaeb8faf] | 58 |
|
---|
[77e81f1] | 59 | <para os="h">Configure the kernel via a menu-driven interface.
|
---|
[573ee7a] | 60 | CBLFS has some information regarding particular kernel configuration
|
---|
| 61 | requirements of packages outside of CLFS at <ulink
|
---|
[0d4607d] | 62 | url="&cblfs-root;"/>:</para>
|
---|
[3f8be484] | 63 |
|
---|
| 64 | <screen os="i"><userinput>make menuconfig</userinput></screen>
|
---|
| 65 |
|
---|
| 66 | <para os="j">Alternatively, <command>make oldconfig</command> may be more
|
---|
| 67 | appropriate in some situations. See the <filename>README</filename>
|
---|
| 68 | file for more information.</para>
|
---|
| 69 |
|
---|
| 70 | <para os="k">If desired, skip kernel configuration by copying the kernel
|
---|
| 71 | config file, <filename>.config</filename>, from the host system
|
---|
| 72 | (assuming it is available) to the root directory of the unpacked kernel
|
---|
| 73 | sources. However, we do not recommend this option. It is often better
|
---|
| 74 | to explore all the configuration menus and create the kernel configuration
|
---|
| 75 | from scratch.</para>
|
---|
| 76 |
|
---|
| 77 | <para os="m">Compile the kernel image and modules:</para>
|
---|
| 78 |
|
---|
| 79 | <screen os="n"><userinput>make</userinput></screen>
|
---|
| 80 |
|
---|
[90eb968] | 81 | <para os="o">If using kernel modules, a configuration file in
|
---|
| 82 | <filename class="directory">/etc/modprobe.d</filename> file may be needed.
|
---|
[3f8be484] | 83 | Information pertaining to modules and kernel configuration is
|
---|
| 84 | located in the kernel documentation in the <filename
|
---|
| 85 | class="directory">Documentation</filename> directory of the kernel
|
---|
[90eb968] | 86 | sources tree. Also, <filename>modprobe.d(5)</filename> may
|
---|
[3f8be484] | 87 | be of interest.</para>
|
---|
| 88 |
|
---|
| 89 | <para os="s">Install the modules, if the kernel configuration uses
|
---|
| 90 | them:</para>
|
---|
| 91 |
|
---|
| 92 | <screen os="t"><userinput>make modules_install</userinput></screen>
|
---|
| 93 |
|
---|
[22211c7] | 94 | <para os="s2">Install the firmware, if the kernel configuration uses
|
---|
| 95 | them:</para>
|
---|
| 96 |
|
---|
| 97 | <screen os="t2"><userinput>make firmware_install</userinput></screen>
|
---|
| 98 |
|
---|
[3f8be484] | 99 | <para os="u">After kernel compilation is complete, additional steps are
|
---|
| 100 | required to complete the installation. Some files need to be copied to
|
---|
| 101 | the <filename class="directory">/boot</filename> directory.</para>
|
---|
| 102 |
|
---|
| 103 | <para os="v">Issue the following command to install the kernel:</para>
|
---|
| 104 |
|
---|
[7349750] | 105 | <screen><userinput>cp -v arch/i386/boot/bzImage /boot/vmlinuz-clfs-&linux-version2;</userinput></screen>
|
---|
[3f8be484] | 106 |
|
---|
| 107 | <para os="w"><filename>System.map</filename> is a symbol file for the kernel.
|
---|
| 108 | It maps the function entry points of every function in the kernel API,
|
---|
| 109 | as well as the addresses of the kernel data structures for the running
|
---|
| 110 | kernel. Issue the following command to install the map file:</para>
|
---|
| 111 |
|
---|
[7349750] | 112 | <screen os="w1"><userinput>cp -v System.map /boot/System.map-&linux-version2;</userinput></screen>
|
---|
[3f8be484] | 113 |
|
---|
| 114 | <para os="x">The kernel configuration file <filename>.config</filename>
|
---|
| 115 | produced by the <command>make menuconfig</command> step above contains
|
---|
| 116 | all the configuration selections for the kernel that was just compiled.
|
---|
| 117 | It is a good idea to keep this file for future reference:</para>
|
---|
| 118 |
|
---|
[7349750] | 119 | <screen os="x1"><userinput>cp -v .config /boot/config-&linux-version2;</userinput></screen>
|
---|
[3f8be484] | 120 |
|
---|
| 121 | <para os="y">It is important to note that the files in the kernel source
|
---|
| 122 | directory are not owned by <systemitem class="username">root</systemitem>.
|
---|
| 123 | Whenever a package is unpacked as user <systemitem
|
---|
[a7fa075] | 124 | class="username">root</systemitem> (like we do inside the final-system
|
---|
| 125 | build environment), the files have the user and group IDs of whatever
|
---|
[3f8be484] | 126 | they were on the packager's computer. This is usually not a problem
|
---|
| 127 | for any other package to be installed because the source tree is
|
---|
| 128 | removed after the installation. However, the Linux source tree is
|
---|
[a7fa075] | 129 | often retained for a long time. Because of this, there is a chance
|
---|
[3f8be484] | 130 | that whatever user ID the packager used will be assigned to somebody
|
---|
| 131 | on the machine. That person would then have write access to the kernel
|
---|
| 132 | source.</para>
|
---|
| 133 |
|
---|
[43daa01] | 134 | <para os="y1">If the kernel source tree is going to retained, run
|
---|
[3f8be484] | 135 | <command>chown -R 0:0</command> on the <filename
|
---|
[43daa01] | 136 | class="directory">linux-&linux-version;</filename> directory to
|
---|
[3f8be484] | 137 | ensure all files are owned by user <systemitem
|
---|
| 138 | class="username">root</systemitem>.</para>
|
---|
| 139 |
|
---|
| 140 | <warning os="z">
|
---|
| 141 | <para>Some kernel documentation recommends creating a symlink from
|
---|
| 142 | <filename class="symlink">/usr/src/linux</filename> pointing to the
|
---|
| 143 | kernel source directory. This is specific to kernels prior to the
|
---|
[fb40919] | 144 | 2.6 series and <emphasis>must not</emphasis> be created on a CLFS
|
---|
[3f8be484] | 145 | system as it can cause problems for packages you may wish to build
|
---|
[fb40919] | 146 | once your base CLFS system is complete.</para>
|
---|
[3f8be484] | 147 |
|
---|
| 148 | <para>Also, the headers in the system's <filename
|
---|
| 149 | class="directory">include</filename> directory should
|
---|
| 150 | <emphasis>always</emphasis> be the ones against which Glibc was
|
---|
[b169dfe] | 151 | compiled and should <emphasis>never</emphasis> be replaced by headers
|
---|
| 152 | from a different kernel version.</para>
|
---|
[3f8be484] | 153 | </warning>
|
---|
| 154 |
|
---|
| 155 | </sect2>
|
---|
| 156 |
|
---|
| 157 | <sect2 id="contents-kernel" role="content">
|
---|
| 158 | <title>Contents of Linux</title>
|
---|
| 159 |
|
---|
| 160 | <segmentedlist>
|
---|
| 161 | <segtitle>Installed files</segtitle>
|
---|
[61ad0b7f] | 162 | <segtitle>Installed directory</segtitle>
|
---|
[3f8be484] | 163 |
|
---|
| 164 | <seglistitem>
|
---|
[3f76cac] | 165 | <seg>config-[linux-version], clfskernel-[linux-version],
|
---|
[3f8be484] | 166 | and System.map-[linux-version]</seg>
|
---|
[61ad0b7f] | 167 | <seg>/lib/modules</seg>
|
---|
[3f8be484] | 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 |
|
---|
[3f76cac] | 186 | <varlistentry id="clfskernel">
|
---|
| 187 | <term><filename>clfskernel-[linux-version]</filename></term>
|
---|
[3f8be484] | 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>
|
---|
[3f76cac] | 196 | <indexterm zone="ch-bootable-kernel clfskernel">
|
---|
| 197 | <primary sortas="b-clfskernel">clfskernel-[linux-version]</primary>
|
---|
[3f8be484] | 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>
|
---|