* [PATCH] kbuild: deb-pkg: Allow setting package name at build
@ 2026-05-05 15:29 Mario Limonciello (AMD)
2026-05-17 6:57 ` Nicolas Schier
0 siblings, 1 reply; 3+ messages in thread
From: Mario Limonciello (AMD) @ 2026-05-05 15:29 UTC (permalink / raw)
To: mario.limonciello, nathan, nsc, corbet, skhan
Cc: Mario Limonciello (AMD), linux-kbuild, linux-doc
Users can change the source package by setting variable `KDEB_SOURCENAME`,
but the binary package name is hardcoded.
Add support for setting binary package name by using `KDEB_PACKAGENAME`
and let it affect both kernel image and debug image packages.
Update kbuild documentation to include defaults and mention both
`KDEB_PACKAGENAME` and `KDEB_SOURCENAME`.
Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
---
Documentation/kbuild/kbuild.rst | 10 ++++++++++
scripts/package/mkdebian | 6 ++++--
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/Documentation/kbuild/kbuild.rst b/Documentation/kbuild/kbuild.rst
index 5a9013bacfb75..cbdd2224c3a55 100644
--- a/Documentation/kbuild/kbuild.rst
+++ b/Documentation/kbuild/kbuild.rst
@@ -177,6 +177,16 @@ the UTS_MACHINE variable, and on some architectures also the kernel config.
The value of KBUILD_DEBARCH is assumed (not checked) to be a valid Debian
architecture.
+KDEB_SOURCENAME
+----------------
+For the deb-pkg target, allows overriding the default source package name.
+The default package name is "linux-upstream".
+
+KDEB_PACKAGENAME
+----------------
+For the deb-pkg target, allows overriding the default binary package name.
+The default package name is "linux-image".
+
KDOCFLAGS
---------
Specify extra (warning/error) flags for kernel-doc checks during the build,
diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
index d4b007b38a475..cbe4266fac732 100755
--- a/scripts/package/mkdebian
+++ b/scripts/package/mkdebian
@@ -166,7 +166,9 @@ else
fi
sourcename=${KDEB_SOURCENAME:-linux-upstream}
-if [ "$ARCH" = "um" ] ; then
+if [ "${KDEB_PACKAGENAME:+set}" ]; then
+ packagename=$KDEB_PACKAGENAME
+elif [ "$ARCH" = "um" ]; then
packagename=user-mode-linux
else
packagename=linux-image
@@ -252,7 +254,7 @@ fi
if is_enabled CONFIG_DEBUG_INFO; then
cat <<EOF >> debian/control
-Package: linux-image-${KERNELRELEASE}-dbg
+Package: $packagename-${KERNELRELEASE}-dbg
Section: debug
Architecture: $debarch
Build-Profiles: <!pkg.${sourcename}.nokerneldbg>
--
2.53.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] kbuild: deb-pkg: Allow setting package name at build
2026-05-05 15:29 [PATCH] kbuild: deb-pkg: Allow setting package name at build Mario Limonciello (AMD)
@ 2026-05-17 6:57 ` Nicolas Schier
2026-05-19 0:08 ` Mario Limonciello
0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Schier @ 2026-05-17 6:57 UTC (permalink / raw)
To: Mario Limonciello (AMD)
Cc: mario.limonciello, nathan, corbet, skhan, linux-kbuild, linux-doc
On Tue, May 05, 2026 at 10:29:54AM -0500, Mario Limonciello (AMD) wrote:
> Users can change the source package by setting variable `KDEB_SOURCENAME`,
> but the binary package name is hardcoded.
>
> Add support for setting binary package name by using `KDEB_PACKAGENAME`
> and let it affect both kernel image and debug image packages.
>
> Update kbuild documentation to include defaults and mention both
> `KDEB_PACKAGENAME` and `KDEB_SOURCENAME`.
>
> Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
> ---
> Documentation/kbuild/kbuild.rst | 10 ++++++++++
> scripts/package/mkdebian | 6 ++++--
> 2 files changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/kbuild/kbuild.rst b/Documentation/kbuild/kbuild.rst
> index 5a9013bacfb75..cbdd2224c3a55 100644
> --- a/Documentation/kbuild/kbuild.rst
> +++ b/Documentation/kbuild/kbuild.rst
> @@ -177,6 +177,16 @@ the UTS_MACHINE variable, and on some architectures also the kernel config.
> The value of KBUILD_DEBARCH is assumed (not checked) to be a valid Debian
> architecture.
>
> +KDEB_SOURCENAME
> +----------------
> +For the deb-pkg target, allows overriding the default source package name.
> +The default package name is "linux-upstream".
> +
> +KDEB_PACKAGENAME
> +----------------
> +For the deb-pkg target, allows overriding the default binary package name.
> +The default package name is "linux-image".
Do you see a real need for that? (We should prevent adding
complexity when it's not neccessary.)
> +
> KDOCFLAGS
> ---------
> Specify extra (warning/error) flags for kernel-doc checks during the build,
> diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
> index d4b007b38a475..cbe4266fac732 100755
> --- a/scripts/package/mkdebian
> +++ b/scripts/package/mkdebian
> @@ -166,7 +166,9 @@ else
> fi
> sourcename=${KDEB_SOURCENAME:-linux-upstream}
>
> -if [ "$ARCH" = "um" ] ; then
> +if [ "${KDEB_PACKAGENAME:+set}" ]; then
> + packagename=$KDEB_PACKAGENAME
> +elif [ "$ARCH" = "um" ]; then
> packagename=user-mode-linux
> else
> packagename=linux-image
> @@ -252,7 +254,7 @@ fi
> if is_enabled CONFIG_DEBUG_INFO; then
> cat <<EOF >> debian/control
>
> -Package: linux-image-${KERNELRELEASE}-dbg
> +Package: $packagename-${KERNELRELEASE}-dbg
> Section: debug
> Architecture: $debarch
> Build-Profiles: <!pkg.${sourcename}.nokerneldbg>
> --
> 2.53.0
>
Did you test that patch?
These changes are not enough, as scripts/package/builddeb does not pick
up the non-standard binary package name in its final 'case', and thus,
_no_ binary package will be generated if KDEB_PACKAGENAME !=
"linux-image".
Kind regards,
Nicolas
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] kbuild: deb-pkg: Allow setting package name at build
2026-05-17 6:57 ` Nicolas Schier
@ 2026-05-19 0:08 ` Mario Limonciello
0 siblings, 0 replies; 3+ messages in thread
From: Mario Limonciello @ 2026-05-19 0:08 UTC (permalink / raw)
To: mario.limonciello, nathan, corbet, skhan, linux-kbuild, linux-doc
On 5/17/26 01:57, Nicolas Schier wrote:
> On Tue, May 05, 2026 at 10:29:54AM -0500, Mario Limonciello (AMD) wrote:
>> Users can change the source package by setting variable `KDEB_SOURCENAME`,
>> but the binary package name is hardcoded.
>>
>> Add support for setting binary package name by using `KDEB_PACKAGENAME`
>> and let it affect both kernel image and debug image packages.
>>
>> Update kbuild documentation to include defaults and mention both
>> `KDEB_PACKAGENAME` and `KDEB_SOURCENAME`.
>>
>> Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
>> ---
>> Documentation/kbuild/kbuild.rst | 10 ++++++++++
>> scripts/package/mkdebian | 6 ++++--
>> 2 files changed, 14 insertions(+), 2 deletions(-)
>>
>> diff --git a/Documentation/kbuild/kbuild.rst b/Documentation/kbuild/kbuild.rst
>> index 5a9013bacfb75..cbdd2224c3a55 100644
>> --- a/Documentation/kbuild/kbuild.rst
>> +++ b/Documentation/kbuild/kbuild.rst
>> @@ -177,6 +177,16 @@ the UTS_MACHINE variable, and on some architectures also the kernel config.
>> The value of KBUILD_DEBARCH is assumed (not checked) to be a valid Debian
>> architecture.
>>
>> +KDEB_SOURCENAME
>> +----------------
>> +For the deb-pkg target, allows overriding the default source package name.
>> +The default package name is "linux-upstream".
>> +
>> +KDEB_PACKAGENAME
>> +----------------
>> +For the deb-pkg target, allows overriding the default binary package name.
>> +The default package name is "linux-image".
>
> Do you see a real need for that? (We should prevent adding
> complexity when it's not neccessary.)
>
>> +
>> KDOCFLAGS
>> ---------
>> Specify extra (warning/error) flags for kernel-doc checks during the build,
>> diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
>> index d4b007b38a475..cbe4266fac732 100755
>> --- a/scripts/package/mkdebian
>> +++ b/scripts/package/mkdebian
>> @@ -166,7 +166,9 @@ else
>> fi
>> sourcename=${KDEB_SOURCENAME:-linux-upstream}
>>
>> -if [ "$ARCH" = "um" ] ; then
>> +if [ "${KDEB_PACKAGENAME:+set}" ]; then
>> + packagename=$KDEB_PACKAGENAME
>> +elif [ "$ARCH" = "um" ]; then
>> packagename=user-mode-linux
>> else
>> packagename=linux-image
>> @@ -252,7 +254,7 @@ fi
>> if is_enabled CONFIG_DEBUG_INFO; then
>> cat <<EOF >> debian/control
>>
>> -Package: linux-image-${KERNELRELEASE}-dbg
>> +Package: $packagename-${KERNELRELEASE}-dbg
>> Section: debug
>> Architecture: $debarch
>> Build-Profiles: <!pkg.${sourcename}.nokerneldbg>
>> --
>> 2.53.0
>>
>
> Did you test that patch?
>
> These changes are not enough, as scripts/package/builddeb does not pick
> up the non-standard binary package name in its final 'case', and thus,
> _no_ binary package will be generated if KDEB_PACKAGENAME !=
> "linux-image".
>
> Kind regards,
> Nicolas
Apparently I didn't test effectively beyond making sure it built and
didn't introspect the build log closely enough. Sorry about that!
Let me explain the background of what I was looking to do here.
The changing a package name was mostly so that I could sync up the
source package and binary package names.
So I could (for example) upload a source package from a given tree to a
PPA and then the PPA would build binary packages.
I could then upload a source package for another tree and let the same
PPA build the binary packages for it.
If you have the same binary package name for both packages then you need
to do some git archaeology to figure out which hashes go with which
trees. Or you can look at PPA build logs and figure it out.
Both of those methods are a lot of work for what I thought could be done
pretty easily with a variable to differentiate.
This would allow easily cross referencing a test result between two
different trees.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-05-19 0:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-05 15:29 [PATCH] kbuild: deb-pkg: Allow setting package name at build Mario Limonciello (AMD)
2026-05-17 6:57 ` Nicolas Schier
2026-05-19 0:08 ` Mario Limonciello
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox