Building kernel on Centos4

Here’s the steps I followed to build the kernel on CentOS4. Writing it here so I dont forget next time, and it helps some other distressed soul.

  1. Download kernel-xxx.src.rpm from any of centos mirrors.
  2. groupadd buildcentos
  3. useradd -g buildcentos buildcentos
  4. rpm -ivh kernel-xxx-src.rpm
  5. cd /usr/src/redhat/SPECS
  6. rpmbuild -bp –target=`uname -p` kernel-xxx.spec
  7. cd /usr/src/redhat/BUILD/kernel-xxx/linux-xxx
  8. make menuconfig
  9. cp -f .config /usr/src/redhat/SOURCES/kernel-xxx-ARCH.config
  10. cd /usr/src/redhat/SPECS
  11. rpmbuild -ba –target=`uname -p` kernel-xxx.spec
  12. go get coffee, or sleep if you have < 256mb ram
  13. rpm -ivh /usr/src/redhat/RPMS/ARCH/kernel-xxx.ARCH.rpm
  14. reboot


  • Steps 2,3 are not needed – but without them you’l get a bunch of warnings and you may panic.
  • Step 9,13: ARCH is `uname -p`