Compiling a 2.6 kernel the Debian Way

Compiling a 2.4 Kernel here

This is not a howto or something remotely close, it‘s just a note i made cause i kept forgetting how to compile the kernel since i do it very rarely :P

First we need some extra packages to compile the kernel in the debian way:

apt-get install make gcc bin86 libc6-dev kernel-package module-init-tools

That will let you use the same old menuconfig in a console(doesn‘t need X) or terminal.

If you want to configure the kernel in X you have 2 options xconfig and gconfig.

xconfig used Tk in kernels 2.4 but in 2.6 it changed to a QT interface so if you use KDE or simply want to use the QT interface to configure the kernel do the following:

apt-get install libqt3-dev make gcc bin86 libc6-dev kernel-package module-init-tools

If you use Gnome or want to use the GTK interface:

apt-get install libglade2-dev make gcc bin86 libc6-dev kernel-package module-init-tools

module-init-tools is the package to manage modules in 2.6, it does the same modutils did for 2.4 kernels.

If you want to compile a kernel with initrd install also the initrd-tools package.

Ok now lets get the kernel source, you can use the sources from or use the ones in debian, i use the debian ones since they include fixes and patches.

root@escaflowne:/usr/src/linux$ apt-cache search kernel-source-2.6 --names-only
kernel-source-2.6.6 - Linux kernel source for version 2.6.6 with Debian patches
kernel-source-2.6.7 - Linux kernel source for version 2.6.7 with Debian patches
kernel-source-2.6.8 - Linux kernel source for version 2.6.8 with Debian patches
kernel-source-2.6.9 - Linux kernel source for version 2.6.9 with Debian patches

Those are the available kernel source packages for unstable/sid at the moment of writing.

apt-get install kernel-source-2.6.9

That will install the sources in /usr/src:

cd /usr/src

Unarchive the sources:

tar jxf kernel-source-2.6.9.tar.bz2

Create a link called linux that points to the source dir:

ln -s kernel-source-2.6.9 linux

Then cd to linux dir and configure the kernel... don‘t rush, there are a lot of options in there but you only have to set them the first time you compile a kernel, next time you just need to update the config.

cd /usr/src/linux

(in case you have a old kernel .config this updates the config with the new options, so in this example next time you compile a kernel, let‘s say 2.6.10, you just have to do a

cp /usr/src/kernel-source-2.6.9/.config /usr/src/kernel-source-2.6.10/

and use the

make oldconfig



make menuconfig

(to use the ncurses interface in a console or terminal)


make xconfig

(to use the QT interface)


make gconfig

(to use the GTK interface)

OK now its time to compile the kernel

make-kpkg kernel_image

Or to create a kernel with initrd

make-kpkg --initrd kernel_image

Now that you have the kernel compiled and the kernel package created you just have to install it.

cd /usr/src
dpkg -i kernel-image-2.6.9_10.00.Custom_i386.deb

It will ask you if you want to make bootdisk, do it... just in case, and if you want to install lilo with the /etc/lilo.conf config also say yes, if you dont the new kernel won‘t boot up.

If you use initrd don‘t forget to check if /etc/lilo.conf has the initrd=/initrd.img option in the section of the new kernel.

If it has add do_initrd = Yes to /etc/kernel-img.conf.

That‘s it! Now reboot and try the new kernel.

This is a very basic text(i can´t even call it a Howto) but if you think something should be here feel free to tell me.

Updated in 2005/04/05