Sunday, 6 February 2011

How to compile a kernel from in Ubuntu 10.04 LTS

This quick how-to is based on

Open a terminal and work through the following set of commands.

Install these packages

sudo apt-get install fakeroot kernel-wedge build-essential makedumpfile kernel-package libncurses5 libncurses5-dev

Run this

sudo apt-get build-dep --no-install-recommends linux-image-$(uname -r)

Create your source directory

mkdir ~/src
cd ~/src

Download and extract your kernel

You can browse for kernels at This guide is using kernel 2.6.37.

tar xvf linux-2.6.37.tar.gz
cd linux-2.6.37

Configure your Kernel

make menuconfig

Build your Kernel

make-kpkg clean
time fakeroot make-kpkg --initrd kernel-image kernel-headers

General rule, concurrency level = number of processor cores + 1

Install your kernel

cd ~/src

sudo dpkg -i linux-image-2.6.37_2.6.37-10.00.Custom_amd64.deb
sudo dpkg -i linux-headers-2.6.37_2.6.37-10.00.Custom_amd64.deb

Create the initramfs image

sudo update-initramfs -c -k 2.6.37

Update your grub.cfg

sudo update-grub

Reboot your system

Enjoy your new kernel.