Linux kernel compilation tutorial step by step instruction

1) Go to kernel.org and download stable version.

Linux kernel compilation

2) After complete download , you will get linux-3.18.tar.xz file. This is a compressed source code of latest linux kernel.

3) UN-compressed with below command. You can also untar or UN-compressed by write click and extract utility on Ubuntu Linux.

# gzip -cd linux-3.X.tar.gz | tar xvf -

Below is way of GUI mode

Linux kernel compilation

4) Go to the Linux source directory.

      #cd linux-3.18.x

Linux kernel compilation

5)  Make sure you have no stale .o files and dependencies lying around:

#make mrproper

You should now have the sources correctly installed.

6) Before compilation we have to configure the kernel by running below command.

#make oldconfig

If you want to carry your existing configuration to a new version with minimal work, use “make oldconfig”, which will only ask you for the answers to new questions.

7) Compile the kernel by make command

aa

8) compile the modules.

           # make modules

9) Install the kernel

              #make modules_install

             #make install

This last command will install new kernel. Note: Installing new linux kernel may make your system UN-stable. So install new kernel with proper guidelines from experts.