Tuesday, September 11, 2012

HowTo - Compile Linux kernel 3.5 under Ubuntu 12.04

1. Dependencies

$ sudo apt-get install gcc libncurses5-dev git-core kernel-package fakeroot build-essential

$ sudo apt-get update && sudo apt-get upgrade

2. Download kernel source

$ wget http://www.kernel.org/pub/linux/kernel/v3.x/linux-3.5.tar.bz2

$ tar -xvf linux-3.5.tar.bz2

$ cd linux-3.5/

3. Compile

If you want to use your current kernel configuration:

$ cp /boot/config-`uname -r` ./.config

$ make menuconfig

Compile the kernel and modules to be .deb packages so that we can easily install/uninstall them.

$ make-kpkg clean

$ fakeroot make-kpkg --initrd --append-to-version=-spica kernel_image kernel_headers

4. Install

Now you have two .deb packages generated, one is to install the kernel headers, another one is to install the kernel image. 

$ sudo dpkg -i linux-*.deb

5. Reboot

During reboot, choose the new kernel in your grub menu. Once you finish rebooting, check your new kernel information by typing in:

$ uname -r

1 comment: