scripts/package/debian/rules | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
In ThinPro, we use the convention <upstream_ver>+hp<patchlevel> for
the kernel package. This does not have a dash in the name or version.
This is built by editing ".version" before a build, and setting
EXTRAVERSION="+hp" and KDEB_PKGVERSION make variables:
echo 68 > .version
make -j<n> EXTRAVERSION="+hp" bindeb-pkg KDEB_PKGVERSION=6.12.2+hp69
.deb name: linux-image-6.12.2+hp_6.12.2+hp69_amd64.deb
Since commit 7d4f07d5cb71 ("kbuild: deb-pkg: squash
scripts/package/deb-build-option to debian/rules"), this no longer
works. The deb build logic changed, even though, the commit message
implies that the logic should be unmodified.
Before, KBUILD_BUILD_VERSION was not set if the KDEB_PKGVERSION did
not contain a dash. After the change KBUILD_BUILD_VERSION is always
set to KDEB_PKGVERSION. Since this determines UTS_VERSION,the uname
output to look off:
(now) uname -a: version 6.12.2+hp ... #6.12.2+hp69
(expected) uname -a: version 6.12.2+hp ... #69
Update the debian/rules logic to restore the original behavior.
Cc: <stable@vger.kernel.org>
Fixes: 7d4f07d5cb71 ("kbuild: deb-pkg: squash scripts/package/deb-build-option to debian/rules")
Signed-off-by: Alexandru Gagniuc <alexandru.gagniuc@hp.com>
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
---
Changes since v1:
* Rework logic so that dpkg-parsechangelog is invoked just once
* Adjust commit message to reflect review feedback
scripts/package/debian/rules | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/scripts/package/debian/rules b/scripts/package/debian/rules
index ca07243bd5cd..d1f400685682 100755
--- a/scripts/package/debian/rules
+++ b/scripts/package/debian/rules
@@ -21,9 +21,11 @@ ifeq ($(origin KBUILD_VERBOSE),undefined)
endif
endif
-revision = $(lastword $(subst -, ,$(shell dpkg-parsechangelog -S Version)))
+revision = $(shell dpkg-parsechangelog -S Version | sed -n 's/.*-//p')
CROSS_COMPILE ?= $(filter-out $(DEB_BUILD_GNU_TYPE)-, $(DEB_HOST_GNU_TYPE)-)
-make-opts = ARCH=$(ARCH) KERNELRELEASE=$(KERNELRELEASE) KBUILD_BUILD_VERSION=$(revision) $(addprefix CROSS_COMPILE=,$(CROSS_COMPILE))
+make-opts = ARCH=$(ARCH) KERNELRELEASE=$(KERNELRELEASE) $(addprefix \
+ KBUILD_BUILD_VERSION=,$(revision)) $(addprefix \
+ CROSS_COMPILE=,$(CROSS_COMPILE))
binary-targets := $(addprefix binary-, image image-dbg headers libc-dev)
--
2.48.1
On Tue, Mar 18, 2025 at 7:42 AM Alexandru Gagniuc
<alexandru.gagniuc@hp.com> wrote:
>
> In ThinPro, we use the convention <upstream_ver>+hp<patchlevel> for
> the kernel package. This does not have a dash in the name or version.
> This is built by editing ".version" before a build, and setting
> EXTRAVERSION="+hp" and KDEB_PKGVERSION make variables:
>
> echo 68 > .version
> make -j<n> EXTRAVERSION="+hp" bindeb-pkg KDEB_PKGVERSION=6.12.2+hp69
>
> .deb name: linux-image-6.12.2+hp_6.12.2+hp69_amd64.deb
>
> Since commit 7d4f07d5cb71 ("kbuild: deb-pkg: squash
> scripts/package/deb-build-option to debian/rules"), this no longer
> works. The deb build logic changed, even though, the commit message
> implies that the logic should be unmodified.
>
> Before, KBUILD_BUILD_VERSION was not set if the KDEB_PKGVERSION did
> not contain a dash. After the change KBUILD_BUILD_VERSION is always
> set to KDEB_PKGVERSION. Since this determines UTS_VERSION,the uname
> output to look off:
>
> (now) uname -a: version 6.12.2+hp ... #6.12.2+hp69
> (expected) uname -a: version 6.12.2+hp ... #69
>
> Update the debian/rules logic to restore the original behavior.
>
> Cc: <stable@vger.kernel.org>
> Fixes: 7d4f07d5cb71 ("kbuild: deb-pkg: squash scripts/package/deb-build-option to debian/rules")
> Signed-off-by: Alexandru Gagniuc <alexandru.gagniuc@hp.com>
> Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
> ---
> Changes since v1:
> * Rework logic so that dpkg-parsechangelog is invoked just once
> * Adjust commit message to reflect review feedback
>
> scripts/package/debian/rules | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/package/debian/rules b/scripts/package/debian/rules
> index ca07243bd5cd..d1f400685682 100755
> --- a/scripts/package/debian/rules
> +++ b/scripts/package/debian/rules
> @@ -21,9 +21,11 @@ ifeq ($(origin KBUILD_VERBOSE),undefined)
> endif
> endif
>
> -revision = $(lastword $(subst -, ,$(shell dpkg-parsechangelog -S Version)))
> +revision = $(shell dpkg-parsechangelog -S Version | sed -n 's/.*-//p')
> CROSS_COMPILE ?= $(filter-out $(DEB_BUILD_GNU_TYPE)-, $(DEB_HOST_GNU_TYPE)-)
> -make-opts = ARCH=$(ARCH) KERNELRELEASE=$(KERNELRELEASE) KBUILD_BUILD_VERSION=$(revision) $(addprefix CROSS_COMPILE=,$(CROSS_COMPILE))
> +make-opts = ARCH=$(ARCH) KERNELRELEASE=$(KERNELRELEASE) $(addprefix \
> + KBUILD_BUILD_VERSION=,$(revision)) $(addprefix \
> + CROSS_COMPILE=,$(CROSS_COMPILE))
Applied to linux-kbuild.
I fixed the place for wrapping for readability.
(In my previous reply, the code was wrapped by Gmail
in unintended places)
Thanks.
> binary-targets := $(addprefix binary-, image image-dbg headers libc-dev)
>
> --
> 2.48.1
>
--
Best Regards
Masahiro Yamada
© 2016 - 2025 Red Hat, Inc.