?? kernel.html
字號:
<HTML><HEAD><TITLE>Installing Linux Kernel-2.4.16</TITLE><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.63"><LINKREL="HOME"TITLE="Linux From Scratch"HREF="../index.html"><LINKREL="UP"TITLE="Preparing the LFS system"HREF="../chapter05/chapter05.html"><LINKREL="PREVIOUS"TITLE="Installing Gzip-1.2.4a"HREF="../chapter05/gzip.html"><LINKREL="NEXT"TITLE="Installing Make-3.79.1"HREF="../chapter05/make.html"></HEAD><BODYCLASS="sect1"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#0000FF"VLINK="#840084"ALINK="#0000FF"><DIVCLASS="NAVHEADER"><TABLEWIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">Linux From Scratch: Version 3.1</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><AHREF="../chapter05/gzip.html">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom">Chapter 5. Preparing the LFS system</TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="../chapter05/make.html">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="sect1"><H1CLASS="sect1"><ANAME="ch05-kernel">5.12. Installing Linux Kernel-2.4.16</A></H1><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><FONTCOLOR="#000000"><PRECLASS="screen">Estimated build time: 3 minutesEstimated required disk space: 132 MB</PRE></FONT></TD></TR></TABLE><DIVCLASS="sect2"><H2CLASS="sect2"><ANAME="AEN1233">5.12.1. Installation of the Linux Kernel</A></H2><P>We won't be compiling a new kernel image yet. We'll do that after wehave finished the installation of the basic system software in thischapter. But because certain software needs the kernel header files, we'regoing to unpack the kernel archive now and set it up so that we cancompile the packages that need the kernel.</P><P>The kernel configuration file is created by running the following command:</P><P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><FONTCOLOR="#000000"><PRECLASS="screen"><TTCLASS="userinput"><B>make mrproper &&yes "" | make config &&make dep &&cd $LFS/usr/include &&cp -a ../src/linux/include/linux . &&chown -R root.root $LFS/usr/include/linux &&mkdir asm &&cp -a ../src/linux/include/asm/* asm &&chown -R root.root $LFS/usr/include/asm</B></TT></PRE></FONT></TD></TR></TABLE></P></DIV><DIVCLASS="sect2"><H2CLASS="sect2"><ANAME="AEN1240">5.12.2. Command explanations</A></H2><P><TTCLASS="userinput"><B>make mrproper:</B></TT> This will ensure that the kerneltree is absolutely clean.</P><P><TTCLASS="userinput"><B>yes "" | make config:</B></TT> This runs make config andanswers with the default answer to every question the config script asks the user (it does this by simply doing the equivalent of hitting theEnter key, thus accepting the default Y and N answers to the questions). We're not configuring the real kernel here, we just need to have some sort of configure file created so that we can run make dep next that will create a few files in $LFS/usr/src/linux/include/linux, like version.h, among others, that we will need to compile Glibc and other packages later in chroot.</P><P><TTCLASS="userinput"><B>make dep:</B></TT> make dep checks dependencies and setsup the dependencies file. We don't really care about the dependencychecks, but what we do care about is that make dep creates thoseaforementioned files in $LFS/usr/src/linux/include/linux we will beneeding later on.</P><P><TTCLASS="userinput"><B>cp -a ../src/linux/include/linux .</B></TT> and<TTCLASS="userinput"><B>mkdir asm && cp -a ../src/linux/include/asm/*asm</B></TT>:These commands copy the kernel headers in the <TTCLASS="filename">$LFS/usr/include</TT> directory.</P><P><TTCLASS="userinput"><B>chown -R root.root $LFS/usr/include/linux</B></TT> and <TTCLASS="userinput"><B>chown -R root.root $LFS/usr/include/asm</B></TT>:These commands change the ownership of the <TTCLASS="filename">$LFS/usr/include/linux</TT> and the <TTCLASS="filename">$LFS/usr/include/asm</TT> directories, plus all thefiles contained therein to the user root and group root.</P></DIV><DIVCLASS="sect2"><H2CLASS="sect2"><ANAME="AEN1257">5.12.3. Why we copy the kernel headers and don't symlink them</A></H2><P>In the past, it was common practice for people to symlink the/usr/include/linux and asm directories to /usr/src/linux/include/linuxand asm respectively. This is a <EM>bad</EM> idea as this extract from a post by Linus Torvalds to the Linux Kernel Mailing List points out:</P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><FONTCOLOR="#000000"><PRECLASS="screen">I would suggest that people who compile new kernels should: - not have a single symbolic link in sight (except the one that the kernel build itself sets up, namely the "linux/include/asm" symlink that is only used for the internal kernel compile itself) And yes, this is what I do. My /usr/src/linux still has the old 2.2.13 header files, even though I haven't run a 2.2.13 kernel in a _loong_ time. But those headers were what glibc was compiled against, so those headers are what matches the library object files. And this is actually what has been the suggested environment for at least the last five years. I don't know why the symlink business keeps on living on, like a bad zombie. Pretty much every distribution still has that broken symlink, and people still remember that the linux sources should go into "/usr/src/linux" even though that hasn't been true in a _loong_ time.</PRE></FONT></TD></TR></TABLE><P>The relevant part here is where he states that the headers shouldbe the ones which <EM>glibc was compiled against</EM>. These are the headers which should remain accessible and so by copying them, we ensurethat we follow these guidelines. Also note that as long as you don't have those symlinks, it is perfectly alright to have the kernel sources in <TTCLASS="filename">/usr/src/linux</TT>.</P></DIV><DIVCLASS="sect2"><H2CLASS="sect2"><ANAME="AEN1265">5.12.4. Contents</A></H2><P>The Linux kernel package contains the Linux kernel.</P></DIV><DIVCLASS="sect2"><H2CLASS="sect2"><ANAME="AEN1268">5.12.5. Description</A></H2><P>The Linux kernel is at the core of every Linux system. It's what makesLinux tick. When a computer is turned on and boots a Linux system, thevery first piece of Linux software that gets loaded is the kernel. Thekernel initializes the system's hardware components such as serialports, parallel ports, sound cards, network cards, IDE controllers, SCSIcontrollers and a lot more. In a nutshell the kernel makes the hardwareavailable so that the software can run.</P></DIV><DIVCLASS="sect2"><H2CLASS="sect2"><ANAME="AEN1271">5.12.6. Dependencies</A></H2><P>Linux-2.4.8 needs the following to be installed:</P><PCLASS="literallayout"><br>sh from the bash package<br><br>ar from the binutils package<br>as from the binutils package<br>ld from the binutils package<br>nm from the binutils package<br>objcopy from the binutils package<br><br>chown from the fileutils package<br>cp from the fileutils package<br>ln from the fileutils package<br>mkdir from the fileutils package<br>mv from the fileutils package<br>rm from the fileutils package<br><br>find from the findutils package<br>xargs from the findutils package<br><br>gcc from the gcc package<br><br>grep from the grep package<br><br>make from the make package<br><br>awk from the mawk package<br><br>depmod from the modutils package<br>genksyms from the modutils package<br><br>hostname from the net-tools package<br><br>sed from the sed package<br><br>basename from the sh-utils package<br>date from the sh-utils package<br>expr from the sh-utils package<br>pwd from the sh-utils package<br>uname from the sh-utils package<br>whoami from the sh-utils package<br>yes from the sh-utils package<br><br>cat from the textutils package<br>md5sum from the textutils package<br>sort from the textutils package<br>tail from the textutils package<br>touch from the textutils package<br>tr from the textutils package<br></P></DIV></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLEWIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="../chapter05/gzip.html">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="../index.html">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="../chapter05/make.html">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">Installing Gzip-1.2.4a</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="../chapter05/chapter05.html">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">Installing Make-3.79.1</TD></TR></TABLE></DIV></BODY></HTML>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -