Linux Support FAQ entry 11 May 2006, logged in as JanIven
LinuxSupportFAQForm
SupportProblem /usr/src/linux-2.6 is gone, there is no kernel-sources RPM. /usr/src/kernels/2.6.9-34.EL.cern is available, but contains only a few header files. Where is the source code, and how do I recompile a custom kernel for SLC4?
SupportAnswer T.U.V decided not to ship binary kernel-sources RPMS anymore in RHEL4, this is documented in the Release notes for both RHEL4 and SL(C)4. Instead, a new kernel-devel package contains just the header files required to compile new kernel modules. If this is what you need to do, kernel-devel ought to be enough, please have a look at the Linux Kernel Module Programming Guide for 2.6-kernels.

For full kernel recompilations (i.e. other options, add-on patches, non-modular code), the source RPM (SRPM) is required. Proceed as follows:

  1. Set up your RPM environment to not compile as "root", see for example the RPM tutorial
  2. install the source RPM of the kernel version you'd like to modify (take care not to pick an old-and-insecure version), e.g.

rpm -ivh http://linuxsoft.cern.ch/cern/slc4X/updates/SRPMS/kernel-2.6.9-34.0.2.EL.cern.src.rpm

This creates a .tar.gz and lots of patches under ..../SOURCES/ (wherever you have configured RPM, default would be /usr/src/redhat/SOURCES but you are not doing this as "root", right??)

  1. run rpmbuild --target i686 -bp ..../SPECS/kernel-2.6-cern.spec (or similar) - this unpacks the .tar.gz and applies the patches, all under ..../BUILD/
  2. modify the extracted version, twiddle and compile. Warning: re-running rpmbuild at this stage will happily overwrite any local modifications.
  3. optional but really recommended: create a patch from your modifications, add it to ..../SOURCES, add it to the ..../SPEC/kernel-2.6-cern.spec file. And edit the .spec file to change the "Release" string, so that your modified kernel RPM can easily be identified. Then invoke rpmbuild --target i686 -bb ..../SPEC/kernel-2.6-cern.spec to get a nicely-packaged custom kernel RPM that is readily installable.

(substitute i686 in the above with x86_64 or ia64 as required). Please remember that you may have to redo standalone modules (such as OpenAFS) against your new kernel.

OsVersion SLC4
HardwareArchitecture any
ApprovedBySupport SupportApproved
Edit | Attach | Watch | Print version | History: r6 < r5 < r4 < r3 < r2 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r6 - 2006-08-11 - JanIven
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    LinuxSupport All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright &© 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback