Re: Change in kernel debian packages between -rc2 and -rc3

From: Theodore Ts'o
Date: Sat Apr 01 2023 - 23:42:06 EST


I've worked around this in xfstests-bld.

- Ted

commit e3309f769882397e605f956755dfec30f1f3f196
Author: Theodore Ts'o <tytso@xxxxxxx>
Date: Sat Apr 1 23:22:09 2023 -0400

kernel-build: work around backwards incompatible change in "make bindeb-pkg"

Starting in v6.3-rc3, "make bindeb-pkg" made an incompatible change in
how the debian package version is constructed, by dropping
CONFIG_LOCALVERSION from the package version. This might make sense
given that Debian and Ubuntu try to adhere to Stable ABI nonsense with
their Distribution kernels, but the default version chosen by "make
bindeb-pkg" isn't compatible with the stable ABI nonsense versioning
scheme in any case, so the change just breaks upstream developers for
no good reason.

Fix this by overriding the package version using KDEB_PKGVERSION,
which is not documented, but hopefully it won't also incompatibly
change in the future. :-(

Signed-off-by: Theodore Ts'o <tytso@xxxxxxx>

diff --git a/kernel-build/kbuild b/kernel-build/kbuild
index 16dfb7cd..4ab9ea28 100755
--- a/kernel-build/kbuild
+++ b/kernel-build/kbuild
@@ -153,7 +153,25 @@ rm -f "$BLD_DIR/linux-image.deb" "$BLD_DIR/linux-image-dbg.deb" \
if test -n "$DO_DPKG" ; then
$NO_ACTION make "${MAKE_ARGS[@]}" prepare
REL=$(make "${MAKE_ARGS[@]}" kernelrelease | grep -v ^make)
- $NO_ACTION time nice make "KDEB_SOURCENAME=linux-${REL}" "${MAKE_ARGS[@]}" \
+ MAJOR=$(echo $REL | awk -F. '{print $1}')
+ MINOR=$(echo $REL | awk -F. '{print $2}')
+ if test -f "$BLD_DIR/.version" ; then
+ NUM=$(cat "$BLD_DIR/.version")
+ # Starting in 6.1, how "make bindeb-pkg" handled the
+ # .version numbering randomly changed; accomodate that
+ # here. Things are broken starting in 6.1-rc1 until 6.1-rc6
+ # but we won't worry about that here. See commit
+ # 5db8face97f8 ("kbuild: Restore .version auto-increment behaviour
+ # for Debian packages") which fixed the problem but in a way
+ # which was different compared to how 6.0 and earlier kernels
+ # handled things.
+ if test "$MAJOR" -ge 6 -a "$MINOR" -ge 1 ; then
+ NUM=$(( $NUM + 1 ))
+ fi
+ else
+ NUM=1
+ fi
+ $NO_ACTION time nice make "KDEB_PKGVERSION=$REL-$NUM" "KDEB_SOURCENAME=linux-${REL}" "${MAKE_ARGS[@]}" \
bindeb-pkg "$@"
err=$?
d="$BLD_DIR/.."