
Currently the enablement of OF_UPSTREAM results on the build system searching for DTs only in dts/upstream/ . There are platforms which use U-Boot specific DTBOs applied on top of U-Boot control DT during SPL stage, and source DTs for these are located in arch/$(ARCH)/dtb.
Add dedicated 'dtbos' target which builds only .dtbos and not .dtbs and in case OF_UPSTREAM is enabled, build this target for arch/$(ARCH)/dtb to generate local U-Boot specific DTBOs.
Adjust top level Makefile so binman would search for .dtb and .dtbo in both OF_UPSTREAM specific paths and arch/$(ARCH)/dtb for the .dtbo case.
Signed-off-by: Marek Vasut marex@denx.de --- Cc: "NXP i.MX U-Boot Team" uboot-imx@nxp.com Cc: Caleb Connolly caleb.connolly@linaro.org Cc: Christoph Niedermaier cniedermaier@dh-electronics.com Cc: Fabio Estevam festevam@gmail.com Cc: Heinrich Schuchardt xypron.glpk@gmx.de Cc: Jonas Karlman jonas@kwiboo.se Cc: Lothar Rubusch l.rubusch@gmail.com Cc: Michal Simek michal.simek@amd.com Cc: Nobuhiro Iwamatsu iwamatsu@nigauri.org Cc: Rasmus Villemoes rasmus.villemoes@prevas.dk Cc: Simon Glass sjg@chromium.org Cc: Stefano Babic sbabic@denx.de Cc: Sumit Garg sumit.garg@linaro.org Cc: Tom Rini trini@konsulko.com Cc: u-boot@dh-electronics.com Cc: u-boot@lists.denx.de --- Makefile | 5 ++++- dts/Makefile | 11 +++++++++-- scripts/Makefile.dts | 5 ++++- 3 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile index 525576f987d..fba8e48681e 100644 --- a/Makefile +++ b/Makefile @@ -1194,6 +1194,8 @@ else dt_dir := arch/$(ARCH)/dts endif
+local_dto_dir := arch/$(ARCH)/dts + ifeq ($(CONFIG_MULTI_DTB_FIT),y)
ifeq ($(CONFIG_MULTI_DTB_FIT_LZO),y) @@ -1377,7 +1379,8 @@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \ build -u -d u-boot.dtb -O . -m \ --allow-missing $(if $(BINMAN_ALLOW_MISSING),--ignore-missing) \ -I . -I $(srctree) -I $(srctree)/board/$(BOARDDIR) \ - -I $(dt_dir) -a of-list=$(CONFIG_OF_LIST) \ + -I $(dt_dir) -I $(local_dto_dir) \ + -a of-list=$(CONFIG_OF_LIST) \ $(foreach f,$(BINMAN_INDIRS),-I $(f)) \ -a atf-bl31-path=${BL31} \ -a tee-os-path=${TEE} \ diff --git a/dts/Makefile b/dts/Makefile index d6c2c9daf31..f872a867667 100644 --- a/dts/Makefile +++ b/dts/Makefile @@ -11,12 +11,16 @@ DEVICE_TREE := unset endif
ifeq ($(CONFIG_OF_UPSTREAM),y) +local_dtbos := local-dtbos +local_dtbo_dir := arch/$(ARCH)/dts ifeq ($(CONFIG_ARM64),y) dt_dir := dts/upstream/src/arm64 else dt_dir := dts/upstream/src/$(ARCH) endif else +local_dtbos := +local_dtbo_dir := dt_dir := arch/$(ARCH)/dts endif
@@ -40,7 +44,7 @@ endif
targets += dt.dtb
-$(DTB): arch-dtbs +$(DTB): arch-dtbs $(local_dtbos) $(Q)test -e $@ || ( \ echo >&2; \ echo >&2 "Device Tree Source ($@) is not correctly specified."; \ @@ -49,10 +53,13 @@ $(DTB): arch-dtbs echo >&2; \ /bin/false)
-PHONY += arch-dtbs +PHONY += arch-dtbs local-dtbos arch-dtbs: $(Q)$(MAKE) $(build)=$(dt_dir) dtbs
+local-dtbos: + $(Q)$(MAKE) $(build)=$(local_dtbo_dir) dtbos + ifeq ($(CONFIG_SPL_BUILD),y) obj-$(CONFIG_OF_EMBED) := dt-spl.dtb.o # support "out-of-tree" build for dtb-spl diff --git a/scripts/Makefile.dts b/scripts/Makefile.dts index 1fe142f2bbf..f4d3a37010a 100644 --- a/scripts/Makefile.dts +++ b/scripts/Makefile.dts @@ -17,8 +17,11 @@ endif
targets += $(dtb-y)
-PHONY += dtbs +PHONY += dtbs dtbos dtbs: $(addprefix $(obj)/, $(dtb-y)) @:
+dtbos: $(addprefix $(obj)/, $(filter-out %.dtb,$(dtb-y))) + @: + clean-files := *.dtb *.dtbo */*.dtb */*.dtbo *_HS