How to compile a customized kernel in Debian 5 Lenny

Posted on August 13th, 2009


In this SevenL tutorial, we will show you how to compile a customized kernel in Debian 5 Lenny.

There are certainly different ways to do this, but we like to use this method =)

Step 1 – Preparing your system.

#apt-get install kernel-package ncurses-dev bzip2 module-init-tools initramfs-tools procps fakeroot

(if you’re using the graphical interface such as gconfig or xconfig, please install additional packages libgtk2.0-dev libglib2.0-dev libglade2-dev for gconfig and libqt3-mt-dev for xconfig)

Step 2 – Download the kernel you require

Before downloading a kernel, please check what your current kernel is

#uname -r

For example, this is mine

=> Linux mx 2.6.26-2-686 #1 SMP Thu Mar 26 01:08:11 UTC 2009 i686 GNU/Linux

#cd /usr/src

#apt-get install linux-source-2.6.26

#tar xvjf linux-source-2.6.26.tar.bz2

#cd linux-source-2.6.26

Step 3 (Optional) – Verifying your current kernel information

I recommend this to you, just in case you’re not sure what packages should be installed

#cp /boot/config-$(uname -r) ./.config

#make oldconfig

#cat /proc/cpuinfo

Step 4 – Configure your kernel and compile it

#make menuconfig

(If you’re using GNOME, please use# make gconfig)

Now clean the slate for kernel compiling

#make-kpkg clean

If you have a multiprocessor, you need to do this.

#export CONCURRENCY_LEVEL=2

It will take from 10 mins to a few hours depending on your hardware and the configuration.

If you want to compile some other modules against your kernel, you need to include kernel_headers

#make-kpkg --rootcmd fakeroot --initrd --revision=SevenL.001 kernel_image kernel_headers

Step 5 – Install the kernel on your box

#cd ..

#dpkg -i *.deb

Before rebooting your box, please check your new kernel is on /boot/

#reboot

Voila! – beautiful isn’t it?

Please provide us comments if there are mistakes or problems you encounter! =)

Thanks!