Subject: [bug#70913] [PATCH 07/11] gnu: ovmf-riscv64: Update to 202402.

From: Efraim Flashner <[email-masked]>
Date: Mon, 13 May 2024 11:21:56 +0300

* gnu/packages/firmware.scm (ovmf-riscv64): Update to 202402.  Build
using make-ovmf-firmware.

Change-Id: I1a7dcaac3975669a61723b929162ad33affa1619
---
 gnu/packages/firmware.scm | 54 ++++++++++++---------------------------
 1 file changed, 16 insertions(+), 38 deletions(-)

diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm
index f660c21712..b0638382cb 100644
--- a/gnu/packages/firmware.scm
+++ b/gnu/packages/firmware.scm
@@ -1057,6 +1057,22 @@ (define-public ovmf-arm
                                               "RELEASE_GCC/FV/QEMU_EFI.fd")
                                (string-append fmw "/ovmf_arm.bin"))))))))))))
 
+(define-public ovmf-riscv64
+  (let ((base (make-ovmf-firmware "riscv64")))
+    (package
+      (inherit base)
+      (arguments
+        (substitute-keyword-arguments (package-arguments base)
+          ((#:phases phases)
+           #~(modify-phases #$phases
+               (replace 'install
+                 (lambda _
+                   (let ((fmw (string-append #$output "/share/firmware")))
+                    (mkdir-p fmw)
+                    (with-directory-excursion "Build/RiscVVirtQemu/RELEASE_GCC/FV"
+                      (install-file "RISCV_VIRT_CODE.fd" fmw)
+                      (install-file "RISCV_VIRT_VARS.fd" fmw))))))))))))
+
 (define-public ovmf
   (let ((toolchain-ver "GCC5"))
     (package
@@ -1157,44 +1173,6 @@ (define-public ovmf
       (license (list license:expat
                      license:bsd-2 license:bsd-3 license:bsd-4)))))
 
-(define-public ovmf-riscv64
-  (let ((toolchain-ver "GCC5"))
-    (package
-      (inherit ovmf)
-      (name "ovmf-riscv64")
-      (native-inputs
-       (append (package-native-inputs ovmf)
-               (if (not (string-prefix? "riscv64" (%current-system)))
-                   `(("cross-gcc" ,(cross-gcc "riscv64-linux-gnu"))
-                     ("cross-binutils" ,(cross-binutils "riscv64-linux-gnu")))
-                   '())))
-      (arguments
-       (substitute-keyword-arguments (package-arguments ovmf)
-         ((#:phases phases)
-          #~(modify-phases #$phases
-              #$@(if (string-prefix? "riscv64" (%current-system))
-                     '()
-                     #~((add-before 'configure 'set-env
-                          (lambda _
-                            (setenv (string-append #$toolchain-ver "_RISCV64_PREFIX")
-                                    "riscv64-linux-gnu-")))))
-              (replace 'build
-                (lambda _
-                  (invoke "build" "-a" "RISCV64" "-t" #$toolchain-ver
-                          "-p" "OvmfPkg/RiscVVirt/RiscVVirtQemu.dsc")))
-              (delete 'build-x64)
-              (replace 'install
-                (lambda _
-                  (let ((fmw (string-append #$output "/share/firmware")))
-                    (mkdir-p fmw)
-                    (copy-file (string-append "Build/RiscVVirtQemu/RELEASE_"
-                                              #$toolchain-ver "/FV/RISCV_VIRT_CODE.fd")
-                               (string-append fmw "/RISCV_VIRT_CODE.fd"))
-                    (copy-file (string-append "Build/RiscVVirtQemu/RELEASE_"
-                                              #$toolchain-ver "/FV/RISCV_VIRT_VARS.fd")
-                               (string-append fmw "/RISCV_VIRT_VARS.fd")))))))))
-      (supported-systems %supported-systems))))
-
 (define* (make-arm-trusted-firmware platform
                                     #:key (triplet "aarch64-linux-gnu"))
   (let ((native-build? (lambda ()
-- 
Efraim Flashner   <[email-masked]>   רנשלפ םירפא
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted