diff mbox series

[v3,38/49] mediatek: Makefile: Drop explicit targets built by binman

Message ID 20200709183948.v3.38.Idd70f441bfba3eafb9a227907177e529323b0731@changeid
State Accepted
Commit e999bea485b3bec03b8135d78e670fea20201931
Headers show
Series rockchip: x86: Support building ROM files automatically with binman | expand

Commit Message

Simon Glass July 10, 2020, 12:40 a.m. UTC
On mediatek various files that need to be created by binman. It does not
make sense to enumerate these in the Makefile. They are described in the
configuration (devicetree) for each board and we can simply run binman
(always) to generate them.

This avoid sprinkling the Makefile with arch-specific code.

Also update the binman definition so that idbloader.img is only needed
when SPL is actually being used.

Reviewed-by: Bin Meng <bmeng.cn at gmail.com>
Signed-off-by: Simon Glass <sjg at chromium.org>
---

Changes in v3:
- Move in the rockchip changes mistakenly in the earlier x86 patch

 Makefile                          | 24 ++++++++++++++++--------
 arch/arm/dts/rockchip-u-boot.dtsi |  2 ++
 2 files changed, 18 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index bdd701e187..77386000e6 100644
--- a/Makefile
+++ b/Makefile
@@ -924,7 +924,10 @@  ifeq ($(CONFIG_ARCH_SUNXI)$(CONFIG_ARM64)$(CONFIG_SPL),yyy)
 INPUTS-y += u-boot-sunxi-with-spl.bin
 endif
 
+# Generate this input file for binman
+ifeq ($(CONFIG_SPL),)
 INPUTS-$(CONFIG_ARCH_MEDIATEK) += u-boot-mtk.bin
+endif
 
 # Add optional build target if defined in board/cpu/soc headers
 ifneq ($(CONFIG_BUILD_TARGET),)
@@ -939,9 +942,20 @@  ifeq ($(CONFIG_MPC85xx)$(CONFIG_OF_SEPARATE),yy)
 INPUTS-y += u-boot-with-dtb.bin
 endif
 
-ifeq ($(CONFIG_ARCH_ROCKCHIP)$(CONFIG_SPL),yy)
+ifeq ($(CONFIG_ARCH_ROCKCHIP),y)
+# On ARM64 this target is produced by binman so we don't need this dep
+ifeq ($(CONFIG_ARM64),y)
+ifeq ($(CONFIG_SPL),y)
+# TODO: Get binman to generate this too
 INPUTS-y += u-boot-rockchip.bin
 endif
+else
+ifeq ($(CONFIG_SPL),y)
+# Generate these inputs for binman which will create the output files
+INPUTS-y += idbloader.img u-boot.img
+endif
+endif
+endif
 
 INPUTS-$(CONFIG_X86) += u-boot-x86-start16.bin u-boot-x86-reset16.bin \
 	$(if $(CONFIG_SPL_X86_16BIT_INIT),spl/u-boot-spl.bin) \
@@ -1457,10 +1471,7 @@  idbloader.img: spl/u-boot-spl.bin FORCE
 	$(call if_changed,mkimage)
 endif
 
-ifeq ($(CONFIG_ARM64),)
-u-boot-rockchip.bin: idbloader.img u-boot.img FORCE
-	$(call if_changed,binman)
-else
+ifeq ($(CONFIG_ARM64),y)
 OBJCOPYFLAGS_u-boot-rockchip.bin = -I binary -O binary \
 	--pad-to=$(CONFIG_SPL_PAD_TO) --gap-fill=0xff
 u-boot-rockchip.bin: idbloader.img u-boot.itb FORCE
@@ -1687,9 +1698,6 @@  u-boot-elf.lds: arch/u-boot-elf.lds prepare FORCE
 
 ifeq ($(CONFIG_SPL),y)
 spl/u-boot-spl-mtk.bin: spl/u-boot-spl
-
-u-boot-mtk.bin: u-boot.dtb u-boot.img spl/u-boot-spl-mtk.bin FORCE
-	$(call if_changed,binman)
 else
 MKIMAGEFLAGS_u-boot-mtk.bin = -T mtk_image \
 	-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) \
diff --git a/arch/arm/dts/rockchip-u-boot.dtsi b/arch/arm/dts/rockchip-u-boot.dtsi
index 0451db735e..eae3ee715d 100644
--- a/arch/arm/dts/rockchip-u-boot.dtsi
+++ b/arch/arm/dts/rockchip-u-boot.dtsi
@@ -11,6 +11,7 @@ 
 	};
 };
 
+#ifdef CONFIG_SPL
 &binman {
 	simple-bin {
 		filename = "u-boot-rockchip.bin";
@@ -25,3 +26,4 @@ 
 		};
 	};
 };
+#endif