⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 kernel.html

📁 lfs3.1 从源代码构建linux。html版本。
💻 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 &#38;&#38;yes "" | make config &#38;&#38;make dep &#38;&#38;cd $LFS/usr/include &#38;&#38;cp -a ../src/linux/include/linux . &#38;&#38;chown -R root.root $LFS/usr/include/linux &#38;&#38;mkdir asm &#38;&#38;cp -a ../src/linux/include/asm/* asm &#38;&#38;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 &#38;&#38; 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&nbsp;from&nbsp;the&nbsp;bash&nbsp;package<br><br>ar&nbsp;from&nbsp;the&nbsp;binutils&nbsp;package<br>as&nbsp;from&nbsp;the&nbsp;binutils&nbsp;package<br>ld&nbsp;from&nbsp;the&nbsp;binutils&nbsp;package<br>nm&nbsp;from&nbsp;the&nbsp;binutils&nbsp;package<br>objcopy&nbsp;from&nbsp;the&nbsp;binutils&nbsp;package<br><br>chown&nbsp;from&nbsp;the&nbsp;fileutils&nbsp;package<br>cp&nbsp;from&nbsp;the&nbsp;fileutils&nbsp;package<br>ln&nbsp;from&nbsp;the&nbsp;fileutils&nbsp;package<br>mkdir&nbsp;from&nbsp;the&nbsp;fileutils&nbsp;package<br>mv&nbsp;from&nbsp;the&nbsp;fileutils&nbsp;package<br>rm&nbsp;from&nbsp;the&nbsp;fileutils&nbsp;package<br><br>find&nbsp;from&nbsp;the&nbsp;findutils&nbsp;package<br>xargs&nbsp;from&nbsp;the&nbsp;findutils&nbsp;package<br><br>gcc&nbsp;from&nbsp;the&nbsp;gcc&nbsp;package<br><br>grep&nbsp;from&nbsp;the&nbsp;grep&nbsp;package<br><br>make&nbsp;from&nbsp;the&nbsp;make&nbsp;package<br><br>awk&nbsp;from&nbsp;the&nbsp;mawk&nbsp;package<br><br>depmod&nbsp;from&nbsp;the&nbsp;modutils&nbsp;package<br>genksyms&nbsp;from&nbsp;the&nbsp;modutils&nbsp;package<br><br>hostname&nbsp;from&nbsp;the&nbsp;net-tools&nbsp;package<br><br>sed&nbsp;from&nbsp;the&nbsp;sed&nbsp;package<br><br>basename&nbsp;from&nbsp;the&nbsp;sh-utils&nbsp;package<br>date&nbsp;from&nbsp;the&nbsp;sh-utils&nbsp;package<br>expr&nbsp;from&nbsp;the&nbsp;sh-utils&nbsp;package<br>pwd&nbsp;from&nbsp;the&nbsp;sh-utils&nbsp;package<br>uname&nbsp;from&nbsp;the&nbsp;sh-utils&nbsp;package<br>whoami&nbsp;from&nbsp;the&nbsp;sh-utils&nbsp;package<br>yes&nbsp;from&nbsp;the&nbsp;sh-utils&nbsp;package<br><br>cat&nbsp;from&nbsp;the&nbsp;textutils&nbsp;package<br>md5sum&nbsp;from&nbsp;the&nbsp;textutils&nbsp;package<br>sort&nbsp;from&nbsp;the&nbsp;textutils&nbsp;package<br>tail&nbsp;from&nbsp;the&nbsp;textutils&nbsp;package<br>touch&nbsp;from&nbsp;the&nbsp;textutils&nbsp;package<br>tr&nbsp;from&nbsp;the&nbsp;textutils&nbsp;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 + -