Team LiB
Previous Section Next Section

Hack 89. Upgrade Your Kernel to 2.6

Hot rod your computer with a new kernel.

Upgrading your kernel from one minor version to another quickly becomes old hat. But when a new major series of kernels comes out, such as the recently released 2.6 kernel series, many people are left scratching their heads not knowing exactly how they should move to this new version.

In this hack, you will migrate from a 2.4 series kernel to a 2.6 series. This hack assumes you know how to compile a kernel and that you have compiled the 2.4 series before [Hack #88] . Starting in mid-2004, most distributions released 2.6 series kernels. If you don't want to compile your own 2.6 kernel but you do want to take advantage of its new features, check your distributions package manager to see if there is already a 2.6 kernel for you to use.

10.3.1. Get the Source

The first step is to grab the latest version of the 2.6 kernel from http://www.kernel.org/, and save it to /usr/src. Then you should extract it and rename the resulting directory to linux. If you have compiled 2.4 before you should rename that source code to something unique such as linux2.4.

With the source code installed, you should read the Changes file in /usr/src/linux/Documentation. This file gives you a list of points and some notes about the changes you will find in the new kernel. More importantly, this file contains a list of software requirements and their minimum version numbers. The file also includes a command that shows you how to find out what version of the software is on your system. You should ensure that you check every piece of software listed, and upgrade your software if necessary. Do not feel tempted to skip something just because the version number is similar; the kernel hackers indicate these version numbers for a reason.

10.3.2. Configure the Code

Although a barrage of new features is included in each new release of the kernel source, the configuration process has remained largely the same; you select options from a menu, and decide if they should be compiled into the kernel or available as loadable modules. What has changed within the configuration process are the configuration programs and how they can work for you. The 2.6 kernel experienced an evolution in this area and saw the birth of two new additions for configuring your kernel. One of these tools is based on the GTK widget set (used by GNOME), and you can run this version with the following:

foo@bar:~$ make gconfig

Another available configuration tool uses the Qt widget set (used by KDE), and you can run this with the following:

foo@bar:~$ make qconfig

Although these two new graphical configuration tools are part of the 2.6 kernel, you can still use make menuconfig for a console-based menu tool.

Users who are migrating from the 2.4 series kernel to 2.6 can use their old .config file. To do this simply copy the .config file from your original 2.4 source code directory to your new 2.6 directory and run make oldconfig. This converts the .config file to one that can be used with the 2.6 kernel. You'll be asked a lot of questions concerning the new features in the 2.6 kernel, but most should be fairly simple to answer.

10.3.3. New Features in 2.6

Version 2.6 has a number of new features and improvements that can be useful in the context of desktop Linux. A huge number of new options are available, and you should explore them fully and choose the ones most pertinent to your needs. Here is a summary of some of the most interesting features.


Kernel preemption

The use of kernel preemption produces a lower delay in general applications and, more specifically, multimedia applications. This is particularly useful if you want to use your desktop as a sound recording or video editing workstation.


ALSA

One of the most substantial additions to the 2.6 series is the Advanced Linux Sound Architecture (ALSA), and it is now the default sound system for Linux. Although ALSA is within the source tree, you will need to run through a few additional steps to get it working. First, you should ensure that you include all the options necessary for your sound card. To find out what options are necessary, look at the excellent ALSA web site at http://www.alsa-project.org/alsa-doc, and select your card from the combo box. Documentation is available for many of the cards ALSA supports, and this documentation can help you get the most out of your card.


New filesystems

A number of additional filesystems have made their way into 2.6, and they include support for ext2, ext3, reiserfs, jfs, xfs, minix, romfs, iso9660, udf, msdos, vfat, ntfs (read-only), adfs, amiga ffs, Apple Macintosh hfs, BeOS befs (read-only), bfs, efs (read-only), cramfs, free vxfs, OS/2 hpfs, qnx4fs, sysvfs, and ufs. Although the kernel is a stable version, you should check that any new filesystems in 2.6 are fully tested before you store important data on them.

10.3.4. Compiling the Kernel

When you have configured the kernel, you can compile it with this:

foo@bar:~$ make
foo@bar:~$ make modules_install

You no longer need to run make dep, make modules, and make clean.

10.3.5. Install the Kernel

The compiled kernel is placed in /usr/src/linux/arch/<platform>/boot and is called bzImage, where <platform> is a placeholder for the type of computer on which you are performing the compile. For example, if you compiled your kernel on an x86 machine, such as a Pentium, Athlon, Celeron, etc., you will find the kernel image in /usr/src/linux/arch/i386/boot. You must copy this image over to /boot. You also should rename it to include the version of the kernel in the filename so that when you have multiple kernels you can easily tell which is which. Also, the Linux kernel image has traditionally been referred to as vmlinuz, and many users continue to call it this. So, if you have a 2.6.5 kernel, you could copy the file with this command as root:

foo@bar:~# cp /usr/src/linux/arch/i386/boot/bzImage /boot/vmlinuz-2.6.5

You should also copy the System.map file (this file has a map of the positions of symbols in the kernel and is used by programs such as depmod) to the /boot directory using a similar naming scheme:

foo@bar:~# cp /usr/src/linux/arch/i386/boot/System.map /boot/System.map-2.6.5

To complete the process, just adjust your bootloader to load the new kernel [Hack #1].

    Team LiB
    Previous Section Next Section