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