* [PATCH] kbuild: rpm-pkg: append %{?dist} macro to Release tag
@ 2026-05-26 6:27 Yafang Shao
2026-05-28 0:43 ` Nathan Chancellor
2026-06-09 23:45 ` Nathan Chancellor
0 siblings, 2 replies; 7+ messages in thread
From: Yafang Shao @ 2026-05-26 6:27 UTC (permalink / raw)
To: nathan, nsc; +Cc: linux-kbuild, Yafang Shao
Add support for the %{?dist} macro in the kernel.spec file. This enables
building and releasing kernel RPMs with a custom distribution suffix
(e.g., via rpmbuild's --define option) to better match production
environment tracking.
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
scripts/package/kernel.spec | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/package/kernel.spec b/scripts/package/kernel.spec
index b3c956205af0..c732415662ef 100644
--- a/scripts/package/kernel.spec
+++ b/scripts/package/kernel.spec
@@ -6,7 +6,7 @@
Name: kernel
Summary: The Linux Kernel
Version: %(echo %{KERNELRELEASE} | sed -e 's/-/_/g')
-Release: %{pkg_release}
+Release: %{pkg_release}%{?dist}
License: GPL
Group: System Environment/Kernel
Vendor: The Linux Community
--
2.47.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] kbuild: rpm-pkg: append %{?dist} macro to Release tag
2026-05-26 6:27 Yafang Shao
@ 2026-05-28 0:43 ` Nathan Chancellor
2026-05-28 8:48 ` Yafang Shao
2026-06-09 23:45 ` Nathan Chancellor
1 sibling, 1 reply; 7+ messages in thread
From: Nathan Chancellor @ 2026-05-28 0:43 UTC (permalink / raw)
To: Yafang Shao; +Cc: nathan, nsc, linux-kbuild
On Tue, 26 May 2026 14:27:32 +0800, Yafang Shao <laoar.shao@gmail.com> wrote:
> diff --git a/scripts/package/kernel.spec b/scripts/package/kernel.spec
> index b3c956205af0..c732415662ef 100644
> --- a/scripts/package/kernel.spec
> +++ b/scripts/package/kernel.spec
> @@ -6,7 +6,7 @@
> Name: kernel
> Summary: The Linux Kernel
> Version: %(echo %{KERNELRELEASE} | sed -e 's/-/_/g')
> -Release: %{pkg_release}
> +Release: %{pkg_release}%{?dist}
This seems reasonable at face value, especially since Fedora recommends
this for all of its packages but the value of dist will be included in
the version string with how this is currently written:
$ make -skj"$(nproc)" ARCH=x86_64 RPMOPTS="--define 'dist .distval123'" mrproper defconfig rpm-pkg
...
$ cat include/generated/utsversion.h
#define UTS_VERSION "#1.distval123 SMP PREEMPT_DYNAMIC Wed May 27 17:27:34 MST 2026"
Maybe that's fine (or even considered a feature)? Figured it was worth
pointing out in case anyone can think of problems from allowing this.
Another option could be just changing
KBUILD_BUILD_VERSION=%{release}
to
KBUILD_BUILD_VERSION=%{pkg_release}
to avoid this.
--
Cheers,
Nathan
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] kbuild: rpm-pkg: append %{?dist} macro to Release tag
2026-05-28 0:43 ` Nathan Chancellor
@ 2026-05-28 8:48 ` Yafang Shao
0 siblings, 0 replies; 7+ messages in thread
From: Yafang Shao @ 2026-05-28 8:48 UTC (permalink / raw)
To: Nathan Chancellor; +Cc: nsc, linux-kbuild
On Thu, May 28, 2026 at 8:43 AM Nathan Chancellor <nathan@kernel.org> wrote:
>
> On Tue, 26 May 2026 14:27:32 +0800, Yafang Shao <laoar.shao@gmail.com> wrote:
> > diff --git a/scripts/package/kernel.spec b/scripts/package/kernel.spec
> > index b3c956205af0..c732415662ef 100644
> > --- a/scripts/package/kernel.spec
> > +++ b/scripts/package/kernel.spec
> > @@ -6,7 +6,7 @@
> > Name: kernel
> > Summary: The Linux Kernel
> > Version: %(echo %{KERNELRELEASE} | sed -e 's/-/_/g')
> > -Release: %{pkg_release}
> > +Release: %{pkg_release}%{?dist}
>
> This seems reasonable at face value, especially since Fedora recommends
> this for all of its packages but the value of dist will be included in
> the version string with how this is currently written:
>
> $ make -skj"$(nproc)" ARCH=x86_64 RPMOPTS="--define 'dist .distval123'" mrproper defconfig rpm-pkg
> ...
>
> $ cat include/generated/utsversion.h
> #define UTS_VERSION "#1.distval123 SMP PREEMPT_DYNAMIC Wed May 27 17:27:34 MST 2026"
>
> Maybe that's fine (or even considered a feature)?
I believe the current behavior is fine because the 'dist' value is
properly displayed in the `uname -a` output, as shown below:
$ uname -a
Linux localhost.localdomain 7.1.0-rc5+ #1.distval123 SMP
PREEMPT_DYNAMIC Thu May 28 06:25:23 UTC 2026 x86_64 x86_64 x86_64
GNU/Linux
However, if we apply the change below, the 'dist' value will be
omitted from the `uname -a` output:
$ uname -a
Linux localhost.localdomain 7.1.0-rc5+ #2 SMP PREEMPT_DYNAMIC Thu
May 28 07:43:05 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux
> Figured it was worth
> pointing out in case anyone can think of problems from allowing this.
> Another option could be just changing
>
> KBUILD_BUILD_VERSION=%{release}
>
> to
>
> KBUILD_BUILD_VERSION=%{pkg_release}
>
> to avoid this.
>
> --
> Cheers,
> Nathan
>
--
Regards
Yafang
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] kbuild: rpm-pkg: append %{?dist} macro to Release tag
2026-05-26 6:27 Yafang Shao
2026-05-28 0:43 ` Nathan Chancellor
@ 2026-06-09 23:45 ` Nathan Chancellor
1 sibling, 0 replies; 7+ messages in thread
From: Nathan Chancellor @ 2026-06-09 23:45 UTC (permalink / raw)
To: nsc, Yafang Shao; +Cc: linux-kbuild
On Tue, 26 May 2026 14:27:32 +0800, Yafang Shao wrote:
> kbuild: rpm-pkg: append %{?dist} macro to Release tag
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux.git kbuild-next
Thanks!
[1/1] kbuild: rpm-pkg: append %{?dist} macro to Release tag
https://git.kernel.org/kbuild/c/159921d63da16
Please look out for regression or issue reports or other follow up
comments, as they may result in the patch/series getting dropped or
reverted. Patches applied to an "unstable" branch are accepted pending
wider testing in -next and any post-commit review; they will generally
be moved to the main branch in a week if no issues are found.
Best regards,
--
Cheers,
Nathan
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] kbuild: rpm-pkg: Preserve .BTF section in kernel modules during debuginfo stripping
@ 2026-07-12 6:28 Yafang Shao
2026-07-12 6:28 ` [PATCH] kbuild: rpm-pkg: append %{?dist} macro to Release tag Yafang Shao
0 siblings, 1 reply; 7+ messages in thread
From: Yafang Shao @ 2026-07-12 6:28 UTC (permalink / raw)
To: nathan, nsc; +Cc: linux-kbuild, bpf, Yafang Shao
After switching to the kernel's default package scripts for our local
kernel RPM builds, we noticed that module BTF entries were missing:
$ ls /sys/kernel/btf/
vmlinux <<<< only vmlinux, no module BTF
Root cause: find-debuginfo.sh (from the debugedit package) prefers
eu-strip over strip when elfutils is installed, which is the common
case on RHEL 9. eu-strip removes non-allocated ELF sections, including
the .BTF section that contains BPF Type Format information for kernel
modules. Without .BTF, BPF tools (bpftool, bcc, bpftrace) cannot resolve
kernel types at runtime, and /sys/kernel/btf/<module> entries are not
created when modules are loaded.
Fix by passing --keep-section .BTF via _find_debuginfo_opts, which adds
-K .BTF to the eu-strip/strip command, preserving the .BTF section while
allowing normal debuginfo extraction to proceed.
After this change, all module BTF files are properly generated:
$ ls /sys/kernel/btf/
aesni_intel drm i2c_i801 mfd_core
ahci drm_client_lib i2c_mux net_failover
backlight drm_kms_helper i2c_smbus pcspkr
ccp drm_shmem_helper input_leds qemu_fw_cfg
dm_log failover intel_rapl_common sch_fq_codel
dm_mirror fat intel_rapl_msr serio_raw
dm_mod fuse irqbypass sunrpc
dm_region_hash gf128mul iTCO_wdt vfat
virtio_balloon virtio_console virtio_dma_buf virtio_gpu
virtio_net virtio_rng virtio_blk vmlinux
xfs
Assisted-by: Comagic:DeepSeek-V4-Flash
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
scripts/package/kernel.spec | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/package/kernel.spec b/scripts/package/kernel.spec
index c732415662ef..abc73de019e0 100644
--- a/scripts/package/kernel.spec
+++ b/scripts/package/kernel.spec
@@ -67,7 +67,7 @@ This package provides debug information for the kernel image and modules from th
%undefine _unique_debug_srcs
%undefine _debugsource_packages
%undefine _debuginfo_subpackages
-%global _find_debuginfo_opts -r
+%global _find_debuginfo_opts -r --keep-section .BTF
%global _missing_build_ids_terminate_build 1
%global _no_recompute_build_ids 1
%{debug_package}
--
2.52.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH] kbuild: rpm-pkg: append %{?dist} macro to Release tag
2026-07-12 6:28 [PATCH] kbuild: rpm-pkg: Preserve .BTF section in kernel modules during debuginfo stripping Yafang Shao
@ 2026-07-12 6:28 ` Yafang Shao
2026-07-12 6:34 ` Yafang Shao
0 siblings, 1 reply; 7+ messages in thread
From: Yafang Shao @ 2026-07-12 6:28 UTC (permalink / raw)
To: nathan, nsc; +Cc: linux-kbuild, bpf, Yafang Shao
Add support for the %{?dist} macro in the kernel.spec file. This enables
building and releasing kernel RPMs with a custom distribution suffix
(e.g., via rpmbuild's --define option) to better match production
environment tracking.
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
scripts/package/kernel.spec | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/package/kernel.spec b/scripts/package/kernel.spec
index b3c956205af0..c732415662ef 100644
--- a/scripts/package/kernel.spec
+++ b/scripts/package/kernel.spec
@@ -6,7 +6,7 @@
Name: kernel
Summary: The Linux Kernel
Version: %(echo %{KERNELRELEASE} | sed -e 's/-/_/g')
-Release: %{pkg_release}
+Release: %{pkg_release}%{?dist}
License: GPL
Group: System Environment/Kernel
Vendor: The Linux Community
--
2.47.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] kbuild: rpm-pkg: append %{?dist} macro to Release tag
2026-07-12 6:28 ` [PATCH] kbuild: rpm-pkg: append %{?dist} macro to Release tag Yafang Shao
@ 2026-07-12 6:34 ` Yafang Shao
0 siblings, 0 replies; 7+ messages in thread
From: Yafang Shao @ 2026-07-12 6:34 UTC (permalink / raw)
To: nathan, nsc; +Cc: linux-kbuild, bpf
On Sun, Jul 12, 2026 at 2:29 PM Yafang Shao <laoar.shao@gmail.com> wrote:
>
> Add support for the %{?dist} macro in the kernel.spec file. This enables
> building and releasing kernel RPMs with a custom distribution suffix
> (e.g., via rpmbuild's --define option) to better match production
> environment tracking.
>
> Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
> ---
> scripts/package/kernel.spec | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/package/kernel.spec b/scripts/package/kernel.spec
> index b3c956205af0..c732415662ef 100644
> --- a/scripts/package/kernel.spec
> +++ b/scripts/package/kernel.spec
> @@ -6,7 +6,7 @@
> Name: kernel
> Summary: The Linux Kernel
> Version: %(echo %{KERNELRELEASE} | sed -e 's/-/_/g')
> -Release: %{pkg_release}
> +Release: %{pkg_release}%{?dist}
> License: GPL
> Group: System Environment/Kernel
> Vendor: The Linux Community
> --
> 2.47.3
>
oops!
Apologies for the confusion. Please disregard the patch, as it was an
accepted patch accidentally included in the same directory and sent
alongside the intended one:
https://lore.kernel.org/linux-kbuild/20260712062834.77872-1-laoar.shao@gmail.com/
--
Regards
Yafang
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-07-12 6:34 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-12 6:28 [PATCH] kbuild: rpm-pkg: Preserve .BTF section in kernel modules during debuginfo stripping Yafang Shao
2026-07-12 6:28 ` [PATCH] kbuild: rpm-pkg: append %{?dist} macro to Release tag Yafang Shao
2026-07-12 6:34 ` Yafang Shao
-- strict thread matches above, loose matches on Subject: below --
2026-05-26 6:27 Yafang Shao
2026-05-28 0:43 ` Nathan Chancellor
2026-05-28 8:48 ` Yafang Shao
2026-06-09 23:45 ` Nathan Chancellor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox