Skip to contentSkip to conversation

package: Add extra Provides to the kernel rpm package

PATCH In review Daan De Meyer 2 participants 2 messages Nov 10, 2024 – Nov 16, 2024 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package: Add extra Provides to the kernel rpm package

It's a useful property for kernel rpms produced from the kernel source tree to behave somewhat as drop-in replacements for the kernel rpms shipped by distributions. For example, when building Linux OS images, this allows replacing the distribution kernel rpm packages with kernel rpm packages produced from the kernel source tree without having to modify the OS image recipes. Instead, by just adding an extra repository containing the kernel rpms built from the kernel source tree, the OS image build process will prefer these rpms over the distribution ones if they're of a newer version.

To make this work, let's add various extra Provides to the kernel rpm spec so that it provides more of the common kernel rpm package names used by the CentOS/Fedora distribution kernel rpm packages.

---
 scripts/package/kernel.spec | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
scripts/package/kernel.spec +15 -0
index 42447c5fd7ac..61a151026afc 100644
@@ -17,6 +17,21 @@ Source0: linux.tar.gz
 Source1: config
 Source2: diff.patch
 Provides: kernel-%{KERNELRELEASE}
+Provides: kernel-%{_target_cpu}
+Provides: kernel-uname-r
+Provides: kernel-core
+Provides: kernel-modules
+Provides: kernel-modules-uname-r
+Provides: kernel-modules-%{_target_cpu}
+Provides: kernel-modules-internal
+Provides: kernel-modules-internal-uname-r
+Provides: kernel-modules-internal-%{_target_cpu}
+Provides: kernel-modules-extra
+Provides: kernel-modules-extra-uname-r
+Provides: kernel-modules-extra-%{_target_cpu}
+Provides: kernel-modules-core
+Provides: kernel-modules-core-uname-r
+Provides: kernel-modules-core-%{_target_cpu}
 BuildRequires: bc binutils bison dwarves
 BuildRequires: (elfutils-libelf-devel or libelf-devel) flex
 BuildRequires: gcc make openssl openssl-devel perl python3 rsync
Signature · 1 line
2.47.0
#1 lore raw
Quoted 10 lines · Daan De Meyer

It's a useful property for kernel rpms produced from the kernel source tree to behave somewhat as drop-in replacements for the kernel rpms shipped by distributions. For example, when building Linux OS images, this allows replacing the distribution kernel rpm packages with kernel rpm packages produced from the kernel source tree without having to modify the OS image recipes. Instead, by just adding an extra repository containing the kernel rpms built from the kernel source tree, the OS image build process will prefer these rpms over the distribution ones if they're of a newer version.

Quoted 3 lines

To make this work, let's add various extra Provides to the kernel rpm spec so that it provides more of the common kernel rpm package names used by the CentOS/Fedora distribution kernel rpm packages.

I did not check these one by one, but kerne.spec in Fedora specifies '= <version>'.

So, I guess this patch will not work equivalently.

Quoted 34 lines
---
 scripts/package/kernel.spec | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
scripts/package/kernel.spec +15 -1
index 42447c5fd7ac..61a151026afc 100644
@@ -17,6 +17,21 @@ Source0: linux.tar.gz
 Source1: config
 Source2: diff.patch
 Provides: kernel-%{KERNELRELEASE}
+Provides: kernel-%{_target_cpu}
+Provides: kernel-uname-r
+Provides: kernel-core
+Provides: kernel-modules
+Provides: kernel-modules-uname-r
+Provides: kernel-modules-%{_target_cpu}
+Provides: kernel-modules-internal
+Provides: kernel-modules-internal-uname-r
+Provides: kernel-modules-internal-%{_target_cpu}
+Provides: kernel-modules-extra
+Provides: kernel-modules-extra-uname-r
+Provides: kernel-modules-extra-%{_target_cpu}
+Provides: kernel-modules-core
+Provides: kernel-modules-core-uname-r
+Provides: kernel-modules-core-%{_target_cpu}
 BuildRequires: bc binutils bison dwarves
 BuildRequires: (elfutils-libelf-devel or libelf-devel) flex
 BuildRequires: gcc make openssl openssl-devel perl python3 rsync
--

2.47.0

Signature · 2 lines
Best Regards
Masahiro Yamada