Rebulding the kernel

References:

The Debian Linux Kernel Handbook (Etch)

The Debian Linux Kernel Handbook (Lenny version - WORK IN PROGRESS)

Definitions:

Discussion:

If you've never done this before, it's quite an intimidating process, especially if you don't want to screw up what you already have so here's an introduction. Glance through this and then you'll be ready to read the references posted above.

I'm still working on this. It seems to me that if this all works, the md5sum for the existing kernel will be the same as the md5sum for the compiled kernel.

First you have to know a few things:

  1. The kernel your box is using is in /boot and named vmlinuz-2.6.26-2-486 (or something similiar - use uname -r to see what yours is)
    (the -2 is the patch level of the 2.6.26 kernel)
  2. The source code is in /usr/src/linux-source-2.6.26 and if it's not there a debian source package needs to be installed.
  3. To get the Debian kernel source at the current maximum patchlevel sudo aptitude install linux-source-2.6.26. This will put a file - linux-source-2.6.26.tar.bz2 - in the /usr/src/ directory which you then have to extract using tar jxvf linux-source-2.6.26.tar.bz2 which will dump a ton of stuff into the directory /usr/src/linux-source-2.6.26, most of which you won't want because the package supports building of kernel images and headers for all currently supported architectures

Here's my question: You want the source at the current maximum patchlevel so you aptitude install linux-source-2.6.26 as stated above. After unpacking, you have a /usr/src/linux-source-2.6.26/ directory full of stuff. Time goes by. You get back to messing with the kernel but what was the "current maximum patchlevel" that you extracted way back when? Here's the answer: Go into that directory and cat version.Debian

Getting to your current patch level

When you install the Debian kernel source at the current maximum patchlevel this is probably not the patchlevel currently running on your computer. To get the Debian kernel source at the patchlevel different from the one provided by the current linux-source-version package, one should first install and unpack it, then roll back the unneeded patch sets using a script from the linux-patch-debian-version package.

  1. sudo aptitude install linux-patch-debian-2.6.18
  2. cd /usr/src/linux-source-2.6.18
  3. sudo /usr/src/kernel-patches/all/2.6.18/apply/debian 2.6.18-3

This last command unrolls all the patches down to patchlevel 3

How to use menuconfig and what it does

If you've ever tried to compile a kernel you know that you get asked a ton of questions, most of which you have no clue how to answer. It seems there should be some kind of script that knows all the answers that were given when your current kernel was compiled at the factory and lets you just scroll through and pick out the changes you might want, sort of the way the Synaptic package manager works. Well, it turns out there is such a script and there is also an answer file that matches your very own copy of the kernel. The answer file is /boot/config-2.6.26-2-486 (or something similiar) and it's plain ASCII and you can peruse it to your heart's content. Copy it to /usr/src/linux-source-2.6.26 and name it .config

Now to run the script that will let you make changes, complete with help run sudo make menuconfig and spend the rest of the day playing with that. To quit the script, press <Esc> twice.

Compiling

To be continued...


Send mail to the Webmaster

logo This site best viewed with a browser
Warning: This is a Debian centric site
Many thanks to Debra and Ian Murdock for making Debian possible
First created Jan 20, 2010 ~ Last revised January 22, 2010

Valid XHTML 1.0 Strict Valid CSS!