Friday, 29 April 2011

How to recompile your Ubuntu 11.04 Kernel

This quick how to guide will show you how to recompile your Ubuntu 11.04 ( Kernel using the terminal.

1. Install these packages

sudo apt-get install kernel-wedge kernel-package libncurses5-dev

2. Run this command

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

3. Create your source directory

mkdir ~/src

cd ~/src

4. Download the Kernel source

apt-get source linux-image-$(uname -r)

5. Configure your Kernel

cd linux-2.6.38

make menuconfig

6. Speed up the build


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

7. Clean up temp files from a previous compile attempt (skip if necessary)

make-kpkg clean

8. Compile your Kernel

time fakeroot make-kpkg --initrd --append-to-version=-tweak kernel-image kernel-headers

You can change -tweak to anything you wish

9. Install your Kernel

cd ~/src

sudo dpkg -i linux-image-

sudo dpkg -i linux-headers-

10. Reboot