Skip to content

Build your own Linux Kernel

November 18, 2012
Download a mainline stable kernel from the

You can download the latest stable kernel from the website.
Now, please note that I am doing this process on Ubuntu 10.04.
After the download is finished. extract the package.
$tar -xvf  linux-3.6.7.tar.bz2
$cd  linux-3.6.7

Now you have to configure the kernel as per your system. (So kernel can actually work on it…). If you don’t know how to configure (like me ;) ) then you can find the existing configuration from your current system.

You can find them in /boot directory. In my case file name was “config-2.6.32-21-generic”. So you can directly copy that configuration.
$cat /boot/config-2.6.32-21-generic > .config
Now with old configuration loaded, we also need to enable few more configuration that are added newly. So for that execute,
$make oldconfig
Just hit enter on every selection, so it will take the default. So now your kernel is ready with configurations.
Compile the kernel using,
$make -j2 && sudo make modules_install
Place the compiled kernel in boot directory
$sudo cp arch/i386/boot/bzImage /boot/vmlinuz-3.6.7
Now we need to update the grub (the boot loader) so it can detect and boot this kernel.
$sudo update-grub2
by running above command, you will get an auto generated file /boot/grub/grub.cfg
In that find this section,
menuentry 'Ubuntu, with Linux 3.6.7' --class ubuntu --class gnu-linux --class gnu --class os {
     insmod ext2
     set root='(hd0,1)'
     search --no-floppy --fs-uuid --set 42d5cc2e-4a0c-4312-91c2-e9ef9d0aecb7
     linux     /boot/vmlinuz-3.6.7 root=/dev/sda1 ro   quiet splash
menuentry 'Ubuntu, with Linux 3.6.7 (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
     insmod ext2
     set root='(hd0,1)'
     search --no-floppy --fs-uuid --set 42d5cc2e-4a0c-4312-91c2-e9ef9d0aecb7
     echo     'Loading Linux 3.6.7 ...'
     linux     /boot/vmlinuz-3.6.7 root=/dev/sda1 ro single 
     echo     'Loading initial ramdisk ...'
Now, In this section add necessary changes in this section according to other existing menuentry
Now try to boot your new Linux kernel. I hope you get it working.
Well, this part of process just a beginning process, you also need to do some more configuration and stuff (If this doesn’t work of-course).
But, By this process you can get idea what to do after that configuration and stuff.
Hope you enjoyed the article.

From → Linux, Ubuntu

Leave a Comment

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


Get every new post delivered to your Inbox.

%d bloggers like this: