From 3ef97253a7f08e26d39ef29c9713086334eee949 Mon Sep 17 00:00:00 2001 From: Zoltan HERPAI Date: Sun, 26 Jan 2020 23:45:48 +0100 Subject: [PATCH] firmware: opensbi: add package for RISC-V Signed-off-by: Zoltan HERPAI --- package/boot/opensbi/Makefile | 87 +++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 package/boot/opensbi/Makefile diff --git a/package/boot/opensbi/Makefile b/package/boot/opensbi/Makefile new file mode 100644 index 0000000000..6699cc2b15 --- /dev/null +++ b/package/boot/opensbi/Makefile @@ -0,0 +1,87 @@ +# +# Copyright (C) 2020 Zoltan HERPAI +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=opensbi +PKG_RELEASE:=0.8 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL=https://github.com/riscv/opensbi +PKG_SOURCE_DATE:=2020-12-19 +PKG_SOURCE_VERSION:=a029bd90c63307e9ef2d7ddbaa2eb2c799fca98a + +PKG_BUILD_DIR = $(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) + +PKG_TARGETS:=bin +PKG_FLAGS:=nonshared +PKG_LICENSE:=BSD-2-Clause +PKG_LICENSE_FILES:=COPYING.BSD +PKG_BUILD_PARALLEL:=1 + +PKG_MAINTAINER:=Zoltan HERPAI + +include $(INCLUDE_DIR)/package.mk + +define Package/opensbi + SECTION:=boot + CATEGORY:=Boot Loaders + DEPENDS:=@TARGET_riscv64 + VARIANT:=$(subst opensbi-,,$(1)) + URL:=https://github.com/riscv/opensbi/blob/master/README.md +endef + +define Package/opensbi-sifive_fu540 + $(Package/opensbi) + TITLE:=OpenSBI for SiFive Unleashed (FU540) + OPENSBI_IMAGE:=fw_dynamic.bin + OPENSBI_PLATFORM:=sifive/fu540 +endef + +define Package/opensbi-generic + $(Package/opensbi) + TITLE:=OpenSBI generic + OPENSBI_IMAGE:=fw_dynamic.bin + OPENSBI_PLATFORM:=generic +endef + +define Package/opensbi-qemu-virt + $(Package/opensbi) + TITLE:=OpenSBI generic + OPENSBI_IMAGE:=fw_dynamic.bin + OPENSBI_PLATFORM:=qemu/virt +endef + +export GCC_HONOUR_COPTS=s + +MAKE_VARS = \ + CROSS_COMPILE="$(TARGET_CROSS)" + +# $(eval $(Package/opensbi-sifive_fu540)) \ +# $(eval $(Package/opensbi-${OPENSBI_PLATFORM})) \ + +define Build/Compile + $(eval $(Package/opensbi-sifive_fu540)) \ + +$(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) \ + PLATFORM=$(OPENSBI_PLATFORM) +endef + +# PLATFORM=$(OPENSBI_PLATFORM) \ +# FW_FDT_PATH=$(STAGING_DIR_IMAGE)/$(DTS) +#endef + +# FW_PAYLOAD_PATH=$(STAGING_DIR_IMAGE)/$(subst /,_/$(OPENSBI_PLATFORM)-u-boot.bin \ + + +define Build/InstallDev + $(INSTALL_DIR) $(STAGING_DIR_IMAGE) + $(CP) $(PKG_BUILD_DIR)/build/platform/$(OPENSBI_PLATFORM)/firmware/fw_dynamic.bin $(STAGING_DIR_IMAGE)/fw_dynamic-${BUILD_VARIANT}.bin +endef + +$(eval $(call BuildPackage,opensbi-sifive_fu540)) +$(eval $(call BuildPackage,opensbi-generic)) +$(eval $(call BuildPackage,opensbi-qemu-virt)) -- 2.30.2