[PATCH 5/7] firmware: build and enable the FW_DYNAMIC_APPEND firmware type

Zong Li zong.li at sifive.com
Mon Jul 6 20:39:52 PDT 2026


Wire up the new FW_DYNAMIC_APPEND firmware type into the build system and
platform configuration.

- firmware/objects.mk: register fw_dynamic_append.bin so that platforms
  can opt in by setting FW_DYNAMIC_APPEND=y. The generic firmware pattern
  rules in the top-level Makefile pick up fw_dynamic_append.S and
  fw_dynamic_append.elf.ldS automatically.

- firmware/external_deps.mk: fw_dynamic_append.S includes fw_dynamic.S
  (hence fw_base.S), so it can embed a device tree via FW_FDT_PATH just
  like the other firmwares. Add the matching build dependency so that
  changing the FDT correctly triggers a rebuild of fw_dynamic_append.o.

- platform/generic/objects.mk: add FW_DYNAMIC_APPEND=y so that
  fw_dynamic_append.bin is produced as part of the default generic build,
  without having to pass FW_DYNAMIC_APPEND=y on the make command line.

- platform/template/objects.mk: add a commented FW_DYNAMIC_APPEND entry
  alongside FW_DYNAMIC so platform authors are aware of the new firmware
  type and how to enable it.

Signed-off-by: Zong Li <zong.li at sifive.com>
---
 firmware/external_deps.mk    | 1 +
 firmware/objects.mk          | 2 ++
 platform/generic/objects.mk  | 1 +
 platform/template/objects.mk | 9 +++++++++
 4 files changed, 13 insertions(+)

diff --git a/firmware/external_deps.mk b/firmware/external_deps.mk
index 6264005b..945715fc 100644
--- a/firmware/external_deps.mk
+++ b/firmware/external_deps.mk
@@ -8,6 +8,7 @@
 #
 
 $(platform_build_dir)/firmware/fw_dynamic.o: $(FW_FDT_PATH)
+$(platform_build_dir)/firmware/fw_dynamic_append.o: $(FW_FDT_PATH)
 $(platform_build_dir)/firmware/fw_jump.o: $(FW_FDT_PATH)
 $(platform_build_dir)/firmware/fw_payload.o: $(FW_FDT_PATH)
 
diff --git a/firmware/objects.mk b/firmware/objects.mk
index bfec4671..d4548523 100644
--- a/firmware/objects.mk
+++ b/firmware/objects.mk
@@ -28,6 +28,8 @@ endif
 
 firmware-bins-$(FW_DYNAMIC) += fw_dynamic.bin
 
+firmware-bins-$(FW_DYNAMIC_APPEND) += fw_dynamic_append.bin
+
 firmware-bins-$(FW_JUMP) += fw_jump.bin
 ifdef FW_JUMP_OFFSET
 firmware-genflags-$(FW_JUMP) += -DFW_JUMP_OFFSET=$(FW_JUMP_OFFSET)
diff --git a/platform/generic/objects.mk b/platform/generic/objects.mk
index ca7fb8b7..91c0a49e 100644
--- a/platform/generic/objects.mk
+++ b/platform/generic/objects.mk
@@ -23,6 +23,7 @@ platform-objs-y += platform_override_modules.carray.o
 
 # Blobs to build
 FW_DYNAMIC=y
+FW_DYNAMIC_APPEND=y
 FW_JUMP=y
 ifeq ($(PLATFORM_RISCV_XLEN), 32)
   # This needs to be 4MB aligned for 32-bit system
diff --git a/platform/template/objects.mk b/platform/template/objects.mk
index 9b4bc928..368bc922 100644
--- a/platform/template/objects.mk
+++ b/platform/template/objects.mk
@@ -51,6 +51,15 @@ platform-objs-y += platform.o
 #
 FW_DYNAMIC=<y|n>
 
+#
+# Dynamic firmware with appended info configuration.
+# Same as FW_DYNAMIC, except the struct fw_dynamic_info is appended to
+# the firmware binary (before .bss) instead of being passed in a register.
+# Optional parameters are commented out. Uncomment and define these parameters
+# as needed.
+#
+FW_DYNAMIC_APPEND=<y|n>
+
 #
 # Jump firmware configuration.
 # Optional parameters are commented out. Uncomment and define these parameters
-- 
2.43.7




More information about the opensbi mailing list