diff mbox series

boot/opensbi: remove dependency on fw_payload to pass FW_FDT_PATH

Message ID 20241106-extract-fw_fdt_path-v1-1-0983c183f71e@bootlin.com
State New
Headers show
Series boot/opensbi: remove dependency on fw_payload to pass FW_FDT_PATH | expand

Commit Message

Thomas Bonnefille Nov. 6, 2024, 2:27 p.m. UTC
Currently, Buildroot requires the installation of fw_payload.bin to pass
FW_FDT_PATH as a compile-time parameter.

According to OpenSBI documentation[1], all firmware types can have an
embedded flattened device tree.

This commit removes the dependency on fw_payload.bin, allowing users to
include the U-Boot flattened device tree using FW_FDT_PATH without
installing fw_payload.

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

Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
---
 boot/opensbi/Config.in  | 3 ++-
 boot/opensbi/opensbi.mk | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)


---
base-commit: 1e9261d9b6388dc382e59f44174f1806d326ad15
change-id: 20241029-extract-fw_fdt_path-87cb8e4be2bb

Best regards,

Comments

Thomas Bonnefille Nov. 8, 2024, 3:30 p.m. UTC | #1
Hello,
I just noticed that there were something lacking in this patch:

On Wed Nov 6, 2024 at 3:27 PM CET, Thomas Bonnefille wrote:
> Currently, Buildroot requires the installation of fw_payload.bin to pass
> FW_FDT_PATH as a compile-time parameter.
>
> According to OpenSBI documentation[1], all firmware types can have an
> embedded flattened device tree.
>
> This commit removes the dependency on fw_payload.bin, allowing users to
> include the U-Boot flattened device tree using FW_FDT_PATH without
> installing fw_payload.
>
> [1] https://github.com/riscv-software-src/opensbi/blob/master/docs/firmware/fw.md
>
> Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
...
> --- a/boot/opensbi/opensbi.mk
> +++ b/boot/opensbi/opensbi.mk
> @@ -47,10 +47,11 @@ 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)

As Buildroot is using u-boot.dtb as the only way of passing the fdt to
OpenSBI. There is this line missing here :
   OPENSBI_DEPENDENCIES += uboot
Without it, OpenSBI can be built before U-Boot and so u-boot.dtb will
not exist yet.

>  OPENSBI_MAKE_ENV += FW_FDT_PATH="$(BINARIES_DIR)/u-boot.dtb"
>  endif

I'll soon send a second version of this patch.
Sorry for the inconvenience,

Regards,
Thomas
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..89571a771445c8c0b6f92345892985a800e25a14 100644
--- a/boot/opensbi/opensbi.mk
+++ b/boot/opensbi/opensbi.mk
@@ -47,10 +47,11 @@  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_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)