For scenarios like OF_PRIOR_STAGE, no device tree blob is provided in the U-Boot build phase hence the binman node information is not available. In order to support such use case, a new Kconfig option BINMAN_DTB is introduced, to tell U-Boot build system that a device tree blob is explicitly required when using binman to package U-Boot.
Signed-off-by: Bin Meng <bmeng...@gmail.com> --- Changes in v2: - new patch: "binman: Support packaging U-Boot for scenarios like OF_PRIOR_STAGE" Makefile | 3 ++- dts/Kconfig | 18 ++++++++++++++++++ lib/Kconfig | 2 +- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 3d88559b67..9043828675 100644 --- a/Makefile +++ b/Makefile @@ -918,6 +918,7 @@ endif endif INPUTS-$(CONFIG_TPL) += tpl/u-boot-tpl.bin INPUTS-$(CONFIG_OF_SEPARATE) += u-boot.dtb +INPUTS-$(CONFIG_BINMAN_DTB) += u-boot.dtb ifeq ($(CONFIG_SPL_FRAMEWORK),y) INPUTS-$(CONFIG_OF_SEPARATE) += u-boot-dtb.img endif @@ -1161,7 +1162,7 @@ u-boot-dtb.bin: u-boot-nodtb.bin dts/dt.dtb FORCE u-boot.bin: u-boot-dtb.bin FORCE $(call if_changed,copy) else -u-boot.bin: u-boot-nodtb.bin FORCE +u-boot.bin: u-boot-nodtb.bin $(if $(CONFIG_BINMAN_DTB),dts/dt.dtb) FORCE $(call if_changed,copy) endif diff --git a/dts/Kconfig b/dts/Kconfig index 99ce75e1a2..84d43fc6a4 100644 --- a/dts/Kconfig +++ b/dts/Kconfig @@ -19,6 +19,24 @@ config BINMAN bool select DTOC +config BINMAN_DTB + bool + depends on BINMAN + default y if OF_PRIOR_STAGE + help + This option tells U-Boot build system that a device tree blob is + explicitly required when using binman to package U-Boot. + + This is not necessary in a common scenario where a device tree blob + is provided in the arch/<arch>/dts directory for a specific board, + where the binman node has been put in the board's device tree, aka + an implicit way. However for a scenario like the board's device tree + is not provided in the U-Boot source tree, but given to U-Boot in the + runtime, e.g.: in the OF_PRIOR_STAGE case that the device tree blob + is passed by a prior stage bootloader. For such scenario, we will + need to provide a device tree blob containing binman node to describe + how to package U-Boot. + menu "Device Tree Control" depends on SUPPORT_OF_CONTROL diff --git a/lib/Kconfig b/lib/Kconfig index 6d2d41de30..7326d95357 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -25,7 +25,7 @@ config BCH config BINMAN_FDT bool "Allow access to binman information in the device tree" depends on BINMAN && DM && OF_CONTROL - default y + default y if !BINMAN_DTB help This enables U-Boot to access information about binman entries, stored in the device tree in a binman node. Typical uses are to -- 2.25.1