[U-Boot] [PATCH v2 1/1] efi_loader: avoid make race condition

Heinrich Schuchardt xypron.debian at gmx.de
Sun Jun 3 22:37:38 UTC 2018


On 06/02/2018 07:00 PM, Heinrich Schuchardt wrote:
> When U-Boot is built with 'make -j' there is not guarantee that targets in
> directory arch/ are built before targets in directory lib/. The current
> build instruction for EFI binaries in lib/ rely on dependencies in arch/.
> If $(EFI_CRT0) or $(EFI_RELOC) is not yet built before trying to build
> %.efi an error
>     *** No rule to make target '%.efi'
> occurs.
> 
> With the patch separate copies of $(EFI_CRT0) and $(EFI_RELOC) named
> efi_crt0.o and efi_reloc.o are built in lib/efi_loader and
> lib/efi_selftest.
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
> ---
> v2
> 	Build separate copies of $(EFI_CRT0) and $(EFI_RELOC) in each
> 	build directory for .efi binaries.
> 
> Hello Tuomas,
> 
> please, test if this resolves your problem.
> 
> Best regards
> 
> Heinrich

Without make mrproper I ran into

$ export CROSS_COMPILE=arm-linux-gnueabihf-
$ make odroid-xu3_defconfig
$ make

lib/efi_loader/efi_crt0.o: file not recognized: File format not recognized
scripts/Makefile.lib:396: recipe for target
'lib/efi_loader/helloworld_efi.so' failed
make[2]: *** [lib/efi_loader/helloworld_efi.so] Error 1

$ file lib/efi_loader/efi_crt0.o
lib/efi_loader/efi_crt0.o: ELF 64-bit LSB relocatable, ARM aarch64,
version 1 (SYSV), with debug_info, not stripped

efi_crt0.o was obviously not rebuilt. After make mrproper I did not run
into problems.

So this patch still needs some fine tuning.

Best regards

Heinrich

> ---
>  scripts/Makefile.lib | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> index ef7604c463..461f1c75a3 100644
> --- a/scripts/Makefile.lib
> +++ b/scripts/Makefile.lib
> @@ -385,8 +385,14 @@ cmd_efi_ld = $(LD) -nostdlib -znocombreloc -T $(EFI_LDS_PATH) -shared \
>  
>  EFI_LDS_PATH = $(srctree)/arch/$(ARCH)/lib/$(EFI_LDS)
>  
> -$(obj)/%_efi.so: $(obj)/%.o arch/$(ARCH)/lib/$(EFI_CRT0) \
> -		arch/$(ARCH)/lib/$(EFI_RELOC)
> +$(obj)/efi_crt0.o: $(srctree)/arch/$(ARCH)/lib/$(EFI_CRT0:.o=.S)
> +	$(call if_changed_dep,as_o_S)
> +
> +$(obj)/efi_reloc.o: $(srctree)/arch/$(ARCH)/lib/$(EFI_RELOC:.o=.c) $(recordmcount_source) FORCE
> +	$(call cmd,force_checksrc)
> +	$(call if_changed_rule,cc_o_c)
> +
> +$(obj)/%_efi.so: $(obj)/%.o $(obj)/efi_crt0.o $(obj)/efi_reloc.o
>  	$(call cmd,efi_ld)
>  
>  # ACPI
> 



More information about the U-Boot mailing list