From 273160552d6540aea5d3bb1065ca296614f43c44 Mon Sep 17 00:00:00 2001 From: Brandon Maier Date: Fri, 9 Aug 2024 16:30:18 +0000 Subject: [PATCH] boot/uboot: fix dependency on xilinx-prebuilt When building with `make -j` and PER_PACKAGE_DIRECTORIES, a race condition occurs between xilinx-prebuilt and u-boot, resulting in the following error. objcopy -O binary -I elf32-little .../images/pmufw.elf .../images/pmufw.bin objcopy: '.../images/pmufw.elf': No such file U-Boot registers a KCONFIG_FIXUP_CMD that uses the pmufw.elf from xilinx-prebuilt. But KCONFIG_FIXUP_CMDS does not use the normal DEPENDENCIES, so xilinx-prebuilt is not guaranteed to have run before fixup. Instead move the `objcopy` call out to a PRE_BUILD_HOOK so it will run after xilinx-prebuilt has finished. Signed-off-by: Brandon Maier Tested-by: Neal Frager Reviewed-by: Neal Frager Signed-off-by: Thomas Petazzoni --- boot/uboot/uboot.mk | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk index 45ad1c880f..cdb9f435f7 100644 --- a/boot/uboot/uboot.mk +++ b/boot/uboot/uboot.mk @@ -460,13 +460,17 @@ endif #ifneq ($(findstring ://,$(UBOOT_ZYNQMP_PMUFW)),) endif #BR2_TARGET_UBOOT_ZYNQMP_PMUFW_PREBUILT -UBOOT_ZYNQMP_PMUFW_BASENAME = $(basename $(UBOOT_ZYNQMP_PMUFW_PATH)) - +ifeq ($(suffix $(UBOOT_ZYNQMP_PMUFW_PATH)),.elf) +UBOOT_ZYNQMP_PMUFW_PATH_FINAL = $(basename $(UBOOT_ZYNQMP_PMUFW_PATH)).bin +define UBOOT_ZYNQMP_PMUFW_CONVERT + objcopy -O binary -I elf32-little $(UBOOT_ZYNQMP_PMUFW_PATH) $(UBOOT_ZYNQMP_PMUFW_PATH_FINAL) +endef +UBOOT_PRE_BUILD_HOOKS += UBOOT_ZYNQMP_PMUFW_CONVERT +else +UBOOT_ZYNQMP_PMUFW_PATH_FINAL = $(UBOOT_ZYNQMP_PMUFW_PATH) +endif define UBOOT_ZYNQMP_KCONFIG_PMUFW - $(if $(filter %.elf,$(UBOOT_ZYNQMP_PMUFW_PATH)), - objcopy -O binary -I elf32-little $(UBOOT_ZYNQMP_PMUFW_BASENAME).elf $(UBOOT_ZYNQMP_PMUFW_BASENAME).bin - $(call KCONFIG_SET_OPT,CONFIG_PMUFW_INIT_FILE,"$(UBOOT_ZYNQMP_PMUFW_BASENAME).bin"), - $(call KCONFIG_SET_OPT,CONFIG_PMUFW_INIT_FILE,"$(UBOOT_ZYNQMP_PMUFW_PATH)")) + $(call KCONFIG_SET_OPT,CONFIG_PMUFW_INIT_FILE,"$(UBOOT_ZYNQMP_PMUFW_PATH_FINAL)") endef UBOOT_ZYNQMP_PM_CFG = $(call qstrip,$(BR2_TARGET_UBOOT_ZYNQMP_PM_CFG))