Anyone who's been following Linux kernel development for the past several months has heard about one exciting feature after another being merged into the still un-released 2.6 kernel. New features that noticeably affect user experience include Robert Love's [interview] preemptible kernel work [story], Ingo Molnar's [interview] O(1) Scheduler [story], Rik Van Riel's [interview] reverse mapping VM [story], Nick Piggins' [interview] Anticipatory I/O scheduler [story], and much, much more...
Having some spare time a few nights ago, I decided to give the latest kernel, 2.6.0-test4, a trial run on my aging 550Mhz PIII desktop computer, and the result was nothing short of spectacular. As the final 2.6.0 release approaches, it is important that an increasing number of users (aka testers) give this kernel a try, especially as currently it's still a sexy task for developers to track down kernel bugs and stabalize their work. Once work starts on the 2.7 development tree, inevitably much talent will again be focusing on new features.
The purpose of this document is to provide some helpful tips to readers that currently compile their own 2.4 kernels, but haven't yet made the leap to 2.6. This is still a development kernel, so you may run into problems, but overall stability and performance is quite impressive and I can't recommend enough that you try it today.
This article is targeted towards Linux users that are already comfortable with compiling their own 2.4 kernels. If you've never compiled a kernel before, I suggest that you start here:
Beyond that, it's also highly recommended that anyone new to the 2.6 kernel review Dave Jones' post-halloween document (aka "2.5 - what to expect").
Step 0: Make a backup of important data.
Before we get started, if you're going to be running a development kernel be sure that you have a current backup of any important data. While I've not run into any problems while running 2.6.0-test4, there are still bugs...
Step 1: Obtain the current 2.6 kernel.
All official versions of the Linux kernel source code can be found at http://kernel.org/. It is highly encouraged that you find the fastest local mirror to spread out the load among willing kernel source hosts. Find the kernel.org mirror list here: http://kernel.org/mirrors/.
At the time of this writing, the current version of the 2.6 kernel is 2.6.0-test4, a development version. The next release will be -test5, then -test6, and so on, until Linux creator Linus Torvalds decides that it's time to release 2.6.0, the first official release of the much-anticipated stable 2.6 tree.
Having downloaded the source, it's also a very good idea to download the GnuPG signature and use it to verify the authenticity and validity of your new kernel source. For more information, go to: http://www.kernel.org/signature.html.
Step 2: Review the provided documentation.
At absolute minimum, you should at least review the top-level README, and the Changes file inside the Documentation directory, both distributed with the Linux kernel source code.
The top-level README refers to itself as being for the 2.5 development kernel, as 2.6.0-test is still part of the development phase. (2.6.0, without a -test extension, will be the first 2.6 kernel) You'll find lots of good tips in this document regarding how to successfully compile a Linux kernel. The document begins:
"These are the release notes for Linux version 2.5. Read them carefully, as they tell you what this is all about, explain how to install the kernel, and what to do if something goes wrong."
The Documentation/Changes file lists the new requirements of the 2.5 development kernel, providing a list of software that must be upgraded to work properly with the new kernel. It begins:
"This document is designed to provide a list of the minimum levels of software necessary to run the 2.5 kernels, as well as provide brief instructions regarding any other 'Gotchas' users may encounter when trying life on the Bleeding Edge."
Step 3: Upgrade your system per the Changes file.
There are a number of utilities that you will have to upgrade for them to work properly with your new 2.6 kernel. Some of the utilities listed in 'Changes' you won't have to worry about, as for example they may be specific to certain filesystems. However, you will at least need to meet the minimum version requirements for the following (see 'Documentation/Changes' for the latest requirements -- they may have changed!):
Name: Minimum version: How to find version: Gnu C Compiler 2.95.3 gcc --version Gnu Make 3.78 make --version binutils 2.12 ld -v util-linux 2.10o fdformat --version module-init-tools 0.9.9 depmod -V procps 2.0.9 ps --version [procps 2.x] [procps 3.x]
The following utilities are filesystem specific. If you're running ext2 or ext3, be sure to update your e2fsprogs, if you're running jfs, be sure to update jfsutils, etc...
Name: Minimum version: How to find version: e2fsprogs 1.29 tune2fs jfsutils 1.0.14 fsck.jfs -V reiserfsprogs 3.6.3 reiserfsck -V 2>&1 | grep reiserfsprogs xfsprogs 2.1.0 xfs_db -V nfs-utils 1.0.5 showmount --version
And a handful of other utilities that you'll want to update if you use them:
Name: Minimum version: How to find version: pcmcia-cs 3.1.21 cardmgr -V quota-tools 3.09 quota -V PPP 2.4.0 ppd --version isdn4k-utils 3.1pre1 isdnctrl 2>&1 | grep version oprofile 0.5.3 oprofiled --version
If you're going to be running ALSA for the first time, also be sure to visit http://www.alsa-project.org/ to grab the latest alsa-lib and alsa-utils.
Step 4: Configure your new kernel.
One of the first changes you'll notice is the new build system [story]. The old Tk/Tcl 'xconfig' build method no longer exists, replaced by a new QT based 'xconfig'. Non-QT fans will be happy to find that a GTK based 'gconfig' is also available for their use.
2.6 build methods include:
This appears to be identical to 'config' in the 2.4 kernel. As the most simplistic configuration method, it simply asks you about each configuration option, one at a time... Requires the 'bash' shell.
This appears to be identical to 'menuconfig' in the 2.4 kernel. A simple curses based configuration method.
This new default graphical configuration system uses the QT libraries. I found it to be quite functional and easy to use.
This option is a clone of the new xconfig, however using the GTK libraries instead of the QT libraries. Unfortunately, in my brief testing I found it to be somewhat buggy. While running, it spews out the same error over and over, and crashed rather quickly. Here's a log to show you what I'm talking about.
This build option will prove extremely useful to you as you upgrade to newer and newer 2.6 kernels. At first glance it looks identical to the plain 'make config', however 'oldconfig' reads your current .config settings and automatically answers for you based on these settings, only prompting you for new configuration choices. To use, simply copy in your old .config file, then type 'make oldconfig'.
When configuring your 2.6 kernel for the first time, keep in mind the following tips from the top-level README file that came with your Linux source:
For many people upgrading from 2.4 to 2.6, this will be your first time using the Advanced Linux Sound Architecture (ALSA) which has replaced OSS. Though it may be tempting to simply enable the deprecated OSS and go about your life as normal, it's probably worth your time to get ALSA working. Thanks to ALSA's OSS API Emulation, it's really not that hard. When configuring your kernel, be sure to enable the OSS emulation options (SND_OSSEMUL, SND_MIXER_OSS and SND_PCM_OSS) Also be sure to enable the appropriate sound driver (in PCI devices) - I compiled mine directly into the kernel. Finally, be sure to download and install the latest alsa-lib and alsa-utils.
Step 5: Build your new kernel.
Actually building the kernel is one step easier than in 2.4, as you no longer have to type 'make dep'. To build a new kernel, type 'make bzImage'. If you've chosen to compile any modules, you'll also need to 'make modules' and 'make modules_install'. Or, you can string it all together like 'make bzImage && make modules && make modules_install'.
When the build starts, you'll notice that the default build process is much quieter than it was in 2.4, providing simple summaries as opposed to all the compiler output.
Step 6: Install your new kernel.
Now that you've built your kernel, you need to copy it into place. For example, on x86 you'll find it in 'arch/i386/boot'. You'll want to copy this file and your new System.map into /boot. For example:
# pwd /usr/src/linux-2.6.0-test4 # mv arch/i386/boot/bzImage /boot/bzImage-2.6.0-test4 # mv System.map /boot/System.map-2.6.0-test4 # cd /boot # rm System.map # ln -s System.map-2.6.0-test4 System.map
I noticed that my new 2.6 kernel is bigger than the last 2.4 kernel I compiled with the same version of gcc, however it's possible that I have more options enabled:
-rw-r--r-- 1 root root 1094390 Aug 12 20:30 bzImage-2.4.21-ck3 -rw-r--r-- 1 root root 1639129 Aug 27 22:06 bzImage-2.6.0-test4
Having copied your new kernel into place, now you need to configure your boot loader. You're probably using grub [manual] or lilo [howto], refer to the appropriate documentation if you're unsure how your boot loader works.
Step 7: It's still not too late...
I'm not trying to scare you, but up to this point you've not done anything that could damage data on your hard drive. However, the next step involves booting the new kernel, so just to be safe one last time I'm going to recommend that you be sure you have a current backup of any important data that lives on your hard drive.
Step 8: Try your new kernel.
And now, the moment you've been waiting for.. It's time to reboot your computer, and test your newly compiled 2.6 kernel. If you've done everything correctly, you'll watch some friendly boot messages, and then be prompted to login. (If your booting to initstate=3, you'll notice the new kernel immediately...)
If you installed ALSA for the first time, you can verify that your sound driver has properly loaded by typing 'cat /proc/asound/cards'. For example:
$ cat /proc/asound/cards 0 [Live ]: EMU10K1 - Sound Blaster Live! Sound Blaster Live! (rev.5) at 0x18e0, irq 11
If you see something like that, but sound still isn't working, launch 'alsamixer' and be sure your device is turned up. I was confused at first in that turning up the 'Master' control wasn't enough, I also had to turn up 'PCM' (/dev/dsp) for sound to start working.
Once you've tried out your new 2.6 kernel, I'd love if you'd post a comment here with your reflections. I'm also open to suggestions on how to make the above directions more useful.
If you run into problems with your new kernel, once again refer to the top-level 'README' that came with your kernel source which has a useful section titled "IF SOMETHING GOES WRONG". Additionally, refer to the top-level 'REPORTING-BUGS' file if the need arises. Prior to posting problems to the high-traffic Linux kernel mailing list, be sure to search one or more of the many online lkml archives to see if someone else has already reported the problem, and better yet if someone else has already posted a fix. Last but not least, you may also try asking for help in the KernelTrap 2.6 kernel forum.
Thanks to a significant amount of reader feedback in the form of comments below and personal emails, I'm going to add a few random but hopeful useful tips to the end of this document. If you have additional tips, please feel free to send me an email. (If you've already sent a comment and I've note yet replied, please be patient...)
I'm already running 2.6.x, how can I easily upgrade to the next release?
The process is described here.
Does GCC 3.x work for compiling the Linux kernel?
Personally, I compiled the 2.6.0-test4 kernel that I'm currently using with gcc 3.2, and I'm not having any problems. The general consensus appears to be that this will work in most cases, but if you run into any compilation problems then try again with the preferred gcc 2.95.3.
Where can I learn more about ALSA?
There's a wealth of information on the Advanced Linux Sound Architecture home page: http://www.alsa-project.org/
Does the NVidia driver work with 2.6?
It has been pointed out that a working NVidia driver with 2.6 can be found at http://www.minion.de/.
Are there any special tips for RedHat 9 users?
You're in luck. I've been pointed to a couple of documents that walk you through the specific issues you may run into when upgrading RedHat 9 to the 2.6 kernel, here and here.
Are there any special tips for Debian users?
Several readers have pointed towards this article by linmagau.org, though it refers to compiling a 2.4 kernel. At this time, there's a debian package for 2.6.0-test2 here. adds, "A Debian Woody system will have module problems. But people running Debian Sid (and Sarge) can just 'apt-get install module-init-tools'. I was pleased that Debian figures out at boot time whether to use the new module-init-tools or the older modutils, though perhaps all distros do this.".
Why didn't you warn me about the problem with <xx>?
Actually, I didn't run into any problems or gotcha's when I upgraded to 2.6.0-test4. But as I learn of more issues (and solutions), I'll post them here.