How to compile a custom kernel in Debian Lenny / Etch?

This is usually quite straight forward, since Debian brings utilities with it to do this:

aptitude install build-essential kernel-package fakeroot libncurses5-dev bzip2
cd /usr/src
wget ""
tar -jxf linux-2.6.36.tar.bz2
cd linux-2.6.36
cp /boot/config-`uname -r` ./.config


After that you can either run make menuconfig, or just use your favorite editor to change the config accordingly.
This step is optional, so if you do not want to change any parameters, you don´t have too. If there are new values available, which haven´t been within pervious kernels, you will be prompted while building the kernel anyhow.


fakeroot make-kpkg clean
fakeroot make-kpkg --append-to-version=.gosi1 kernel_image


 The kernel build will take a while, afterwards you just need to install it using dpkg -i and do not forget to update the initrd:


update-initramfs -c -k 2.6.36.gosi1


You might encounter a few problems, here are the solutions for some of them:

Error Message Solution
”error: zlib.h: No such file or directory” aptitude install zlib1g-dev
lguest.c:21:25: error: sys/eventfd.h: No such file or directory disable the pravirtualized guest support in the kernel config: “Processor type and features”: “Paravirtualized guest support” = N
(this needs to be done in Lenny because it comes with older libc6 which omits sys/eventfd.h)
The UTS Release version in include/linux/version.h does not match current version Download this and install it, even if you run Lenny..

You cannot comment on this entry