GeoCitesSites.com
Home >> Notes >> Linux kernel migration Asim Shankar

Migrating from 2.4 to 2.6

I have a Dell Inspiron 8500 laptop which was working pretty well with Fedora Core 1. However, that had kernel 2.4 and like many nerds I couldn't wait for Fedora Core 2 so I had to jump in and try the new kernel myself.

Updates

  • March 5, 2004 - New reference to Sandino Flores Moreno's website where you can find alternative configurations and some interesting patches.
  • January 20, 2004 - Now running 2.6.1. Small change in configuration for CPU frequency scaling.

Introduction

The steps described here should work for any kernel 2.4 setup. The migration is divided into the following steps:


Step 0: Before you begin

This document assumes that you have a fully functional 2.4 setup. The specific version (2.4.8 or 2.4.22-1.2115.nptl or what not) is not important. Also, though this upgrade deals with 2.4.x to 2.6.0, the exact same steps should apply to 2.6.x as and when they come out. Since there are interface changes between 2.4.x and 2.6.x, the upgrade is slightly more tedious that upgrading within the same branch.

My machine is a Dell Inspiron 8500 laptop and if you install Fedora Core 1 on it, most of the things work without effort. For more information on Linux on the Inspiron 8500/8600 you may want to check out Diwaker's notes or Diego's notes.

The wireless card may be slightly problematic if you have a Dell TrueMobile 1300/1400 or an Intel PRO/Wireless 2100 miniPCI card. I have a Dell TrueMobile 1150 whose drivers (orinoco) are available and works without trouble. To get the other cards to work you may find NdisWrapper useful. I've heard of it being used successfully with 2.6.0 and the Intel PRO/Wireless 2100 card.

Backing Up
The upgrade requires a few modifications to various config files. Just to be safe, it would be a good idea to copy these files to a safe location so that reverting back to your existing setup is easy. The files are:

  • /etc/rc.sysinit
  • /etc/init.d/halt
  • /etc/fstab

Now it's time to get down to work. By the way, so far you have not affected your current setup at all. In fact, only in Step 3 do we begin modifications that will affect your current setup.


Step 1: module-init-tools

Download the latest version of module-init-tools from http://www.kernel.org/pub/linux/kernel/people/rusty/modules/. I used 0.9.15-pre4. This package contains updated versions of modprobe, insmod, rmmod etc. required because of the reimplementation of the in-kernel module loader in 2.6. However, these tools are backward compatible so things will still work in your 2.4 setup after you install it. You need to unpack the tarball, backup the old utilities and install the new ones. This would be done as follows (replace 0.9.15-pre4 with the version you downloaded):
      $ tar -xvzf module-init-tools-0.9.15-pre4.tar.gz
      $ cd module-init-tools-0.9.15-pre4
      $ ./configure --prefix=/
      $ make moveold
      $ make
      $ make install
      $ ./generate-modprobe.conf /etc/modprobe.conf
    
This will create /etc/modprobe.conf which is what 2.6 uses instead of /etc/modules.conf. View the README file for more detailed information.

Step 2: The new kernel

You want to upgrade to 2.6, you need to get it first. Download the source tarball from http://www.kernel.org/pub/linux/kernel/v2.6/. Unpack the tarball, say into /usr/src. (Note: Change 2.6.0 in the lines below to whatever version you're using).
      $ cd /usr/src
      $ bunzip2 -c linux-2.6.0.tar.bz2 | tar -xv
      $ cd linux-2.6.0
    
