[PATCH v3] use objcopy for riscv64 with gnu-efi >= 4.0

0 views
Skip to first unread message

Quirin Gylstorff

unread,
Jul 6, 2026, 7:57:36 AM (6 days ago) Jul 6
to jan.k...@siemens.com, efibootg...@googlegroups.com
From: Quirin Gylstorff <quirin.g...@siemens.com>

With gnu-efi >= 4.0 the binary copy no longer works for riscv64
as it leads to non working efi binaries. The binaries are from
type `data` instead of `PE32+ executable for EFI`.
This can be check with the command `file
<path to the efibootguard binary>`

This fixes Debian bug 1130324 [1].

[1]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1130324

The armhf target still needs the binary copy option tested with gnu-efi
4.0.4.

Signed-off-by: Quirin Gylstorff <quirin.g...@siemens.com>
---
Changes v3:
- add line about armhf to commit message
- clarify gnu_efi versions

Changes v2:
- add parenthesis
- correct comments

configure.ac | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index 1779661..afc5d88 100644
--- a/configure.ac
+++ b/configure.ac
@@ -245,12 +245,17 @@ AC_DEFINE_UNQUOTED([GNU_EFI_VERSION], [${GNU_EFI_VERSION}], [gnu-efi version])

AC_SUBST([OBJCOPY_HAS_EFI_APP_TARGET], [$($OBJCOPY --info | $GREP -q pei- 2>/dev/null && echo "true")])

-# Use objcopy -O binary on riscv64, arm, and aarch64 with gnu-efi 3.0.15
+# Use objcopy -O binary arm, aarch64 with gnu-efi < 3.0.16 and riscv64 < 4.0
AM_CONDITIONAL([OBJCOPY_USE_BINARY_COPY],
- [test "$ARCH" = "arm" || test "$ARCH" = "riscv64" || test "$ARCH" = "aarch64" -a $GNU_EFI_VERSION -eq 0])
-
-# Ensure objcopy supports target=efi-app for x86 across the board(s) and aarch64 with gnu-efi > 3.0.15
-if test -z "$ARCH_IS_X86_TRUE" -a -z "$OBJCOPY_HAS_EFI_APP_TARGET" || test "$ARCH" = "aarch64" -a -z "$OBJCOPY_HAS_EFI_APP_TARGET" -a $GNU_EFI_VERSION -gt 0; then
+ [test "$ARCH" = "arm" || \
+ (test "$ARCH" = "riscv64" && test $GNU_EFI_VERSION -lt 4000000) || \
+ (test "$ARCH" = "aarch64" && test $GNU_EFI_VERSION -eq 0)])
+
+# Ensure objcopy supports target=efi-app for x86 across the board(s), aarch64 with gnu-efi > 3.0.15,
+# and riscv64 >= 4.0
+if (test -z "$ARCH_IS_X86_TRUE" && test -z "$OBJCOPY_HAS_EFI_APP_TARGET") || \
+ (test "$ARCH" = "aarch64" && test -z "$OBJCOPY_HAS_EFI_APP_TARGET" && test $GNU_EFI_VERSION -gt 0) || \
+ (test "$ARCH" = "riscv64" && test -z "$OBJCOPY_HAS_EFI_APP_TARGET" && test $GNU_EFI_VERSION -ge 4000000); then
AC_MSG_ERROR([objcopy doesn't support --target=efi-app but that is needed by gnu-efi])
fi

--
2.53.0

Jan Kiszka

unread,
Jul 6, 2026, 10:29:42 AM (6 days ago) Jul 6
to Quirin Gylstorff, efibootg...@googlegroups.com
On 06.07.26 13:57, 'Quirin Gylstorff' via EFI Boot Guard wrote:
> From: Quirin Gylstorff <quirin.g...@siemens.com>
>
> With gnu-efi >= 4.0 the binary copy no longer works for riscv64

So, this is most likely since 4.0.0 the case, right?

I've just scanned the history >4.0.0, and there is nothing RISC-V
related. In contrast, 4.0.0 had this suspicious one:

https://github.com/ncroxon/gnu-efi/commit/353984bb9720f31f7e27ac761a718f7fa564ba82
Thanks, applied.

Jan

--
Siemens AG, Foundational Technologies
Linux Expert Center
Reply all
Reply to author
Forward
0 new messages