blob: da7e27c64c8d36f26d649959f876ae09d540e008 [file] [log] [blame]
Brad Bishopd5ae7d92018-06-14 09:52:03 -07001From 5c2e24a9ed54dfee77d1844a080e998b4affe916 Mon Sep 17 00:00:00 2001
2From: Heinrich Schuchardt <xypron.glpk@gmx.de>
3Date: Sat, 2 Jun 2018 19:00:41 +0200
4Subject: [PATCH] efi_loader: avoid make race condition
5
6When U-Boot is built with 'make -j' there is not guarantee that targets in
7directory arch/ are built before targets in directory lib/. The current
8build instruction for EFI binaries in lib/ rely on dependencies in arch/.
9If $(EFI_CRT0) or $(EFI_RELOC) is not yet built before trying to build
10%.efi an error
11 *** No rule to make target '%.efi'
12occurs.
13
14With the patch separate copies of $(EFI_CRT0) and $(EFI_RELOC) named
15efi_crt0.o and efi_reloc.o are built in lib/efi_loader and
16lib/efi_selftest.
17
18Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
19Signed-off-by: Alexander Graf <agraf@suse.de>
20
21Upstream-Status: Backport from 2018.07
22
23Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
24---
25 scripts/Makefile.lib | 10 ++++++++--
26 1 file changed, 8 insertions(+), 2 deletions(-)
27
28diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
29index 8f19b2db56..f2f398c935 100644
30--- a/scripts/Makefile.lib
31+++ b/scripts/Makefile.lib
32@@ -404,8 +404,14 @@ cmd_efi_ld = $(LD) -nostdlib -znocombreloc -T $(EFI_LDS_PATH) -shared \
33
34 EFI_LDS_PATH = $(srctree)/arch/$(ARCH)/lib/$(EFI_LDS)
35
36-$(obj)/%_efi.so: $(obj)/%.o arch/$(ARCH)/lib/$(EFI_CRT0) \
37- arch/$(ARCH)/lib/$(EFI_RELOC)
38+$(obj)/efi_crt0.o: $(srctree)/arch/$(ARCH)/lib/$(EFI_CRT0:.o=.S)
39+ $(call if_changed_dep,as_o_S)
40+
41+$(obj)/efi_reloc.o: $(srctree)/arch/$(ARCH)/lib/$(EFI_RELOC:.o=.c) $(recordmcount_source) FORCE
42+ $(call cmd,force_checksrc)
43+ $(call if_changed_rule,cc_o_c)
44+
45+$(obj)/%_efi.so: $(obj)/%.o $(obj)/efi_crt0.o $(obj)/efi_reloc.o
46 $(call cmd,efi_ld)
47
48 # ACPI
49--
502.17.1
51