diff mbox series

[v2] boot/opensbi: remove dependency on fw_payload to pass FW_FDT_PATH

Message ID 20241112-extract-fw_fdt_path-v2-1-0239de112994@bootlin.com
State New
Headers show
Series [v2] boot/opensbi: remove dependency on fw_payload to pass FW_FDT_PATH | expand

Commit Message

Thomas Bonnefille Nov. 12, 2024, 11:19 a.m. UTC
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

Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
---
Changes in v2:
- Rework commit message
- Add dependency on U-Boot to build u-boot.dtb
- Link to v1: https://lore.kernel.org/r/20241106-extract-fw_fdt_path-v1-1-0983c183f71e@bootlin.com
---
 boot/opensbi/Config.in  | 3 ++-
 boot/opensbi/opensbi.mk | 4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)


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

Best regards,
diff mbox series

Patch

diff --git a/boot/opensbi/Config.in b/boot/opensbi/Config.in
index de2f0aae20dbe1ec62dc0f575a069a92d85bee4c..0a01615e5a0648110f48c0fbdb585ddba5eea33f 100644
--- a/boot/opensbi/Config.in
+++ b/boot/opensbi/Config.in
@@ -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
diff --git a/boot/opensbi/opensbi.mk b/boot/opensbi/opensbi.mk
index dd113a0bf87589c49af74d63180007e35f0a796c..28e25f845a5d5453ee685998d4afc046dfc3fd91 100644
--- a/boot/opensbi/opensbi.mk
+++ b/boot/opensbi/opensbi.mk
@@ -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)