Skip to contentSkip to conversation

FAILED: patch "[PATCH] kbuild: rpm-pkg: simplify installkernel %post" failed to apply to 6.6-stable tree

PATCH In review [email protected] 4 participants 9 messages Feb 19, 2024 – Jun 23, 2025

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 6.6-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y
git checkout FETCH_HEAD
git cherry-pick -x 358de8b4f201bc05712484b15f0109b1ae3516a8
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2024021932-lavish-expel-58e5@gregkh' --subject-prefix 'PATCH 6.6.y' HEAD^..

Possible dependencies:

358de8b4f201 ("kbuild: rpm-pkg: simplify installkernel %post") 0df8e9708594 ("scripts: clean up IA-64 code")

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 358de8b4f201bc05712484b15f0109b1ae3516a8 Mon Sep 17 00:00:00 2001
From: Jose Ignacio Tornos Martinez <[email protected]>
Date: Mon, 29 Jan 2024 10:28:19 +0100
Subject: [PATCH] kbuild: rpm-pkg: simplify installkernel %post

The new installkernel application that is now included in systemd-udev package allows installation although destination files are already present in the boot directory of the kernel package, but is failing with the implemented workaround for the old installkernel application from grubby package.

For the new installkernel application, as Davide says:
<<The %post currently does a shuffling dance before calling installkernel. This isn't actually necessary afaict, and the current implementation ends up triggering downstream issues such as
https://github.com/systemd/systemd/issues/29568
This commit simplifies the logic to remove the shuffling. For reference, the original logic was added in commit 3c9c7a14b627("rpm-pkg: add %post section to create initramfs and grub hooks").>>

But we need to keep the old behavior as well, because the old installkernel application from grubby package, does not allow this simplification and we need to be backward compatible to avoid issues with the different packages.

Mimic Fedora shipping process and store vmlinuz, config amd System.map in the module directory instead of the boot directory. In this way, we will avoid the commented problem for all the cases, because the new destination files are not going to exist in the boot directory of the kernel package.

Replace installkernel tool with kernel-install tool, because the latter is more complete.

