The CentOS Way
Install the development utils, libs and headers
yum install gcc gcc-c++ kernel-devel ncurses-devel rpm-build
Grab a new kernel
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.29.1.tar.gz tar zxvf linux-2.6.29.1 cd !$
Make sure you enable support for at least the hardware in the machine you’re compiling the kernel on (safe bet). You can use the lspci
command to figure out what that is
[root@c1024 linux-2.6.29.1]# lspci 00:00.0 Host bridge: Intel Corporation 82G33/G31/P35/P31 Express DRAM Controller (rev 10) 00:02.0 VGA compatible controller: Intel Corporation 82G33/G31 Express Integrated Graphics Controller (rev 10) 00:1c.0 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 1 (rev 01) 00:1d.0 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #1 (rev 01) 00:1d.1 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #2 (rev 01) 00:1d.2 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #3 (rev 01) 00:1d.3 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #4 (rev 01) 00:1d.7 USB Controller: Intel Corporation 82801G (ICH7 Family) USB2 EHCI Controller (rev 01) 00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev e1) 00:1f.0 ISA bridge: Intel Corporation 82801GB/GR (ICH7 Family) LPC Interface Bridge (rev 01) 00:1f.1 IDE interface: Intel Corporation 82801G (ICH7 Family) IDE Controller (rev 01) 00:1f.2 IDE interface: Intel Corporation 82801GB/GR/GH (ICH7 Family) SATA IDE Controller (rev 01) 00:1f.3 SMBus: Intel Corporation 82801G (ICH7 Family) SMBus Controller (rev 01) 01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8101E PCI Express Fast Ethernet controller (rev 01) [root@c1024 linux-2.6.29.1]#
Create your kernel config. (If you already have one, just create a new file called .config
and put your kernel configuration in it.
make menuconfig
or
make config
Once you have completed your kernel configuration, you can build the kernel and create an RPM for installation on other hosts. I have a Core2Quad CPU in this system, so I’ll set the number of jobs to 5 -j5
make -j5 rpm
After it has built (without errors) you need to install the kernel from RPM, do a directory listing to see what the name of the file that was built is:
ls /usr/src/redhat/RPMS/`uname -m` cd !$ rpm -ivh kernel-2.6.29.1.x86_64.rpm
Okay, now create an initial ramdisk for the kernel (initrd)
mkinitrd /boot/initrd-2.6.29.1.img 2.6.29.1
Now edit your /boot/grub/menu.lst
to include the new kernel and you’re all set!
Enjoy.