Build Linux Kernel in 10 steps

01 Mar

Linux Kernel In Action

Linux kernel In Action


  1. Download the Linux Kernel Source:
    Download Location:
    View Kernel Source Online:
    Acknowledgment: Above logo is from the same site!
    Here, am building Linux Kernel version

  3. Extract the source:
    tar xvf linux-
    You can choose your suitable location, I am doing it at $HOME. Extract the source and ‘cd’ to it.

  5. Copy the config file:
    sudo cp /boot/config-2.6.31generic ~/linux-
    My existing Kernel version on the laptop is: 2.6.31.

  7. Customize the kernel configuration as you want:
    make menuconfig

  9. Build the Kernel:

  11. Build the Kernel modules:
    make modules

  13. Ready the modules to be installed:
    sudo make modules_install


  15. Install the Kernel Modules:
    sudo make install

  17. Create the initramfs image for required kernel version
    The update-initramfs script manages your initramfs images on your local
    box. It keeps track of the existing initramfs archives in /boot.
    There are three modes of operation create, update or delete. You must
    at least specify one of those modes.
    The initramfs is a gzipped cpio archive. At boot time, the kernel
    unpacks that archive into RAM disk, mounts and uses it as initial root
    file system. All finding of the root device happens in this early
    sudo update-initramfs -k -c
    OR you can ‘cd’ to /boot and use mkinitramfs command as below:
    sudo mkinitramfs -o initrd.img-

  19. Update the grub:
    sudo update-grub


  • Once all 10 steps are executed successfully, you can ‘reboot’ the system to see the customized Linux kernel in action! You can confirm this change by following command:

    uname -a
    Linux machine_name 2.6.31-14-generic #48-Ubuntu SMP Fri Oct 16 14:04:26 UTC 2009 i686 GNU/Linux

    Linux machine_name #1 SMP Tue Mar 1 20:53:55 IST 2011 i686 GNU/Linux

    Note: Message content may differ based on Linux kernel version, data, time, etc.

  • If there is an issue during any of these 10 steps, you can always comment here or google it out! 🙂

Note: If you are facing problems like: failed to mount root fs on /proc/mounts or similar, you can boot the machine using working Linux kernel version and run

sudo update-initramfs -u -k all

This will update the initrd images of all kernel versions.

Leave a comment

Posted by on March 1, 2011 in Linux, Technical


Tags: ,

Leave a Reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s

%d bloggers like this: