[U-Boot] [PATCH] arm64: zynqmp: fail SPL build if no psu_init found

Jean-Francois Dagenais jeff.dagenais at gmail.com
Mon Apr 3 00:51:48 UTC 2017


When doing the SPL build, not finding the psu_init files yields an
unuseable spl binary. Time is wasted as the build is carried through dev
ops all the way to trying to boot the DUD build.

A failure immediately alerts developers that something is wrong in the
configuration of the u-boot tree, thus allowing quicker recovery.

Adding an extra test in this section made the logic a bit too clunky so
the layout of the tests was refactored for the reader's benefit.

Signed-off-by: Jean-Francois Dagenais <jeff.dagenais at gmail.com>
---
 board/xilinx/zynqmp/Makefile | 28 ++++++++++++++++++++++------
 1 file changed, 22 insertions(+), 6 deletions(-)

diff --git a/board/xilinx/zynqmp/Makefile b/board/xilinx/zynqmp/Makefile
index 2bf0375..78cb550 100644
--- a/board/xilinx/zynqmp/Makefile
+++ b/board/xilinx/zynqmp/Makefile
@@ -7,22 +7,38 @@
 
 obj-y	:= zynqmp.o
 
-hw-platform-y :=$(shell echo $(CONFIG_DEFAULT_DEVICE_TREE))
+ifeq ($(CONFIG_SPL_BUILD), y)
 
+# use the devicetree name as a hint for the psu_init file dir name
+hw-platform-y :=$(shell echo $(CONFIG_DEFAULT_DEVICE_TREE))
 init-objs := $(if $(wildcard $(srctree)/$(src)/$(hw-platform-y)/psu_init_gpl.c),\
 	$(hw-platform-y)/psu_init_gpl.o)
 
+# if couldn't find psu_init files where they *should*, be...
 ifeq ($(init-objs),)
-ifneq ($(wildcard $(srctree)/$(src)/psu_init_gpl.c),)
-init-objs := psu_init_gpl.o
-$(if $(CONFIG_SPL_BUILD),\
-$(warning Put custom psu_init_gpl.c/h to board/xilinx/zynqmp/custom_hw_platform/))
+# then fallback to this current dir, if file exists
+init-objs := $(if $(wildcard $(srctree)/$(src)/psu_init_gpl.c), psu_init_gpl.o)
 endif
+
+# if init-objs still empty, then abort
+ifeq ($(init-objs),)
+# define a \n equivalent:
+define n
+
+
+endef
+
+$(error Could not locate psu_init_gpl.c/h files, tried: $n\
+	$(srctree)/$(src)/$(hw-platform-y)/psu_init_gpl.c and $n\
+	$(srctree)/$(src)/psu_init_gpl.c)
 endif
 
-obj-$(CONFIG_ZYNQ_SDHCI) += tap_delays.o
 obj-$(CONFIG_SPL_BUILD) += $(init-objs)
 
+endif # if SPL_BUILD
+
+obj-$(CONFIG_ZYNQ_SDHCI) += tap_delays.o
+
 # Suppress "warning: function declaration isn't a prototype"
 CFLAGS_REMOVE_psu_init_gpl.o := -Wstrict-prototypes
 
-- 
2.1.4



More information about the U-Boot mailing list