- Download the Linux Kernel Source:
Download Location: http://kernel.org
View Kernel Source Online: http://lxr.linux.no/
Acknowledgment: Above logo is from the same site!
Here, am building Linux Kernel version 184.108.40.206.
- Extract the source:
tar xvf linux-220.127.116.11.tar.bz2
You can choose your suitable location, I am doing it at $HOME. Extract the source and ‘cd’ to it.
- Copy the config file:
sudo cp /boot/config-2.6.31generic ~/linux-18.104.22.168/.config
My existing Kernel version on the laptop is: 2.6.31.
- Customize the kernel configuration as you want:
- Build the Kernel:
- Build the Kernel modules:
- Ready the modules to be installed:
sudo make modules_install
- Install the Kernel Modules:
sudo make install
- 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 22.214.171.124 -c
OR you can ‘cd’ to /boot and use mkinitramfs command as below:
sudo mkinitramfs -o initrd.img-126.96.36.199 188.8.131.52
- Update the 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:
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 184.108.40.206 #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.