# Disable debug packages, we don't need them. %global debug_package %{nil} # Make sure we use the cross-binary to strip. %global __strip riscv64-linux-gnu-strip # Avoid this error caused by cross-compilation and packaging the # result in a noarch package: # error: Arch dependent binaries in noarch package %global _binaries_in_noarch_packages_terminate_build 0 %global forgeurl https://github.com/riscv/opensbi %global commit 355796c5bc1906d749850e4215e0f7f53802ba5b %forgemeta Name: opensbi Version: 1.2 Release: 1%{?dist} Summary: RISC-V Open Source Supervisor Binary Interface License: BSD URL: %{forgeurl} Source: %{forgesource} # The resulting binary contains RISC-V firmware intended to be used # under virtualization, so it can be used on any architecture. Buildarch: noarch BuildRequires: gcc-riscv64-linux-gnu BuildRequires: binutils-riscv64-linux-gnu BuildRequires: findutils BuildRequires: grep BuildRequires: coreutils BuildRequires: make BuildRequires: dtc BuildRequires: python3 BuildRequires: gawk BuildRequires: sed %description RISC-V Open Source Supervisor Binary Interface. The current version is for QEMU RISC-V virt machines, SiFive HiFive Unleashed, T-HEAD C9xx and some others. %prep %forgesetup %build mkdir build32 build64 # Build 32 bit firmware. %make_build \ O=build32 \ CROSS_COMPILE=riscv64-linux-gnu- \ PLATFORM=generic \ PLATFORM_RISCV_XLEN=32 # Build 64 bit firmware. %make_build \ O=build32 \ CROSS_COMPILE=riscv64-linux-gnu- \ PLATFORM=generic %install # Install 32 bit firmware. %make_install \ O=build32 \ CROSS_COMPILE=riscv64-linux-gnu- \ PLATFORM=generic \ PLATFORM_RISCV_XLEN=32 \ I=%{buildroot} \ INSTALL_LIB_PATH=%{_libdir} \ INSTALL_FIRMWARE_PATH=%{_datadir}/%{name} pushd %{buildroot}%{_datadir}/%{name}/generic/firmware for f in fw_*.bin fw_*.elf; do mv $f opensbi-riscv32-generic-$f done popd # Install 64 bit firmware. %make_install \ O=build64 \ CROSS_COMPILE=riscv64-linux-gnu- \ PLATFORM=generic \ I=%{buildroot} \ INSTALL_LIB_PATH=%{_libdir} \ INSTALL_FIRMWARE_PATH=%{_datadir}/%{name} pushd %{buildroot}%{_datadir}/%{name}/generic/firmware for f in fw_*.bin fw_*.elf; do mv $f opensbi-riscv64-generic-$f done popd # Remove development libraries and headers for the time being. rm -rfv %{buildroot}%{_libdir} rm -rfv %{buildroot}/include # Remove the example/testing payloads. rm -rfv %{buildroot}%{_datadir}/%{name}/*/firmware/payloads %files %license COPYING.BSD %doc README.md %dir %{_datadir}/%{name} %{_datadir}/%{name}/* %changelog * Tue May 23 2023 Richard W.M. Jones 1.2 - Use forge macros - Convert to use cross-compilation - Fix dates in changelog * Tue May 02 2023 David Abdurachmanov v1.2.116.2023.05.02.7919530-1 - Sync with upstream master branch (v1.2-116-g7919530) * Thu Jan 26 2023 David Abdurachmanov v1.2.0.2023.01.26.c6b5188c-1 - Use v1.2 (last stable release for now) * Wed Jan 25 2023 David Abdurachmanov v1.2.34.2023.01.25.c45992c-1 - Sync with upstream master branch (v1.2-34-gc45992c) * Thu Nov 17 2022 David Abdurachmanov v1.1.85.2022.11.17.14f5c4c-1 - Sync with upstream master branch (v1.1-85-g14f5c4c) * Mon Jun 27 2022 David Abdurachmanov v1.1.0.2022.06.27.4489876-1 - Sync with upstream master branch (v1.1 tag) * Thu Jun 23 2022 David Abdurachmanov v1.0.99.2022.06.23.6f1fe98-1 - Sync with upstream master branch * Thu Jun 02 2022 David Abdurachmanov v1.0.92.2022.06.13.9dc5ec5-1 - Sync with upstream master branch * Thu Jun 02 2022 David Abdurachmanov v1.0.81.2022.06.02.cb8271c-1 - Sync with upstream master branch * Sat Nov 06 2021 David Abdurachmanov v0.9.163.2021.11.06.0979ffd-1 - Sync with upstream master branch * Fri Oct 08 2021 David Abdurachmanov v0.9.152.2021.10.08.754d511-1 - Sync with upstream master branch * Tue Aug 17 2021 David Abdurachmanov v0.9.134.2021.08.17.7aa6c9a-1 - Sync with upstream master branch - Upstream support for SiFive HiFive Unmatched * Wed Apr 21 2021 David Abdurachmanov v0.9.35.2021.04.21.f41196a - Update to v0.9+ * Wed Jan 06 2021 David Abdurachmanov v0.8.81.2021.01.06.7dcb1e1 - New version - Switch to generic platform - Remove all others special Fedora variants of firmware - Remove development library and documentation (not needed) - Remove example payloads