summary refs log tree commit diff
diff options
context:
space:
mode:
authorEfraim Flashner <efraim@flashner.co.il>2018-06-11 12:38:42 +0300
committerEfraim Flashner <efraim@flashner.co.il>2018-06-11 19:16:23 +0300
commit6da97043ea11490792c658255b5413c10e295b53 (patch)
tree3d2097204d54654b402449a54af22ed021b90bbe
parentcb97be5f8341849dfe4e8e202910bde535dc41f5 (diff)
downloadguix-6da97043ea11490792c658255b5413c10e295b53.tar.gz
gnu: Add ovmf-arm.
* gnu/packages/firmware.scm (ovmf-arm): New variable.
-rw-r--r--gnu/packages/firmware.scm35
1 files changed, 35 insertions, 0 deletions
diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm
index 3eed3163c9..176eef5137 100644
--- a/gnu/packages/firmware.scm
+++ b/gnu/packages/firmware.scm
@@ -338,6 +338,41 @@ Virtual Machines.  OVMF contains a sample UEFI firmware for QEMU and KVM.")
                  #t)))))))
     (supported-systems %supported-systems)))
 
+(define-public ovmf-arm
+  (package
+    (inherit ovmf)
+    (name "ovmf-arm")
+    (native-inputs
+     `(,@(package-native-inputs ovmf)
+       ,@(if (not (string-prefix? "armhf" (%current-system)))
+           `(("cross-gcc" ,(cross-gcc "arm-linux-gnueabihf"))
+             ("cross-binutils" ,(cross-binutils "arm-linux-gnueabihf")))
+           '())))
+    (arguments
+     (substitute-keyword-arguments (package-arguments ovmf)
+       ((#:phases phases)
+        `(modify-phases ,phases
+           (add-before 'configure 'set-env
+             (lambda _
+               ,@(if (not (string-prefix? "armhf" (%current-system)))
+                     `((setenv "GCC49_ARM_PREFIX" "arm-linux-gnueabihf-"))
+                     '())
+               #t))
+           (replace 'build
+             (lambda _
+               (invoke "build" "-a" "ARM" "-t" "GCC49"
+                       "-p" "ArmVirtPkg/ArmVirtQemu.dsc")))
+           (delete 'build-x64)
+           (replace 'install
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let* ((out (assoc-ref outputs "out"))
+                      (fmw (string-append out "/share/firmware")))
+                 (mkdir-p fmw)
+                 (copy-file "Build/ArmVirtQemu-ARM/RELEASE_GCC49/FV/QEMU_EFI.fd"
+                            (string-append fmw "/ovmf_arm.bin"))
+                 #t)))))))
+    (supported-systems %supported-systems)))
+
 (define* (make-arm-trusted-firmware platform #:optional (arch "aarch64"))
   (package
     (name (string-append "arm-trusted-firmware-" platform))