📄 kernel.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content= "application/xhtml+xml; charset=iso-8859-1" /> <title> 12.3. Linux-2.6.16.5 </title> <link rel="stylesheet" href="../stylesheets/lfs.css" type="text/css" /> <meta name="generator" content="DocBook XSL Stylesheets V1.69.1" /> <link rel="stylesheet" href="../stylesheets/lfs-print.css" type= "text/css" media="print" /> </head> <body id="lfs" class="CLFS-SVN-20060417-MIPS"> <div class="navheader"> <div class="headertitles"> <h4> Cross-Compiled Linux From Scratch - Version CLFS-SVN-20060417-MIPS </h4> <h3> Chapter 12. Making the LFS System Bootable </h3> </div> <ul class="headerlinks"> <li class="prev"> <a accesskey="p" href="fstab.html" title= "Creating the /etc/fstab File">Prev</a> <p> Creating the /etc/fstab File </p> </li> <li class="next"> <a accesskey="n" href="colo.html" title= "Making the LFS System Bootable via Colo">Next</a> <p> Making the LFS System Bootable via Colo </p> </li> <li class="up"> <a accesskey="u" href="chapter.html" title= "Chapter 12. Making the LFS System Bootable">Up</a>. </li> <li class="home"> <a accesskey="h" href="../index.html" title= "Cross-Compiled Linux From Scratch - Version CLFS-SVN-20060417-MIPS"> Home</a> </li> </ul> </div> <div class="wrap" lang="en" xml:lang="en"> <div class="titlepage"> <h1 class="sect1"> 12.3. Linux-2.6.16.5 </h1> </div> <div class="package" lang="en" xml:lang="en"> <p> The Linux package contains the Linux kernel. </p> <div class="segmentedlist"> <div class="seglistitem"> <div class="seg"> <strong><span class="segtitle">Installation depends on:</span></strong> <span class="seg">Bash, Binutils, Coreutils, Findutils, GCC, Glibc, Grep, Gzip, Kbd, Make, Module-Init-Tools, Perl, and Sed</span> </div> </div> </div> </div> <div class="installation" lang="en" xml:lang="en"> <div class="titlepage"> <h2 class="sect2"> 12.3.1. Installation of the kernel </h2> </div> <p> Building the kernel involves a few steps—configuration, compilation, and installation. Read the <tt class= "filename">README</tt> file in the kernel source tree for alternative methods to the way this book configures the kernel. </p> <p> The following patch merges changes from Linux-MIPS.org into the kernel: </p> <pre class="userinput"><kbd class="command">patch -Np1 -i ../linux-2.6.16.5-mips-1.patch</kbd></pre> <p> Prepare for compilation by running the following command: </p> <pre class="userinput"><kbd class="command">make mrproper</kbd></pre> <p> This ensures that the kernel tree is absolutely clean. The kernel team recommends that this command be issued prior to each kernel compilation. Do not rely on the source tree being clean after un-tarring. </p> <p> If, in <a href="../bootscripts/console.html" title= "11.7. Configuring the Linux Console">Section 11.7, “Configuring the Linux Console,”</a> it was decided to compile the keymap into the kernel, issue the command below: </p> <pre class="userinput"><kbd class="command">loadkeys -m /usr/share/kbd/keymaps/<em class="replaceable"><tt>[path to keymap]</tt></em> > \ drivers/char/defkeymap.c</kbd></pre> <p> For example, if using a Dutch keyboard, use <tt class= "filename">/usr/share/kbd/keymaps/i386/qwerty/nl.map.gz</tt>. </p> <p> Configure the kernel via a menu-driven interface. Please note that the udev bootscript requires "rtc" and "tmpfs" to be enabled and built into the kernel, not as modules. BLFS has some information regarding particular kernel configuration requirements of packages outside of LFS at <a href= "http://www.linuxfromscratch.org/blfs/view/svn/longindex.html#kernel-config-index"> <i>http://www.linuxfromscratch.org/blfs/view/svn/longindex.html#kernel-config-index</i></a>: </p> <pre class="userinput"><kbd class="command">make menuconfig</kbd></pre> <p> If desired, skip kernel configuration by copying the kernel config file, <tt class="filename">.config</tt>, from the host system (assuming it is available) to the root directory of the unpacked kernel sources. However, we do not recommend this option. It is often better to explore all the configuration menus and create the kernel configuration from scratch. </p> <p> Compile the kernel image and modules: </p> <pre class="userinput"><kbd class="command">make</kbd></pre> <p> If using kernel modules, an <tt class= "filename">/etc/modprobe.conf</tt> file may be needed. Information pertaining to modules and kernel configuration is located in the kernel documentation in the <tt class="filename">Documentation</tt> directory of the kernel sources tree. Also, <tt class= "filename">modprobe.conf(5)</tt> may be of interest. </p> <p> Be very careful when reading other documentation relating to kernel modules because it usually applies to 2.4.x kernels only. As far as we know, kernel configuration issues specific to Hotplug and Udev are not documented. The problem is that Udev will create a device node only if Hotplug or a user-written script inserts the corresponding module into the kernel, and not all modules are detectable by Hotplug. Note that statements like the one below in the <tt class="filename">/etc/modprobe.conf</tt> file do not work with Udev: </p> <pre class="screen"><tt class="literal">alias char-major-XXX some-module</tt></pre> <p> Because of the complications with Hotplug, Udev, and modules, we strongly recommend starting with a completely non-modular kernel configuration, especially if this is the first time using Udev. </p> <p> Install the modules, if the kernel configuration uses them: </p> <pre class="userinput"><kbd class="command">make modules_install</kbd></pre> <p> After kernel compilation is complete, additional steps are required to complete the installation. Some files need to be copied to the <tt class="filename">/boot</tt> directory. </p> <p> Issue the following command to install the kernel: </p> <pre class="userinput"><kbd class="command">cp vmlinux /boot/vmlinux-2.6.16.5gzip -9 /boot/vmlinux-2.6.16.5</kbd></pre> <p> <tt class="filename">System.map</tt> is a symbol file for the kernel. It maps the function entry points of every function in the kernel API, as well as the addresses of the kernel data structures for the running kernel. Issue the following command to install the map file: </p> <pre class="userinput"><kbd class="command">cp System.map /boot/System.map-2.6.16.5</kbd></pre> <p> The kernel configuration file <tt class="filename">.config</tt> produced by the <span><strong class="command">make menuconfig</strong></span> step above contains all the configuration selections for the kernel that was just compiled. It is a good idea to keep this file for future reference: </p> <pre class="userinput"><kbd class="command">cp .config /boot/config-2.6.16.5</kbd></pre> <p> It is important to note that the files in the kernel source directory are not owned by <tt class="systemitem">root</tt>. Whenever a package is unpacked as user <tt class= "systemitem">root</tt> (like we did inside chroot), the files have the user and group IDs of whatever they were on the packager's computer. This is usually not a problem for any other package to be installed because the source tree is removed after the installation. However, the Linux source tree is often retained for a long time. Because of this, there is a chance that whatever user ID the packager used will be assigned to somebody on the machine. That person would then have write access to the kernel source. </p> <p> If the kernel source tree is going to retained, run <span><strong class="command">chown -R 0:0</strong></span> on the <tt class="filename">linux-2.6.16.5</tt> directory to ensure all files are owned by user <tt class="systemitem">root</tt>. </p> <div class="warning"> <div class="admonhead"> <img alt="[Warning]" src="../images/warning.png" /> <h3 class="admontitle"> Warning </h3> </div> <div class="admonbody"> <p> Some kernel documentation recommends creating a symlink from <tt class="filename">/usr/src/linux</tt> pointing to the kernel source directory. This is specific to kernels prior to the 2.6 series and <span class="emphasis"><em>must not</em></span> be created on an LFS system as it can cause problems for packages you may wish to build once your base LFS system is complete. </p> <p> Also, the headers in the system's <tt class= "filename">include</tt> directory should <span class= "emphasis"><em>always</em></span> be the ones against which Glibc was compiled, that is, the ones from the Linux-Libc-Headers package, and therefore, should <span class= "emphasis"><em>never</em></span> be replaced by the kernel headers. </p> </div> </div> </div> <div class="content" lang="en" xml:lang="en"> <div class="titlepage"> <a id="contents-kernel" name="contents-kernel"></a> <h2 class="sect2"> 12.3.2. Contents of Linux </h2> </div> <div class="segmentedlist"> <div class="seglistitem"> <div class="seg"> <strong><span class="segtitle">Installed files:</span></strong> <span class="seg">config-[linux-version], lfskernel-[linux-version], and System.map-[linux-version]</span> </div> </div> </div> <div class="variablelist"> <h3> <a id="id3696395" name="id3696395"></a>Short Descriptions </h3> <table border="0"> <col align="left" valign="top" /> <tbody> <tr> <td> <a id="config" name="config"></a><span class= "term"><tt class= "filename">config-[linux-version]</tt></span> </td> <td> <p> Contains all the configuration selections for the kernel </p> </td> </tr> <tr> <td> <a id="lfskernel" name="lfskernel"></a><span class= "term"><tt class= "filename">lfskernel-[linux-version]</tt></span> </td> <td> <p> The engine of the Linux system. When turning on the computer, the kernel is the first part of the operating system that gets loaded. It detects and initializes all components of the computer's hardware, then makes these components available as a tree of files to the software and turns a single CPU into a multitasking machine capable of running scores of programs seemingly at the same time. </p> </td> </tr> <tr> <td> <a id="System.map" name="System.map"></a><span class= "term"><tt class= "filename">System.map-[linux-version]</tt></span> </td> <td> <p> A list of addresses and symbols; it maps the entry points and addresses of all the functions and data structures in the kernel </p> </td> </tr> </tbody> </table> </div> </div> </div> <div class="navfooter"> <ul> <li class="prev"> <a accesskey="p" href="fstab.html" title= "Creating the /etc/fstab File">Prev</a> <p> Creating the /etc/fstab File </p> </li> <li class="next"> <a accesskey="n" href="colo.html" title= "Making the LFS System Bootable via Colo">Next</a> <p> Making the LFS System Bootable via Colo </p> </li> <li class="up"> <a accesskey="u" href="chapter.html" title= "Chapter 12. Making the LFS System Bootable">Up</a>. </li> <li class="home"> <a accesskey="h" href="../index.html" title= "Cross-Compiled Linux From Scratch - Version CLFS-SVN-20060417-MIPS"> Home</a>. </li> </ul> </div> </body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -