-   Debian (
-   -   Guide to 2.6 kernel upgrade/recompile (

m_yates 07-19-2004 12:36 PM

Guide to 2.6 kernel upgrade/recompile
I successfully upgraded to the 2.6.7 kernel and then patched it to include the Debian Logo at boot up and Win4Lin support. I ran into some issues that took some time to figure out, so I thought I'd post my upgrade path here in the event it may help anyone else. I was using kernel 2.4.26 initially with the nvidia display driver. Here are the steps to take:

1. Install a 2.6 kernel using apt-get:

apt-get -t unstable install kernel-image-2.6.7-1-386
2. The PS/2 mouse and nvidia driver won't work with the new kernel. To make sure the new kernel boots up, you need to add the lines "psmouse" and "mousedev" to /etc/modules, and temporarily change the video driver listed in /etc/X11/XF86Config-4 from "nvidia" to "nv". If you have a USB mouse and/or keyboard, you may need to add "usbhid" tp /etc/modules to get it to work.

3. Make sure that the kernel is listed in either /boot/grub/menu.lst or /etc/lilo.conf depending on which bootloader you use. Note that Debian uses initrd, so you have to include the kernel's initrd or it won't boot. I use grub, and the entry looks something like:

title Linux, 2.6.7
root (hd0,0)
kernel /boot/vmlinuz-2.6.7-1-386 root=/dev/hda1 ro hdc=scsi
initrd /boot/initrd.img-2.6.7-1-386
Also edit /etc/fstab to include the line:

none /sys sysfs defaults 0 0
and make sure you have the /sys directory:

mkdir /sys
4. Reboot into the new kernel and make sure that everything is working. It *should* work, but of course mileage may vary. NOTE: If you experience system freezes or shutdowns with the new kernel, try adding "acpi=off" to the kernel line in grub's menu.lst.

5. For re-compiling, it is important to use Debian kernel sources, because they have cramfs patches that allow the initrd to work. Install kernel-source and the debian boot logo:

apt-get -t unstable install kernel-source-2.6.7 kernel-patch-debianlogo
I also downloaded 2.6 Win4Lin patches from Netraverse. These files are called "mki-adapter26_1_3_6.patch" and "Kernel-Win4Lin3-2.6.7.patch"

6. Unpack kernel-source and create symbolic link to /usr/src/linux:

cd /usr/src
tar -jxf kernel-source-2.6.7.tar.bz2
rm linux
ln -s kernel-source-2.6.7 linux

7. Unpack the debian boot logo patch. As of this writing, the latest version was for kernel 2.6.2, but it works with kernel 2.6.7:

cd /usr/src/kernel-patches/diffs/debianlogo
gunzip debian-logo-2.6.2.gz

8. Patch the kernel to include the Debian logo and Win4Lin support:

cd /usr/src/linux
patch -p1 < /usr/src/kernel-patches/diffs/debianlogo/debian-logo-2.6.2
patch -p1 < /usr/src/mki-adapter26_1_3_6.patch
patch -p1 < /usr/src/Kernel-Win4Lin3-2.6.7.patch

9. Copy the existing kernel configuration as a starting point and configure the kernel:

cd /usr/src/linux
cp /boot/config-2.6.7-1-386 .config
make menuconfig

You need to change two things in menuconfig. First enable the following option for win4lin support:

NeTraverse Win4Lin Support --->[*] Include NeTraverse Win4Lin Support
Second, enable the following options for framebuffer console with debian boot logo:

Graphics support --->[*] Support for frame buffer devices[*] VESA VGA graphics support
Console display driver support --->[*] Video mode selection support
<*> Framebuffer Console support[*] Select compiled-in fonts[*] VGA 8x8 font[*] VGA 8x16 font
Logo Configuration --->[*] Debian GNU/Linux Open Use logo (NEW)
Say "N" to all other device drivers except vesa. The Debian configuration has lots of things built as modules here and it seems to cause problems (at least for me). Say "N" to all other boot logos except Debian.

10. Compile and install the kernel:

make-kpkg clean
make-kpkg --initrd --append-to-version=-mykernelname kernel_image
cd /usr/src
dpkg -i kernel-image-2.6.7-mykernelname_10.00.Custom_i386.deb

Where "mykernelname" is the name you want appended. Mine is "win4lin", so my kernel is named 2.6.7-win4lin.

11. Finally, make an entry for the new kernel in your boot loader. Dpkg should do this automatically, but you should check everything to be sure. The entry for Grub in menu.lst would be something like:

title          Linux, 2.6.7
root            (hd0,0)
kernel        /boot/vmlinuz-2.6.7-mykernelname root=/dev/hda1 ro hdc=scsi video=vesafb:ywrap,mtrr vga=788
initrd          /boot/initrd.img-2.6.7-mykernelname

Note that you need to add the "video=" and "vga=" to select the driver and resolution for the console. More details are in Gentoo's documentation:
NOTE: You may need to add "acpi=off" to the kernel line if you experience system freezes or shutdowns.

12. Reboot with the new kernel. You should see the Debian logo at the top of the screen and nice small fonts during boot up. You should also now be able to install Win4Lin from Netraverse to run legacy windows applications. You will have to re-install the nvidia display driver. Go to, download the latest driver and follow the directions. After it installs, change the driver listed in /etc/X11/XF86Config-4 from "nv" back to "nvidia".

I hope this helps others. I spent a lot of time over the weekend figuring this out. Please let me know if there are mistakes above.


godzilla_roar20 07-19-2004 09:29 PM


m_yates 07-19-2004 09:34 PM

Well, I don't know if that is yep! it helped you, or yep! it is full of mistakes. If the former, I'm glad to hear it :cool: If the latter, I'm very sorry :cry:

dukeinlondon 07-22-2004 03:07 AM

Nice one. Thanks.

laclavis 07-22-2004 09:39 AM

it was quite helpful. thanks!

macondo 07-22-2004 11:09 AM

I just succesfully upgraded my kernel following your instructions to the letter.


thanks bud!

HappyTux 07-22-2004 11:43 AM

You may want to edit and include fakeroot in front of the lines.

fakeroot make-kpkg clean
fakeroot make-kpkg kernel_image

This is why the package exists there is no need to compile a kernel as root as long as you are a member of the src group (if not then adduser user_name src as root then logout and back in) nice post otherwise though.

R00ts 07-23-2004 03:37 AM

Please help me. I'll give you my first born...ok I won't but I'll give you respect
I'm trying to upgrade my kernel from 2.4.25 to 2.6.6 (so very close to the same upgrade). I installed the debian kernel image, source, and headers, and it boots up alright but when I get to my bootloader my USB keyboard won't respond, and my USB mouse won't respond. If I plug in a PS/2 keyboard that works, but a PS/2 mouse still won't work. Its very frustrating and I don't know how to fix it. I tried adding the two lines you said in your guide above to /etc/modules, but that didn't help. What do I need to do to get it working? I've been (slowly) trying to upgrade my kernel for almost two weeks and I'm getting rather frustrated with it right now. Please give me divine guidance ;)

PS: When I last tried to boot it up a couple hours ago, I think I saw it display something about a couple mouse modules (like /dev/mouse maybe?) not being found. I didn't get a clear shot at it though because the boot screen goes by so fast. But why the heck wouldn't mouse modules be compiled into the debian packaged kernel in the first place? :confused:

m_yates 07-23-2004 07:39 AM

r00ts, I stumbled upon this post: It seems you need modules ohci-hcd and usbhid for the usbmouse to work. I just checked the kernel configuration from debian and usbhid and ohci-hcd are built as modules. Try adding them to /etc/modules and see if that works. I can't test it myself because I don't have usb input devices.

I'm glad to hear from others that my post has helped with some things. To happytux: I couldn't get fakeroot to work properly. Granted, I didn't try very hard, but I added myself to the "src" group, and then tried running "fakeroot make-kpkg clean" as a user and it told me I didn't have permission. I think the problem was that my /usr/src/linux directory has the group "root" not "src". In any event, I just became root and continued without fakeroot. The documentation here: suggests using fakeroot too, but I didn't take the time to figure out why it wasn't working for me.

R00ts 07-23-2004 10:06 PM

I tried adding those two modules (as well as usbmouse and usbkbd) but it still didn't work. :cry: I also found another post that said to try adding in a couple other modules, but those failed as well. I'm about to just uninstall this kernel and do a re-compile from scratch because I'm getting nowhere fast. Thanks for trying to help though.

R00ts 07-26-2004 02:43 AM

Ok, so I scratched my 2.6.6 kernel installation and followed your instructions for the 2.6.7 kernel. I got as far as step #4 before something went wrong (new record :)). It's really weird, because it looks like everything is working ok. The kernel boots ok, startx works and I get a graphical login prompt. My USB mouse and keyboard actually work. But after I login and my session finishes initialization, I'll have about 10 seconds before something very very bad happens. I've tried booting it twice and here's what happened each time:

1) Machine froze completely. My monitor displayed a "no signal found" and I couldn't do a damn thing except turn off the computer and turn it back on.

2) Machine automatically restarts without warning.

Does anyone have any clue as to what could be causing this? The only thing I have edited myself is my /etc/modules file below.


# /etc/modules: kernel modules to load at boot time.
# This file should contain the names of kernel modules that are
# to be loaded at boot time, one per line.  Comments begin with
# a "#", and everything on the line after them are ignored.

psmouse  # Added for 2.6.6 kernel upgrade
mousedev # "                            "


# Mouse

# Keyboard

I'm not sure I even need half of those modules, but they are there just in case. Thanks for any help you can provide. I'm so hopeless when it comes to kernel upgrades. :(

m_yates 07-26-2004 09:29 AM

I would suggest commenting out the USB modules and seeing if it does it again. If your keyboard and mouse don't work, try just uncommenting "usbhid" and see if that works. I think the mouse and keyboard only need the usb-human input device (usbhid) to work. The usbmouse and usbkbd drivers are probably not needed. It is possible that some of the other drivers are conflicting, but I'm not sure about that.

R00ts 07-26-2004 04:23 PM

I tried commenting out things so my /etc/modules file looks like this:



# Mouse


# Mouse

# Keyboard

But I had the same problem (the mouse and keyboard still worked). Someone told me that it sounds like a problem with AMP or ACPI (both of which I am totally clueless about what they are), and to try compiling my own kernel. I'm considering that option, but first I'll need to read what AMP and ACPI are.

On another note I have a question about kernel modules. Do both my 2.4.25 kernel and my 2.6.7 kernel look to /etc/modules to find out what modules to load when booting the kernel? I thought that they would have different files since each kernel may need different modules (or maybe modules is something new to 2.6.x kernels?). Also is there a way to find out what modules I have installed and other detailed information for a specific kernel? Thanks for your help.

m_yates 07-26-2004 05:23 PM

Well, glad that the mouse still works. It may be an acpi problem. The 2.6 kernel uses acpi for power management features and the 2.4 kernel used apm (although you could compile acpi into it).

Try adding "acpi=off" on your kernel line in grub. That boot option should prevent acpi from being loaded.

R00ts 07-26-2004 07:05 PM

Hah! It works it works! Thank you so much m_yates!!! I'm so pumped WOOHOOOO!!!! I am in your debt :D

All times are GMT -5. The time now is 05:01 PM.