Package 32- and 64-bit firmware versions
authorRichard W.M. Jones <rjones@redhat.com>
Tue, 6 Jun 2023 12:54:26 +0000 (13:54 +0100)
committerRichard W.M. Jones <rjones@redhat.com>
Tue, 6 Jun 2023 12:54:26 +0000 (13:54 +0100)
opensbi/opensbi.spec

index 8d779b3..ad8051c 100644 (file)
@@ -48,21 +48,54 @@ RISC-V virt machines.
 
 
 %build
-make \
+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
-make \
+# Install 32 bit firmware.
+%make_install \
+  O=build32 \
   CROSS_COMPILE=riscv64-linux-gnu- \
   PLATFORM=generic \
+  PLATFORM_RISCV_XLEN=32 \
   I=%{buildroot} \
-  INSTALL_LIB_PATH=lib64 \
-  INSTALL_FIRMWARE_PATH=%{_datadir}/%{name} \
-  install
-
-rm -rfv %{buildroot}/lib64
+  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 riscv32_$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 riscv64_$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