Building and Installing linux kernel

It is always exciting to add something (at least a print message) in kernel and see your own kernel image booting… Well it is not difficult task. Following few steps you can build and install kernel.

  • Find proper defconfig according to your system configuration. For x86-64 bit architecture, x86_64_defconfig is used.
  • Configure kernel
    # make ARCH=x86 x86_64_defconfig
  • Compile kernel
    # make ARCH=x86
  • Install Kernel
    # sudo make modules_install
    # sudo make install

This command automatically updates grub and adds entry for new installed kernel. TO be safer, it is recommanded that you add some delay in grub.cfg so that if newly installed kernel cannot boot due to some reason, you can get a chance to boot using other kernel. If this delay is 0, grub will boot default kernel without prompt to select kernel.

+ set timeout=5
  ### END /etc/grub.d/30_os-prober ###

You can also set timeout in /etc/default/grub

GRUB_TIMEOUT=10                                                                 
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s