1 # vim:expandtab:shiftwidth=4:softtabstop=4:tabstop=4:
3 # increment this if you have made a change that should force a new kernel
4 # to be built for this release of this distribution (only -- if you want to
5 # force a kernel build on all releases of this distribution, update the BUILD_GEN
6 # variable in build/lbuild-rhel and if you want to force kernel bulid for all
7 # distributions, update the BUILD_GEN variable in build/lbuild)
10 source ${0%/*}/lbuild-rhel
12 SPEC_NAME="kernel-2.6.spec"
17 # edit the SPEC with our changes
18 patch_spec_common "$buildid"
19 sed -i -e '/^# empty final patch file to facilitate testing of kernel patches/i\
20 # adds Lustre patches\
21 Patch99995: linux-%{kversion}-lustre.patch' \
22 -e '/^# conditionally applied test patch for debugging convenience/i\
26 -e '/-e $RPM_SOURCE_DIR\/kabi_whitelist_/i\
27 rm -f $RPM_SOURCE_DIR/kabi_whitelist_%{_target_cpu}$Flavour' \
28 -e '/_sourcedir\/kabitool -b \./a\
29 cp $RPM_BUILD_ROOT/kabi_whitelist $RPM_SOURCE_DIR/kabi_whitelist_%{_target_cpu}$Flavour' \
30 -e '/^%prep$/,/^# END OF PATCH APPLICATIONS$/s/kernel-%{kversion}/%{name}-%{kversion}/g' \
31 -e 's/^\(%define signmodules \).*/\10/' \
32 SPECS/$SPEC_NAME 2>&1 || \
33 fatal 1 "Error while editing SPECS/$SPEC_NAME"
35 if $KERNEL_LUSTRE_NAMING; then
36 # these are all of the changes needed because we change the package names
37 # to kernel-lustre-*. these should all go away when we stop this insanity
38 sed -i -e 's/^\(Name:.*kernel\)/\1-lustre/' \
39 -e '/^Provides: glibc-kernheaders = /a\
40 Provides: kernel-headers = %{rpmversion}-%{release}
41 Obsoletes: kernel-headers
43 -e '/^Provides: kernel-%{_target_cpu} = %{rpmversion}-%{release}$/a\
44 Provides: kernel = %{rpmversion}-%{release}
46 -e '/^Provides: kernel-devel-%{_target_cpu} = %{rpmversion}-%{release}$/a\
47 Provides: kernel-devel = %{rpmversion}-%{release}
48 Obsoletes: kernel-devel
50 -e '/^Provides: %{name}-debuginfo-common-%{_target_cpu} = %{KVERREL}$/a\
51 Provides: kernel-debuginfo-common = %{KVERREL}
52 Obsoletes: kernel-debuginfo-common
54 -e '/^Provides: %{name}-debuginfo-%{_target_cpu} = %{KVERREL}$/a\
55 Provides: kernel-debuginfo = %{KVERREL}
56 Obsoletes: kernel-debuginfo
58 SPECS/$SPEC_NAME 2>&1 || \
59 fatal 1 "Error while editing SPECS/$SPEC_NAME"
62 # finally, work around RH bug 491775, if needed
63 if ! grep -q "cp -a asm-x86_64 \$RPM_BUILD_ROOT/lib/modules/\$KernelVer/build/include" \
64 SPECS/$SPEC_NAME; then
65 # XXX - i wonder if we will need to do this ad-hoc patching enough to
66 # formalize a patching system. let's assume not for the time
68 patch -s -p0 <<"EOF" 2>&1 || \
69 fatal 1 "Error while patching SPECS/$SPEC_NAME"
70 --- SPECS/$SPEC_NAME.dist 2009-03-23 20:30:55.000000000 -0400
71 +++ SPECS/$SPEC_NAME 2009-03-23 20:37:03.000000000 -0400
72 @@ -6961,6 +6961,10 @@
74 cp -a acpi config keys linux math-emu media mtd net pcmcia rdma rxrpc scsi sound video asm asm-generic $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include
75 cp -a `readlink asm` $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include
76 + if [ "$Arch" = "i386" ]; then
77 + mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include/asm-x86_64
78 + cp -a asm-x86_64/{stacktrace,k8,pci-direct}.h $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include/asm-x86_64
80 if [ "$Arch" = "x86_64" ]; then
81 cp -a asm-i386 $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include
90 unpack_linux_devel_rpm-rhel5() {
91 local callers_rpm="$1"
93 unpack_linux_devel_rpm-rhel "$callers_rpm"
96 if [ ! -f usr/src/kernels/${lnxmaj}${lnxmin}-${lnxrel}-$TARGET_ARCH/symsets-${lnxmaj}${lnxmin}-${lnxrel}.tar.gz ]; then
97 fatal 1 "cannot build modules: the Kernel's symsets is missing."
105 find_linux_rpm-rhel5() {
107 local wanted_kernel="$2"
108 local pathtorpms=${3:-"${KERNELRPMSBASE}/${lnxmaj}/${DISTRO}/${TARGET_ARCH}"}
110 find_linux_rpm-rhel "$prefix" "$wanted_kernel" "$pathtorpms"
113 kernel_srpm_location() {
115 echo "http://ftp.redhat.com/pub/redhat/linux/enterprise/5Server/en/os/SRPMS/"