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