Kernel
It makes sure that all processes in the system works fine
Rebuilding
It is done to optimize the kernel to suit our requirements as well as make it more secure from internet attacks
Steps
1. Determining the current hardware
This is required during configuration process to enable hardwares that our new kernel has to support.
Commands used for the same are:
2. Download the Source
latest sources and its corresponding patches are always available fromhttp://www.kernel.org/pub/linux/kernel/
As of today (Oct 21, 2008) the latest available source is linux-2.6.27.2.tar.gz and the patch is patch-2.6.27.2.gz
Apply the patches
Extract the source using tar -zxvf and patch using gunzip to /usr/src/ folder.
Now cd to linux-2.6.27.2 and apply the patch as shown below:
4. Configuration
You may copy the current configuration by copying the file .config.
cp ../linux/.config config.old
Begin the configuration by wiping out all previous configurations and resetting the source directory to a pristine state:
Run the configuration utility. Either of the below step can be used to run the configuration utility:
5. Start Build
Clean before the build:
Start the build after cleaning process:
6. Build and install all the loadable modules
make modules_install
7. Copy the required files and generate initrd
Copy the files over for the kernel itself
cp arch/i386/boot/bzImage /boot/vmlinuz-2.6.27.2
cp System.map /boot/System.map-2.6.27.2
mkinitrd /boot/initrd-2.6.27.2.img 2.6.27.2
If you come across an error like: “/dev/mapper/control: open failed: No such file or directory” , Run the following commands:
mkinitrd –omit-lvm-modules /boot/initrd-2.6.27.2.img 2.6.27.2
8. Configure Grub & enable failsafe
Open grub.conf file
Add the below code to the top of the kernel list:
root (hd0,0)
kernel /vmlinuz-2.6.27.2 ro root=LABEL=/
initrd /initrd-2.6.27.2.img
Set the default value to your working kernel. (NOTE: NOT NEW KERNEL)
Now save and exit from grub.conf file and enter into grub mode by typing “grub” from bash prompt
And set to boot from newly compiled kernel during next reboot:
If your server is up, you are done with your new kernel. Open the file grub.conf and change the value of default to “0″
Congratulations! You are done with your new kernel.

















