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