Besides, after installkernel tool execution, check to complete if the correct package files vmlinuz, System.map and config files are present in /boot directory, and if necessary, copy manually for install operation. In this way, take into account if files were not previously copied from /usr/lib/kernel/install.d/* scripts and if the suitable files for the requested package are present (it could be others if the rpm files were replace with a new pacakge with the same release and a different build).

Tested with Fedora 38, Fedora 39, RHEL 9, Oracle Linux 9.3, openSUSE Tumbleweed and openMandrive ROME, using dnf/zypper and rpm tools.

scripts/package/kernel.spec +11 -11
index 89298983a169..f58726671fb3 100644
@@ -55,12 +55,12 @@ patch -p1 < %{SOURCE2}
 %{make} %{makeflags} KERNELRELEASE=%{KERNELRELEASE} KBUILD_BUILD_VERSION=%{release}
 
 %install
-mkdir -p %{buildroot}/boot
-cp $(%{make} %{makeflags} -s image_name) %{buildroot}/boot/vmlinuz-%{KERNELRELEASE}
+mkdir -p %{buildroot}/lib/modules/%{KERNELRELEASE}
+cp $(%{make} %{makeflags} -s image_name) %{buildroot}/lib/modules/%{KERNELRELEASE}/vmlinuz
 %{make} %{makeflags} INSTALL_MOD_PATH=%{buildroot} modules_install
 %{make} %{makeflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install
-cp System.map %{buildroot}/boot/System.map-%{KERNELRELEASE}
-cp .config %{buildroot}/boot/config-%{KERNELRELEASE}
+cp System.map %{buildroot}/lib/modules/%{KERNELRELEASE}
+cp .config %{buildroot}/lib/modules/%{KERNELRELEASE}/config
 ln -fns /usr/src/kernels/%{KERNELRELEASE} %{buildroot}/lib/modules/%{KERNELRELEASE}/build
 %if %{with_devel}
 %{make} %{makeflags} run-command KBUILD_RUN_COMMAND='${srctree}/scripts/package/install-extmod-build %{buildroot}/usr/src/kernels/%{KERNELRELEASE}'
@@ -70,13 +70,14 @@ ln -fns /usr/src/kernels/%{KERNELRELEASE} %{buildroot}/lib/modules/%{KERNELRELEA
 rm -rf %{buildroot}
 
 %post
-if [ -x /sbin/installkernel -a -r /boot/vmlinuz-%{KERNELRELEASE} -a -r /boot/System.map-%{KERNELRELEASE} ]; then
-cp /boot/vmlinuz-%{KERNELRELEASE} /boot/.vmlinuz-%{KERNELRELEASE}-rpm
-cp /boot/System.map-%{KERNELRELEASE} /boot/.System.map-%{KERNELRELEASE}-rpm
-rm -f /boot/vmlinuz-%{KERNELRELEASE} /boot/System.map-%{KERNELRELEASE}
-/sbin/installkernel %{KERNELRELEASE} /boot/.vmlinuz-%{KERNELRELEASE}-rpm /boot/.System.map-%{KERNELRELEASE}-rpm
-rm -f /boot/.vmlinuz-%{KERNELRELEASE}-rpm /boot/.System.map-%{KERNELRELEASE}-rpm
+if [ -x /usr/bin/kernel-install ]; then
+	/usr/bin/kernel-install add %{KERNELRELEASE} /lib/modules/%{KERNELRELEASE}/vmlinuz
 fi
+for file in vmlinuz System.map config; do
+	if ! cmp --silent "/lib/modules/%{KERNELRELEASE}/${file}" "/boot/${file}-%{KERNELRELEASE}"; then
+		cp "/lib/modules/%{KERNELRELEASE}/${file}" "/boot/${file}-%{KERNELRELEASE}"
+	fi
+done
 
 %preun
 if [ -x /sbin/new-kernel-pkg ]; then
@@ -94,7 +95,6 @@ fi
 %defattr (-, root, root)
 /lib/modules/%{KERNELRELEASE}
 %exclude /lib/modules/%{KERNELRELEASE}/build
-/boot/*
 
 %files headers
 %defattr (-, root, root)
#1 lore raw

cover Apply commit 358de8b4f201 to 6.6.y

From: Chuck Lever <[email protected]>

Tested: "make binrpm-pkg" on Fedora 39 then installed with "rpm -ivh ...". Newly installed kernel reboots as expected.

I will have a look at origin/linux-6.1.y next.

Jose Ignacio Tornos Martinez (1):
kbuild: rpm-pkg: simplify installkernel %post

Masahiro Yamada (1):
scripts: clean up IA-64 code

 scripts/checkstack.pl        |  3 ---
 scripts/gdb/linux/tasks.py   | 15 +++------------
 scripts/head-object-list.txt |  1 -
 scripts/kconfig/mconf.c      |  2 +-
 scripts/kconfig/nconf.c      |  2 +-
 scripts/package/kernel.spec  | 28 +++++++++++-----------------
 scripts/package/mkdebian     |  2 +-
 scripts/recordmcount.c       |  1 -
 scripts/recordmcount.pl      |  7 -------
 scripts/xz_wrap.sh           |  1 -
 10 files changed, 17 insertions(+), 45 deletions(-)
Signature · 1 line
2.49.0
author maintainer
#2 lore raw

Re: [PATCH 6.6.y 0/2] Apply commit 358de8b4f201 to 6.6.y

Quoted 13 lines · Chuck Lever

From: Chuck Lever <[email protected]>

Tested: "make binrpm-pkg" on Fedora 39 then installed with "rpm -ivh ...". Newly installed kernel reboots as expected.

I will have a look at origin/linux-6.1.y next.

Jose Ignacio Tornos Martinez (1):
kbuild: rpm-pkg: simplify installkernel %post

Masahiro Yamada (1):
scripts: clean up IA-64 code

Quoted 11 lines
 scripts/checkstack.pl        |  3 ---
 scripts/gdb/linux/tasks.py   | 15 +++------------
 scripts/head-object-list.txt |  1 -
 scripts/kconfig/mconf.c      |  2 +-
 scripts/kconfig/nconf.c      |  2 +-
 scripts/package/kernel.spec  | 28 +++++++++++-----------------
 scripts/package/mkdebian     |  2 +-
 scripts/recordmcount.c       |  1 -
 scripts/recordmcount.pl      |  7 -------
 scripts/xz_wrap.sh           |  1 -
 10 files changed, 17 insertions(+), 45 deletions(-)

Why is this needed in 6.6.y? Is this just a new feature or fixing something that has always been broken? It looks to me like a new feature...

thanks,

greg k-h

#3 lore raw

Re: [PATCH 6.6.y 0/2] Apply commit 358de8b4f201 to 6.6.y

Quoted 26 lines · Greg KH
Quoted 13 lines · Chuck Lever

From: Chuck Lever <[email protected]>

Tested: "make binrpm-pkg" on Fedora 39 then installed with "rpm -ivh ...". Newly installed kernel reboots as expected.

I will have a look at origin/linux-6.1.y next.

Jose Ignacio Tornos Martinez (1):
kbuild: rpm-pkg: simplify installkernel %post

Masahiro Yamada (1):
scripts: clean up IA-64 code

Quoted 11 lines
 scripts/checkstack.pl        |  3 ---
 scripts/gdb/linux/tasks.py   | 15 +++------------
 scripts/head-object-list.txt |  1 -
 scripts/kconfig/mconf.c      |  2 +-
 scripts/kconfig/nconf.c      |  2 +-
 scripts/package/kernel.spec  | 28 +++++++++++-----------------
 scripts/package/mkdebian     |  2 +-
 scripts/recordmcount.c       |  1 -
 scripts/recordmcount.pl      |  7 -------
 scripts/xz_wrap.sh           |  1 -
 10 files changed, 17 insertions(+), 45 deletions(-)
Quoted 3 lines

Why is this needed in 6.6.y? Is this just a new feature or fixing something that has always been broken? It looks to me like a new feature...

Hi Greg -

TL;DR: This commit fixes something that is broken.

Reference bug: https://bugzilla.redhat.com/show_bug.cgi?id=2239008

The LTS v6.6 kernel's "make binrpm-pkg" target is broken on Fedora 39 and 40 due to a change in grubby. This breaks some CI environments.

The commits in this series address the kernel install problem.

Agreed, I should have mentioned that in this cover letter. I assumed readers would remember my question about backporting these commits from last week, and I was perhaps also leaning on the patch descriptions, which have turned out to be obscure. Apologies.

Signature · 1 line
Chuck Lever
#4 lore raw

Re: [PATCH 6.6.y 0/2] Apply commit 358de8b4f201 to 6.6.y

Quoted 40 lines · Chuck Lever
Quoted 26 lines · Greg KH
Quoted 13 lines · Chuck Lever

From: Chuck Lever <[email protected]>

Tested: "make binrpm-pkg" on Fedora 39 then installed with "rpm -ivh ...". Newly installed kernel reboots as expected.

I will have a look at origin/linux-6.1.y next.

Jose Ignacio Tornos Martinez (1):
kbuild: rpm-pkg: simplify installkernel %post

Masahiro Yamada (1):
scripts: clean up IA-64 code

Quoted 11 lines
 scripts/checkstack.pl        |  3 ---
 scripts/gdb/linux/tasks.py   | 15 +++------------
 scripts/head-object-list.txt |  1 -
 scripts/kconfig/mconf.c      |  2 +-
 scripts/kconfig/nconf.c      |  2 +-
 scripts/package/kernel.spec  | 28 +++++++++++-----------------
 scripts/package/mkdebian     |  2 +-
 scripts/recordmcount.c       |  1 -
 scripts/recordmcount.pl      |  7 -------
 scripts/xz_wrap.sh           |  1 -
 10 files changed, 17 insertions(+), 45 deletions(-)
Quoted 3 lines

Why is this needed in 6.6.y? Is this just a new feature or fixing something that has always been broken? It looks to me like a new feature...

Hi Greg -

TL;DR: This commit fixes something that is broken.

Reference bug: https://bugzilla.redhat.com/show_bug.cgi?id=2239008

The LTS v6.6 kernel's "make binrpm-pkg" target is broken on Fedora 39 and 40 due to a change in grubby. This breaks some CI environments.

Quoted 6 lines

The commits in this series address the kernel install problem.

Agreed, I should have mentioned that in this cover letter. I assumed readers would remember my question about backporting these commits from last week, and I was perhaps also leaning on the patch descriptions, which have turned out to be obscure. Apologies.

But also, I didn't think a justification to backport was necessary because "kbuild: rpm-pkg: simplify installkernel %post" has a
Cc: stable tag and the only reason it's not already in LTS 6.6 is because it didn't apply cleanly.

Signature · 1 line
Chuck Lever
#5 lore raw

PATCH 1/2 scripts: clean up IA-64 code

In reply to [email protected]

From: Masahiro Yamada <[email protected]>

[ Upstream commit 0df8e97085946dd79c06720678a845778b6d6bf8 ]

A little more janitorial work after commit cf8e8658100d ("arch: Remove Itanium (IA-64) architecture").

---
 scripts/checkstack.pl        |  3 ---
 scripts/gdb/linux/tasks.py   | 15 +++------------
 scripts/head-object-list.txt |  1 -
 scripts/kconfig/mconf.c      |  2 +-
 scripts/kconfig/nconf.c      |  2 +-
 scripts/package/kernel.spec  |  6 ------
 scripts/package/mkdebian     |  2 +-
 scripts/recordmcount.c       |  1 -
 scripts/recordmcount.pl      |  7 -------
 scripts/xz_wrap.sh           |  1 -
 10 files changed, 6 insertions(+), 34 deletions(-)
scripts/checkstack.pl +0 -3
index f27d552aec43..aad423c5181a 100755
@@ -68,9 +68,6 @@ my (@stack, $re, $dre, $sub, $x, $xs, $funcre, $min_stack);
 		#    2f60:    48 81 ec e8 05 00 00       sub    $0x5e8,%rsp
 		$re = qr/^.*[as][du][db]    \$(0x$x{1,8}),\%(e|r)sp$/o;
 		$dre = qr/^.*[as][du][db]    (%.*),\%(e|r)sp$/o;
-	} elsif ($arch eq 'ia64') {
-		#e0000000044011fc:       01 0f fc 8c     adds r12=-384,r12
-		$re = qr/.*adds.*r12=-(([0-9]{2}|[3-9])[0-9]{2}),r12/o;
 	} elsif ($arch eq 'm68k') {
 		#    2b6c:       4e56 fb70       linkw %fp,#-1168
 		#  1df770:       defc ffe4       addaw #-28,%sp
scripts/gdb/linux/tasks.py +3 -12
index 17ec19e9b5bf..5be53b372a69 100644
@@ -86,21 +86,12 @@ LxPs()
 
 thread_info_type = utils.CachedType("struct thread_info")
 
-ia64_task_size = None
-
 
 def get_thread_info(task):
     thread_info_ptr_type = thread_info_type.get_type().pointer()
-    if utils.is_target_arch("ia64"):
-        global ia64_task_size
-        if ia64_task_size is None:
-            ia64_task_size = gdb.parse_and_eval("sizeof(struct task_struct)")
-        thread_info_addr = task.address + ia64_task_size
-        thread_info = thread_info_addr.cast(thread_info_ptr_type)
-    else:
-        if task.type.fields()[0].type == thread_info_type.get_type():
-            return task['thread_info']
-        thread_info = task['stack'].cast(thread_info_ptr_type)
+    if task.type.fields()[0].type == thread_info_type.get_type():
+        return task['thread_info']
+    thread_info = task['stack'].cast(thread_info_ptr_type)
     return thread_info.dereference()
 
 
scripts/head-object-list.txt +0 -1
index 26359968744e..890f69005bab 100644
@@ -17,7 +17,6 @@ arch/arm/kernel/head-nommu.o
 arch/arm/kernel/head.o
 arch/csky/kernel/head.o
 arch/hexagon/kernel/head.o
-arch/ia64/kernel/head.o
 arch/loongarch/kernel/head.o
 arch/m68k/68000/head.o
 arch/m68k/coldfire/head.o
scripts/kconfig/mconf.c +1 -1
index eccc87a441e7..3795c36a9181 100644
@@ -247,7 +247,7 @@ search_help[] =
 	"      -> PCI support (PCI [=y])\n"
 	"(1)     -> PCI access mode (<choice> [=y])\n"
 	"  Defined at drivers/pci/Kconfig:47\n"
-	"  Depends on: X86_LOCAL_APIC && X86_IO_APIC || IA64\n"
+	"  Depends on: X86_LOCAL_APIC && X86_IO_APIC\n"
 	"  Selects: LIBCRC32\n"
 	"  Selected by: BAR [=n]\n"
 	"-----------------------------------------------------------------\n"
scripts/kconfig/nconf.c +1 -1
index 143a2c351d57..8cd72fe25974 100644
@@ -216,7 +216,7 @@ search_help[] =
 "Symbol: FOO [ = m]\n"
 "Prompt: Foo bus is used to drive the bar HW\n"
 "Defined at drivers/pci/Kconfig:47\n"
-"Depends on: X86_LOCAL_APIC && X86_IO_APIC || IA64\n"
+"Depends on: X86_LOCAL_APIC && X86_IO_APIC\n"
 "Location:\n"
 "  -> Bus options (PCI, PCMCIA, EISA, ISA)\n"
 "    -> PCI support (PCI [ = y])\n"
scripts/package/kernel.spec +0 -6
index 3eee0143e0c5..89298983a169 100644
@@ -56,13 +56,7 @@ patch -p1 < %{SOURCE2}
 
 %install
 mkdir -p %{buildroot}/boot
-%ifarch ia64
-mkdir -p %{buildroot}/boot/efi
-cp $(%{make} %{makeflags} -s image_name) %{buildroot}/boot/efi/vmlinuz-%{KERNELRELEASE}
-ln -s efi/vmlinuz-%{KERNELRELEASE} %{buildroot}/boot/
-%else
 cp $(%{make} %{makeflags} -s image_name) %{buildroot}/boot/vmlinuz-%{KERNELRELEASE}
-%endif
 %{make} %{makeflags} INSTALL_MOD_PATH=%{buildroot} modules_install
 %{make} %{makeflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install
 cp System.map %{buildroot}/boot/System.map-%{KERNELRELEASE}
scripts/package/mkdebian +1 -1
index 5044224cf671..c1a36da85e84 100755
@@ -26,7 +26,7 @@ set_debarch() {
 
 	# Attempt to find the correct Debian architecture
 	case "$UTS_MACHINE" in
-	i386|ia64|alpha|m68k|riscv*)
+	i386|alpha|m68k|riscv*)
 		debarch="$UTS_MACHINE" ;;
 	x86_64)
 		debarch=amd64 ;;
scripts/recordmcount.c +0 -1
index 40ae6b2c7a6d..3e4f54799cc0 100644
@@ -590,7 +590,6 @@ static int do_file(char const *const fname)
 		ideal_nop = ideal_nop4_arm64;
 		is_fake_mcount64 = arm64_is_fake_mcount;
 		break;
-	case EM_IA_64:	reltype = R_IA64_IMM64; break;
 	case EM_MIPS:	/* reltype: e_class    */ break;
 	case EM_LOONGARCH:	/* reltype: e_class    */ break;
 	case EM_PPC:	reltype = R_PPC_ADDR32; break;
