Linux kbuild/kconfig development
 help / color / mirror / Atom feed
* [PATCH] kbuild: deb-pkg: allow to set package name version
@ 2026-10-19 19:16 Guido Günther
  2026-10-20 19:16 ` sashiko-bot
  2026-10-20 20:02 ` Nicolas Schier
  0 siblings, 2 replies; 6+ messages in thread
From: Guido Günther @ 2026-10-19 19:16 UTC (permalink / raw)
  To: Nathan Chancellor, Nicolas Schier
  Cc: linux-kbuild, linux-kernel, Guido Günther

Instead of hardcoding ${KERNELRELEASE} in the package name allow
the user to override this.

This can be useful if one doesn't want to accumulate different packages
for every commit or micro version bump by setting
KDEB_PKGNAMEVERSION=7.3 or even KDEB_PKGNAMEVERSION=stable.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
---
 scripts/package/mkdebian | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
index d4b007b38a475..44ca9991fd6f4 100755
--- a/scripts/package/mkdebian
+++ b/scripts/package/mkdebian
@@ -172,6 +172,12 @@ else
 	packagename=linux-image
 fi
 
+if [ "${KDEB_PKGNAMEVERSION:+set}" ]; then
+	packagenameversion=$KDEB_PKGNAMEVERSION
+else
+	packagenameversion=$KERNELRELEASE
+fi
+
 debarch=
 set_debarch
 
@@ -215,7 +221,7 @@ Build-Depends-Arch: bc, bison, flex,
  python3:native, rsync
 Homepage: https://www.kernel.org/
 
-Package: $packagename-${KERNELRELEASE}
+Package: $packagename-${packagenameversion}
 Architecture: $debarch
 Description: Linux kernel, version ${KERNELRELEASE}
  This package contains the Linux kernel, modules and corresponding other
@@ -238,7 +244,7 @@ EOF
 if is_enabled CONFIG_MODULES; then
 cat <<EOF >> debian/control
 
-Package: linux-headers-${KERNELRELEASE}
+Package: linux-headers-${packagenameversion}
 Architecture: $debarch
 Build-Profiles: <!pkg.${sourcename}.nokernelheaders>
 Description: Linux kernel headers for ${KERNELRELEASE} on $debarch
@@ -252,7 +258,7 @@ fi
 if is_enabled CONFIG_DEBUG_INFO; then
 cat <<EOF >> debian/control
 
-Package: linux-image-${KERNELRELEASE}-dbg
+Package: linux-image-${packagenameversion}-dbg
 Section: debug
 Architecture: $debarch
 Build-Profiles: <!pkg.${sourcename}.nokerneldbg>

---
base-commit: c03c1a14507dfaf8b856c2608f9ac216021fc222
change-id: 20261019-deb-pkg-a6ef2837687e

Best regards,
--  
Guido Günther <agx@sigxcpu.org>


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] kbuild: deb-pkg: allow to set package name version
  2026-10-19 19:16 [PATCH] kbuild: deb-pkg: allow to set package name version Guido Günther
@ 2026-10-20 19:16 ` sashiko-bot
  2026-10-20 19:48   ` Guido Günther
  2026-10-20 20:02 ` Nicolas Schier
  1 sibling, 1 reply; 6+ messages in thread
From: sashiko-bot @ 2026-10-20 19:16 UTC (permalink / raw)
  To: Guido Günther, Nathan Chancellor, Nicolas Schier; +Cc: linux-kbuild

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] kbuild: deb-pkg: broken build symlink in install_kernel_headers()
--

commit bc8efaaf9e21748a005be3c75bb9c6c2334ac049
Author: Guido Günther <agx@sigxcpu.org>

kbuild: deb-pkg: allow to set package name version

This commit introduces KDEB_PKGNAMEVERSION in scripts/package/mkdebian to
allow overriding the version suffix used in the generated Debian binary
package names instead of always using KERNELRELEASE.

> diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
> index d4b007b38a475..44ca9991fd6f4 100755
> --- a/scripts/package/mkdebian
> +++ b/scripts/package/mkdebian
> @@ -172,6 +172,12 @@ else
>  	packagename=linux-image
>  fi
>  
> +if [ "${KDEB_PKGNAMEVERSION:+set}" ]; then
> +	packagenameversion=$KDEB_PKGNAMEVERSION
> +else
> +	packagenameversion=$KERNELRELEASE
> +fi
> +
>  debarch=
>  set_debarch
>  
> @@ -215,7 +221,7 @@ Build-Depends-Arch: bc, bison, flex,
>   python3:native, rsync
>  Homepage: https://www.kernel.org/
>  
> -Package: $packagename-${KERNELRELEASE}
> +Package: $packagename-${packagenameversion}
>  Architecture: $debarch
>  Description: Linux kernel, version ${KERNELRELEASE}
>   This package contains the Linux kernel, modules and corresponding other
> @@ -238,7 +244,7 @@ EOF
>  if is_enabled CONFIG_MODULES; then
>  cat <<EOF >> debian/control
>  
> -Package: linux-headers-${KERNELRELEASE}
> +Package: linux-headers-${packagenameversion}

[Severity: Medium]
When KDEB_PKGNAMEVERSION is set to a value different from KERNELRELEASE (such
as 7.3 or stable) with CONFIG_MODULES enabled, does this break the
/lib/modules/${KERNELRELEASE}/build symlink in the linux-headers package?

In scripts/package/builddeb, install_linux_image() installs modules under
/lib/modules/${KERNELRELEASE} and removes the build symlink so the headers
package can provide it:

scripts/package/builddeb:install_linux_image() {
	...
	${MAKE} -f ${srctree}/Makefile INSTALL_MOD_PATH="${pdir}" INSTALL_MOD_STRIP=1 modules_install
	rm -f "${pdir}/lib/modules/${KERNELRELEASE}/build"
	...
}

However, install_kernel_headers() in scripts/package/builddeb derives
$version by stripping "linux-headers-" from the package name ($1) rather than
using ${KERNELRELEASE}:

scripts/package/builddeb:install_kernel_headers() {
	pdir=debian/$1
	version=${1#linux-headers-}
	...
	mkdir -p $pdir/lib/modules/$version/
	ln -s /usr/src/linux-headers-$version $pdir/lib/modules/$version/build
}

Because $1 is now linux-headers-${KDEB_PKGNAMEVERSION}, won't
install_kernel_headers() create the symlink at
/lib/modules/${KDEB_PKGNAMEVERSION}/build instead of
/lib/modules/${KERNELRELEASE}/build, leaving /lib/modules/$(uname -r)/build
missing for out-of-tree module builds and DKMS?

[ ... ]

>
>
>
>
>
>
>
>
>
>
>
>
>
>

[]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261019-deb-pkg-v1-1-7f8e60bbede5@sigxcpu.org?part=1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] kbuild: deb-pkg: allow to set package name version
  2026-10-20 19:16 ` sashiko-bot
@ 2026-10-20 19:48   ` Guido Günther
  0 siblings, 0 replies; 6+ messages in thread
From: Guido Günther @ 2026-10-20 19:48 UTC (permalink / raw)
  To: sashiko-reviews; +Cc: Nathan Chancellor, Nicolas Schier, linux-kbuild

Hi,
On Tue, Oct 20, 2026 at 07:16:51PM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] kbuild: deb-pkg: broken build symlink in install_kernel_headers()
> --
> 
> commit bc8efaaf9e21748a005be3c75bb9c6c2334ac049
> Author: Guido Günther <agx@sigxcpu.org>
> 
> kbuild: deb-pkg: allow to set package name version
> 
> This commit introduces KDEB_PKGNAMEVERSION in scripts/package/mkdebian to
> allow overriding the version suffix used in the generated Debian binary
> package names instead of always using KERNELRELEASE.

That's true, the script should use ${KERNELRELEASE} when referring to the
kernel version and $version elsewhere. Other parts of the script have
that correct so it's just a:

diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index ba1defc616524..5fdc9ea0dcca4 100755
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -147,8 +147,8 @@ install_kernel_headers () {
 		"${srctree}/scripts/package/install-extmod-build" "${pdir}/usr/src/linux-headers-${version}"
 	fi
 
-	mkdir -p $pdir/lib/modules/$version/
-	ln -s /usr/src/linux-headers-$version $pdir/lib/modules/$version/build
+	mkdir -p $pdir/lib/modules/${KERNELRELEASE}/
+	ln -s /usr/src/linux-headers-$version $pdir/lib/modules/${KERNELRELEASE}/build
 }
 
 install_libc_headers () {

I'll fold that into a v2 after waiting a bit more for other feedback.

Cheers,
 -- Guido

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] kbuild: deb-pkg: allow to set package name version
  2026-10-19 19:16 [PATCH] kbuild: deb-pkg: allow to set package name version Guido Günther
  2026-10-20 19:16 ` sashiko-bot
@ 2026-10-20 20:02 ` Nicolas Schier
  2026-10-20 20:16   ` Thomas Weißschuh
  2026-10-20 21:16   ` Guido Günther
  1 sibling, 2 replies; 6+ messages in thread
From: Nicolas Schier @ 2026-10-20 20:02 UTC (permalink / raw)
  To: Guido Günther; +Cc: Nathan Chancellor, linux-kbuild, linux-kernel

On Mon, Oct 19, 2026 at 09:16:14PM +0200, Guido Günther wrote:
> Instead of hardcoding ${KERNELRELEASE} in the package name allow
> the user to override this.
> 
> This can be useful if one doesn't want to accumulate different packages
> for every commit or micro version bump by setting
> KDEB_PKGNAMEVERSION=7.3 or even KDEB_PKGNAMEVERSION=stable.

I am not yet convinced, that this is a good idea.  Do you want to
elaborate a bit more, why you think this is necessary?  Have you tested
your patch?  I don't like that source package name and binary package
name divert w/o good reasoning.

Kind regards
Nicolas

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] kbuild: deb-pkg: allow to set package name version
  2026-10-20 20:02 ` Nicolas Schier
@ 2026-10-20 20:16   ` Thomas Weißschuh
  2026-10-20 21:16   ` Guido Günther
  1 sibling, 0 replies; 6+ messages in thread
From: Thomas Weißschuh @ 2026-10-20 20:16 UTC (permalink / raw)
  To: Nicolas Schier, Guido Günther, Nathan Chancellor,
	linux-kbuild, linux-kernel

On 2026-10-20 22:02:25+0200, Nicolas Schier wrote:
> On Mon, Oct 19, 2026 at 09:16:14PM +0200, Guido Günther wrote:
> > Instead of hardcoding ${KERNELRELEASE} in the package name allow
> > the user to override this.
> > 
> > This can be useful if one doesn't want to accumulate different packages
> > for every commit or micro version bump by setting
> > KDEB_PKGNAMEVERSION=7.3 or even KDEB_PKGNAMEVERSION=stable.
> 
> I am not yet convinced, that this is a good idea.  Do you want to
> elaborate a bit more, why you think this is necessary?  Have you tested
> your patch?  I don't like that source package name and binary package
> name divert w/o good reasoning.

FWIW we have something similar for the Arch Linux packaging with
PACMAN_PKGBASE. It is the complement to the proposed patch, as Arch Linux
by default does *not* allow multiple installed kernel packages of a
single type at the same time. PACMAN_PKGBASE allows this.
KDEB_PKGNAMEVERSION would enable the Arch Linux behavior for the Debian
packages. Personally I would have found this convenient in the past.


Thomas

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] kbuild: deb-pkg: allow to set package name version
  2026-10-20 20:02 ` Nicolas Schier
  2026-10-20 20:16   ` Thomas Weißschuh
@ 2026-10-20 21:16   ` Guido Günther
  1 sibling, 0 replies; 6+ messages in thread
From: Guido Günther @ 2026-10-20 21:16 UTC (permalink / raw)
  To: Nicolas Schier, Nathan Chancellor, linux-kbuild, linux-kernel

Hi Nicolas,
On Tue, Oct 20, 2026 at 10:02:25PM +0200, Nicolas Schier wrote:
> On Mon, Oct 19, 2026 at 09:16:14PM +0200, Guido Günther wrote:
> > Instead of hardcoding ${KERNELRELEASE} in the package name allow
> > the user to override this.
> > 
> > This can be useful if one doesn't want to accumulate different packages
> > for every commit or micro version bump by setting
> > KDEB_PKGNAMEVERSION=7.3 or even KDEB_PKGNAMEVERSION=stable.
> 
> I am not yet convinced, that this is a good idea.  Do you want to
> elaborate a bit more, why you think this is necessary?  Have you tested
> your patch?  I don't like that source package name and binary package
> name divert w/o good reasoning.

The source and the binary package names can already differ due to the
`KDEB_SOURCENAME` variable (and we're making use of that).

What this patch adds is the ability to control the suffix so we can
e.g. build a `linux-ng-foo` and a `linux-stable-bar` instead of having a
linux-image-7.3.17, linux-image-7.3.18 (or with git versions or …). It's
just about having a bit more control over the generated binary package
names so we can decide what replaces what on upgrades.

I have tested the patch with and without setting KDEB_PKGNAMEVERSION.
Without setting this variable nothing should change for existing users.

Cheers,
 -- Guido

> 
> Kind regards
> Nicolas
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-10-20 21:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-19 19:16 [PATCH] kbuild: deb-pkg: allow to set package name version Guido Günther
2026-10-20 19:16 ` sashiko-bot
2026-10-20 19:48   ` Guido Günther
2026-10-20 20:02 ` Nicolas Schier
2026-10-20 20:16   ` Thomas Weißschuh
2026-10-20 21:16   ` Guido Günther

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox