boot/opensbi: introduce BR2_TARGET_OPENSBI_FW_FDT_PATH
authorDrew Fustini <drew@beagleboard.org>
Wed, 16 Jun 2021 05:03:41 +0000 (22:03 -0700)
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>
Sun, 18 Jul 2021 19:24:37 +0000 (21:24 +0200)
If U-Boot CONFIG_OF_SEPARATE is defined [1], then the device tree will
be built and placed in a u-boot.dtb file alongside u-boot.bin.

When BR2_TARGET_UBOOT_FORMAT_DTB is enabled, buildroot will copy
u-boot.dtb to $(BINARIES_DIR).

This is useful for RISC-V platforms that want to build OpenSBI with an
external DTB by using FW_FDT_PATH [2].

[1] https://github.com/u-boot/u-boot/blob/master/doc/README.fdt-control
[2] https://github.com/riscv/opensbi/blob/master/docs/firmware/fw.md

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Drew Fustini <drew@beagleboard.org>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
boot/opensbi/Config.in
boot/opensbi/opensbi.mk

index 632eeec88d776c0c2bdd8f73937ea365361d5148..f1443498d9c9c85c26bdd3eef202eaa39f5b15fa 100644 (file)
@@ -109,4 +109,14 @@ config BR2_TARGET_OPENSBI_UBOOT_PAYLOAD
        help
          Build OpenSBI with the U-Boot as a Payload.
 
+config BR2_TARGET_OPENSBI_FW_FDT_PATH
+       bool "Include U-Boot DTB in OpenSBI Payload"
+       depends on BR2_TARGET_OPENSBI_UBOOT_PAYLOAD
+       select BR2_TARGET_UBOOT_FORMAT_DTB
+       help
+         Build OpenSBI with FW_FDT_PATH set to
+         $(BINARIES_DIR)/u-boot.dtb. Note that CONFIG_OF_SEPARATE
+         must be set in the U-Boot configuration for this file to be
+         produced.
+
 endif
index a525b8aea3488c4ecce2fae489fbf0e8c1e7f1bf..8e055633a82d998b6d2da83f9f4ea6538f76767e 100644 (file)
@@ -46,6 +46,9 @@ endif
 ifeq ($(BR2_TARGET_OPENSBI_UBOOT_PAYLOAD),y)
 OPENSBI_DEPENDENCIES += uboot
 OPENSBI_MAKE_ENV += FW_PAYLOAD_PATH="$(BINARIES_DIR)/u-boot.bin"
+ifeq ($(BR2_TARGET_OPENSBI_FW_FDT_PATH),y)
+OPENSBI_MAKE_ENV += FW_FDT_PATH="$(BINARIES_DIR)/u-boot.dtb"
+endif
 endif
 
 define OPENSBI_BUILD_CMDS