📄 00000063.htm
字号:
<HTML><HEAD> <TITLE>BBS水木清华站∶精华区</TITLE></HEAD><BODY><CENTER><H1>BBS水木清华站∶精华区</H1></CENTER>发信人: reden (鱼 ~ 君子律己以利人), 信区: Linux <BR>标 题: Linux Kernel Installation <BR>发信站: BBS 水木清华站 (Mon Oct 5 00:13:15 1998) WWW-POST <BR> <BR>"Linux Gazette...making Linux just a little more fun!"
<BR>
<BR>
<BR>
<BR>A Linux Journal Review: This article appeared in the November 1997 issue of <BR>Linux Journal.
<BR>
<BR>
<BR>
<BR> Linux Kernel Installation
<BR>
<BR> By David A. Bandel
<BR>
<BR>
<BR>
<BR>Linux is many users' introduction to a truly powerful, configurable operating <BR>system. In the past, a Unix-like operating system was
<BR>out of reach for most. If it wasn't the operating system's 4-digit price tag, <BR>it was the hardware. Even the now
<BR>free-for-personal-use SCO Unixware requires a system with SCSI drives, and <BR>most of us are using IDE to keep costs down.
<BR>Along with the power that Linux brings comes the need to perform a task users <BR>have not had to do on simpler operating systems:
<BR>configure the kernel to your hardware and operations.
<BR>
<BR>Previous installation kernels from 1.2.x and before suggested that you <BR>rebuild; however, with the new 2.0.x kernel, rebuilding has
<BR>almost become a necessity. The kernel that comes with the installation <BR>packages from Red Hat, Caldera, Debian and most others,
<BR>is a generic, ``almost everything is included'' kernel. While rebuilding a <BR>kernel may seem like a daunting task and living with the
<BR>installed kernel may not be too bad, rebuilding is a good introduction to <BR>your system.
<BR>
<BR>
<BR>
<BR>Why Roll Your Own?
<BR>
<BR>The standard installation kernels are an attempt to make as many systems as <BR>possible usable for the task of installing a workable
<BR>Linux system. As such, the kernel is bloated and has a lot of unnecessary <BR>code in it for the average machine. It also does not have
<BR>some code a lot of users want.
<BR>
<BR>Then, of course, there's always the need to upgrade the kernel because you've <BR>bought new hardware, etc. Upgrading within a
<BR>series is usually very straightforward. When it comes to upgrading, say from <BR>1.2.something to 2.0.something, now the task is
<BR>beyond the scope of this article and requires some savvy. Better to get a new <BR>distribution CD and start fresh--this is also true for
<BR>upgrading to the experimental 2.1.x kernels.
<BR>
<BR>
<BR>
<BR>Kernel Version Numbering
<BR>
<BR>All Linux kernel version numbers contain three numbers separated by periods <BR>(dots). The first number is the kernel version. We
<BR>are now on the third kernel version, 2. Some of you may be running a version <BR>1 kernel, and I am aware of at least one running
<BR>version 0 kernel.
<BR>
<BR>The second number is the kernel major number. Major numbers which are even <BR>numbers (0 is considered an even number) are
<BR>said to be stable. That is, these kernels should not have any crippling bugs, <BR>as they have been fairly heavily tested. While some
<BR>contain small bugs, they can usually be upgraded for hardware compatibility <BR>or to armor the kernel against system crackers. For
<BR>example, kernel 2.0.30, shunned by some in favor of 2.0.29 because of <BR>reported bugs, contains several patches including one to
<BR>protect against SYN denial of service attacks. The kernels with odd major <BR>numbers are developmental kernels. These have not
<BR>been tested and often as not will break any software packages you may be <BR>running. Occasionally, one works well enough that it
<BR>will be adopted by users needing the latest and greatest support before the <BR>next stable release. This is the exception rather than
<BR>the rule, and it requires substantial changes to a system.
<BR>
<BR>The last number is the minor number and is increased by one for each release. <BR>If you see kernel version 2.0.8, you know it's a
<BR>kernel 2.0, stable kernel, and it is the ninth release (we begin counting <BR>with 0).
<BR>
<BR>
<BR>
<BR>Assumptions
<BR>
<BR>I hate to make any assumptions; they always seem to come back to bite me. So <BR>I need to mention a few things so that we're
<BR>working off the same sheet of music. In order to compile a kernel, you'll <BR>need a few things. First, I'll assume you've installed a
<BR>distribution with a 2.0.x kernel, all the base packages and perhaps a few <BR>more. You'll also need to have installed gcc version 2.7
<BR>and all the supporting gcc libraries. You'll also need the libc-dev library <BR>and the binutils and bin86 packages (normally installed as
<BR>part of a standard distribution install). If you download the source or copy <BR>it from a CD, you'll also need the tar and gunzip
<BR>packages. Also, you'll need lots of disk real estate. Plan on 7MB to <BR>download, another 20MB to unpack this monster and a few
<BR>more to compile it.
<BR>
<BR>Needless to say, many of the things we will discuss require you to be logged <BR>in as root. If you've downloaded the kernel as a
<BR>non-privileged user and you have write permission to the /usr/src <BR>subdirectory, you can still do much of this task without becoming
<BR>root. For the newcomers to Linux, I highly recommend you do as much as <BR>possible as a non-privileged user and become root
<BR>(type: su - face) only for those jobs that require it. One day, you'll be <BR>glad you acquired this habit. Remember, there are two
<BR>kinds of systems administrators, those who have totally wrecked a running <BR>setup inadvertently while logged in as root, and those
<BR>who will.
<BR>
<BR>
<BR>
<BR>Obtaining/Upgrading the Source
<BR>
<BR>Kernel sources for Linux are available from a large number of ftp sites and <BR>on almost every Linux distribution CD-ROM. For
<BR>starters, you can go to ftp.funet.fi, the primary site for the Linux kernel. <BR>This site has a list of mirror sites from which you can
<BR>download the kernel. Choosing the site nearest you helps decrease overall <BR>Internet traffic.
<BR>
<BR>Once you've obtained the source, put it in the /usr/src directory. Create a <BR>subdirectory to hold the source files once they are
<BR>unpacked using tar. I recommend naming the directories something like <BR>linux-2.0.30 or kernel-2.0.30, substituting your version
<BR>numbers. Create a link to this subdirectory called linux using the following <BR>command:
<BR>
<BR>ln -sf linux-2.0.30 linux
<BR>
<BR>I included the -f in the link command because if you already have a kernel <BR>source in /usr/src, it will contain this link too, and we
<BR>want to force it to look in our subdirectory. (On some versions of ln <BR>(notably version 3.13), the force option (-f) does not work.
<BR>You'll have to first remove the link then establish it again. This works <BR>correctly by version 3.16.) The only time you may have a
<BR>problem is if linux is a subdirectory name, not a link. If you have this <BR>problem, you'll have to rename the subdirectory before
<BR>continuing:
<BR>
<BR>mv linux linux-2.0.8
<BR>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -