summary refs log tree commit diff
diff options
context:
space:
mode:
authorMarius Bakke <marius@gnu.org>2022-12-20 22:25:46 +0100
committerMarius Bakke <marius@gnu.org>2022-12-22 16:50:47 +0100
commita5dbe84a619cd3b04c242ff7e76c452a74b79428 (patch)
treefd523e8daf8b4e61940fb96e5eb6c2ca424cb323
parentffc0037458674d80267878ccec370300c45a0209 (diff)
downloadguix-a5dbe84a619cd3b04c242ff7e76c452a74b79428.tar.gz
gnu: ipxe-qemu: Cross-compile on non x86_64.
* gnu/packages/bootloaders.scm (ipxe-qemu)[native-inputs]: When not targeting
x86_64, add CROSS-GCC and CROSS-BINUTILS.
[arguments]: Set CROSS_COMPILE in that case.
-rw-r--r--gnu/packages/bootloaders.scm19
1 files changed, 14 insertions, 5 deletions
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index c8b8adbc93..04d7eefae2 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -1535,8 +1535,14 @@ the features of iPXE without the hassle of reflashing.")
   (package/inherit ipxe
     (name "ipxe-qemu")
     (native-inputs
-     (modify-inputs (package-native-inputs ipxe)
-       (prepend edk2-tools)))
+     ;; QEMU uses a 64-bit UEFI firmware.
+     (if (target-x86-64?)
+         (modify-inputs (package-native-inputs ipxe)
+           (prepend edk2-tools))
+         (modify-inputs (package-native-inputs ipxe)
+           (prepend edk2-tools
+                    (cross-gcc "x86_64-linux-gnu")
+                    (cross-binutils "x86_64-linux-gnu")))))
     (arguments
      (let ((roms
             ;; Alist of ROM -> (VID . DID) entries.  This list and below
@@ -1554,14 +1560,17 @@ the features of iPXE without the hassle of reflashing.")
           `((ice-9 match) ,@modules))
          ((#:make-flags flags)
           #~(append (delete "everything" #$flags)
-                    '("CONFIG=qemu")
+                    '("CONFIG=qemu"
+                      #$@(if (target-x86-64?)
+                             '()
+                             '("CROSS_COMPILE=x86_64-linux-gnu-")))
                     (map (match-lambda
                            ((_ . (vid . did))
                             (string-append "bin/" vid did ".rom")))
                          '#$roms)
                     (map (match-lambda
                            ((_ . (vid . did))
-                            (string-append "bin-efi/"
+                            (string-append "bin-x86_64-efi/"
                                            vid did ".efidrv")))
                          '#$roms)))
          ((#:phases phases)
@@ -1582,7 +1591,7 @@ the features of iPXE without the hassle of reflashing.")
                                   "-l" "0x02"
                                   "-f" (string-append "0x" vid)
                                   "-i" (string-append "0x" did)
-                                  "-ec" (string-append "bin-efi/"
+                                  "-ec" (string-append "bin-x86_64-efi/"
                                                        vid did ".efidrv")
                                   "-o" (string-append firmware
                                                       "/efi-" name ".rom")))))