CentOS (RHEL) 5.4 kernel source

My annoying, non-google-able problem of the day: Say you want to build the source tree for a RHEL/CentOS 5.4 kernel (2.6.18-164.11.1.el5 in my case) and you are running a recent Debian or Fedora system. You might get patch failure errors that look like this:

Patch #212 (linux-2.6-x86-support-rdtscp-for-gtod.patch):
+ + /bin/cat /Users/david/rpmbuild/SOURCES/linux-2.6-x86-support-rdtscp-for-gtod.patch
/usr/bin/patch -s -p1 --fuzz=0
1 out of 7 hunks FAILED -- saving rejects to file arch/x86_64/kernel/time.c.rej
error: Bad exit status from /var/tmp/rpm-tmp.5n4IVi (%prep)


This is caused by newer versions of rpmbuild passing --fuzz=0 to patch. You can fix it by putting this line in the kernel-2.6.spec file:

%define _default_patch_fuzz 2

That’s it. I just saved you 8 hours of screwing around and looking for pre-patched kernels sources. ;-)

2 thoughts on “CentOS (RHEL) 5.4 kernel source”

  1. I can’t possibly thank you enough for your work here in making the non-googl-able googl-able. Worked like a charm.

  2. Yes. Yes you did.

    For inscrutable reasons, I am trying to rebuild a very old kernel (kernel-2.6.18-8.el5.src.rpm) from src.rpm and got this exact error. It was nice to have this *exact* error show up on the google. I had noticed the fuzz=0 on the patch line, but would have spent a lot of time before settling on that as the culprit.

Leave a Reply

Your email address will not be published. Required fields are marked *

Last Modified on: Dec 31, 2014 18:59pm