1 # vim:expandtab:shiftwidth=4:softtabstop=4:tabstop=4:
3 source ${LBUILD_DIR}/lbuild-rhel
5 # increment this if you have made a change that should force a new kernel
9 SPEC_NAME="kernel.spec"
10 DEVEL_PATH_ARCH_DELIMETER="."
13 # force local definition of %dist into ~/.rpmmacros
14 # to avoid verbose extended strings like ".el7.centos"
15 # in kernel version and rpm names
18 grep '^%dist' $RMAC &> /dev/null || echo '%dist .el7' >> $RMAC
20 # We modify the RHEL7 kmodtool script, because it expects
21 # the kernel source to be in the correct packaged RHEL location.
22 # lbuild does not put the source in correct packaged RHEL location.
23 RHEL_KMODTOOL=/usr/lib/rpm/redhat/kmodtool
24 LBUILD_KMODTOOL="${LBUILD_DIR}/rhel7/kmodtool"
25 cp $RHEL_KMODTOOL $LBUILD_KMODTOOL
26 pushd ${LBUILD_DIR}/rhel7
27 patch -p1 < kmodtool.patch
30 # Next we replace %kernel_module_package with one that is nearly
31 # identical, but calls lbuild's modified kmodtool script.
32 # We need to cleanout the previous entry
33 sed -i "/^%kernel_module_package/,/^)}$/d" $RMAC
34 sed -e "s|REPLACE_ME|$LBUILD_KMODTOOL|" \
35 ${LBUILD_DIR}/rhel7/rpmmacros.template > ${LBUILD_DIR}/rhel7/rpmmacros
36 cat ${LBUILD_DIR}/rhel7/rpmmacros >> $RMAC
41 # the el7 .spec file requires patch names to begin with "patch-3."
42 # so rename the lustre patch from lbuild to one the .spec will like
43 mv $TOPDIR/SOURCES/linux-${lnxmaj}-lustre.patch \
44 $TOPDIR/SOURCES/patch-${lnxmaj}-lustre.patch
46 # edit the SPEC with our changes
47 patch_spec_common "$buildid"
48 sed -i -e '/^# empty final patch to facilitate testing of kernel patches/i\
49 # adds Lustre patches\
50 Patch99995: patch-%{version}-lustre.patch' \
51 -e '/^ApplyOptionalPatch linux-kernel-test.patch/i\
54 ApplyOptionalPatch patch-%{version}-lustre.patch\
56 -e '/rm -f include\/generated\/kernel.cross/i\
57 # lustre kernel config.\
58 if [ -f %{_topdir}/lustre/lustre/kernel_patches/kernel_configs/kernel-%{version}-3.10-rhel7-%{_target_cpu}.config ]; then\
59 echo "# $Arch" > configs/kernel-%{version}-%{_target_cpu}.config\
60 cat %{_topdir}/lustre/lustre/kernel_patches/kernel_configs/kernel-%{version}-3.10-rhel7-%{_target_cpu}.config >> configs/kernel-%{version}-%{_target_cpu}.config\
62 -e '/^# Dynamically generate kernel/a echo "CONFIG_BH_LRU_SIZE=16" >> config-generic'\
63 -e '/^%define listnewconfig_fail 1/s/1/0/'\
64 SPECS/$SPEC_NAME 2>&1 || \
65 fatal 1 "Error while editing SPECS/$SPEC_NAME"
72 unpack_linux_devel_rpm-rhel7() {
73 local callers_rpm="$1"
75 unpack_linux_devel_rpm-rhel "$callers_rpm"
84 if $KERNEL_LUSTRE_NAMING; then
85 echo -e "--define \"variant -lustre\" \c"
87 echo "--with firmware"
93 find_linux_rpm-rhel7() {
95 local wanted_kernel="$2"
96 local pathtorpms=${3:-"$KERNELRPMSBASE/$lnxmaj/$DISTROMAJ/$TARGET_ARCH"}
98 find_linux_rpm-rhel "$prefix" "$wanted_kernel" "$pathtorpms"
102 kernel_srpm_location() {
104 echo "http://vault.centos.org/centos/7/updates/Source/SPackages/"
108 kernel_debuginfo_location() {
110 echo "http://debuginfo.centos.org/7/x86_64/"
114 cleanup_rpmmacros() {
115 sed -i "/^%kernel_module_package/,/^)}$/d" $RMAC
118 apply_kmod_requires_conflicts() {
119 # until we have achieved full kABI compatibility we need to
120 # restrict the kernel range that can be used to the kernel
121 # version from the RHEL minor release
122 # this is supposed to be done for kmods automatically but
123 # RHBZ#1467319 seems to be getting in the way
124 local kver=$(find_linux_release)
125 local linuxversion=${kver%%-*}
126 local linuxrelease=${kver##*-}
127 local kabiminor=${linuxrelease%%.*}
128 echo "Requires: kernel < $linuxversion-$((kabiminor+1)), kernel >= $linuxversion-$((kabiminor))" >> rpm/kmp-lustre.preamble
130 # don't allow the patched kernel to be considered as a valid kernel
131 # for the patchless client
132 echo "Conflicts: kernel-lustre" >> rpm/kmp-lustre.preamble