Tips and tricks: Where is the kernel-source package for Red Hat Enterprise Linux 4?
Unlike Red Hat Enterprise Linux versions 2.1 and 3, there is no kernel-source package in the Red Hat Enterprise Linux 4 distribution. It was deemed redundant to provide a kernel-source package and a kernel .src.rpm package at the same time. Users that require access to the kernel sources can find them in the kernel.src.rpm file.
In Red Hat Enterprise Linux 4, The kernel-devel package includes the kernel headers files and you no longer require the kernel source package to build a third party kernel module. To install the kernel-devel package run the following command as root user in a terminal:
#up2date kernel-devel
A full source tree is not required in order to build modules against the current kernel you are using. You can simply point your Makefile to /lib/modules/`uname -r`/build. A more detailed explanation can also be found in the Release Notes.
If you require the kernel source package for reasons other than building a kernel module, you can obtain it in Red Hat Enterprise Linux 4 by typing the following as root user in a terminal:
# up2date redhat-rpm-config rpm-build # up2date --get-source kernel # rpm -ivh /var/spool/up2date/kernel*.src.rpm # cd /usr/src/redhat/SPECS # rpmbuild -bp --target=i686 kernel-2.6.spec # cp -a /usr/src/redhat/BUILD/kernel-2.6.9/linux-2.6.9 /usr/src # ln -s /usr/src/linux-2.6.9 /usr/src/linux
Note: This will build the source tree for a x86 based architecture. For different architectures, (i.e. x86_64) pass the appropriate target variable (i.e. rpmbuild -bp –target=x86_64 kernel-2.6.spec )
Once completed, a symlinked directory pointing to the latest Linux 2.6 kernel source should be available:
# ls -lt /usr/src total 28 lrwxrwxrwx 1 root root 12 Mar 2 16:36 linux -> linux-2.6.9/ drwxr-xr-x 20 root root 4096 Mar 2 16:21 linux-2.6.9
Note:The steps are also provided in the Red Hat Enterprise Linux 4 Release Notes: http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/release-notes/as-x86/
