Thursday, April 9, 2009

How to install complete kernel source centos

The process has a few key steps -

1. Determine your kernel version by doing -
uname -a

Determine your current distro version by -
cat /etc/*release*

Download the relevant source from the centos mirror at -

where the ver is based on the version
of the distribution. The kernel src rpm is usually by the name
of kernel-{kernel version}.src.rpm

2. Install the source by -
$> rpm -ivh kernel*.src.rpm

3. Prepare the kernel source by applying proper patches
cd /usr/src/redhat/SPECS
$> rpmbuild -bp --target $(arch) kernel-2.6.spec

If it says that rpmbuild is not found, do a yum install on
rpm-build to get the utility. The -bp switch does the patch

4. Move and link it;

# cd /usr/src/redhat/BUILD/kernel-{version} /usr/src/
$> mv linux-{ver} /usr/src/
$> cd /usr/src
$> ln -s ./linux-{ver} linux
$> cd /usr/src/linux

You are done. The /usr/src/linux directory has all the current
kernel source code. Not you need to do this procedure if
you need the entire source and not just the current kernel
source code.


Anonymous said...

By the way, do not forget to eliminate the -preps in the Makefile.

Anonymous said...

The last comment was very useful. This can now be done through the GUI too.

Post a Comment