Saturday, 15 June 2013

How to Compile Linux Kernel from Source

Linux kernel is the important part of all Linux family of operating systems including Ubuntu, CentOS, and Fedora.

In this tutorial, we’ll explain how to compile Linux kernel from source.

1.Download Kernel source from kernel.org

 # wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.9.3.tar.xz
 

2. Untar the kernel source 

 # tar -xvJf linux-3.9.3.tar.xz
 

3. Configure kernel

 # cd linux-3.9.3

 # make menuconfig

 
We will use the default config provided by the kernel. So select “Save” and save the config in the file name “.config”
 

4. Compile the kernel 

   # make

 5. Compile Kernel modules 

  # make modules 

6. Install kernel modules

  # make modules_install

7. Install new kernel

  # make install

 8. Boot with new kernel

 #  reboot