public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH] kernel-install.eclass: fix objcopy overwriting uki
@ 2024-10-09 14:22 Nowa Ammerlaan
  0 siblings, 0 replies; only message in thread
From: Nowa Ammerlaan @ 2024-10-09 14:22 UTC (permalink / raw
  To: gentoo-dev

 From 2a98da86d978d4a4ffaa61390cc2253026e1e3de Mon Sep 17 00:00:00 2001
From: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
Date: Tue, 1 Oct 2024 20:34:43 +0200
Subject: [PATCH] kernel-install.eclass: fix objcopy overwriting uki

 From the manual:
If you do not specify outfile, objcopy creates a temporary file and
destructively renames the result with the name of infile.

We don't want that. Unfortunately we cannot use /dev/null as dump, objcopy
complains, so we dump it in T instead.

Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
---
  eclass/kernel-install.eclass | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/eclass/kernel-install.eclass b/eclass/kernel-install.eclass
index dc337c7862fde..03c2b4917aef5 100644
--- a/eclass/kernel-install.eclass
+++ b/eclass/kernel-install.eclass
@@ -650,7 +650,10 @@ kernel-install_extract_from_uki() {
  	local uki=${2}
  	local out=${3}

-	$(tc-getOBJCOPY) "${uki}" --dump-section ".${extract_type}=${out}" ||
+	# objcopy overwrites input if there is no output, dump the output in T.
+	# We unfortunately cannot use /dev/null here
+	$(tc-getOBJCOPY) "${uki}" "${T}/dump.efi" \
+		--dump-section ".${extract_type}=${out}" ||
  		die "Failed to extract ${extract_type}"
  	chmod 644 "${out}" || die
  }



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2024-10-09 14:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-09 14:22 [gentoo-dev] [PATCH] kernel-install.eclass: fix objcopy overwriting uki Nowa Ammerlaan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox