728x90 AdSpace

Latest News

Monday, 25 November 2013

Simple Steps To Compile The Linux Kernel

We have been hearing a lot from our readers that they want to read something about the process of compiling the Linux kernel. So here we bring to you a 11 step guide to compile the Linux kernel on your own! Read on...

Linux, Linux kernel, Compiling linux kernel, how to compile linux kernel, open source, process of compiling linux kernel


1. Get the latest version of the Linux kernel from http://www.kernel.org.

2. Ensure that you download the complete source by clicking on the "F" where the text says, "The latest stable version is..." If missed, you will only be downloading the patch which is used if your existing kernel is just a patch number lower. For example, for upgrading from 3.4.4.1 to 3.4.4.2.

3. Once done downloading, just open the terminal and extract the kernel using the below command:

- tar xjvf kernel (Here -j option is for bz2 compression)

4. After successfully extracting the kernel, use the terminal to move into the directory that has been created.

5. Configure the kernel using one of the below 3 ways:

- make oldconfig – This method asks you one by one on what all the kernel should be supporting, simple but a little time consuming.
- make menuconfig – This method provides you a menu that lets you browse the options that the kernel will support. This requires ncurses library, but that is already available on most of the computers.
- make qconfig/xconfig/gconfig – This method is similar to the menuconfig, the only difference being that the configuration menu is graphics based. Also note that the "qconfig" command requires the QT library.

6. While you are in the configuration window, you can see that there are certain specifications that are already configured like the support for essential drivers including Broadcom wireless support/EXT4 filesystem etc. This is the place where you can make your customization like adding support for your specific type of device/controller/driver like you may add support for NTFS file system from "Filesystem >> DOS/FAT/NT/ >> select NTFS file system support.

In addition to the above, while you are in the customization menu, there is a section known as kernel hacking (Here hacking means exploring into it). This will be the place where you can add further options by hacking into the kernel. In case you aren't willing to use this option, you can disable the option "kernel debugging". This disabling is specially useful if you are planning to make keep it light.

7. Once you are done with the configuration, it's time for compiling and installing the kernel. For this, you will be required to execute the below commands in order and this might take a long time.

- make (-j option may also be added to fork additional processes for compiling kernel, syntax would be "make -j 3" 3 here represents the number of processes to be created)
- make modules_install
- make install

8. You might want to take a break here as this process may take atleast 20 minutes of time on any modern computer. To simply enter all your commands in one go, you can use the ampersand '&' symbol, e.g.

- make && make modules_install && make install

9. Once the kernel is installed, you are required to make it bootable. To do this go to /boot

10. Now run the below command:

mkinitrd -o initrd.img-< kernelversion > < kernelversion >

(You are not required to create initrd for Redhat based distros, as it available there by default) Here replace < kernelverison > with the version number of the kernel you build.

11. Now point the boot loader on the new kernel to run and use the tool that came with your distro for configuration of the bootloader. Here add a new entry for the new kernel.



no image
  • Title : Simple Steps To Compile The Linux Kernel
  • Posted by :
  • Date : 21:56
  • Labels :
  • Blogger Comments
  • Facebook Comments

0 comments:

Post a Comment

Top