Compiling Latest Linux Kernel

By | October 1, 2013

Hi Friends,

As per requirement of our client, recently I compiled latest stable Linux kernel (linux-3.9.7) on my CentOS-6.3.
So as usual I wanna share steps for compiling the kernel ūüôā

Below are the steps. Please follow if you also want to do the same.

Step 1) Download latest stable Linux Kernel from http://kernel.org/ and untar the package.

[root@localhost ~]# cd /usr/src/

[root@localhost src]# wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.9.7.tar.xz
[root@localhost src]#tar -xvf linux-3.9.7.tar.xz
step 2) Choose appropriate Module 
 
[root@localhost src]# cd linux-3.9.7
[root@localhost linux-3.9.7 ]# make menuconfig
Note: This will show kernel configuration screen . Navigate and deselect things (drivers) you do not need. In case of doubt just leave the initial option/selection. Save the configuration and exit the menu.
After saving your configuration (it is stored in the “.config” file) exit from screen.
Step 3) compile the kernel
 
[root@localhost linux-3.9.7 ]#make
Note: This is time consuming task and will take more then hr’s depending on your hardware.
Step 4)¬†copy all the modules to a new directory, “/lib/modules/3.9.7”
[root@localhost linux-3.9.7 ]#make modules_install
Step 5) copy compiled files into appropriate locations
[root@localhost linux-3.9.7 ]#make install
Step 6) Remove all generated files + config + various backup files 
[root@localhost linux-3.9.7 ]#make mrproper
That’s all about Kernel compiling. And Please don’t forget to edit grub.conf to change default boot option with new kernel.
Enjoy !!!!!!!
Share itShare on FacebookEmail this to someoneTweet about this on TwitterShare on Google+Share on LinkedInPrint this page

4 thoughts on “Compiling Latest Linux Kernel

  1. Mukesh

    Very useful topic for every engineer, they must know compile process,
    Thanks Amit

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Current month ye@r day *