Whamcloud - gitweb
LU-15874 kernel: new kernel [RHEL 9.0 5.14.0-70.22.1.el9_0]
[fs/lustre-release.git] / contrib / lbuild / lbuild-rhel9
1 source ${LBUILD_DIR}/lbuild-rhel
2
3 # increment this if you have made a change that should force a new kernel
4 # to build built
5 BUILD_GEN+=".0"
6
7 SPEC_NAME="kernel.spec"
8 DEVEL_PATH_ARCH_DELIMETER="."
9 USE_KABI=false
10
11 # force local definition of %dist into ~/.rpmmacros
12 # to avoid verbose extended strings like ".el9.centos"
13 # in kernel version and rpm names
14 #
15 RMAC=$HOME/.rpmmacros
16 grep '^%dist' $RMAC &> /dev/null || echo '%dist .el9' >> $RMAC
17
18 patch_spec_rhel9() {
19         sed -i -e '/Provides: kernel-uname-r =/a\
20 Provides: kernel-lustre = %{KVRA}%{?1:.%{1}}\\' \
21                -e '/Provides: kernel-devel-uname-r =/a\
22 Provides: kernel-devel-lustre = %{KVRA}%{?1:.%{1}}\\' \
23                -e '/^    find $RPM_BUILD_ROOT\/lib\/modules\/$KernelVer/a\
24         cp -a fs/ext4/* $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/fs/ext4\
25         rm -f $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/fs/ext4/ext4-inode-test*' \
26         SPECS/$SPEC_NAME 2>&1 ||
27                 fatal 1 "Error while editing SPECS/$SPEC_NAME"
28 }
29
30 patch_spec() {
31         local buildid="$1"
32
33         # the el9 .spec file requires patch names to begin with "patch-3."
34         # so rename the lustre patch from lbuild to one the .spec will like
35         mv $TOPDIR/SOURCES/linux-${lnxmaj}-lustre.patch \
36                 $TOPDIR/SOURCES/patch-${lnxmaj}-lustre.patch
37
38         # edit the SPEC with our changes
39         patch_spec_rhel9 "$buildid"
40         sed -i -e '/^# empty final patch to facilitate testing of kernel patches/i\
41 # adds Lustre patches\
42 Patch99995: patch-%{version}-lustre.patch' \
43                -e '/^ApplyOptionalPatch linux-kernel-test.patch/i\
44 \
45 # lustre patch\
46 ApplyOptionalPatch patch-%{version}-lustre.patch\
47 ' \
48                 -e '/^# Dynamically generate kernel/a echo "CONFIG_BH_LRU_SIZE=16" >> config-generic'\
49         SPECS/$SPEC_NAME 2>&1 ||
50                 fatal 1 "Error while editing SPECS/$SPEC_NAME"
51 }
52
53 unpack_linux_devel_rpm-rhel9() {
54         local callers_rpm="$1"
55
56         unpack_linux_devel_rpm-rhel "$callers_rpm"
57 }
58
59 get_rpmbuildopts() {
60         if $KERNEL_LUSTRE_NAMING; then
61                 echo -e "--define \"variant -lustre\" \c"
62         fi
63
64         echo "--with firmware --without debug"
65 }
66
67 find_linux_rpm-rhel9() {
68         local prefix="$1"
69         local wanted_kernel="$2"
70         local pathtorpms=${3:-"$KERNELRPMSBASE/$lnxmaj/$DISTROMAJ/$TARGET_ARCH"}
71
72         find_linux_rpm-rhel "$prefix" "$wanted_kernel" "$pathtorpms"
73 }
74
75 kernel_srpm_location() {
76         local base_os="http://mirror.stream.centos.org/9-stream/BaseOS"
77
78         echo "$base_os/source/tree/Packages/"
79 }
80
81 kernel_debuginfo_location() {
82         local base_os="http://mirror.stream.centos.org/9-stream/BaseOS"
83
84         echo "$base_os/$TARGET_ARCH/debug/tree/Packages/"
85 }
86
87 apply_kmod_requires_conflicts() {
88         if $PATCHLESS; then
89                 # don't allow the patched kernel to be considered as
90                 # a valid kernel for the patchless client
91                 echo "Conflicts:      kernel-lustre" >> rpm/kmp-lustre.preamble
92         fi
93 }