If you try to re-build kernel in RHEL 4, but encounter this error message:

[/usr/src/kernels/2.6.9-34.0.2.EL-i686]# make bzImage
CHK include/linux/version.h
CHK include/asm-i386/asm_offsets.h
UPD include/asm-i386/asm_offsets.h
/bin/sh: arch/i386/kernel/asm-offsets.s: No such file or directory
mv: cannot stat `include/asm-i386/asm_offsets.h.tmp’: No such file or directory
make: *** [include/asm-i386/asm_offsets.h] Error 1

This is because RHEL4 doesn’t install kernel source package by default, but install a package including minimum kernel header and source file (kernel-devel-$(uname -r).i686.rpm).

This package provides kernel headers and makefiles sufficient to build modules against the kernel package. Hence it cannot be used to build kernel source.

To re-build kernel, please to see the “kernel” section in the release-notes in RHEL 4.

In order to eliminate the redundancy inherent in providing a separate package for the kernel source code when that source code already exists in the kernel’s .src.rpm file, Red Hat Enterprise Linux 4 no longer includes the kernel-source package. Users that require access to the kernel sources can find them in the kernel.src.rpm file.

To create an exploded source tree from this file, perform the following steps:

  1. Obtain the kernel-$(uname -r).src.rpm file from one of the following sources:
    • The SRPMS directory on the appropriate “SRPMS” CD iso image
    • By running the following command:
      up2date –get-source kernel
  2. Install kernel-$(uname -r).src.rpm
    rpm -Uvh /var/spool/up2date/kernel-$(uname -r).src.rpm (if kernel.src.rpm is gained by up2date)
  3. Change directory to /usr/src/redhat/SPECS/
  4. rpmbuild -bp –target=$(uname -m) kernel-2.6.spec
  5. Issue the following command:
    make oldconfig

You can then proceed as usual.

Popularity: 35% [?]