Feature: HowTo Upgrade To The 2.6 Kernel

发表于:2007-07-04来源:作者:点击数: 标签:
Having some spare time a few nights ago, I decided to give thelatest kernel, 2.6.0-test4, a trial run on my aging 550Mhz PIII desktopcomputer, and the result was nothing short of spectacular. As the final2.6.0 release approaches, it is imp

Having some spare time a few nights ago, I decided to give thelatest kernel, 2.6.0-test4, a trial run on my aging 550Mhz PIII desktopcomputer, and the result was nothing short of spectacular. As the final2.6.0 release approaches, it is important that an increasing number ofusers (aka testers) give this kernel a try, especially as currentlyit's still a sexy task for developers to track down kernel bugs andstabalize 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 toreaders that currently compile their own 2.4 kernels, but haven't yetmade the leap to 2.6. This is still a development kernel, so you mayrun into problems, but overall stability and performance is quiteimpressive and I can't recommend enough that you try it today.

Target Audience:
This article is targeted towards Linuxusers that are already comfortable with compiling their own 2.4kernels. If you've never compiled a kernel before, I suggest that youstart here:

  • The Linux Kernel HOWTO
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.
Beforewe get started, if you're going to be running a development kernel besure that you have a current backup of any important data. While I'venot run into any problems while running 2.6.0-test4, there are stillbugs...

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 tospread out the load among willing kernel source hosts. Find thekernel.org mirror list here: http://kernel.org/mirrors/.

At the time of this writing, the current version of the 2.6kernel is 2.6.0-test4, a development version. The next release will be-test5, then -test6, and so on, until Linux creator Linus Torvaldsdecides that it's time to release 2.6.0, the first official release ofthe 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.
Atabsolute minimum, you should at least review the top-level README, andthe Changes file inside the Documentation directory, both distributedwith the Linux kernel source code.

The top-level READMErefers to itself as being for the 2.5 development kernel, as 2.6.0-testis still part of the development phase. (2.6.0, without a -testextension, will be the first 2.6 kernel) You'll find lots of good tipsin 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, explainhow to install the kernel, and what to do if something goes wrong."

The Documentation/Changesfile lists the new requirements of the 2.5 development kernel,providing a list of software that must be upgraded to work properlywith the new kernel. It begins:

"This document is designed to provide a list of theminimum levels of software necessary to run the 2.5 kernels, as well asprovide brief instructions regarding any other 'Gotchas' users mayencounter when trying life on the Bleeding Edge."

Step 3: Upgrade your system per the Changes file.
Thereare a number of utilities that you will have to upgrade for them towork 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 bespecific to certain filesystems. However, you will at least need tomeet 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 runningext2 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 anew QT based 'xconfig'. Non-QT fans will be happy to find that a GTKbased 'gconfig' is also available for their use.

2.6 build methods include:

  • make config
    javascript:window.open(this.src);" style="CURSOR: pointer" onload="return imgzoom(this,550)">

    This appears to be identical to 'config' in the 2.4 kernel. As themost simplistic configuration method, it simply asks you about eachconfiguration option, one at a time... Requires the 'bash' shell.

  • make menuconfig

    This appears to be identical to 'menuconfig' in the 2.4 kernel. A simple curses based configuration method.

  • make xconfig

    This new default graphical configuration system uses the QT libraries. I found it to be quite functional and easy to use.

  • make gconfig

    This option is a clone of the new xconfig, however using the GTKlibraries instead of the QT libraries. Unfortunately, in my brieftesting I found it to be somewhat buggy. While running, it spews outthe same error over and over, and crashed rather quickly. Here's a log to show you what I'm talking about.

  • make oldconfig

    This build option will prove extremely useful to you as you upgradeto newer and newer 2.6 kernels. At first glance it looks identical tothe plain 'make config', however 'oldconfig' reads your current .configsettings and automatically answers for you based on these settings,only prompting you for new configuration choices. To use, simply copyin your old .config file, then type 'make oldconfig'.

