From 8012cc5c2f2a96fdea66359e8c559a3804cebdd4 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Sat, 4 Nov 2017 03:12:28 +0900 Subject: [PATCH 1/2] Build: introduce ${BUILD_PLAT} target to create the top build directory Some platforms (for ex. UniPhier) want to create files in the very top of the build directory. Add ${BUILD_PLAT} so such files can depend on it. Make existing directory targets depend on ${BUILD_PLAT} because they are sub-directories of ${BUILD_PLAT}. Signed-off-by: Masahiro Yamada --- Makefile | 2 ++ make_helpers/build_macros.mk | 2 +- plat/rockchip/rk3399/platform.mk | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index b32b417b6..a648d8c0b 100644 --- a/Makefile +++ b/Makefile @@ -260,6 +260,8 @@ include lib/stack_protector/stack_protector.mk include ${PLAT_MAKEFILE_FULL} +$(eval $(call MAKE_PREREQ_DIR,${BUILD_PLAT})) + # Platform compatibility is not supported in AArch32 ifneq (${ARCH},aarch32) # If the platform has not defined ENABLE_PLAT_COMPAT, then enable it by default diff --git a/make_helpers/build_macros.mk b/make_helpers/build_macros.mk index e59a64b42..7531f6d80 100644 --- a/make_helpers/build_macros.mk +++ b/make_helpers/build_macros.mk @@ -291,7 +291,7 @@ define MAKE_BL # Create generators for object directory structure -$(eval $(call MAKE_PREREQ_DIR,${BUILD_DIR},)) +$(eval $(call MAKE_PREREQ_DIR,${BUILD_DIR},${BUILD_PLAT})) $(eval $(foreach objd,${OBJ_DIRS},$(call MAKE_PREREQ_DIR,${objd},${BUILD_DIR}))) diff --git a/plat/rockchip/rk3399/platform.mk b/plat/rockchip/rk3399/platform.mk index 85cca1b6b..6cd5b242a 100644 --- a/plat/rockchip/rk3399/platform.mk +++ b/plat/rockchip/rk3399/platform.mk @@ -88,7 +88,7 @@ ${RK_PLAT_SOC}/drivers/pmu/pmu_fw.c: $(RK3399M0FW) ${BUILD_PLAT}/bl31/cdn_dp.o: CCACHE_EXTRAFILES=$(HDCPFW) ${RK_PLAT_SOC}/drivers/dp/cdn_dp.c: $(HDCPFW) -$(eval $(call MAKE_PREREQ_DIR,${BUILD_M0},)) +$(eval $(call MAKE_PREREQ_DIR,${BUILD_M0},${BUILD_PLAT})) .PHONY: $(RK3399M0FW) $(RK3399M0FW): | ${BUILD_M0} $(MAKE) -C ${RK_PLAT_SOC}/drivers/m0 BUILD=$(abspath ${BUILD_PLAT}/m0) From 3c9461520f734b92f27345da515160d8522eeda6 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Sat, 4 Nov 2017 03:14:03 +0900 Subject: [PATCH 2/2] uniphier: make sure to create build directory before ROT key Building the UniPhier platform in parallel with TRUSTED_BOARD_BOOT=1 could fail due to non-existing directory. It might be difficult to reproduce, but here is an easier way to trigger the problem: $ make PLAT=uniphier TRUSTED_BOARD_BOOT=1 MBEDTLS_DIR=mbedtls certificates OPENSSL build/uniphier/release/rot_key.pem /bin/sh: 1: cannot create build/uniphier/release/rot_key.pem: Directory nonexistent make: *** [build/uniphier/release/rot_key.pem] Error 2 The $(ROT_KEY) must depend on $(BUILD_PLAT) so that the build directory is created before the key. Signed-off-by: Masahiro Yamada --- plat/socionext/uniphier/platform.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plat/socionext/uniphier/platform.mk b/plat/socionext/uniphier/platform.mk index e6f510e0e..c91abb6be 100644 --- a/plat/socionext/uniphier/platform.mk +++ b/plat/socionext/uniphier/platform.mk @@ -101,7 +101,7 @@ $(BUILD_PLAT)/bl1/uniphier_rotpk.o: $(ROTPK_HASH) $(BUILD_PLAT)/bl2/uniphier_rotpk.o: $(ROTPK_HASH) certificates: $(ROT_KEY) -$(ROT_KEY): +$(ROT_KEY): | $(BUILD_PLAT) @echo " OPENSSL $@" $(Q)openssl genrsa 2048 > $@ 2>/dev/null