There are tons of configuration options and you may be overwhelmed. You can use my config file as a starting point. Download this (updated January 20, 2004) and copy it to /usr/src/linux-2.6.0/.config (or wherever you've unpacked the kernel source). Then, change configuration options to your liking and compile the new kernel:
      $ make xconfig
      $ make
      $ make modules
      $ make modules_install
    
Now you have a compiled kernel, time to copy it and make changes to the boot loader (grub).
      $ make install
    
Lines looking somewhat as follows would have been added to /boot/grub/grub.conf:
    title Linux 2.6.0 
	root (hd0,2)
	kernel /boot/vmlinuz-2.6.0 ro root=LABEL=/ acpi=on 
	initrd /boot/initrd-2.6.0.img
    
(hd0,2) would be replaced with whatever your root partition is. Though you now have a bootable kernel, don't boot it up just yet. We need to change some config files in order to achieve a smooth first boot.

Patchwork
There are various functionality-enhancing patches already available for 2.6, most notable of which is swsusp which provides Windows' Hibernate like functionality. I haven't experimented with that yet, will update this doc when I do. The patch is available at swsusp.sourceforce.net.


Step 3: USB Module Name Changes

The names of some USB related modules have changed between 2.4 and 2.6.

First, open /etc/modprobe.conf and replace occurrences of usb-uhci with uhci-hcd (this will probably be at one place, changing alias usb-controller1 usb-uhci to alias usb-controller1 uhci-hcd).

Also, change all instances of mousedev to usbmouse and instances of keybdev to usbkbd.

Now repeat the mousedev and keybdev replacements in /etc/rc.sysinit.


Step 4: sysfs

The sysfs file-system is used by drivers in 2.6 to export innards of drivers (previously this was done through the /proc filesystem). Getting this to work is not necessary, but its a new feature in 2.6 and thus should be used.

First, create a /sys directory and add the following line to /etc/fstab:
none    /sys    sysfs    defaults    0 0

Second, edit /etc/init.d/halt and change
awk '$2 ~ /^\/$|^\/proc|^\/dev/{next} to
awk '$2 ~ /^\/$|^\/proc|^\/sys|^\/dev/{next}.

Now for some changes to /etc/rc.sysinit:

  • Change all occurences of
    /proc/ksyms
    to
    /proc/kallsyms
    (This has little to do with sysfs, but should be done anyway)
  • Add
    mount -f /sys
    below
    mount -f /proc
  • Add
    mount -n -t sysfs /sys /sys
    below
    mount -n -t proc /proc /proc
On some websites I've read that /proc/bus/usb is to be replaced by /sys/bus/usb in rc.sysinit which would result in mounting usbdevfs on /sys/bus/usb. However, things work fine even if you don't do this and I also have a feeling that it should not be done. Once I figure this out, I'll post an update but as of now, there is no need to do so.

Step 5: ALSA Sound

As mentioned earlier, ALSA (Advanced Linux Sound Architecture) has been merged into the 2.6 series and replaces the older Open Sound System (OSS). You could get ALSA to work with 2.4 too, so if you did that then things should work fine and you can skip this step. Otherwise, you need to make some changes to /etc/modprobe.conf.

Open /etc/modprobe.conf and delete any lines that look like any of the following:

      options i810_audio clocking=48000
      alias sound-slot-0 i810_audio
      install sound-slot-0 /sbin/modprobe [...blah blah...]
      remove  sound-slot-0 [...blah blah...]
    
Note that my machine uses the Intel i810 audio drivers. If you use something else, then you will have something else instead of i810_audio. Now that we got rid of the OSS stuff, time to add ALSA lines. Add the following:
      alias char-major-116 snd
      alias snd-card-0 snd-intel8x0
      alias sound-service-0-0 snd-mixer-oss
      alias sound-service-0-1 snd-seq-oss
      alias sound-service-0-3 snd-pcm-oss
      alias sound-service-0-8 snd-seq-oss
      alias sound-service-0-12 snd-pcm-oss
    
Again, if you don't use the Intel 810 audio drivers, then snd-intel8x0 will have to be changed to suit your card. Also, add the following two lines:

install snd-card-0 /sbin/modprobe --ignore-install snd-card-0 && { /usr/sbin/alsactl restore >/dev/null 2>&1 || :; }

remove snd-card-0 { /usr/sbin/alsactl store >/dev/null 2>&1 || :; } ; /sbin/modprobe -r --ignore-remove snd-card-0


Step 6: First Boot

Okay, now you're all set and hopefully the first boot into 2.6 should be smooth. Just reboot the system and select the new entry in grub. In the unlikely event that things go wrong, you can boot into your old 2.4 kernel. Chances are that because of all the config file changes, you'll get lots of error messages. Fortunately, we backed up the files in Step 0, so all you need to do is restore the backup files and reboot.

However, if you have an nvidia graphics card and use their binary driver some extra effort is required. NVidia drivers need to be installed so boot into console mode, i.e., without an X server. To prevent the X server from automatically starting hit 'a' on the grub screen after selecting the appropriate entry. On the command prompt, add 3 and then hit Enter. What this does is causes the system to boot into runlevel 3 (no X server) instead of 5 (X server).


Step 7: NVIDIA Graphics

If you don't have an nvidia card or have one but want to use the open-source nv driver instead of the nvidia binary driver then skip this step. Otherwise, if you used the nvidia drivers from http://www.nvidia.com/object/linux.html, then things don't quite work with kernel 2.6. However, don't despair, there is a fix available.

You have two options. One is to download the drivers from nvidia and the corresponding .README and .diff files from http://www.minion.de/. The README explains things quite well and worked for me quite smoothly.

Alternatively, instead of doing the patchwork manually you can download the patched nvidia driver binaries from http://www.sh.nu/download/nvidia/linux-2.6/.

Once installed, then start the X server by:
$ init 5


References

  • New functionality in 2.6 - The post-halloween document nicely summarizes the major changes between 2.4 and 2.6
  • Sandino Flores Moreno - Get an alternative configuration and some interesting patches for 2.6. Pay special attention to alps.patch and synaptics-touchpad-X11 which enable a faked wheel over a little area of the touchpad (this would be useful if you have an ALPS touchpad on your laptop. Dell i8500 and i8600's do.
  • Migrating to 2.6 - Also talks about upgrading to 2.6 from a RedHat 9 system. Quite similar to this document.
  • KernelNewbies.org - As the name suggests!


Last modified: Sat Mar 06 18:18:22 Central Standard Time 2004