source: clfs-embedded/BOOK/bootable/x86/kernel.xml@ 81d9bce

Last change on this file since 81d9bce was 81d9bce, checked in by Jim Gifford <clfs@…>, 18 years ago

Added note about what has to built into the kernel

  • Property mode set to 100644
File size: 8.9 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 %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&mdash;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 <para os="e">Configure the kernel via a menu-driven interface.
40 Please note that the udev bootscript requires "rtc" and "tmpfs" to be
41 enabled and built into the kernel, not as modules. BLFS has
42 some information regarding particular kernel configuration requirements of
43 packages outside of CLFS at <ulink
44 url="&blfs-root;view/svn/longindex.html#kernel-config-index"/>:</para>
45
46 <note os="f"><para>Since we are building for an embedded system we need to make sure
47 our key components are build into the kernel and not as modules. Our key
48 components are console/video, disk, and network. With out these built in our
49 system will not function properly.</para></note>
50
51<screen os="g"><userinput>make ARCH=i386 CROSS_COMPILE=${CLFS_TARGET}- menuconfig</userinput></screen>
52
53 <para os="h">Alternatively, <command>make oldconfig</command> may be more
54 appropriate in some situations. See the <filename>README</filename>
55 file for more information.</para>
56
57 <para os="i">If desired, skip kernel configuration by copying the kernel
58 config file, <filename>.config</filename>, from the host system
59 (assuming it is available) to the root directory of the unpacked kernel
60 sources. However, we do not recommend this option. It is often better
61 to explore all the configuration menus and create the kernel configuration
62 from scratch.</para>
63
64 <para os="j">Compile the kernel image and modules:</para>
65
66<screen os="k"><userinput>make ARCH=i386 CROSS_COMPILE=${CLFS_TARGET}-</userinput></screen>
67
68 <para os="l">If using kernel modules, an
69 <filename>/etc/modprobe.conf</filename> file may be needed.
70 Information pertaining to modules and kernel configuration is
71 located in the kernel documentation in the <filename
72 class="directory">Documentation</filename> directory of the kernel
73 sources tree. Also, <filename>modprobe.conf(5)</filename> may
74 be of interest.</para>
75
76 <para os="m">Be very careful when reading other documentation relating to
77 kernel modules because it usually applies to 2.4.x kernels only. As
78 far as we know, kernel configuration issues specific to Hotplug and
79 Udev are not documented. The problem is that Udev will create a device
80 node only if Hotplug or a user-written script inserts the corresponding
81 module into the kernel, and not all modules are detectable by Hotplug.
82 Note that statements like the one below in the
83 <filename>/etc/modprobe.conf</filename> file do not work with Udev:</para>
84
85<screen os="n"><literal>alias char-major-XXX some-module</literal></screen>
86
87 <para os="o">Because of the complications with Udev and modules,
88 we strongly recommend starting with a completely non-modular kernel
89 configuration, especially if this is the first time using Udev.</para>
90
91 <para os="p">Install the modules, if the kernel configuration uses
92 them:</para>
93
94<screen os="q"><userinput>make ARCH=i386 CROSS_COMPILE=${CLFS_TARGET}- \
95 INSTALL_MOD_PATH=${CLFS} modules_install</userinput></screen>
96
97 <para os="r">After kernel compilation is complete, additional steps are
98 required to complete the installation. Some files need to be copied to
99 the <filename class="directory">${CLFS}/boot</filename> directory.</para>
100
101 <para os="s">Issue the following command to install the kernel:</para>
102
103<screen os="t"><userinput>cp vmlinux ${CLFS}/boot/clfskernel-&linux-version;</userinput></screen>
104
105 <para os="u"><filename>System.map</filename> is a symbol file for the kernel.
106 It maps the function entry points of every function in the kernel API,
107 as well as the addresses of the kernel data structures for the running
108 kernel. Issue the following command to install the map file:</para>
109
110<screen os="v"><userinput>cp System.map ${CLFS}/boot/System.map-&linux-version;</userinput></screen>
111
112 <para os="w">If we compiled our kernel with modules and we made sure depmod.pl
113 is avaiable from busybox, we need to create the module dependency list by
114 issuing the following command:</para>
115
116<screen os="x"><userinput>${CLFS}/cross-tools/bin/depmod.pl -F ${CLFS}/boot/System.map -b ${CLFS}/lib/modules/&linux-version;</userinput></screen>
117
118 <para os="y">The kernel configuration file <filename>.config</filename>
119 produced by the <command>make menuconfig</command> step above contains
120 all the configuration selections for the kernel that was just compiled.
121 It is a good idea to keep this file for future reference:</para>
122
123<screen os="z"><userinput>cp .config ${CLFS}/boot/config-&linux-version;</userinput></screen>
124
125 <warning os="aa">
126 <para>Some kernel documentation recommends creating a symlink from
127 <filename class="symlink">/usr/src/linux</filename> pointing to the
128 kernel source directory. This is specific to kernels prior to the
129 2.6 series and <emphasis>must not</emphasis> be created on an CLFS
130 system as it can cause problems for packages you may wish to build
131 once your base CLFS system is complete.</para>
132
133 <para>Also, the headers in the system's <filename
134 class="directory">include</filename> directory should
135 <emphasis>always</emphasis> be the ones against which Glibc was
136 compiled (from the Linux-Headers package) and should
137 <emphasis>never</emphasis> be replaced by the kernel headers.</para>
138 </warning>
139
140 <para os="ab">The bootloaders section contains more information on
141 how to configure the kernel for specifc bootloaders. Please refer
142 to this section for your specific needs.</para>
143
144 </sect2>
145
146 <sect2 id="contents-kernel" role="content">
147 <title>Contents of Linux</title>
148
149 <segmentedlist>
150 <segtitle>Installed files</segtitle>
151
152 <seglistitem>
153 <seg>config-[linux-version], clfskernel-[linux-version],
154 and System.map-[linux-version]</seg>
155 </seglistitem>
156 </segmentedlist>
157
158 <variablelist>
159 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
160 <?dbfo list-presentation="list"?>
161 <?dbhtml list-presentation="table"?>
162
163 <varlistentry id="config">
164 <term><filename>config-[linux-version]</filename></term>
165 <listitem>
166 <para>Contains all the configuration selections for the kernel</para>
167 <indexterm zone="ch-bootable-kernel config">
168 <primary sortas="e-/boot/config">/boot/config-[linux-version]</primary>
169 </indexterm>
170 </listitem>
171 </varlistentry>
172
173 <varlistentry id="clfskernel">
174 <term><filename>clfskernel-[linux-version]</filename></term>
175 <listitem>
176 <para>The engine of the Linux system. When turning on the
177 computer, the kernel is the first part of the operating system
178 that gets loaded. It detects and initializes all components of
179 the computer's hardware, then makes these components available
180 as a tree of files to the software and turns a single CPU into
181 a multitasking machine capable of running scores of programs
182 seemingly at the same time.</para>
183 <indexterm zone="ch-bootable-kernel clfskernel">
184 <primary sortas="b-clfskernel">clfskernel-[linux-version]</primary>
185 </indexterm>
186 </listitem>
187 </varlistentry>
188
189 <varlistentry id="System.map">
190 <term><filename>System.map-[linux-version]</filename></term>
191 <listitem>
192 <para>A list of addresses and symbols; it maps the entry points
193 and addresses of all the functions and data structures in the
194 kernel</para>
195 <indexterm zone="ch-bootable-kernel System.map">
196 <primary sortas="e-/boot/System.map">/boot/System.map-[linux-version]</primary>
197 </indexterm>
198 </listitem>
199 </varlistentry>
200
201 </variablelist>
202
203 </sect2>
204
205</sect1>
Note: See TracBrowser for help on using the repository browser.