Skip to contentSkip to conversation

boot/opensbi: remove dependency on fw_payload to pass FW_FDT_PATH

PATCH New Thomas Bonnefille via buildroot 1 participant 1 message Nov 12, 2024

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 boot/opensbi: remove dependency on fw_payload to pass FW_FDT_PATH

OpenSBI firmware can be built in three different ways depending on how it transitions to the bootloader (fw_dynamic, fw_jump, and fw_payload).

Additionally, it is possible to pass a device-tree to OpenSBI during compilation using the FW_FDT_PATH variable. If this variable is not provided at compilation time, OpenSBI expects the previous boot stage to supply the required device-tree.

Currently, in Buildroot, the only way to use the FW_FDT_PATH variable is to include the device-tree blob generated by U-Boot. The upstream Buildroot currently forces the user to install fw_payload for this purpose.

This patch allows specifying FW_FDT_PATH without installing fw_payload, as permitted by the "Firmware Configuration and Compilation" section[1].

[1] https://github.com/riscv-software-src/opensbi/blob/master/docs/firmware/fw.md

---
Changes in v2:
- Rework commit message
- Add dependency on U-Boot to build u-boot.dtb
- Link to v1: https://lore.kernel.org/r/[email protected]

---
 boot/opensbi/Config.in  | 3 ++-
 boot/opensbi/opensbi.mk | 4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)
boot/opensbi/Config.in +2 -1
index de2f0aae20dbe1ec62dc0f575a069a92d85bee4c..0a01615e5a0648110f48c0fbdb585ddba5eea33f 100644
@@ -111,7 +111,8 @@ config BR2_TARGET_OPENSBI_UBOOT_PAYLOAD
 
 config BR2_TARGET_OPENSBI_FW_FDT_PATH
 	bool "Include U-Boot DTB in OpenSBI Payload"
-	depends on BR2_TARGET_OPENSBI_UBOOT_PAYLOAD
+	depends on BR2_TARGET_OPENSBI_PLAT != ""
+	depends on BR2_TARGET_UBOOT
 	select BR2_TARGET_UBOOT_FORMAT_DTB
 	help
 	  Build OpenSBI with FW_FDT_PATH set to
boot/opensbi/opensbi.mk +3 -1
index dd113a0bf87589c49af74d63180007e35f0a796c..28e25f845a5d5453ee685998d4afc046dfc3fd91 100644
@@ -47,10 +47,12 @@ endif
 ifeq ($(BR2_TARGET_OPENSBI_UBOOT_PAYLOAD),y)
 OPENSBI_DEPENDENCIES += uboot
 OPENSBI_MAKE_ENV += FW_PAYLOAD_PATH="$(BINARIES_DIR)/u-boot.bin"
+endif
+
 ifeq ($(BR2_TARGET_OPENSBI_FW_FDT_PATH),y)
+OPENSBI_DEPENDENCIES += uboot
 OPENSBI_MAKE_ENV += FW_FDT_PATH="$(BINARIES_DIR)/u-boot.dtb"
 endif
-endif
 
 define OPENSBI_BUILD_CMDS
 	$(TARGET_MAKE_ENV) $(OPENSBI_MAKE_ENV) $(MAKE) -C $(@D)

---
base-commit: d242ab6b8e2805ee173de54bec47dbbcbcecc939
change-id: 20241029-extract-fw_fdt_path-87cb8e4be2bb

Best regards,

Signature · 6 lines
Thomas Bonnefille <[email protected]>

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot