Compiling a 2.4 kernel the Debian Way

Compiling a 2.6 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 libncurses5-dev tk8.2 make gcc bin86 libc6-dev kernel-package

tk8.2 is only available in woody, so if you use sarge or sid install tk8.3 or tk8.4.

Thanks to ninjos from Finland for that update.

You can uses the sources from kernel.org or use the ones in debian, i use the debian ones since they include fixes and patchs.

root@escaflowne:/home/cantara$ apt-cache search kernel-source
kernel-source-2.2.22 - Linux kernel source for version 2.2.22
kernel-source-2.4.10 - Linux kernel source for version 2.4.10
kernel-source-2.4.14 - Linux kernel source for version 2.4.14
kernel-source-2.4.16 - Linux kernel source for version 2.4.16
kernel-source-2.4.17 - Linux kernel source for version 2.4.17
kernel-source-2.4.17-hppa - Linux kernel source for version 2.4.17 on HPPA
kernel-source-2.4.17-ia64 - Linux kernel source for version 2.4.17 on IA-64
kernel-source-2.4.18 - Linux kernel source for version 2.4.18
kernel-patch-2.2-lids - LIDS Kernel Patch
kernel-patch-2.4-lids - LIDS Kernel Patch
kernel-source-2.2.20 - Linux kernel source for version 2.2.20
kernel-source-2.4.18-hppa - Linux kernel source for version 2.4.18 on HPPA
kernel-source-2.4.19 - Linux kernel source for version 2.4.19
kernel-source-2.4.19-hppa - Linux kernel source for version 2.4.19 on HPPA
kernel-source-2.4.19-ia64 - Linux kernel source for version 2.4.19 on IA-64
kernel-source-2.4.20 - Linux kernel source for version 2.4.20 with Debian patches
lidstools-2.2 - LIDS Admintool
lidstools-2.4 - LIDS Admintool
freeswan - IPSEC utilities for FreeSWan
root@escaflowne:/home/cantara$ 

Those are the available kernel packages for unstable/sid at the the momemt of writing. In this case i‘ll use the 2.4.20.

apt-get install kernel-source-2.4.20

That will install the sources in /usr/src

cd /usr/src

Unarchive the sources

tar xvzf linux-2.4.20.tar.gz

And link the newly created dir to linux

ln -s linux-2.4.20 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
make xconfig

OK now its time to compile the kernel

make-kpkg clean
make-kpkg --revision=1:escaflowne2420 kernel_image

In my case the revision parameter is the name of the box escaflowne and the kernel version 2420, you can set it to whatever you want or even forget about that parameter and only use:

make-kpkg 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.4.20_escaflowne2420_i386.deb

or if you used make-kpkg kernel_image

dpkg -i kernel-image-2.4.20_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.

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

Updated in 2005/04/05 anarka@anarka.org

You can find more information in: /usr/share/doc/kernel-package/README.gz