1 source ${LBUILD_DIR}/lbuild-rhel
3 # increment this if you have made a change that should force a new kernel
7 SPEC_NAME="kernel.spec"
8 DEVEL_PATH_ARCH_DELIMETER="."
11 # force local definition of %dist into ~/.rpmmacros
12 # to avoid verbose extended strings like ".el9.centos"
13 # in kernel version and rpm names
16 grep '^%dist' $RMAC &> /dev/null || echo '%dist .el9' >> $RMAC
18 # We modify the RHEL9 kmodtool script, because it expects
19 # the kernel source to be in the correct packaged RHEL location.
20 # lbuild does not put the source in correct packaged RHEL location.
21 RHEL_KMODTOOL=/usr/lib/rpm/redhat/kmodtool
22 LBUILD_KMODTOOL="${LBUILD_DIR}/rhel9/kmodtool"
23 cp $RHEL_KMODTOOL $LBUILD_KMODTOOL
24 pushd ${LBUILD_DIR}/rhel9
25 # Replace the hardcoded /usr/src/kernels with our build path
26 tmp="${TOPDIR}/reused/usr/src/kernels"
27 sed -i "s|/usr/src/kernels|${tmp}|g" ${LBUILD_DIR}/rhel9/kmodtool
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|" -e "s|/usr/src/kernels|${tmp}|g" \
35 ${LBUILD_DIR}/rhel9/rpmmacros.template > ${LBUILD_DIR}/rhel9/rpmmacros
36 cat ${LBUILD_DIR}/rhel9/rpmmacros >> $RMAC
39 sed -i -e '/Provides: kernel-uname-r =/a\
40 Provides: kernel-lustre = %{KVRA}%{?1:.%{1}}\\' \
41 -e '/Provides: kernel-devel-uname-r =/a\
42 Provides: kernel-devel-lustre = %{KVRA}%{?1:.%{1}}\\' \
43 -e '/^ find $RPM_BUILD_ROOT\/lib\/modules\/$KernelVer/a\
44 cp -a fs/ext4/* $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/fs/ext4\
45 rm -f $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/fs/ext4/ext4-inode-test*' \
46 -e '/^%global efiuki 1/s/1/0/'\
47 SPECS/$SPEC_NAME 2>&1 ||
48 fatal 1 "Error while editing SPECS/$SPEC_NAME"
54 # the el9 .spec file requires patch names to begin with "patch-3."
55 # so rename the lustre patch from lbuild to one the .spec will like
56 mv $TOPDIR/SOURCES/linux-${lnxmaj}-lustre.patch \
57 $TOPDIR/SOURCES/patch-${lnxmaj}-lustre.patch
59 # edit the SPEC with our changes
60 patch_spec_rhel9 "$buildid"
61 sed -i -e '/^# empty final patch to facilitate testing of kernel patches/i\
62 # adds Lustre patches\
63 Patch99995: patch-%{version}-lustre.patch' \
64 -e '/^ApplyOptionalPatch linux-kernel-test.patch/i\
67 ApplyOptionalPatch patch-%{version}-lustre.patch\
69 -e '/^# Dynamically generate kernel/a echo "CONFIG_BH_LRU_SIZE=16" >> config-generic'\
70 SPECS/$SPEC_NAME 2>&1 ||
71 fatal 1 "Error while editing SPECS/$SPEC_NAME"
74 unpack_linux_devel_rpm-rhel9() {
75 local callers_rpm="$1"
77 unpack_linux_devel_rpm-rhel "$callers_rpm"
81 if $KERNEL_LUSTRE_NAMING; then
82 echo -e "--define \"variant -lustre\" \c"
85 echo "--with firmware --without debug"
88 find_linux_rpm-rhel9() {
90 local wanted_kernel="$2"
91 local pathtorpms=${3:-"$KERNELRPMSBASE/$lnxmaj/$DISTROMAJ/$TARGET_ARCH"}
93 find_linux_rpm-rhel "$prefix" "$wanted_kernel" "$pathtorpms"
96 kernel_srpm_location() {
97 local base_os="http://mirror.stream.centos.org/9-stream/BaseOS"
99 echo "$base_os/source/tree/Packages/"
102 kernel_debuginfo_location() {
103 local base_os="http://mirror.stream.centos.org/9-stream/BaseOS"
105 echo "$base_os/$TARGET_ARCH/debug/tree/Packages/"
108 apply_kmod_requires_conflicts() {
110 # don't allow the patched kernel to be considered as
111 # a valid kernel for the patchless client
112 echo "Conflicts: kernel-lustre" >> rpm/kmp-lustre.preamble