Index: head/sysutils/opensbi/Makefile =================================================================== --- head/sysutils/opensbi/Makefile +++ head/sysutils/opensbi/Makefile @@ -0,0 +1,56 @@ +# $FreeBSD$ + +PORTNAME= opensbi +DISTVERSIONPREFIX=v +DISTVERSION= 0.5 +CATEGORIES= sysutils + +MAINTAINER= mhorne@FreeBSD.org +COMMENT= RISC-V SBI bootloader and firmware + +LICENSE= BSD2CLAUSE + +USES= gmake + +USE_GITHUB= yes +GH_ACCOUNT= riscv + +RISCV_PREFIX= riscv64-unknown-${OPSYS:tl}${OSREL}- +BUILD_DEPENDS= ${RISCV_PREFIX}gcc:devel/riscv64-xtoolchain-gcc + +MAKE_ARGS= CROSS_COMPILE=${RISCV_PREFIX} I=${STAGEDIR}${PREFIX} + +OPTIONS_GROUP= PLATFORMS +OPTIONS_GROUP_PLATFORMS=QEMU_VIRT SIFIVE_FU540 +OPTIONS_SUB= yes +OPTIONS_DEFAULT= QEMU_VIRT SIFIVE_FU540 + +QEMU_VIRT_DESC= Support for QEMU Virt platform +QEMU_VIRT_PLATFORM= qemu/virt + +SIFIVE_FU540_DESC= Support for SiFive U540 platform +SIFIVE_FU540_PLATFORM= sifive/fu540 + +INSTALL_TARGET= install + +.for platform in ${OPTIONS_GROUP_PLATFORMS} + +post-build-${platform}-on: + ${MAKE_CMD} -C ${WRKSRC} ${MAKE_ARGS} PLATFORM=${${platform}_PLATFORM} + +do-install-${platform}-on: + ${MKDIR} ${STAGEDIR}${DATADIR} + ${MAKE_CMD} -C ${WRKSRC} PLATFORM=${${platform}_PLATFORM} \ + I=${STAGEDIR}${DATADIR} install_firmwares + ${MAKE_CMD} -C ${WRKSRC} PLATFORM=${${platform}_PLATFORM} \ + I=${STAGEDIR}${DATADIR} install_libplatsbi + +post-install-${platform}-on: +.for i in dynamic jump payload + ${STRIP_CMD} ${STAGEDIR}${DATADIR}/platform/${${platform}_PLATFORM}/firmware/fw_${i}.elf +.endfor + ${STRIP_CMD} ${STAGEDIR}${DATADIR}/platform/${${platform}_PLATFORM}/firmware/payloads/test.elf + +.endfor # OPTIONS_GROUP_PLATFORMS + +.include Index: head/sysutils/opensbi/distinfo =================================================================== --- head/sysutils/opensbi/distinfo +++ head/sysutils/opensbi/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1571500133 +SHA256 (riscv-opensbi-v0.5_GH0.tar.gz) = bc82f1e63663cafb7976b324d8a01263510cfd816063dc89e0ccffb9763fb1dd +SIZE (riscv-opensbi-v0.5_GH0.tar.gz) = 138745 Index: head/sysutils/opensbi/files/patch-Makefile =================================================================== --- head/sysutils/opensbi/files/patch-Makefile +++ head/sysutils/opensbi/files/patch-Makefile @@ -0,0 +1,11 @@ +--- Makefile.orig 2019-10-09 02:45:51 UTC ++++ Makefile +@@ -180,7 +180,7 @@ ASFLAGS += $(firmware-asflags-y) + + ARFLAGS = rcs + +-ELFFLAGS += -Wl,--build-id=none -N -static-libgcc -lgcc ++ELFFLAGS += -Wl,--build-id=none -N -static-libgcc + ELFFLAGS += $(platform-ldflags-y) + ELFFLAGS += $(firmware-ldflags-y) + Index: head/sysutils/opensbi/pkg-descr =================================================================== --- head/sysutils/opensbi/pkg-descr +++ head/sysutils/opensbi/pkg-descr @@ -0,0 +1,18 @@ +The RISC-V Supervisor Binary Interface (SBI) is the recommended interface +between: + +1. A platform-specific firmware running in M-mode and a bootloader, a + hypervisor or a general-purpose OS executing in S-mode or HS-mode. +2. A hypervisor running in HS-mode and a bootloader or a general-purpose OS + executing in VS-mode. + +The RISC-V SBI specification is maintained as an independent project by the +RISC-V Foundation at https://github.com/riscv/riscv-sbi-doc. + +The goal of the OpenSBI project is to provide an open-source reference +implementation of the RISC-V SBI specifications for platform-specific firmwares +executing in M-mode (case 1 mentioned above). An OpenSBI implementation can be +easily extended by RISC-V platform and system-on-chip vendors to fit a +particular hardware configuration. + +WWW: https://github.com/riscv/opensbi Index: head/sysutils/opensbi/pkg-plist =================================================================== --- head/sysutils/opensbi/pkg-plist +++ head/sysutils/opensbi/pkg-plist @@ -0,0 +1,56 @@ +include/sbi/fw_dynamic.h +include/sbi/riscv_asm.h +include/sbi/riscv_atomic.h +include/sbi/riscv_barrier.h +include/sbi/riscv_encoding.h +include/sbi/riscv_fp.h +include/sbi/riscv_io.h +include/sbi/riscv_locks.h +include/sbi/riscv_unpriv.h +include/sbi/sbi_bitops.h +include/sbi/sbi_bits.h +include/sbi/sbi_console.h +include/sbi/sbi_const.h +include/sbi/sbi_ecall.h +include/sbi/sbi_ecall_interface.h +include/sbi/sbi_emulate_csr.h +include/sbi/sbi_error.h +include/sbi/sbi_fifo.h +include/sbi/sbi_hart.h +include/sbi/sbi_illegal_insn.h +include/sbi/sbi_init.h +include/sbi/sbi_ipi.h +include/sbi/sbi_misaligned_ldst.h +include/sbi/sbi_platform.h +include/sbi/sbi_scratch.h +include/sbi/sbi_string.h +include/sbi/sbi_system.h +include/sbi/sbi_timer.h +include/sbi/sbi_tlb.h +include/sbi/sbi_trap.h +include/sbi/sbi_types.h +include/sbi/sbi_version.h +include/sbi_utils/irqchip/plic.h +include/sbi_utils/serial/sifive-uart.h +include/sbi_utils/serial/uart8250.h +include/sbi_utils/sys/clint.h +lib/libsbi.a +lib/libsbiutils.a +%%QEMU_VIRT%%%%DATADIR%%/platform/qemu/virt/firmware/fw_dynamic.bin +%%QEMU_VIRT%%%%DATADIR%%/platform/qemu/virt/firmware/fw_dynamic.elf +%%QEMU_VIRT%%%%DATADIR%%/platform/qemu/virt/firmware/fw_jump.bin +%%QEMU_VIRT%%%%DATADIR%%/platform/qemu/virt/firmware/fw_jump.elf +%%QEMU_VIRT%%%%DATADIR%%/platform/qemu/virt/firmware/fw_payload.bin +%%QEMU_VIRT%%%%DATADIR%%/platform/qemu/virt/firmware/fw_payload.elf +%%QEMU_VIRT%%%%DATADIR%%/platform/qemu/virt/firmware/payloads/test.bin +%%QEMU_VIRT%%%%DATADIR%%/platform/qemu/virt/firmware/payloads/test.elf +%%QEMU_VIRT%%%%DATADIR%%/platform/qemu/virt/lib/libplatsbi.a +%%SIFIVE_FU540%%%%DATADIR%%/platform/sifive/fu540/firmware/fw_dynamic.bin +%%SIFIVE_FU540%%%%DATADIR%%/platform/sifive/fu540/firmware/fw_dynamic.elf +%%SIFIVE_FU540%%%%DATADIR%%/platform/sifive/fu540/firmware/fw_jump.bin +%%SIFIVE_FU540%%%%DATADIR%%/platform/sifive/fu540/firmware/fw_jump.elf +%%SIFIVE_FU540%%%%DATADIR%%/platform/sifive/fu540/firmware/fw_payload.bin +%%SIFIVE_FU540%%%%DATADIR%%/platform/sifive/fu540/firmware/fw_payload.elf +%%SIFIVE_FU540%%%%DATADIR%%/platform/sifive/fu540/firmware/payloads/test.bin +%%SIFIVE_FU540%%%%DATADIR%%/platform/sifive/fu540/firmware/payloads/test.elf +%%SIFIVE_FU540%%%%DATADIR%%/platform/sifive/fu540/lib/libplatsbi.a