Skip to content

Commit 76ca5af

Browse files
committed
sys-boot/shim: Fix parallel build
The bundled gnu-efi build is implemented in a buggy way that can break when built in parallel. We've hit this in the nightly sdk build. Add a patch for it. The patch has been posted upstream at rhboot/shim#643. Signed-off-by: Jeremi Piotrowski <[email protected]>
1 parent e2162e2 commit 76ca5af

File tree

3 files changed

+49
-0
lines changed

3 files changed

+49
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
From f10087671538e8e052f035f011fc826f36f2af3b Mon Sep 17 00:00:00 2001
2+
From: Jeremi Piotrowski <[email protected]>
3+
Date: Thu, 29 Feb 2024 10:00:22 +0100
4+
Subject: [PATCH] Fix parallel build of gnu-efi
5+
6+
When building with make 4.4.1, gnu-efi may be built twice and in parallel:
7+
8+
$ make -n -j ARCH=x86_64 2>&1 | tee build.log
9+
$ grep -e 'make -C gnu-efi' build.log
10+
make -C gnu-efi \
11+
make -C gnu-efi \
12+
13+
This has been seen to cause linking failures when building libgnuefi.a because
14+
some object files may end up truncated.
15+
16+
The reason for this is that make interprets multiple targets in the same rule
17+
as independent and can run the rule multiple times. The solution is to define a
18+
grouped target with &:, which causes make to behave the way one expects: runs
19+
the rule once and expects it to create all targets.
20+
21+
Grouped target support was added in make 4.3 released 4 years ago.
22+
23+
Signed-off-by: Jeremi Piotrowski <[email protected]>
24+
---
25+
Makefile | 2 +-
26+
1 file changed, 1 insertion(+), 1 deletion(-)
27+
28+
diff --git a/Makefile b/Makefile
29+
index 8283d56..bbf707b 100644
30+
--- a/Makefile
31+
+++ b/Makefile
32+
@@ -154,7 +154,7 @@ $(MMSONAME): $(MOK_OBJS) $(LIBS)
33+
$(LD) -o $@ $(LDFLAGS) $^ $(EFI_LIBS) lib/lib.a
34+
35+
gnu-efi/$(ARCH_GNUEFI)/gnuefi/libgnuefi.a gnu-efi/$(ARCH_GNUEFI)/lib/libefi.a: CFLAGS+=-DGNU_EFI_USE_EXTERNAL_STDARG
36+
-gnu-efi/$(ARCH_GNUEFI)/gnuefi/libgnuefi.a gnu-efi/$(ARCH_GNUEFI)/lib/libefi.a:
37+
+gnu-efi/$(ARCH_GNUEFI)/gnuefi/libgnuefi.a gnu-efi/$(ARCH_GNUEFI)/lib/libefi.a &:
38+
mkdir -p gnu-efi/lib gnu-efi/gnuefi
39+
$(MAKE) -C gnu-efi \
40+
COMPILER="$(COMPILER)" \
41+
--
42+
2.39.2
43+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
shim-15.8.ebuild

sdk_container/src/third_party/coreos-overlay/sys-boot/shim/shim-15.8.ebuild

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ DEPEND="
2222
dev-libs/openssl
2323
coreos-base/coreos-sb-keys
2424
"
25+
26+
PATCHES=(
27+
"${FILESDIR}/0001-Fix-parallel-build-of-gnu-efi.patch"
28+
)
29+
2530
src_compile() {
2631
local emake_args=(
2732
CROSS_COMPILE="${CHOST}-"

0 commit comments

Comments
 (0)