Friday, May 16, 2008

Recompile Kernel on CentOS 4.6

1. Download the latest kernel source from kernel.org

2. Copy kernel source to /usr/src/kernel/ and unpack it
[root@appdev kernels]tar jxvf linux-2.6.25.3.tar.bz2

3. Copy config files from original kernel
[root@appdev kernels]# cd linux-2.6.25.3
[root@appdev linux-2.6.25.3]# cp /boot/config-2.6.9-67.0.15.ELsmp .config
[root@appdev linux-2.6.25.3]# make menuconfig

and then exit

4. Rebuild RPM package
[root@appdev linux-2.6.25.3]# make rpm

5. You will find src rpm and rpm package on /usr/src/redhat/RPMS and /usr/src/redhat/ SRPMS

6. Install the new rpm package
[root@appdev]#rpm -ivh --nodeps /usr/src/redhat/RPMS/i386/kernel-2.6.25.3-1.i386.rpm

7. Make init files
[root@appdev]#mkinitrd /boot/initrd-kernel-2.6.25.3.img 2.6.25.3

8. Edit boot loader and add the new kernel
[root@appdev]#vi /boot/grub/grub.conf

9. Reboot the system
[root@appdev]#shutdown now -r

This article taken from
http://www.howtoforge.com/kernel_compilation_centos

2 comments:

Anonymous said...

Thanks, saved me a great deal of trial and error. I havent done it yet, but it looks like it is on the right track.. Thank you.

Unknown said...

I installed Centos 4.6 and I am trying to recompile a 2.6.9 kernel to enable firewire harddrive support. I followed your instructions, which are the same as those in the references url, but at step 4, the make rpm fails with an "Bad exit status from /var/tmp/rpm-tmp.51909 (%build)"

What could be the problem?