Skip to contentSkip to conversation

kbuild: rpm-pkg: provide kernel{-devel}-uname-r

PATCH In review Avi Kivity 2 participants 2 messages Apr 14 – Apr 29 Kbuild

lore
Share & tools
lore

Avi Kivity

author
#0 lore raw

PATCH 1/1 kbuild: rpm-pkg: provide kernel{-devel}-uname-r

From: Avi Kivity <[email protected]>

Fedora kernels provide, and the akmods external module build tools expect, kernel-devel-uname-r virtual packages. To improve the life of those who depend on akmods, do the same with the kernel's RPM packages.

Assisted-by OpenCode:claude-opus-4.6
---
 scripts/package/kernel.spec | 2 ++
 1 file changed, 2 insertions(+)
scripts/package/kernel.spec +2 -0
index b3c956205af00..dcb04c1e7e8ef 100644
@@ -13,10 +13,11 @@ Vendor: The Linux Community
 URL: https://www.kernel.org
 Source0: linux.tar.gz
 Source1: config
 Source2: diff.patch
 Provides: kernel-%{KERNELRELEASE}
+Provides: kernel-uname-r = %{KERNELRELEASE}
 BuildRequires: bc binutils bison dwarves
 BuildRequires: (elfutils-devel or libdw-devel)
 BuildRequires: (elfutils-libelf-devel or libelf-devel) flex
 BuildRequires: gcc make openssl openssl-devel perl python3 rsync
 
@@ -38,10 +39,11 @@ glibc package.
 %if %{with_devel}
 %package devel
 Summary: Development package for building kernel modules to match the %{version} kernel
 Group: System Environment/Kernel
 AutoReqProv: no
+Provides: kernel-devel-uname-r = %{KERNELRELEASE}
 %description -n kernel-devel
 This package provides kernel headers and makefiles sufficient to build modules
 against the %{version} kernel package.
 %endif
 
Signature · 1 line
2.53.0
#1 lore raw

scripts/package/kernel.spec Source0: linux.tar.gz · line 18

Quoted 9 lines · Avi Kivity
scripts/package/kernel.spec +1 -0
index b3c956205af0..dcb04c1e7e8e 100644
@@ -15,6 +15,7 @@ Source0: linux.tar.gz
 Source1: config
 Source2: diff.patch
 Provides: kernel-%{KERNELRELEASE}
+Provides: kernel-uname-r = %{KERNELRELEASE}

Sashiko notes that this will cause the build to fail when there are two or more hyphens in KERNELRELEASE:

https://sashiko.dev/#/message/[email protected]

I can confirm this easily reproduces when CONFIG_LOCALVERSION_AUTO is enabled:

  | $ make -skj"$(nproc)" ARCH=arm64 CROSS_COMPILE=aarch64-linux- mrproper defconfig binrpm-pkg
  | Building target platforms: aarch64-linux
  | Building for target aarch64-linux
  | error: line 24: Invalid version (double separator '-'): 7.0.0-08202-g663bd6ce5b7f: Provides: kernel-uname-r = 7.0.0-08202-g663bd6ce5b7f
  | ...

This should probably be %{version}? Please test and verify that change still works for your use case then send a v2.

Signature · 2 lines
Cheers,
Nathan