source: chapter08/kernel.xml@ dc6acb5

Last change on this file since dc6acb5 was dc6acb5, checked in by Manuel Canales Esparcia <manuel@…>, 20 years ago

In DocBook-NG the replacement for <ulink> is a new definition of <link>.

git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/LFS-RNG/BOOK@4544 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 9.8 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE section [
3 <!ENTITY % general-entities SYSTEM "../general.ent">
4 %general-entities;
5]>
6<section xmlns="http://docbook.org/docbook-ng"
7 xmlns:xlink="http://www.w3.org/1999/xlink"
8 xml:id="ch-bootable-kernel" xreflabel="Linux" role="wrap">
9<title>Linux-&linux-version;</title>
10<?dbhtml filename="kernel.html"?>
11
12<indexterm zone="ch-bootable-kernel"><primary sortas="a-Linux">Linux</primary></indexterm>
13
14<section role="package"><title/>
15<para>The Linux package contains the kernel and the header files.</para>
16
17<segmentedlist>
18<segtitle>&buildtime;</segtitle>
19<segtitle>&diskspace;</segtitle>
20<seglistitem><seg>All default options: 4.20 SBU</seg>
21<seg>All default options: 181 MB</seg></seglistitem>
22</segmentedlist>
23
24<segmentedlist>
25<segtitle>Linux installation depends on</segtitle>
26<seglistitem><seg>Bash, Binutils, Coreutils, Findutils,
27GCC, Glibc, Grep, Gzip, Make, Modutils, Perl, Sed</seg></seglistitem>
28</segmentedlist>
29</section>
30
31<section role="installation">
32<title>Installation of the kernel</title>
33
34<para>Building the kernel involves a few steps: configuration, compilation, and
35installation. If you don't like the way this book configures the kernel, view
36the <filename>README</filename> file in the kernel source tree for alternative
37methods.</para>
38
39<para>Prepare for compilation by running the following command:</para>
40
41<screen><userinput>make mrproper</userinput></screen>
42
43<para>This ensures that the kernel tree is absolutely clean. The kernel team
44recommends that this command be issued prior to <emphasis>each</emphasis>
45kernel compilation. You shouldn't rely on the source tree being clean after
46un-tarring.</para>
47
48<para>Also, ensure that the kernel does not attempt to pass hotplugging events
49to userspace until userspace specifies that it is ready:</para>
50
51<screen><userinput>sed -i 's@/sbin/hotplug@/bin/true@' kernel/kmod.c</userinput></screen>
52
53<para>If, in <xref linkend="ch-scripts-console"/>, you decided you want
54to compile the keymap into the kernel, issue the command below:</para>
55
56<screen><userinput>loadkeys -m /usr/share/kbd/keymaps/<replaceable>[path to keymap]</replaceable> &gt; \
57 <replaceable>[unpacked sources dir]</replaceable>/linux-&linux-version;/drivers/char/defkeymap.c</userinput></screen>
58
59<para>For example, if you have a Dutch keyboard, you would use
60<filename>/usr/share/kbd/keymaps/i386/qwerty/nl.map.gz</filename>.</para>
61
62<para>Configure the kernel via a menu-driven interface:</para>
63
64<screen><userinput>make menuconfig</userinput></screen>
65
66<para><command>make oldconfig</command> may be more appropriate in some
67situations. See the <filename>README</filename> file for more
68information.</para>
69
70<para>If you wish, you may skip kernel configuration by simply copying the
71kernel config file, <filename>.config</filename>, from your host system
72(assuming it is available) to the unpacked <filename class="directory">linux-&linux-version;</filename>
73directory. However, we
74don't recommend this option. You're much better off exploring all the
75configuration menus and creating your own kernel configuration from
76scratch.</para>
77
78<para>For POSIX shared memory support, ensure that the kernel config option
79<quote>Virtual memory file system support</quote> is enabled. It resides within
80the <quote>File systems</quote> menu and is normally enabled by default.</para>
81
82<para>LFS bootscripts make the assumption that you either compile
83both <quote>Support for Host-side USB</quote> and
84<quote>USB device filesystem</quote> directly into the kernel, or don't compile them at
85all. Bootscripts will not work properly if it is a module (<filename>usbcore.ko</filename>).</para>
86
87<note><para>NPTL requires the kernel to be compiled with GCC 3.x, in this case
88&gcc-version;. Compiling with 2.95.x is known to cause failures in the glibc
89testsuite, so do <emphasis>not</emphasis> compile the kernel with gcc 2.95.x
90unless you know what you're getting yourself into.</para></note>
91
92<para>Compile the kernel image and modules:</para>
93
94<screen><userinput>make</userinput></screen>
95
96<para>If you intend to use kernel modules, you may need an
97<filename>/etc/modprobe.conf</filename> file. Information pertaining
98to modules and to kernel configuration in general may be found in the
99kernel documentation, which is found in the
100<filename class="directory">linux-&linux-version;/Documentation</filename> directory.
101The modprobe.conf man page
102<!-- removed for review from tldp.org
103and the kernel HOWTO at
104<ulink url="http://www.tldp.org/HOWTO/Kernel-HOWTO.html"/> -->
105may also be of interest to you.</para>
106
107<para>Be very suspicious while reading other documentation, because it
108usually applies to 2.4.x kernels only. As far as the editors know, kernel
109configuration issues specific to Hotplug and Udev
110are documented nowhere. The problem is that Udev will create a device node
111only if Hotplug or a user-written script inserts the corresponding module
112into the kernel, and not all modules are detectable by Hotplug. Note
113that statements like
114<screen>alias char-major-XXX some-module</screen>
115in <filename>/etc/modprobe.conf</filename> file don't work with
116Udev, and other aliases are often unnecessary with Hotplug.</para>
117
118<para>Because of all those compilcations with Hotplug, Udev and modules, we
119strongly recommend you to start with a completely non-modular kernel
120configuration, especially if this is the first time you use Udev.</para>
121
122<para>Install the modules, if your kernel configuration uses them:</para>
123
124<screen><userinput>make modules_install</userinput></screen>
125
126<para>If you have a lot of modules and very little space, you may want to
127consider stripping and compressing the modules. For most people such compression
128isn't worth the trouble, but if you're really pressed for space, then have a look at
129<link xlink:href="http://www.linux-mips.org/archives/linux-mips/2002-04/msg00031.html"/>.</para>
130
131<para>Kernel compilation has finished but more steps are required to complete
132the installation. Some files need to be copied to the <filename class="directory">/boot</filename>
133directory.</para>
134
135<para>The path to the kernel image may vary depending on the platform you're
136using. Issue the following command to install the kernel:</para>
137
138<screen><userinput>cp arch/i386/boot/bzImage /boot/lfskernel-&linux-version;</userinput></screen>
139
140<para><filename>System.map</filename> is a symbol file for the kernel. It maps
141the function entry points of every function in the kernel API (Application Programming Interface), as well as the
142addresses of the kernel data structures for the running kernel. Issue the
143following command to install the map file:</para>
144
145<screen><userinput>cp System.map /boot/System.map-&linux-version;</userinput></screen>
146
147<para><filename>.config</filename> is the kernel configuration file that was
148produced by the <command>make menuconfig</command> step above. It contains all
149the config selections for the kernel that was just compiled. It's a good idea
150to keep this file for future reference:</para>
151
152<screen><userinput>cp .config /boot/config-&linux-version;</userinput></screen>
153
154<para>It is important to note that the files in the kernel source directory are
155not owned by <emphasis>root</emphasis>. Whenever you unpack a package as user
156<emphasis>root</emphasis> (like we did here inside chroot), the files end up
157having the user and group IDs of whatever they were on the packager's computer.
158This is usually not a problem for any other package you install because you
159remove the source tree after the installation. But the Linux source tree is
160often kept around for a long time, so there's a chance that whatever user ID
161the packager used will be assigned to somebody on your machine and then that
162person would have write access to the kernel source.</para>
163
164<para>If you are going to keep the kernel source tree around, you may want to
165run <command>chown -R 0:0</command> on the
166<filename class="directory">linux-&linux-version;</filename> directory to ensure all files are
167owned by user <emphasis>root</emphasis>.</para>
168
169</section>
170
171
172<section xml:id="contents-kernel" role="content"><title>Contents of Linux</title>
173
174<segmentedlist>
175<segtitle>Installed files</segtitle>
176<seglistitem><seg>the kernel, the kernel headers,
177and the System.map</seg></seglistitem>
178</segmentedlist>
179
180<variablelist><title>Short descriptions</title>
181
182<varlistentry xml:id="kernel">
183<term>The <emphasis>kernel</emphasis></term>
184<listitem>
185<indexterm zone="ch-bootable-kernel kernel"><primary sortas="b-kernel">kernel</primary></indexterm>
186<para>is the engine of your Linux system.
187When switching on your box, the kernel is the first part of your operating
188system that gets loaded. It detects and initializes all the components of your
189computer's hardware, then makes these components available as a tree of files
190to the software, and turns a single CPU into a multi-tasking machine capable
191of running scores of programs seemingly at the same time.</para>
192</listitem>
193</varlistentry>
194
195<varlistentry xml:id="kernel-headers">
196<term>The <emphasis>kernel headers</emphasis></term>
197<listitem>
198<indexterm zone="ch-bootable-kernel kernel-headers"><primary sortas="e-kernel-headers">kernel headers</primary></indexterm>
199<para>define the interface to the
200services that the kernel provides. The headers in your system's
201<filename class="directory">include</filename> directory should <emphasis>always</emphasis> be
202the ones against which Glibc was compiled and should therefore
203<emphasis>not</emphasis> be replaced when upgrading the kernel.</para>
204</listitem>
205</varlistentry>
206
207<varlistentry xml:id="System.map">
208<term><filename>System.map</filename></term>
209<listitem>
210<indexterm zone="ch-bootable-kernel System.map"><primary sortas="e-/boot/System.map">/boot/System.map</primary></indexterm>
211<para>is a list of addresses and symbols. It maps the entry points and addresses
212of all the functions and data structures in the kernel.</para>
213</listitem>
214</varlistentry>
215</variablelist>
216
217</section>
218
219</section>
Note: See TracBrowser for help on using the repository browser.