kernel compilation Debian Lenny

Preparing Your system

First you need to install the following packages

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

If you plan on using the graphical configuration tools, gconfig or xconfig, you’ll need additional packages, respectively libgtk2.0-dev libglib2.0-dev libglade2-dev for gconfig or libqt3-mt-dev for xconfig.

Check your kernel version using the following command

uname -r

Download source using the following command

#apt-get install linux-source-2.6.26

Make directory for compiling

#mkdir ~/newkernel/

Copy source to newly created folder

#cp /usr/src/linux-source-2.6.26.tar.bz2 ~/newkernel/

#cd /newkernel/

Extract the source using the following command

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

#cd linux-source-2.6.26

Optional Step

You might optionally want to copy a working template for the kernel .config to this directory, you can find some in /boot/.

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

Check your processor details using the following command

#cat /proc/cpuinfo

Configure kernel options

#make config


#make menuconfig
In the above scree you have to click on the Y/M/N letter in the very last column of your choice to enable or disable some options

Now Clean the slate for kernel compiling

#make-kpkg clean

If you have a multiprocessor machine, you’ll want to make all processors work


Perform the actual compile, this will take anywhere from 10 minutes to 5 hours depending on your hardware and configuration choices (the more you selected, the longer it will take). You need to include kernel_headers if you want to compile some other modules against your kernel, e.g. ati or nvidia drivers.

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

It then will give you all kind of chatter, warnings and notices during, it’s quite normal.

Once it’s done, goto the lower directory where the .deb we just created is

#cd ..

Install .deb package using the following command

#dpkg -i *.deb

Reboot and select from the list the new kernel with your initials or what ever ID you gave it at config time.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License