scripts/recordmcount.pl +0 -7
index 6a4645a57976..f84df9e383fd 100755
@@ -275,13 +275,6 @@ if ($arch eq "x86_64") {
     $section_type = '%progbits';
     $mcount_regex = "^\\s*([0-9a-fA-F]+):\\s*R_AARCH64_CALL26\\s+_mcount\$";
     $type = ".quad";
-} elsif ($arch eq "ia64") {
-    $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s_mcount\$";
-    $type = "data8";
-
-    if ($is_module eq "0") {
-	$cc .= " -mconstant-gp";
-    }
 } elsif ($arch eq "sparc64") {
     # In the objdump output there are giblets like:
     # 0000000000000000 <igmp_net_exit-0x18>:
scripts/xz_wrap.sh +0 -1
index 76e9cbcfbeab..d06baf626abe 100755
@@ -15,7 +15,6 @@ LZMA2OPTS=
 case $SRCARCH in
 	x86)            BCJ=--x86 ;;
 	powerpc)        BCJ=--powerpc ;;
-	ia64)           BCJ=--ia64; LZMA2OPTS=pb=4 ;;
 	arm)            BCJ=--arm ;;
 	sparc)          BCJ=--sparc ;;
 esac
Signature · 1 line
2.49.0
maintainer Reviewed-by Nicolas Schier on v1 1/2
#6 lore raw

