summaryrefslogtreecommitdiff
path: root/src/arch
diff options
context:
space:
mode:
authorMaximilian Brune <maximilian.brune@9elements.com>2024-06-29 01:41:47 +0200
committerMaximilian Brune <maximilian.brune@9elements.com>2024-11-28 13:57:54 +0000
commit6c063250b55eb9d7bc96615557fa731474f287fe (patch)
tree9192e07973789ea491105ed9d68307adf7262e3b /src/arch
parent7f36241461510b0f083b04485564ffa544f973a4 (diff)
arch/riscv: Allow adding OpenSBI as external blob
The reasoning is that even though vendors currently tend to open source their OpenSBI implementation, they often do so in their own repository. So instead of adding all possible source repositories as submodules, we shall allow specifying a path to an already compiled OpenSBI ELF file. This is similar of what we currently do on ARM64 with the BL31 binary. Signed-off-by: Maximilian Brune <maximilian.brune@9elements.com> Change-Id: I6592ad90a254ca4ac9a6cee89404ad49274f0dea Reviewed-on: https://review.coreboot.org/c/coreboot/+/83284 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Alicja Michalska <ahplka19@gmail.com> Reviewed-by: ron minnich <rminnich@gmail.com>
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/riscv/Kconfig20
-rw-r--r--src/arch/riscv/Makefile.mk7
2 files changed, 24 insertions, 3 deletions
diff --git a/src/arch/riscv/Kconfig b/src/arch/riscv/Kconfig
index 66c64c2cd3..148d966059 100644
--- a/src/arch/riscv/Kconfig
+++ b/src/arch/riscv/Kconfig
@@ -55,15 +55,29 @@ config RISCV_OPENSBI
Load OpenSBI after payload has been loaded and use it to
provide the SBI and to handover control to payload.
+if RISCV_OPENSBI
+
+config OPENSBI_BLOB
+ bool "Include OpenSBI ELF binary blob"
+ depends on RISCV_OPENSBI
+ help
+ If enabled it allows to specify a file path to an already compiled OpenSBI binary.
+ If disabled the OpenSBI binary will be compiled from upstream OpenSBI repository.
+ This option is discouraged as compatibility with out-of-tree blobs may break anytime.
+
+config OPENSBI_BLOB_PATH
+ string "Path to external opensbi.elf"
+ depends on OPENSBI_BLOB
+ help
+ Absolute (or relative to coreboot directory) path to the OpenSBI ELF file.
+
config OPENSBI_PLATFORM
string
- depends on RISCV_HAS_OPENSBI
help
The OpenSBI platform to build for.
config OPENSBI_TEXT_START
hex
- depends on RISCV_HAS_OPENSBI
help
The linking address used to build opensbi.
@@ -77,6 +91,8 @@ config OPENSBI_FW_DYNAMIC_BOOT_HART
that is the mode usually used for the payload. If the hart does not support
Supervisor mode OpenSBI will again look for a hart that does support it.
+endif # RISCV_OPENSBI
+
config ARCH_RISCV_U
# U (user) mode is for programs.
bool
diff --git a/src/arch/riscv/Makefile.mk b/src/arch/riscv/Makefile.mk
index 51ed016653..bda392adb4 100644
--- a/src/arch/riscv/Makefile.mk
+++ b/src/arch/riscv/Makefile.mk
@@ -159,7 +159,12 @@ $(OPENSBI_TARGET): $(obj)/config.h | $(OPENSBI_SOURCE)
FW_PAYLOAD=n \
FW_TEXT_START=$(CONFIG_OPENSBI_TEXT_START)
-$(OPENSBI): $(OPENSBI_TARGET)
+# build upstream OpenSBI source tree
+opensbi-source-y = $(OPENSBI_TARGET)
+# get OpenSBI from specified binary
+opensbi-source-$(CONFIG_OPENSBI_BLOB) = $(call strip_quotes,$(CONFIG_OPENSBI_BLOB_PATH))
+
+$(OPENSBI): $(opensbi-source-y)
cp $< $@
OPENSBI_CBFS := $(CONFIG_CBFS_PREFIX)/opensbi