--- /dev/null
+# Debuginfo and stripping makes no sense for this package.
+%global debug_package %{nil}
+%global __strip /bin/true
+%global _binaries_in_noarch_packages_terminate_build 0
+
+Name: opensbi
+Version: 0.9
+Release: 1%{?dist}
+Summary: RISC-V Open Source Supervisor Binary Interface (OpenSBI)
+
+License: BSD
+URL: https://github.com/riscv-software-src/opensbi
+
+Source0: https://github.com/riscv-software-src/%{name}/archive/refs/tags/v%{version}.tar.gz
+
+BuildRequires: gcc-riscv64-linux-gnu
+BuildRequires: binutils-riscv64-linux-gnu
+
+# The -devel subpackage contains riscv64 code so you'll get:
+# > Arch dependent binaries in noarch package
+Buildarch: noarch
+
+
+%description
+The RISC-V Supervisor Binary Interface (SBI) is the firmware
+used to boot RISC-V virtual machines in qemu.
+
+
+%package devel
+Summary: Development files for %{name}
+# NB: Doesn't require the base package because it doesn't need it.
+
+
+%description devel
+This package contains development files (headers, libraries, etc)
+for %{name}.
+
+
+%prep
+%setup -q -n opensbi-%{version}
+
+
+%build
+%global platforms generic
+for platform in %{platforms}; do
+ make CROSS_COMPILE=riscv64-linux-gnu- PLATFORM=$platform %{?_smp_mflags}
+done
+
+
+%install
+# This installs into the install/ subdirectory ...
+for platform in %{platforms}; do
+ make CROSS_COMPILE=riscv64-linux-gnu- PLATFORM=$platform %{?_smp_mflags} \
+ install
+done
+# ... and we copy the files we want to the desired locations.
+
+mkdir -p %{buildroot}%{_libdir}
+cp -a install/usr/lib64/* %{buildroot}%{_libdir}
+
+mkdir -p %{buildroot}%{_includedir}
+cp -a install/usr/include/* %{buildroot}%{_includedir}
+
+mkdir -p %{buildroot}%{_datadir}
+cp -a install/usr/share/opensbi %{buildroot}%{_datadir}/%{name}
+
+
+%files
+%{_datadir}/%{name}
+
+
+%files devel
+%dir %{_libdir}/lp64
+%{_libdir}/lp64/libsbi*.a
+%{_libdir}/lp64/opensbi/generic/lib/libplatsbi.a
+%{_includedir}/sbi/
+%{_includedir}/sbi_utils/
+
+
+%changelog
+* Mon Sep 20 2021 Richard W.M. Jones <rjones@redhat.com> - 0.9-1
+- Initial release.
-# Debuginfo and stripping makes no sense for this package.
+# Disable debug packages, we don't need them.
%global debug_package %{nil}
-%global __strip /bin/true
-%global _binaries_in_noarch_packages_terminate_build 0
-Name: opensbi
-Version: 0.9
-Release: 1%{?dist}
-Summary: RISC-V Open Source Supervisor Binary Interface (OpenSBI)
+Name: opensbi-unstable
+# The last part is short hash
+# Format: <TAG>.<NUMBER_OF_COMMITS_AFTER_TAG>.<YEAR>.<MONTH>.<DAY>.<SHORT_COMMIT>
+Version: v1.2.116.2023.05.02.7919530
+Release: 1%{?dist}
+Summary: RISC-V Open Source Supervisor Binary Interface
+
+License: BSD
+URL: https://github.com/riscv/opensbi
+
+# Download tarball, e.g.:
+# https://github.com/riscv/opensbi/archive/%full_commit.tar.gz
+%global full_commit 791953030836d39687688a8e7f1a3e708892cfa1
+Source0: https://github.com/riscv/opensbi/archive/%{full_commit}.tar.gz
+
+BuildRequires: gcc
+BuildRequires: binutils
+BuildRequires: findutils
+BuildRequires: grep
+BuildRequires: coreutils
+BuildRequires: make
+BuildRequires: dtc
+BuildRequires: python3
+BuildRequires: gawk
+BuildRequires: sed
-License: BSD
-URL: https://github.com/riscv-software-src/opensbi
-Source0: https://github.com/riscv-software-src/%{name}/archive/refs/tags/v%{version}.tar.gz
+%description
+RISC-V Open Source Supervisor Binary Interface compiled in jump variant.
+This is only for QEMU RISC-V virt machine.
-BuildRequires: gcc-riscv64-linux-gnu
-BuildRequires: binutils-riscv64-linux-gnu
-# The -devel subpackage contains riscv64 code so you'll get:
-# > Arch dependent binaries in noarch package
-Buildarch: noarch
+%prep
+%autosetup -n opensbi-%{full_commit}
-%description
-The RISC-V Supervisor Binary Interface (SBI) is the firmware
-used to boot RISC-V virtual machines in qemu.
+%build
+make \
+ PLATFORM=generic
-%package devel
-Summary: Development files for %{name}
-# NB: Doesn't require the base package because it doesn't need it.
+%install
+make \
+ PLATFORM=generic \
+ I=%{buildroot} \
+ INSTALL_LIB_PATH=lib64 \
+ INSTALL_FIRMWARE_PATH=%{_datadir}/%{name} \
+ install
-%description devel
-This package contains development files (headers, libraries, etc)
-for %{name}.
+rm -rfv %{buildroot}/lib64
+rm -rfv %{buildroot}/include
+rm -rfv %{buildroot}%{_datadir}/%{name}/*/firmware/payloads
-%prep
-%setup -q -n opensbi-%{version}
+%files
+%license COPYING.BSD
+%doc README.md
+%dir %{_datadir}/%{name}
+%{_datadir}/%{name}/*
-%build
-%global platforms generic
-for platform in %{platforms}; do
- make CROSS_COMPILE=riscv64-linux-gnu- PLATFORM=$platform %{?_smp_mflags}
-done
+%changelog
+* Tue May 02 2022 David Abdurachmanov <davidlt@rivosinc.com> v1.2.116.2023.05.02.7919530-1
+- Sync with upstream master branch (v1.2-116-g7919530)
+* Thu Jan 26 2022 David Abdurachmanov <davidlt@rivosinc.com> v1.2.0.2023.01.26.c6b5188c-1
+- Use v1.2 (last stable release for now)
-%install
-# This installs into the install/ subdirectory ...
-for platform in %{platforms}; do
- make CROSS_COMPILE=riscv64-linux-gnu- PLATFORM=$platform %{?_smp_mflags} \
- install
-done
-# ... and we copy the files we want to the desired locations.
+* Tue Jan 25 2022 David Abdurachmanov <davidlt@rivosinc.com> v1.2.34.2023.01.25.c45992c-1
+- Sync with upstream master branch (v1.2-34-gc45992c)
-mkdir -p %{buildroot}%{_libdir}
-cp -a install/usr/lib64/* %{buildroot}%{_libdir}
+* Thu Nov 17 2022 David Abdurachmanov <davidlt@rivosinc.com> v1.1.85.2022.11.17.14f5c4c-1
+- Sync with upstream master branch (v1.1-85-g14f5c4c)
-mkdir -p %{buildroot}%{_includedir}
-cp -a install/usr/include/* %{buildroot}%{_includedir}
+* Mon Jun 23 2022 David Abdurachmanov <davidlt@rivosinc.com> v1.1.0.2022.06.27.4489876-1
+- Sync with upstream master branch (v1.1 tag)
-mkdir -p %{buildroot}%{_datadir}
-cp -a install/usr/share/opensbi %{buildroot}%{_datadir}/%{name}
+* Thu Jun 23 2022 David Abdurachmanov <davidlt@rivosinc.com> v1.0.99.2022.06.23.6f1fe98-1
+- Sync with upstream master branch
+* Thu Jun 02 2022 David Abdurachmanov <davidlt@rivosinc.com> v1.0.92.2022.06.13.9dc5ec5-1
+- Sync with upstream master branch
-%files
-%{_datadir}/%{name}
+* Thu Jun 02 2022 David Abdurachmanov <davidlt@rivosinc.com> v1.0.81.2022.06.02.cb8271c-1
+- Sync with upstream master branch
+* Sat Nov 06 2021 David Abdurachmanov <david.abdurachmanov@gmail.com> v0.9.163.2021.11.06.0979ffd-1
+- Sync with upstream master branch
-%files devel
-%dir %{_libdir}/lp64
-%{_libdir}/lp64/libsbi*.a
-%{_libdir}/lp64/opensbi/generic/lib/libplatsbi.a
-%{_includedir}/sbi/
-%{_includedir}/sbi_utils/
+* Fri Oct 08 2021 David Abdurachmanov <david.abdurachmanov@gmail.com> v0.9.152.2021.10.08.754d511-1
+- Sync with upstream master branch
+* Tue Aug 17 2021 David Abdurachmanov <david.abdurachmanov@gmail.com> v0.9.134.2021.08.17.7aa6c9a-1
+- Sync with upstream master branch
+- Upstream support for SiFive HiFive Unmatched
-%changelog
-* Mon Sep 20 2021 Richard W.M. Jones <rjones@redhat.com> - 0.9-1
-- Initial release.
+* Wed Apr 21 2021 David Abdurachmanov <david.abdurachmanov@gmail.com> v0.9.35.2021.04.21.f41196a
+- Update to v0.9+
+
+* Wed Jan 06 2021 David Abdurachmanov <david.abdurachmanov@sifive.com> 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