Compiling A 2.6 Linux Kernel

For this tutorial I will be using a very widely accepted distribution and my personal favorite: Debian, as well as installing the 2.6.7 kernel

First you need the system to compile the kernel, which means installing debian and moving up to the unstable version. You can do the latter by editing /etc/apt/sources.list file and changing any instance of "stable" to "unstable", then do the following the next 3 steps: apt-get update; apt-get upgrade; apt-get dist-upgrade. After the final step its advisable to restart, just to make sure everything is as it should be.

Download the linux-2.6.7.tar.gz (or any other 2.6 kernel) file from and move it into /usr/src

Go to the /usr/src directory and extract it there tar xvf linux-2.6.7.tar.gz

Go into the newly created directory linux-2.6.7

Run the following command making sure you have either access to the net or a local debian repoitory: apt-get install tk8.4 make gcc bin86 libc6-dev kernel-package libqt3-dev g++ module-init-tools

This will install all necessary software used to compile the kernel. I will be using X-Windows for kernel configuration, so make sure you have at least x-window-system installed and running ok.

Once in X-Windows open up a terminal window, and move into the /usr/src/linux-2.6.7 directory if not already in there and run the command make xconfig

From there a graphical window pops up with the different menu options, each configuring some part of the kernel. Use the menu's and select the different options you want to include in your custom kernel. What options to select I cant tell you, every machine has a different processor and hardware. Be sure to select to build into the kernel or make modules all of the items that you will need (IE: you have a scsi scanner, make sure you enable scsi support). You can either select an item and build it into the kernel (by pressing Y), load it as a module (by pressing M), or not at all (by pressing N). Once done with the list of options choose save from the menu.

Once out of the kernel configure window do a make-kpkg clean. Then a make-kpkg -rev custom.1 kernel_image. This will compile the kernel and tidy things up a bit. Compiling a kernel can take quite a bit of time, in some machines 10min others over night. The more ram, higher cpu clock speed and such will determine how long it takes. In any case grabbing a cup of coffee right about now wouldnt be such a bad idea. My P4 2.6Ghz system 512MB Ram took less than 15min to compile my options, while my 266Mhz 64MB Ram laptop took close to 2 hours.

When finished your non computer duties of daily coffee dosage, in your /usr/src directory is your new kernel deb file (kernel-image-2.6.7_custom.1_i386.deb), which you simply use kpkg to install kpkg -i kernel-image-2.6.7_custom.1_i386.deb. Follow the prompts, reboot and wham! new system running new kernel. Once logged back in to the system after the reboot do a uname -a to see the kernel version. Check and make sure all devices are working properly, if any of your hardware doesnt work, verify you compiled the necessary options in the kernel. If you forgot to compile something your best bet is to go and redo the process.