KERNEL COMPILATION
******************
RED HAT
******************
1. Get the kernel source
http://www.kernel.org/pub/linux/kernel/v2.6/
2. Check the server settings
lspci
lsmod
cat /proc/cpuinfo
3. Download the kernel
cd /usr/src/kernels
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.21.tar.gz
tar -zxf linux-2.6.21.tar.gz
cd linux-2.6.21
4. Configure the kernel
cp /boot/config-`uname -r` .config
make menuconfig
5. Prepare kernel image
make bzImage
6. Install Kernel modules
make modules
make modules_install
7. Install the kernel
make install
or
Do the following
a) cp .config /boot/config-2.6.21
b) cp arch/i386/boot/bzImage /boot/vmlinuz-2.6.21
c) cp System.map /boot/System.map-2.6.21
d) mkinitrd /boot/initrd-2.6.21.img 2.6.21
Now alter grub
vi /etc/grub.conf
Add line
title CentOS-4 i386 (2.6.21)
root (hd0,0)
kernel /vmlinuz-2.6.21 ro root=LABEL=/ panic=3
initrd /initrd-2.6.21.img
8. Set the grub to load the new kernel after reboot
Type grub in the console
Type savedefault --default=1 --once
9. Reboot the server
reboot
10. Check the kernel version
uname -a
*********************
DEBIAN
**********************
1. Install the required packages: apt-get install kernel-package libncurses5-dev fakeroot wget bzip2 2. Download the latest kernel cd /usr/src wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.19.2.tar.bz2 tar xjf linux-2.6.19.2.tar.bz2 cd linux-2.6.19.2 3. Select the required kernel features and compile the kernel source make menuconfig make-kpkg clean fakeroot make-kpkg --revision=custom.1.0 kernel_image 4. If the compilation stops with an error, run make clean and then re-run the previous commands starting with make menuconfig 5. Go ahead with cd ../ dpkg -i kernel-image-2.6.19.2_custom.1.0_i386.deb This will install your new kernel and also update grub configuration file. 6. Create a ramdisk of your new kernel, otherwise your system will most likely not boot: cd /boot/ mkinitrd -o /boot/initrd.img-2.6.19.2 2.6.19.2 7. Now edit /boot/grub/menu.lst and put the following entry after the kernel directive of the new kernel: initrd /boot/initrd.img-2.6.19.2 But if the /boot is on a separate partition, the entry should be as follows: initrd /initrd.img-2.6.19.2 8. Reboot your machine with new kernel: shutdown -r now 9. If everything is ok your machine should come up with the new kernel. You can run uname -a
Praji's Blog