You should always rpm -U (upgrade) a new kernel rpm, rather than rpm -i (install), to avoid overwriting the old, but still working, kernel. This is done as a safety measure. What if the new one does not work?

Kernel Versions

The Linux kernel is in a constant state of development. As new features are added, bugs are fixed, and new technology is incorporated into the code base, it becomes necessary to provide stable releases of the kernel for use in a production environment. It is also important to have separate releases that contain the newest code for developers to test. To keep track of the kernels, version numbers are assigned to them. Programmers enjoy using sequential version numbers that have abstract meaning. Is version 8 twice as advanced as version 4 of the same application? Is version 1 of one application less developed than version 3 of another? The version numbers cannot be used for this kind of qualitative or quantitative comparison. It is entirely possible that higher version numbers can have fewer features and more bugs than older versions. The numbers exist solely to differentiate and organize sequential revisions of software.

For the latest development version of the kernel at the time of writing, for example, the kernel version number is 2.6.22.

The kernel version can be broken down into four sections:

major version — This is the major version number, now at 2.

minor version — This is the minor version number, now at 6.

sublevel number — This number indicates the current iteration of the kernel; here it is number 10.

extraversion level — This is the number representing a collection of patches and additions made to the kernel by the Red Hat engineers to make the kernel work for them (and you). Each collection is numbered, and the number is indicated here in the kernel name. From the preceding example, it is 1 .

Typing uname -r at the command prompt displays your current kernel version:

# uname -r

2.6.10-1

Even-numbered minor versions are stable kernels, whereas odd-numbered minor versions are development releases. Version 2.6.x is the stable production kernel, whereas version 2.5.x is the development Linux kernel. When a new version of the development kernel is started, it will be labeled 2.7.x.

For production machines, you should always use the kernels with even minor numbers. The odd minor numbers introduce new features, so you might want to use those on a test machine if you need features they provide.

Obtaining the Kernel Sources

The Linux kernel has always been freely available to anyone who wants it. If you just want to recompile the existing kernel, install the kernel-sources RPM from the CD. To get the very latest vanilla version, open an FTP connection to ftp.kernel.org, using your favorite FTP client, and log in as anonymous. Because you are interested in the 2.6 kernel, change directories to /pub/linux/kernel/v2.6. The latest stable kernel as of this writing is 2.6.15.

NOTE

ftp.kernel.org receives more than its share of requests for download. It is considered a courtesy to use a mirror site to reduce the traffic that ftp.kernel.org bears. http://www.kernel.org/mirrors/ has a list of all mirrors around the world. Find one close to your geographic location and substitute that address for ftp.kernel.org.

A number of different entries are on the FTP archive site for each kernel version, but because you are interested in only the full kernel, it is necessary to get only the full package of source code. There are two of these packages:

linux-2.6.15.tar.gz

linux-2.6.15.bz2

Although these are the same kernel packages, they are built using different compression utilities: The .gz extension is the gzip package, found on almost every Linux system available. The .bz2 extension is the newer bzip2 utility, which has better compression than gzip. Both packages have the same content, so download the one compressed with the program you use.

After it is downloaded, move the package to a directory other than /usr/src and unpack it. If you downloaded the .gz package, the unpacking command is tar -xzvf linux- 2.6.15.tar.gz. Otherwise, the bzip2 unpack command is tar -xjvf linux- 2.6.15.tar.bz2. When it is unpacked, the package creates a new directory, linux-2.6.15. Copy it to /usr/src/kernels or move it there. Then create a symbolic link of linux-2.6 to linux-2.6.15 (otherwise, some scripts will not work). Here is how to create the symbolic link:

# rm /usr/src/kernels/linux-2.6

# ln -s /usr/src/kernels/linux-2.6.15 /usr/src/kernels/linux-2.6

By creating a symbolic link to /usr/src/linux-2.6, it is possible to allow multiple kernel versions to be compiled and tailored for different functions: You just change the symbolic link to the kernel directory on which you want to work.

CAUTION

The correct symbolic link is critical to the operation of make. Always have the symbolic link point to the version of the kernel sources with which you are working.

Patching the Kernel

It is possible to patch a kernel to the newest Linux kernel version, as opposed to down loading the entire source code. This choice can be beneficial for those who are not using a high-speed broadband connection. (A typical compressed kernel source file is nearly 30MB for a download time of about 10 minutes on a 512Kb DSL connection; adjust accordingly for your connection.) Whether you are patching existing sources or down loading the full source, the end results are identical.

Patching the kernel is not a mindless task. It requires the user to retrieve all patches from her current version to the version to which she wants to upgrade. For example, if you are currently running 2.6.1 (and have those sources) and want to upgrade to 2.6.8, you must retrieve the 2.6.2, and 2.6.3 patch sets, and so on. After they are downloaded, these patches must be applied in succession to upgrade to 2.6.8. This is more tedious than downloading the entire source, but useful for those who keep up with kernel hacking and want to perform incremental upgrades to keep their Linux kernel as up-to-date as possible.

To patch up to several versions in a single operation, you can use the patch-kernel script

Добавить отзыв
ВСЕ ОТЗЫВЫ О КНИГЕ В ИЗБРАННОЕ

0

Вы можете отметить интересные вам фрагменты текста, которые будут доступны по уникальной ссылке в адресной строке браузера.

Отметить Добавить цитату