Skip to content

Commit 94d32a9

Browse files
[draft] better handle kABI checks
Performing kABI checks on non-RT LTS kernels is necessary. To check which kernel is which, enforce branch naming in the kernel build script so that we can determine which "base" branch is being developed. Once we determine which "base" branch is being developed, we can easily determine if it is an RT kernel or not. Enable kABI check if it is a non-RT kernel and also track the upstream git tag from which we branched off. Check for the presence of the kernel-dist-git directory and instruct on how to set it up if absent. The upstream git tag is tracked so that we can checkout the kernel-dist-git repository to the given dist tag, ensuring that the kABI check fails only because of a kABI change, and not because the correct tag wasn't checked out.
1 parent a33a3d3 commit 94d32a9

File tree

1 file changed

+70
-8
lines changed

1 file changed

+70
-8
lines changed

kernel_build.sh

Lines changed: 70 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,25 @@
33

44
pwd
55

6-
BRANCH=$(git branch | grep \* | cut -d ' ' -f2 | sed -r 's/[{}/]/_/g')
6+
REAL_BRANCH="$(git branch --show-current)"
7+
# Enforce branch naming so that we can determine
8+
# 1. If a kABI check is even necessary
9+
# 2. Which git tag to checkout in the kernel-dist-git
10+
# Can do with an if but I always get it wrong
11+
if ! echo "$REAL_BRANCH" | grep -q -E '((ciqlts[0-9]+_[0-9]+(-rt)?|ciqcbr7_9)$|fips-([0-9]+|legacy-[0-9]+)(-compliant|-certified)?/)'; then
12+
echo "Unexpected branch name."
13+
echo "Either of the following must be present (part of) in the branch name, enforced for kABI check."
14+
echo "- 'ciqcbr7_9'"
15+
echo "- 'ciqltsX_Y'"
16+
echo "- 'ciqltsX_Y-rt'"
17+
echo "- 'fips-legacy-X-compliant/'"
18+
echo "- 'fips-legacy-X/'"
19+
echo "- 'fips-X/'"
20+
echo "- 'fips-X-compliant/'"
21+
echo "- 'fips-X-certified/'"
22+
exit 1
23+
fi
24+
BRANCH=$(echo "$REAL_BRANCH" | sed -r 's/[{}/]/_/g')
725

826
START=$(date +%s)
927
START_MRPROPER=$(date +%s)
@@ -86,14 +104,58 @@ fi
86104
END_INSTALL=$(date +%s)
87105
echo "[TIMER]{INSTALL}: $(( $END_INSTALL - $START_INSTALL ))s"
88106

89-
echo "Checking kABI"
90-
# ../kernel-dist-git/SOURCES/check-kabi -k ../kernel-dist-git/SOURCES/Module.kabi_x86_64 -s Module.symvers || echo "kABI failed"
91-
KABI_CHECK=$(../kernel-dist-git/SOURCES/check-kabi -k ../kernel-dist-git/SOURCES/Module.kabi_${ARCH} -s Module.symvers)
92-
if [ $? -ne 0 ]; then
93-
echo "Error: kABI check failed"
94-
exit 1
107+
# "temporary" duct tape
108+
KERNEL_DIST_GIT_TAG=undecided
109+
CHECK_KABI=undecided
110+
# TODO: find status of FIPS and CBR and implement it here
111+
if echo "$REAL_BRANCH" | grep -q 'ciqlts8_6-rt'; then
112+
CHECK_KABI=false
113+
114+
elif echo "$REAL_BRANCH" | grep -q 'ciqlts8_8-rt'; then
115+
CHECK_KABI=false
116+
117+
elif echo "$REAL_BRANCH" | grep -q 'ciqlts9_2-rt'; then
118+
CHECK_KABI=false
119+
120+
elif echo "$REAL_BRANCH" | grep -q 'ciqlts8_6'; then
121+
CHECK_KABI=true
122+
KERNEL_DIST_GIT_TAG='imports/r8/kernel-4.18.0-372.32.1.el8_6'
123+
124+
elif echo "$REAL_BRANCH" | grep -q 'ciqlts8_8'; then
125+
CHECK_KABI=true
126+
KERNEL_DIST_GIT_TAG='imports/r8/kernel-4.18.0-477.27.1.el8_8'
127+
128+
elif echo "$REAL_BRANCH" | grep -q 'ciqlts9_2'; then
129+
CHECK_KABI=true
130+
KERNEL_DIST_GIT_TAG='imports/r9/kernel-5.14.0-284.30.1.el9_2'
131+
132+
elif echo "$REAL_BRANCH" | grep -q 'ciqlts9_4'; then
133+
CHECK_KABI=true
134+
KERNEL_DIST_GIT_TAG='imports/r9/kernel-5.14.0-427.42.1.el9_4'
135+
136+
else
137+
echo "Warning: Could not determine if kABI check was necessary, defaulting to 'no.'"
138+
CHECK_KABI=false
139+
fi
140+
141+
if [ $CHECK_KABI == 'true' ]; then
142+
echo "Checking kABI"
143+
if [ ! -d ../kernel-dist-git ]; then
144+
echo "Error: kernel-dist-git is missing."
145+
echo "RUN: 'git clone https://git.rockylinux.org/staging/rpms/kernel.git $(realpath ../kernel-dist-git)'"
146+
echo "RUN: 'git -C $(realpath ../kernel-dist-git) checkout $KERNEL_DIST_GIT_TAG'"
147+
exit 1
148+
fi
149+
# make sure we're on the right branch (the commit author is bad at this and this check exists for him)
150+
git -C "$(realpath ../kernel-dist-git)" checkout "$KERNEL_DIST_GIT_TAG"
151+
KABI_CHECK=$(../kernel-dist-git/SOURCES/check-kabi -k ../kernel-dist-git/SOURCES/Module.kabi_${ARCH} -s Module.symvers)
152+
if [ $? -ne 0 ]; then
153+
echo "Error: kABI check failed"
154+
exit 1
155+
fi
156+
157+
echo "kABI check passed"
95158
fi
96-
echo "kABI check passed"
97159

98160
GRUB_INFO=$(sudo grubby --info=ALL | grep -E "^kernel|^index")
99161

0 commit comments

Comments
 (0)