arch/arm64: Avoid race condition when building bl31

The arm-trusted-firmware build system may not create the final bl31.elf file
atomically, confusing our make to try to use it before it's ready.
Hence insert a (hopefully, but not guaranteed to be atomic) file move.

Change-Id: Iffc80467e0f4bbc96fc62414d4abfaa7b42634f4
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-on: http://review.coreboot.org/10700
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Tested-by: build bot (Jenkins)
This commit is contained in:
Patrick Georgi 2015-06-29 22:13:53 +02:00 committed by Patrick Georgi
parent da0098a4d0
commit 2268b3b750
1 changed files with 3 additions and 2 deletions

View File

@ -195,12 +195,12 @@ BL31_MAKEARGS += DEBUG=1
endif # CONFIG_CONSOLE_SERIAL endif # CONFIG_CONSOLE_SERIAL
# Avoid build/release|build/debug distinction by overriding BUILD_PLAT directly # Avoid build/release|build/debug distinction by overriding BUILD_PLAT directly
BL31_MAKEARGS += BUILD_PLAT="$(top)/$(obj)/3rdparty/arm-trusted-firmware" BL31_MAKEARGS += BUILD_PLAT="$(abspath $(obj)/3rdparty/arm-trusted-firmware)"
BL31_CFLAGS := -fno-pic -fno-stack-protector BL31_CFLAGS := -fno-pic -fno-stack-protector
BL31_LDFLAGS := --emit-relocs BL31_LDFLAGS := --emit-relocs
BL31 := $(obj)/3rdparty/arm-trusted-firmware/bl31/bl31.elf BL31 := $(obj)/bl31.elf
$(BL31): $(BL31):
@printf " MAKE $(subst $(obj)/,,$(@))\n" @printf " MAKE $(subst $(obj)/,,$(@))\n"
@ -208,6 +208,7 @@ $(BL31):
CFLAGS="$(BL31_CFLAGS)" \ CFLAGS="$(BL31_CFLAGS)" \
LDFLAGS="$(BL31_LDFLAGS)" \ LDFLAGS="$(BL31_LDFLAGS)" \
$(MAKE) -C $(BL31_SOURCE) $(BL31_MAKEARGS) bl31 $(MAKE) -C $(BL31_SOURCE) $(BL31_MAKEARGS) bl31
mv $(obj)/3rdparty/arm-trusted-firmware/bl31/bl31.elf $@
.PHONY: $(BL31) .PHONY: $(BL31)