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