Installing latest kernel in ubuntu

After a long time I installed latest kernel to my ubuntu 12.04 :). Long time back I use to install and test the latest kernels, so completely forgot the steps. Managed to do it by Googling, so thought of writing a wiki.

Clone latest kernel from Linus Torvalds repository:

$ git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

$ cd linux

If you want to use the previous config, execute below command

$ make localmodconfig

Then execute make ( I am compiling with -j3 to distribute task to 3 cores )

$ make -j3

After successful compilation, needs to install the kernel and modules to the system.

Execute below command to install modules which is compiled.

$ sudo make modules_install

This will copy all the compiled modules to /lib/linux-<version>/ directory.

The next steps are copy kernel, System_map and config to /boot directory.

I am using inter x86 32 bit PC, so my bzImage is located in 

<Kernel_Base_Dir>/arch/x86/boot/bzImage. This will install the kernel.

$ sudo cp arch/x86/boot/bzImage /boot/vmlinuz-<version> 

$ sudo cp <Kernel_Base_Dir>/System.map /boot/System.map-<version>

$ sudo cp <Kernel_Base_Dir>/.config /boot/config-<version>

Above two commands installs the System.map and config to the /boot directory.

Create initramfs:

$ sudo update-initramfs -c -k <version>

Above command will create initramfs file, in my case it creates initrd.img-3.14.0-rc4-00008-g7472e00 file

Update the grub 🙂

$ sudo update-grub2

Above command will update the grub with new kernel :).

 

Thats it!!!! You installed a brand new kernel 🙂

Advertisements