[PATCH v8 31/32] fdt: Avoid emitting an device tree when not needed
Simon Glass
sjg at chromium.org
Fri Dec 17 04:59:38 CET 2021
U-Boot always needs some sort of a device tree in the build. Some boards
never actually use this, at least in production systems, since a prior
firmware stage sets one up and passes it to U-Boot. At present the only
mechanism to do that is with custom function (OF_BOARD), but future work
will include a standard way of doing this ('standard passage').
It can be confusing to see a device tree emitted from the U-Boot build in
this situation. Add an option to drop it.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
Changes in v8:
- Fix devicetree logic so that just u-boot.dtb is omitted
Makefile | 6 ++++--
dts/Kconfig | 10 ++++++++++
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 98ef2642f68..dc391af29ca 100644
--- a/Makefile
+++ b/Makefile
@@ -952,7 +952,9 @@ INPUTS-$(CONFIG_SPL_FRAMEWORK) += u-boot.img
endif
endif
INPUTS-$(CONFIG_TPL) += tpl/u-boot-tpl.bin
-INPUTS-$(CONFIG_OF_SEPARATE) += u-boot.dtb
+
+# Allow omitting the .dtb output if it is not normally used
+INPUTS-$(CONFIG_OF_SEPARATE) += $(if $(CONFIG_OF_OMIT_DTB),dts/dt.dtb,u-boot.dtb)
ifeq ($(CONFIG_SPL_FRAMEWORK),y)
INPUTS-$(CONFIG_OF_SEPARATE) += u-boot-dtb.img
endif
@@ -1199,7 +1201,7 @@ u-boot.bin: u-boot-fit-dtb.bin FORCE
u-boot-dtb.bin: u-boot-nodtb.bin dts/dt.dtb FORCE
$(call if_changed,cat)
-else ifeq ($(CONFIG_OF_SEPARATE),y)
+else ifeq ($(CONFIG_OF_SEPARATE).$(CONFIG_OF_OMIT_DTB),y.)
u-boot-dtb.bin: u-boot-nodtb.bin dts/dt.dtb FORCE
$(call if_changed,cat)
diff --git a/dts/Kconfig b/dts/Kconfig
index e57ce84b98d..fb7df533f92 100644
--- a/dts/Kconfig
+++ b/dts/Kconfig
@@ -129,6 +129,16 @@ config OF_HAS_PRIOR_STAGE
Note: This option must be set in Kconfig and cannot be enabled or
disabled in the board's defconfig file.
+config OF_OMIT_DTB
+ bool "Omit the device tree output when building"
+ default y if OF_HAS_PRIOR_STAGE && !BINMAN
+ help
+ As a special case, avoid writing a device tree file u-boot.dtb when
+ building. Also don't include that file in u-boot.bin
+
+ This is used for boards which normally provide a devicetree via a
+ runtime mechanism (such as OF_BOARD), to avoid confusion.
+
config DEFAULT_DEVICE_TREE
string "Default Device Tree for DT control"
depends on OF_CONTROL
--
2.34.1.173.g76aa8bc2d0-goog
More information about the U-Boot
mailing list