source: BOOK/bootable/x86/kernel.xml@ d38e4cf

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since d38e4cf was 3f8be484, checked in by Jim Gifford <clfs@…>, 19 years ago

r627@server (orig r625): jim | 2005-10-31 12:59:34 -0800
Import of Cross-LFS Book

  • Property mode set to 100644
File size: 10.4 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
3 "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
4 <!ENTITY % general-entities SYSTEM "../../general.ent">
5 <!ENTITY % patches-entities SYSTEM "../../patches.ent">
6 %general-entities;
7 %patches-entities;
8]>
9
10<sect1 id="ch-bootable-kernel" role="wrap">
11 <?dbhtml filename="kernel.html"?>
12
13 <title>Linux-&linux-x86-version;</title>
14
15 <indexterm zone="ch-bootable-kernel">
16 <primary sortas="a-Linux">Linux</primary>
17 </indexterm>
18
19 <sect2 role="package"><title/>
20 <para>The Linux package contains the Linux kernel.</para>
21
22 <segmentedlist>
23 <segtitle>&buildtime;</segtitle>
24 <segtitle>&diskspace;</segtitle>
25
26 <seglistitem>
27 <seg>Not checked yet</seg>
28 <seg>Not checked yet</seg>
29 </seglistitem>
30 </segmentedlist>
31
32 <segmentedlist>
33 <segtitle>&dependencies;</segtitle>
34
35 <seglistitem>
36 <seg>Bash, Binutils, Coreutils, Findutils, GCC, Glibc, Grep,
37 Gzip, Make, Modutils, Perl, and Sed</seg>
38 </seglistitem>
39 </segmentedlist>
40
41 </sect2>
42
43 <sect2 role="installation">
44 <title>Installation of the kernel</title>
45
46 <para os="a">Building the kernel involves a few steps&mdash;configuration,
47 compilation, and installation. Read the <filename>README</filename>
48 file in the kernel source tree for alternative methods to the way this
49 book configures the kernel.</para>
50
51 <para os="b">Prepare for compilation by running the following command:</para>
52
53<screen os="c"><userinput>make mrproper</userinput></screen>
54
55 <para os="d">This ensures that the kernel tree is absolutely clean. The
56 kernel team recommends that this command be issued prior to each
57 kernel compilation. Do not rely on the source tree being clean after
58 un-tarring.</para>
59
60 <para os="e">If, in <xref linkend="ch-scripts-console" role=","/> it was
61 decided to compile the keymap into the kernel, issue the command
62 below:</para>
63
64<screen os="f"><userinput>loadkeys -m /usr/share/kbd/keymaps/<replaceable>[path to keymap]</replaceable> &gt; \
65 drivers/char/defkeymap.c</userinput></screen>
66
67 <para os="g">For example, if using a Dutch keyboard, use
68 <filename>/usr/share/kbd/keymaps/i386/qwerty/nl.map.gz</filename>.</para>
69
70 <para os="h">Configure the kernel via a menu-driven interface. BLFS has
71 some information regarding particular kernel configuration requirements of
72 packages outside of LFS at <ulink
73 url="&blfs-root;view/svn/longindex.html#kernel-config-index"/>:</para>
74
75<screen os="i"><userinput>make menuconfig</userinput></screen>
76
77 <para os="j">Alternatively, <command>make oldconfig</command> may be more
78 appropriate in some situations. See the <filename>README</filename>
79 file for more information.</para>
80
81 <para os="k">If desired, skip kernel configuration by copying the kernel
82 config file, <filename>.config</filename>, from the host system
83 (assuming it is available) to the root directory of the unpacked kernel
84 sources. However, we do not recommend this option. It is often better
85 to explore all the configuration menus and create the kernel configuration
86 from scratch.</para>
87
88 <note os="l">
89 <para>Linux-2.6 kernel series requires to be compiled with GCC-3.x or
90 later, in this case &gcc-version;. It is not recommended to compile the
91 kernel with GCC-2.95.x, as this causes failures in the Glibc test suite.
92 Normally, this wouldn't be mentioned as LFS doesn't build GCC-2.95.x.
93 Unfortunately, the kernel documentation is outdated and still claims
94 GCC-2.95.3 is the recommended compiler.</para>
95 </note>
96
97 <para os="m">Compile the kernel image and modules:</para>
98
99<screen os="n"><userinput>make</userinput></screen>
100
101 <para os="o">If using kernel modules, an
102 <filename>/etc/modprobe.conf</filename> file may be needed.
103 Information pertaining to modules and kernel configuration is
104 located in the kernel documentation in the <filename
105 class="directory">Documentation</filename> directory of the kernel
106 sources tree. Also, <filename>modprobe.conf(5)</filename> may
107 be of interest.</para>
108
109 <para os="p">Be very careful when reading other documentation relating to
110 kernel modules because it usually applies to 2.4.x kernels only. As
111 far as we know, kernel configuration issues specific to Hotplug and
112 Udev are not documented. The problem is that Udev will create a device
113 node only if Hotplug or a user-written script inserts the corresponding
114 module into the kernel, and not all modules are detectable by Hotplug.
115 Note that statements like the one below in the
116 <filename>/etc/modprobe.conf</filename> file do not work with Udev:</para>
117
118<screen os="q"><literal>alias char-major-XXX some-module</literal></screen>
119
120 <para os="r">Because of the complications with Hotplug, Udev, and modules,
121 we strongly recommend starting with a completely non-modular kernel
122 configuration, especially if this is the first time using Udev.</para>
123
124 <para os="s">Install the modules, if the kernel configuration uses
125 them:</para>
126
127<screen os="t"><userinput>make modules_install</userinput></screen>
128
129 <para os="u">After kernel compilation is complete, additional steps are
130 required to complete the installation. Some files need to be copied to
131 the <filename class="directory">/boot</filename> directory.</para>
132
133 <para os="v">Issue the following command to install the kernel:</para>
134
135<screen><userinput>cp arch/i386/boot/bzImage /boot/lfskernel-&linux-x86-version;</userinput></screen>
136
137 <para os="w"><filename>System.map</filename> is a symbol file for the kernel.
138 It maps the function entry points of every function in the kernel API,
139 as well as the addresses of the kernel data structures for the running
140 kernel. Issue the following command to install the map file:</para>
141
142<screen><userinput>cp System.map /boot/System.map-&linux-x86-version;</userinput></screen>
143
144 <para os="x">The kernel configuration file <filename>.config</filename>
145 produced by the <command>make menuconfig</command> step above contains
146 all the configuration selections for the kernel that was just compiled.
147 It is a good idea to keep this file for future reference:</para>
148
149<screen><userinput>cp .config /boot/config-&linux-x86-version;</userinput></screen>
150
151 <para os="y">It is important to note that the files in the kernel source
152 directory are not owned by <systemitem class="username">root</systemitem>.
153 Whenever a package is unpacked as user <systemitem
154 class="username">root</systemitem> (like we did
155 inside chroot), the files have the user and group IDs of whatever
156 they were on the packager's computer. This is usually not a problem
157 for any other package to be installed because the source tree is
158 removed after the installation. However, the Linux source tree is
159 often retained for a long time. Because of this, there is a chance
160 that whatever user ID the packager used will be assigned to somebody
161 on the machine. That person would then have write access to the kernel
162 source.</para>
163
164 <para>If the kernel source tree is going to retained, run
165 <command>chown -R 0:0</command> on the <filename
166 class="directory">linux-&linux-x86-version;</filename> directory to
167 ensure all files are owned by user <systemitem
168 class="username">root</systemitem>.</para>
169
170 <warning os="z">
171 <para>Some kernel documentation recommends creating a symlink from
172 <filename class="symlink">/usr/src/linux</filename> pointing to the
173 kernel source directory. This is specific to kernels prior to the
174 2.6 series and <emphasis>must not</emphasis> be created on an LFS
175 system as it can cause problems for packages you may wish to build
176 once your base LFS system is complete.</para>
177
178 <para>Also, the headers in the system's <filename
179 class="directory">include</filename> directory should
180 <emphasis>always</emphasis> be the ones against which Glibc was
181 compiled, that is, the ones from the Linux-Libc-Headers package,
182 and therefore, should <emphasis>never</emphasis> be replaced by
183 the kernel headers.</para>
184 </warning>
185
186 </sect2>
187
188 <sect2 id="contents-kernel" role="content">
189 <title>Contents of Linux</title>
190
191 <segmentedlist>
192 <segtitle>Installed files</segtitle>
193
194 <seglistitem>
195 <seg>config-[linux-version], lfskernel-[linux-version],
196 and System.map-[linux-version]</seg>
197 </seglistitem>
198 </segmentedlist>
199
200 <variablelist>
201 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
202 <?dbfo list-presentation="list"?>
203 <?dbhtml list-presentation="table"?>
204
205 <varlistentry id="config">
206 <term><filename>config-[linux-version]</filename></term>
207 <listitem>
208 <para>Contains all the configuration selections for the kernel</para>
209 <indexterm zone="ch-bootable-kernel config">
210 <primary sortas="e-/boot/config">/boot/config-[linux-version]</primary>
211 </indexterm>
212 </listitem>
213 </varlistentry>
214
215 <varlistentry id="lfskernel">
216 <term><filename>lfskernel-[linux-version]</filename></term>
217 <listitem>
218 <para>The engine of the Linux system. When turning on the
219 computer, the kernel is the first part of the operating system
220 that gets loaded. It detects and initializes all components of
221 the computer's hardware, then makes these components available
222 as a tree of files to the software and turns a single CPU into
223 a multitasking machine capable of running scores of programs
224 seemingly at the same time.</para>
225 <indexterm zone="ch-bootable-kernel lfskernel">
226 <primary sortas="b-lfskernel">lfskernel-[linux-version]</primary>
227 </indexterm>
228 </listitem>
229 </varlistentry>
230
231 <varlistentry id="System.map">
232 <term><filename>System.map-[linux-version]</filename></term>
233 <listitem>
234 <para>A list of addresses and symbols; it maps the entry points
235 and addresses of all the functions and data structures in the
236 kernel</para>
237 <indexterm zone="ch-bootable-kernel System.map">
238 <primary sortas="e-/boot/System.map">/boot/System.map-[linux-version]</primary>
239 </indexterm>
240 </listitem>
241 </varlistentry>
242
243 </variablelist>
244
245 </sect2>
246
247</sect1>
Note: See TracBrowser for help on using the repository browser.