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 ".el8.centos"
15 # in kernel version and rpm names
18 grep '^%dist' $RMAC &> /dev/null || echo '%dist .el8' >> $RMAC
20 # We modify the RHEL8 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}/rhel8/kmodtool"
25 cp $RHEL_KMODTOOL $LBUILD_KMODTOOL
26 pushd ${LBUILD_DIR}/rhel8
27 patch -p1 < kmodtool.patch
28 # Replace the hardcoded /usr/src/kernels with our build path
29 tmp="${TOPDIR}/reused/usr/src/kernels"
31 sed -i "s/\/usr\/src\/kernels/${tmp}/g" ${LBUILD_DIR}/rhel8/kmodtool
34 # Next we replace %kernel_module_package with one that is nearly
35 # identical, but calls lbuild's modified kmodtool script.
36 # We need to cleanout the previous entry
37 sed -i "/^%kernel_module_package/,/^)}$/d" $RMAC
38 sed -e "s|REPLACE_ME|$LBUILD_KMODTOOL|" -e "s/\/usr\/src\/kernels/${tmp}/g" \
39 ${LBUILD_DIR}/rhel8/rpmmacros.template > ${LBUILD_DIR}/rhel8/rpmmacros
40 cat ${LBUILD_DIR}/rhel8/rpmmacros >> $RMAC
43 sed -i -e '/Provides: kernel-uname-r =/a\
44 Provides: kernel-lustre = %{KVRA}%{?1:.%{1}}\\' \
45 -e '/Provides: kernel-devel-uname-r =/a\
46 Provides: kernel-devel-lustre = %{KVRA}%{?1:.%{1}}\\' \
47 -e '/^ find $RPM_BUILD_ROOT\/lib\/modules\/$KernelVer/a\
48 cp -a fs/ext4/* $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/fs/ext4\
49 rm -f $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/fs/ext4/ext4-inode-test*' \
50 SPECS/$SPEC_NAME 2>&1 ||
51 fatal 1 "Error while editing SPECS/$SPEC_NAME"
57 # the el8 .spec file requires patch names to begin with "patch-3."
58 # so rename the lustre patch from lbuild to one the .spec will like
59 mv $TOPDIR/SOURCES/linux-${lnxmaj}-lustre.patch \
60 $TOPDIR/SOURCES/patch-${lnxmaj}-lustre.patch
62 # edit the SPEC with our changes
63 patch_spec_rhel8 "$buildid"
64 sed -i -e '/^# empty final patch to facilitate testing of kernel patches/i\
65 # adds Lustre patches\
66 Patch99995: patch-%{version}-lustre.patch' \
67 -e '/^ApplyOptionalPatch linux-kernel-test.patch/i\
70 ApplyOptionalPatch patch-%{version}-lustre.patch\
72 -e '/^# Dynamically generate kernel/a echo "CONFIG_BH_LRU_SIZE=16" >> config-generic'\
73 SPECS/$SPEC_NAME 2>&1 || \
74 fatal 1 "Error while editing SPECS/$SPEC_NAME"
81 unpack_linux_devel_rpm-rhel8() {
82 local callers_rpm="$1"
84 unpack_linux_devel_rpm-rhel "$callers_rpm"
93 if $KERNEL_LUSTRE_NAMING; then
94 echo -e "--define \"variant -lustre\" \c"
96 echo "--with firmware"
102 find_linux_rpm-rhel8() {
104 local wanted_kernel="$2"
105 local pathtorpms=${3:-"$KERNELRPMSBASE/$lnxmaj/$DISTROMAJ/$TARGET_ARCH"}
107 find_linux_rpm-rhel "$prefix" "$wanted_kernel" "$pathtorpms"
111 kernel_srpm_location() {
115 *8_4) kdir="8.4.2105" ;;
116 *8_3) kdir="8.3.2011" ;;
117 *8_2) kdir="8.2.2004" ;;
118 *8_1) kdir="8.1.1911" ;;
119 *8_0) kdir="8.0.1905" ;;
123 echo "http://vault.centos.org/$kdir/BaseOS/Source/SPackages/"
126 kernel_debuginfo_location() {
127 echo "http://debuginfo.centos.org/8/x86_64/Packages/"
130 cleanup_rpmmacros() {
131 sed -i "/^%kernel_module_package/,/^)}$/d" $RMAC
134 apply_kmod_requires_conflicts() {
136 # don't allow the patched kernel to be considered as a valid kernel
137 # for the patchless client
138 echo "Conflicts: kernel-lustre" >> rpm/kmp-lustre.preamble