Upgrade to latest kernel 3.3.7 with customization in size reduction

Upgrade to latest customised kernel.

The new kernel 3.3.7 is out and I am sure most of you have not yet updated your kernel. Well, don’t worry, this post will help you easily compile (build) a customised kernel suiting your needs and thus increasing your Linux experience.

Ok, so why compile the kernel?

Sometimes, some latest software modules need patch ups and need some kernel flags to be set for better user experience.

Nonetheless, even if you don’t want to, just do it to learn something new. That’s what this blog is all about.

So, beginning with the guide,

Step 1:

Download the latest kernel source code from www.kernel.org

Step 2:

Extract the source code using

tar xf linux-3.3.7.tar.bz2

Copy the extracted source code into the /usr/src directory using the GUI or using the command

sudo cp linux-3.3.7 /usr/src

Step 3:

Well, I will not go much into the details of this extracted folder as our main aim here is to build a customised kernel, which very few blogs around will help you with. So coming right back to action,

cd linux-3.3.7

The Linux kernel is made up of thousands of modules. Generally we don’t care much about this and just compile the kernel, but I will now try to show some modules and why not to install some modules if you don’t need them. The basic benefit of excluding some modules is that you never use them and hence it will improve your system boot time.

Generally the Linux image size is 5 MB, with the help of some decent options you can reduce it to about 3.5 MB and still have a perfectly running system that boots much faster

So, moving on, copy the old configuration file using the command,

cp /boot/config-(your current kernel version)  .config

This will create a new .config file in linux-3.3.7 which we can now use to modify and compile the kernel.

Step 4:

So to go to the configuration settings, type

make menuconfig

Image

This command will give you a GUI interface which you can use to decide which features to install.

Some modules like touch screen support, tablet support, joystick support and monitor interfacing are not required by a general user so I would advise you to deselect those options.

I cannot go on explaining each and every module in this post as that is not  possible considering thousands of modules, but the best way is to use [SHIFT]+? key together to get more information on what the module does, and decide accordingly. It will help you figure things out on your own.

So after deselecting the unnecessary modules as per your usage, we will now compile this kernel. save the configuration file using the last option which will redirect you back to the terminal.

Step 5:

Type:

make

This will take about 45 minutes depending on your system configuration. A good idea is to catch some sandwich while your kernel compiles.

Next, after this is done type,

make modules_install install

Step 6:

Type :

update-initramfs  -c  -k  3.3.7

This will enable us to choose the latest kernel during boot.

And finally update the grup by the command

update-grub

You are now ready to boot the latest kernel. Restart your system and bingo, a new kernel will show up for booting.

Do comment below in case of any error encountered below during compilation, and I will try my best to solve them for you.

Happy Linuxing!