All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [git commit] boot/opensbi: new package
@ 2019-03-26 12:30 Thomas Petazzoni
  0 siblings, 0 replies; only message in thread
From: Thomas Petazzoni @ 2019-03-26 12:30 UTC (permalink / raw)
  To: buildroot

commit: https://git.buildroot.net/buildroot/commit/?id=cbce379fafd205c6540a1a076b00bdd35db9b6d7
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master

OpenSBI is a much improved alternative to BBL (riscv-pk). Add OpenSBI
support to buildroot.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
[Thomas:
 - disable target installation, as we install nothing
 - enable staging installation
 - enable images installation only when needed
 - improve the comment about the staging installation]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 DEVELOPERS              |  1 +
 boot/Config.in          |  1 +
 boot/opensbi/Config.in  | 25 +++++++++++++++++++++++++
 boot/opensbi/opensbi.mk | 41 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 68 insertions(+)

diff --git a/DEVELOPERS b/DEVELOPERS
index 002ffa09c7..d21e494b14 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -122,6 +122,7 @@ F:	package/kvazaar/
 F:	package/v4l2loopback/
 
 N:	Alistair Francis <alistair@alistair23.me>
+F:	boot/opensbi/
 F:	package/xen/
 
 N:	Alvaro G. M <alvaro.gamez@hazent.com>
diff --git a/boot/Config.in b/boot/Config.in
index 74481e7545..97bd3de6e9 100644
--- a/boot/Config.in
+++ b/boot/Config.in
@@ -14,6 +14,7 @@ source "boot/lpc32xxcdl/Config.in"
 source "boot/mv-ddr-marvell/Config.in"
 source "boot/mxs-bootlets/Config.in"
 source "boot/optee-os/Config.in"
+source "boot/opensbi/Config.in"
 source "boot/riscv-pk/Config.in"
 source "boot/s500-bootloader/Config.in"
 source "boot/shim/Config.in"
diff --git a/boot/opensbi/Config.in b/boot/opensbi/Config.in
new file mode 100644
index 0000000000..5f3cc13312
--- /dev/null
+++ b/boot/opensbi/Config.in
@@ -0,0 +1,25 @@
+config BR2_TARGET_OPENSBI
+	bool "opensbi"
+	depends on BR2_riscv
+	help
+	  OpenSBI aims to provide an open-source and extensible
+	  implementation of the RISC-V SBI specification for a platform
+	  specific firmware (M-mode) and a general purpose OS,
+	  hypervisor or bootloader (S-mode or HS-mode). OpenSBI
+	  implementation can be easily extended by RISC-V platform or
+	  System-on-Chip vendors to fit a particular hadware
+	  configuration.
+
+	  https://github.com/riscv/opensbi.git
+
+if BR2_TARGET_OPENSBI
+config BR2_TARGET_OPENSBI_PLAT
+	string "OpenSBI Platform"
+	default ""
+	help
+	  Specifies the OpenSBI platform to build. If no platform is
+	  specified only the OpenSBI platform independent static
+	  library libsbi.a is built. If a platform is specified then
+	  the platform specific static library libplatsbi.a and firmware
+	  examples are built.
+endif
diff --git a/boot/opensbi/opensbi.mk b/boot/opensbi/opensbi.mk
new file mode 100644
index 0000000000..b0b413abf9
--- /dev/null
+++ b/boot/opensbi/opensbi.mk
@@ -0,0 +1,41 @@
+################################################################################
+#
+# opensbi
+#
+################################################################################
+
+OPENSBI_VERSION = v0.3
+OPENSBI_SITE = $(call github,riscv,opensbi,$(OPENSBI_VERSION))
+OPENSBI_LICENSE = BSD-2-Clause
+OPENSBI_LICENSE_FILES = COPYING.BSD
+OPENSBI_INSTALL_TARGET = NO
+OPENSBI_INSTALL_STAGING = YES
+
+OPENSBI_MAKE_ENV = \
+	CROSS_COMPILE=$(TARGET_CROSS)
+
+OPENSBI_PLAT = $(call qstrip,$(BR2_TARGET_OPENSBI_PLAT))
+ifneq ($(OPENSBI_PLAT),)
+OPENSBI_MAKE_ENV += PLATFORM=$(OPENSBI_PLAT)
+endif
+
+define OPENSBI_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(OPENSBI_MAKE_ENV) $(MAKE) -C $(@D)
+endef
+
+ifneq ($(OPENSBI_PLAT),)
+OPENSBI_INSTALL_IMAGES = YES
+define OPENSBI_INSTALL_IMAGES_CMDS
+	$(INSTALL) -m 0644 -D $(@D)/build/platform/$(OPENSBI_PLAT)/firmware/fw_jump.bin $(BINARIES_DIR)/fw_jump.bin
+	$(INSTALL) -m 0644 -D $(@D)/build/platform/$(OPENSBI_PLAT)/firmware/fw_jump.elf $(BINARIES_DIR)/fw_jump.elf
+endef
+endif
+
+# libsbi.a is not a library meant to be linked in user-space code, but
+# with bare metal code, which is why we don't install it in
+# $(STAGING_DIR)/usr/lib
+define OPENSBI_INSTALL_STAGING_CMDS
+	$(INSTALL) -m 0644 -D $(@D)/build/lib/libsbi.a $(STAGING_DIR)/usr/share/opensbi/libsbi.a
+endef
+
+$(eval $(generic-package))

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-03-26 12:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-26 12:30 [Buildroot] [git commit] boot/opensbi: new package Thomas Petazzoni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.