public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Subject: Re: [gentoo-dev] [PATCH 2/2] dist-kernel-utils.eclass: skip initrd installation when using the uki layout
Date: Sat, 17 Jun 2023 20:21:48 +0200	[thread overview]
Message-ID: <5c62b67f-077d-1be3-655e-a72e56a60332@gentoo.org> (raw)
In-Reply-To: <a14a1d48-69b2-8fe9-3d55-7954bdfd6511@gentoo.org>

This replaces a workaround with a better one. Instead of tricking 
50-dracut.install with an empty inird file we instruct kernel-install to 
simply skip this plugin.

This way we don't end up with a bunch of confusing empty initrd files in 
/boot. End result is the same.

I've got an upstream PR open to fix the underlying issue (i.e make 
50-dracut.install work properly with uefi=yes and layout=uki): 
https://github.com/dracutdevs/dracut/pull/2405


 From c2d6ecb074d25c70677fa9c371801a0002c9a216 Mon Sep 17 00:00:00 2001
From: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
Date: Fri, 16 Jun 2023 22:51:00 +0200
Subject: [PATCH] dist-kernel-utils.eclass: skip initrd installation when 
using
  uki

Gets rid of a hack that prevents 50-dracut.install from regenerating the 
initrd
when calling kernel-install. Instead instruct kernel-install to simply 
not run
this plugin.

Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
---
  eclass/dist-kernel-utils.eclass | 19 +++++++++++++++----
  1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/eclass/dist-kernel-utils.eclass 
b/eclass/dist-kernel-utils.eclass
index c6892c2f01278..e371e035c8565 100644
--- a/eclass/dist-kernel-utils.eclass
+++ b/eclass/dist-kernel-utils.eclass
@@ -106,10 +106,21 @@ dist-kernel_install_kernel() {
  		# install the combined executable in place of kernel
  		image=${initrd}.efi
  		mv "${initrd}" "${image}" || die
-		# put an empty file in place of initrd.  installing a duplicate
-		# file would waste disk space, and removing it entirely provokes
-		# kernel-install to regenerate it via dracut.
-		> "${initrd}"
+		# We moved the generated initrd, prevent dracut from running again
+		local plugins=()
+		for file in "${EROOT}"/usr/lib/kernel/install.d/*; do
+			if [[ ${file} != */50-dracut.install && \
+				${file} != */51-dracut-rescue.install && \
+				${file} == *.install ]]; then
+					plugins+=( "${file}" )
+			fi
+		done
+		for file in "${EROOT}"/etc/kernel/install.d/*; do
+			if [[ ${file} == *.install ]]; then
+					plugins+=( "${file}" )
+			fi
+		done
+		export KERNEL_INSTALL_PLUGINS="${KERNEL_INSTALL_PLUGINS} ${plugins[@]}"
  	fi

  	ebegin "Installing the kernel via installkernel"



  reply	other threads:[~2023-06-17 18:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-17 18:17 [gentoo-dev] [PATCH 1/2] dist-kernel-utils.eclass: fix extension of generated efi file Andrew Ammerlaan
2023-06-17 18:21 ` Andrew Ammerlaan [this message]
2023-06-19 12:33   ` [gentoo-dev] [PATCH 2/2 v2] dist-kernel-utils.eclass: skip initrd installation when using the uki layout Andrew Ammerlaan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5c62b67f-077d-1be3-655e-a72e56a60332@gentoo.org \
    --to=andrewammerlaan@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox