From: Zoltan HERPAI Date: Sun, 26 Jan 2020 22:45:48 +0000 (+0100) Subject: opensbi: add package for RISC-V X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=3b8f19240eb6e2c57ada513e82d2a28e52739a0e;p=openwrt%2Fstaging%2Fwigyori.git opensbi: add package for RISC-V OpenSBI is a form of a first-stage bootloader, which initializes certain parts of an SoC and then passes on control to the second stage bootloader i.e. an u-boot image. Signed-off-by: Zoltan HERPAI --- diff --git a/package/boot/opensbi/Makefile b/package/boot/opensbi/Makefile new file mode 100644 index 0000000000..1cdf260f6d --- /dev/null +++ b/package/boot/opensbi/Makefile @@ -0,0 +1,71 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Copyright (C) 2022 OpenWrt.org +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=opensbi +PKG_RELEASE:=0.9 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL=https://github.com/riscv/opensbi +PKG_SOURCE_DATE:=2021-01-18 +PKG_SOURCE_VERSION:=234ed8e427f4d92903123199f6590d144e0d9351 +PKG_MIRROR_HASH:=2efd6c28caffa57884bdd98260aa870a03dc1877514fa9f82a4527b9ebc7681d + +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_sifiveu + URL:=https://github.com/riscv/opensbi/blob/master/README.md + VARIANT:=$(subst _,/,$(subst opensbi_,,$(1))) + TITLE:=OpenSBI generic + OPENSBI_IMAGE:= + PLAT:= +endef + +define Package/opensbi_generic + $(Package/opensbi) + TITLE:=OpenSBI generic + OPENSBI_IMAGE:=fw_dynamic.bin + PLAT:=generic +endef + +define Package/opensbi_sifive-fu540 + $(Package/opensbi) + TITLE:=OpenSBI for SiFive Unleashed (FU540) + OPENSBI_IMAGE:=fw_dynamic.bin + PLAT:=sifive/fu540 +endef + +export GCC_HONOUR_COPTS=s + +MAKE_VARS = \ + CROSS_COMPILE="$(TARGET_CROSS)" + +define Build/Compile + $(eval $(Package/opensbi_$(BUILD_VARIANT))) \ + +$(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) \ + PLATFORM=$(PLAT) +endef + +define Build/InstallDev + $(INSTALL_DIR) $(STAGING_DIR_IMAGE) + $(CP) $(PKG_BUILD_DIR)/build/platform/$(PLAT)/firmware/fw_dynamic.bin $(STAGING_DIR_IMAGE)/fw_dynamic-${BUILD_VARIANT}.bin +endef + +$(eval $(call BuildPackage,opensbi_generic)) +$(eval $(call BuildPackage,opensbi_sifive-fu540))