Brad Bishop | d5ae7d9 | 2018-06-14 09:52:03 -0700 | [diff] [blame] | 1 | From 5c2e24a9ed54dfee77d1844a080e998b4affe916 Mon Sep 17 00:00:00 2001 |
| 2 | From: Heinrich Schuchardt <xypron.glpk@gmx.de> |
| 3 | Date: Sat, 2 Jun 2018 19:00:41 +0200 |
| 4 | Subject: [PATCH] efi_loader: avoid make race condition |
| 5 | |
| 6 | When U-Boot is built with 'make -j' there is not guarantee that targets in |
| 7 | directory arch/ are built before targets in directory lib/. The current |
| 8 | build instruction for EFI binaries in lib/ rely on dependencies in arch/. |
| 9 | If $(EFI_CRT0) or $(EFI_RELOC) is not yet built before trying to build |
| 10 | %.efi an error |
| 11 | *** No rule to make target '%.efi' |
| 12 | occurs. |
| 13 | |
| 14 | With the patch separate copies of $(EFI_CRT0) and $(EFI_RELOC) named |
| 15 | efi_crt0.o and efi_reloc.o are built in lib/efi_loader and |
| 16 | lib/efi_selftest. |
| 17 | |
| 18 | Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> |
| 19 | Signed-off-by: Alexander Graf <agraf@suse.de> |
| 20 | |
| 21 | Upstream-Status: Backport from 2018.07 |
| 22 | |
| 23 | Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> |
| 24 | --- |
| 25 | scripts/Makefile.lib | 10 ++++++++-- |
| 26 | 1 file changed, 8 insertions(+), 2 deletions(-) |
| 27 | |
| 28 | diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib |
| 29 | index 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 | -- |
| 50 | 2.17.1 |
| 51 | |