Re: [PATCH 6.6.y 1/2] scripts: clean up IA-64 code

[ Sasha's backport helper bot ]

Hi,

✅ All tests passed successfully. No issues detected. No action required from the submitter.

The upstream commit SHA1 provided is correct: 0df8e97085946dd79c06720678a845778b6d6bf8

WARNING: Author mismatch between patch and upstream commit:
Backport author: Chuck Lever<[email protected]> Commit author: Masahiro Yamada<[email protected]>

Status in newer kernel trees:
6.15.y | Present (exact SHA1)
6.12.y | Present (exact SHA1)

Note: The patch differs from the upstream commit:
---
1: 0df8e97085946 ! 1: 8f82f37000689 scripts: clean up IA-64 code
@@ Metadata
## Commit message ##
scripts: clean up IA-64 code

+ [ Upstream commit 0df8e97085946dd79c06720678a845778b6d6bf8 ]
+
A little more janitorial work after commit cf8e8658100d ("arch: Remove Itanium (IA-64) architecture").

+ Signed-off-by: Chuck Lever <[email protected]>

## scripts/checkstack.pl ##
@@ scripts/checkstack.pl: my (@stack, $re, $dre, $sub, $x, $xs, $funcre, $min_stack);
---

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-6.6.y        |  Success    |  Success   |
#7 lore raw

PATCH 2/2 kbuild: rpm-pkg: simplify installkernel %post

In reply to [email protected]

From: Jose Ignacio Tornos Martinez <[email protected]>

[ Upstream commit 358de8b4f201bc05712484b15f0109b1ae3516a8 ]

The new installkernel application that is now included in systemd-udev package allows installation although destination files are already present in the boot directory of the kernel package, but is failing with the implemented workaround for the old installkernel application from grubby package.

For the new installkernel application, as Davide says:
<<The %post currently does a shuffling dance before calling installkernel. This isn't actually necessary afaict, and the current implementation ends up triggering downstream issues such as
https://github.com/systemd/systemd/issues/29568
This commit simplifies the logic to remove the shuffling. For reference, the original logic was added in commit 3c9c7a14b627("rpm-pkg: add %post section to create initramfs and grub hooks").>>

But we need to keep the old behavior as well, because the old installkernel application from grubby package, does not allow this simplification and we need to be backward compatible to avoid issues with the different packages.

Mimic Fedora shipping process and store vmlinuz, config amd System.map in the module directory instead of the boot directory. In this way, we will avoid the commented problem for all the cases, because the new destination files are not going to exist in the boot directory of the kernel package.

Replace installkernel tool with kernel-install tool, because the latter is more complete.

Besides, after installkernel tool execution, check to complete if the correct package files vmlinuz, System.map and config files are present in /boot directory, and if necessary, copy manually for install operation. In this way, take into account if files were not previously copied from /usr/lib/kernel/install.d/* scripts and if the suitable files for the requested package are present (it could be others if the rpm files were replace with a new pacakge with the same release and a different build).

Tested with Fedora 38, Fedora 39, RHEL 9, Oracle Linux 9.3, openSUSE Tumbleweed and openMandrive ROME, using dnf/zypper and rpm tools.

---
 scripts/package/kernel.spec | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
scripts/package/kernel.spec +11 -11
index 89298983a169..f58726671fb3 100644
@@ -55,12 +55,12 @@ patch -p1 < %{SOURCE2}
 %{make} %{makeflags} KERNELRELEASE=%{KERNELRELEASE} KBUILD_BUILD_VERSION=%{release}
 
 %install
-mkdir -p %{buildroot}/boot
-cp $(%{make} %{makeflags} -s image_name) %{buildroot}/boot/vmlinuz-%{KERNELRELEASE}
+mkdir -p %{buildroot}/lib/modules/%{KERNELRELEASE}
+cp $(%{make} %{makeflags} -s image_name) %{buildroot}/lib/modules/%{KERNELRELEASE}/vmlinuz
 %{make} %{makeflags} INSTALL_MOD_PATH=%{buildroot} modules_install
 %{make} %{makeflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install
-cp System.map %{buildroot}/boot/System.map-%{KERNELRELEASE}
-cp .config %{buildroot}/boot/config-%{KERNELRELEASE}
+cp System.map %{buildroot}/lib/modules/%{KERNELRELEASE}
+cp .config %{buildroot}/lib/modules/%{KERNELRELEASE}/config
 ln -fns /usr/src/kernels/%{KERNELRELEASE} %{buildroot}/lib/modules/%{KERNELRELEASE}/build
 %if %{with_devel}
 %{make} %{makeflags} run-command KBUILD_RUN_COMMAND='${srctree}/scripts/package/install-extmod-build %{buildroot}/usr/src/kernels/%{KERNELRELEASE}'
@@ -70,13 +70,14 @@ ln -fns /usr/src/kernels/%{KERNELRELEASE} %{buildroot}/lib/modules/%{KERNELRELEA
 rm -rf %{buildroot}
 
 %post
-if [ -x /sbin/installkernel -a -r /boot/vmlinuz-%{KERNELRELEASE} -a -r /boot/System.map-%{KERNELRELEASE} ]; then
-cp /boot/vmlinuz-%{KERNELRELEASE} /boot/.vmlinuz-%{KERNELRELEASE}-rpm
-cp /boot/System.map-%{KERNELRELEASE} /boot/.System.map-%{KERNELRELEASE}-rpm
-rm -f /boot/vmlinuz-%{KERNELRELEASE} /boot/System.map-%{KERNELRELEASE}
-/sbin/installkernel %{KERNELRELEASE} /boot/.vmlinuz-%{KERNELRELEASE}-rpm /boot/.System.map-%{KERNELRELEASE}-rpm
-rm -f /boot/.vmlinuz-%{KERNELRELEASE}-rpm /boot/.System.map-%{KERNELRELEASE}-rpm
+if [ -x /usr/bin/kernel-install ]; then
+	/usr/bin/kernel-install add %{KERNELRELEASE} /lib/modules/%{KERNELRELEASE}/vmlinuz
 fi
+for file in vmlinuz System.map config; do
+	if ! cmp --silent "/lib/modules/%{KERNELRELEASE}/${file}" "/boot/${file}-%{KERNELRELEASE}"; then
+		cp "/lib/modules/%{KERNELRELEASE}/${file}" "/boot/${file}-%{KERNELRELEASE}"
+	fi
+done
 
 %preun
 if [ -x /sbin/new-kernel-pkg ]; then
@@ -94,7 +95,6 @@ fi
 %defattr (-, root, root)
 /lib/modules/%{KERNELRELEASE}
 %exclude /lib/modules/%{KERNELRELEASE}/build
-/boot/*
 
 %files headers
 %defattr (-, root, root)
Signature · 1 line
2.49.0
maintainer
#8 lore raw

Re: [PATCH 6.6.y 2/2] kbuild: rpm-pkg: simplify installkernel %post

[ Sasha's backport helper bot ]

Hi,

✅ All tests passed successfully. No issues detected. No action required from the submitter.

The upstream commit SHA1 provided is correct: 358de8b4f201bc05712484b15f0109b1ae3516a8

WARNING: Author mismatch between patch and upstream commit:
Backport author: Chuck Lever<[email protected]>
Commit author: Jose Ignacio Tornos Martinez<[email protected]>

Status in newer kernel trees:
6.15.y | Present (exact SHA1)
6.12.y | Present (exact SHA1)

Note: The patch differs from the upstream commit:
---
1: 358de8b4f201b ! 1: 4ec47d5c243f8 kbuild: rpm-pkg: simplify installkernel %post
@@ Metadata
## Commit message ##
kbuild: rpm-pkg: simplify installkernel %post

+ [ Upstream commit 358de8b4f201bc05712484b15f0109b1ae3516a8 ]
+
The new installkernel application that is now included in systemd-udev package allows installation although destination files are already present in the boot directory of the kernel package, but is failing with the
@@ Commit message

+ Signed-off-by: Chuck Lever <[email protected]>

## scripts/package/kernel.spec ##
@@ scripts/package/kernel.spec: patch -p1 < %{SOURCE2}
---

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-6.12.y       |  Success    |  Success   |