Whamcloud - gitweb
LU-185 LBUG: (cl_page.c:1362:cl_page_completion()) ...
[fs/lustre-release.git] / build / lbuild-rhel5
1 # vim:expandtab:shiftwidth=4:softtabstop=4:tabstop=4:
2
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)
8 BUILD_GEN+=".0"
9
10 source ${0%/*}/lbuild-rhel
11
12 SPEC_NAME="kernel-2.6.spec"
13
14 patch_spec() {
15     local buildid="$1"
16
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\
23 # lustre patch\
24 %patch99995 -p1\
25 ' \
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           SPECS/$SPEC_NAME 2>&1 || \
32         fatal 1 "Error while editing SPECS/$SPEC_NAME"
33
34     if $KERNEL_LUSTRE_NAMING; then
35         # these are all of the changes needed because we change the package names
36         # to kernel-lustre-*.  these should all go away when we stop this insanity
37         sed -i -e 's/^\(Name:.*kernel\)/\1-lustre/' \
38                -e '/^Provides: glibc-kernheaders = /a\
39 Provides: kernel-headers = %{rpmversion}-%{release}
40 Obsoletes: kernel-headers
41 ' \
42                -e '/^Provides: kernel-%{_target_cpu} = %{rpmversion}-%{release}$/a\
43 Provides: kernel = %{rpmversion}-%{release}
44 ' \
45                -e '/^Provides: kernel-devel-%{_target_cpu} = %{rpmversion}-%{release}$/a\
46 Provides: kernel-devel = %{rpmversion}-%{release}
47 Obsoletes: kernel-devel
48 ' \
49                -e '/^Provides: %{name}-debuginfo-common-%{_target_cpu} = %{KVERREL}$/a\
50 Provides: kernel-debuginfo-common = %{KVERREL}
51 Obsoletes: kernel-debuginfo-common
52 ' \
53                -e '/^Provides: %{name}-debuginfo-%{_target_cpu} = %{KVERREL}$/a\
54 Provides: kernel-debuginfo = %{KVERREL}
55 Obsoletes: kernel-debuginfo
56 ' \
57               SPECS/$SPEC_NAME 2>&1 || \
58             fatal 1 "Error while editing SPECS/$SPEC_NAME"
59     fi
60
61     # finally, work around RH bug 491775, if needed
62     if ! grep -q "cp -a asm-x86_64 \$RPM_BUILD_ROOT/lib/modules/\$KernelVer/build/include" \
63               SPECS/$SPEC_NAME; then
64         # XXX - i wonder if we will need to do this ad-hoc patching enough to
65         #       formalize a patching system.  let's assume not for the time
66         #       being.
67         patch -s -p0 <<"EOF" 2>&1 || \
68             fatal 1 "Error while patching SPECS/$SPEC_NAME"
69 --- SPECS/$SPEC_NAME.dist       2009-03-23 20:30:55.000000000 -0400
70 +++ SPECS/$SPEC_NAME    2009-03-23 20:37:03.000000000 -0400
71 @@ -6961,6 +6961,10 @@
72      cd include
73      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
74      cp -a `readlink asm` $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include
75 +    if [ "$Arch" = "i386" ]; then
76 +      mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include/asm-x86_64
77 +      cp -a asm-x86_64/{stacktrace,k8,pci-direct}.h $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include/asm-x86_64
78 +    fi
79      if [ "$Arch" = "x86_64" ]; then
80        cp -a asm-i386 $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include
81      fi
82 EOF
83     fi
84
85     return 0
86
87 }
88
89 unpack_linux_devel_rpm-rhel5() {
90     local callers_rpm="$1"
91
92     unpack_linux_devel_rpm-rhel "$callers_rpm"
93
94     if [ ! -f usr/src/kernels/${lnxmaj}${lnxmin}-${lnxrel}-$TARGET_ARCH/symsets-${lnxmaj}${lnxmin}-${lnxrel}.tar.gz ]; then
95         fatal 1 "cannot build modules: the Kernel's symsets is missing."
96     fi
97
98     return 0
99
100 }
101
102 find_linux_rpm-rhel5() {
103     local prefix="$1"
104     local wanted_kernel="$2"
105     local pathtorpms=${3:-"${KERNELRPMSBASE}/${lnxmaj}/${DISTRO}/${TARGET_ARCH}"}
106
107     find_linux_rpm-rhel "$prefix" "$wanted_kernel" "$pathtorpms"
108 }
109
110 kernel_srpm_location() {
111
112     echo "http://mirror.centos.org/centos-5/5/updates/SRPMS/"
113
114 }