Whenconfiguring your 2.6 kernel for the first time, keep in mind thefollowing tips from the top-level README file that came with your Linuxsource:
  • having unnecessary drivers will make the kernel bigger, and canunder some circumstances lead to problems: probing for a nonexistentcontroller card may confuse your other controllers.
  • the "kernel hacking" configuration details usually result inbigger or slower kernel (or both), and can even make the kernel lessstable by configuring some routines to actively try to break bad codeto find kernel problems (kmalloc()). Thus you should probably answer'n' to the questions for "development", "experimental", or "debugging"features.

ALSA:
For many people upgrading from 2.4 to 2.6, this willbe your first time using the Advanced Linux Sound Architecture (ALSA)which has replaced OSS. Though it may be tempting to simply enable thedeprecated OSS and go about your life as normal, it's probably worthyour time to get ALSA working. Thanks to ALSA's OSS API Emulation, it'sreally not that hard. When configuring your kernel, be sure to enablethe 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 downloadand install the latest alsa-lib and alsa-utils.
Step 5: Build your new kernel.
Actuallybuilding the kernel is one step easier than in 2.4, as you no longerhave to type 'make dep'. To build a new kernel, type 'make bzImage'. Ifyou've chosen to compile any modules, you'll also need to 'makemodules' and 'make modules_install'. Or, you can string it all togetherlike 'make bzImage && make modules && makemodules_install'.

When the build starts, you'll notice that the default buildprocess is much quieter than it was in 2.4, providing simple summariesas opposed to all the compiler output.

Step 6: Install your new kernel.
Nowthat you've built your kernel, you need to copy it into place. Forexample, on x86 you'll find it in 'arch/i386/boot'. You'll want to copythis 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 kernelI compiled with the same version of gcc, however it's possible that Ihave 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'mnot trying to scare you, but up to this point you've not done anythingthat could damage data on your hard drive. However, the next stepinvolves booting the new kernel, so just to be safe one last time I'mgoing to recommend that you be sure you have a current backup of anyimportant data that lives on your hard drive.

Step 8: Try your new kernel.
Andnow, the moment you've been waiting for.. It's time to reboot yourcomputer, and test your newly compiled 2.6 kernel. If you've doneeverything correctly, you'll watch some friendly boot messages, andthen be prompted to login. (If your booting to initstate=3, you'llnotice the new kernel immediately...)

If you installed ALSA for the first time, you can verify thatyour 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
Ifyou see something like that, but sound still isn't working, launch'alsamixer' and be sure your device is turned up. I was confused atfirst in that turning up the 'Master' control wasn't enough, I also hadto 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'dpost a comment here with your reflections. I'm also open to suggestionson how to make the above directions more useful.

If you run into problems with your new kernel, once againrefer to the top-level 'README' that came with your kernel source whichhas a useful section titled "IF SOMETHING GOES WRONG". Additionally,refer to the top-level 'REPORTING-BUGS' file if the need arises. Priorto posting problems to the high-traffic Linux kernel mailing list, be sure to search one or more of the manyonline lkml archives to see if someone else has already reported theproblem, and better yet if someone else has already posted a fix. Lastbut not least, you may also try asking for help in the KernelTrap 2.6 kernel forum.

Additional tips/FAQs:
Thanks to a significant amountof 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 ofthis 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 gcc3.2, and I'm not having any problems. The general consensus appears tobe that this will work in most cases, but if you run into anycompilation 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/.

How can I install and use the reiser4 filesystem?
The makers of reiser4, namesys, have a brief 'getting started' document.

Are there any special tips for RedHat 9 users?
You'rein luck. I've been pointed to a couple of documents that walk youthrough the specific issues you may run into when upgrading RedHat 9 tothe 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, "ADebian Woody system will have module problems. But people runningDebian Sid (and Sarge) can just 'apt-get install module-init-tools'. Iwas pleased that Debian figures out at boot time whether to use the newmodule-init-tools or the older modutils, though perhaps all distros dothis.".

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 to2.6.0-test4. But as I learn of more issues (and solutions), I'll postthem here.


 

原文转自:http://www.ltesting.net