Add opensbi 0.9
authorRichard W.M. Jones <rjones@redhat.com>
Mon, 20 Sep 2021 09:04:57 +0000 (10:04 +0100)
committerRichard W.M. Jones <rjones@redhat.com>
Mon, 20 Sep 2021 09:24:44 +0000 (10:24 +0100)
https://bugzilla.redhat.com/show_bug.cgi?id=1739133

To build:
$ rpmbuild --define "_sourcedir $PWD" -ba opensbi.spec

opensbi/.gitignore [new file with mode: 0644]
opensbi/opensbi.spec [new file with mode: 0644]

diff --git a/opensbi/.gitignore b/opensbi/.gitignore
new file mode 100644 (file)
index 0000000..8e9fff5
--- /dev/null
@@ -0,0 +1 @@
+/v0.9.tar.gz
diff --git a/opensbi/opensbi.spec b/opensbi/opensbi.spec
new file mode 100644 (file)
index 0000000..cda873a
--- /dev/null
@@ -0,0 +1,82 @@
+# 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.