Compile and boot into custom kernel

Posted: April 7, 2012 in Technology
Tags: , , ,

Here I am considering the kernel-3.3.0-rc7. You can modify the scripts according to the kernel version you want to try out.
Become Superuser:
sudo su
Install packages required for compiling the kernel:
apt-get install gcc make libncurses5-dev
Download the source code of the kernel version you want to try from using either the web browser or the wget utility or whatever downloader you use.
cd ~/Downloads

Extract the source code to /usr/src directory using
tar -xvf ~/Downloads/linux-3.3-rc7.tar.bz2 -C /usr/src
Goto linux kernel source path and configure the kernel :
cd /usr/src/linux-3.3-rc7/
make menuconfig

Instead of menuconfig, you can also try oldconfig if you want to use the configuration of already existing kernel on your system. There are other configuration commands based on graphical look and feel which can be found in README under parent kernel source directory.
Now compile the kernel,kernel modules and install the kernel modules :
make modules_install install

Now what left is that to boot into this kernel. Above commands creates the following files under /boot directory:
If you dont find initrd.img file, do
update-initramfs -u -k 3.3.0-rc7
Check for an entry in /boot/grub/grub.cfg for the kernel you have just installed. Its in menuentry section. Now update the grub:

Now if you reboot, your system by default will boot into this kernel.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s