[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
21/22: system: vm: Support cross-compilation.
From: |
guix-commits |
Subject: |
21/22: system: vm: Support cross-compilation. |
Date: |
Fri, 15 Nov 2019 11:32:47 -0500 (EST) |
mothacehe pushed a commit to branch core-updates
in repository guix.
commit 4ba3c0da4f76e8ec487036f23a14f9353f09131a
Author: Mathieu Othacehe <address@hidden>
Date: Wed Aug 21 09:19:58 2019 +0200
system: vm: Support cross-compilation.
* gnu/system.scm (system-linux-image-file-name): Add support for cross-built
systems. Remove system argument that was ignored,
(operating-system-kernel-file): adapt by removing ignored os argument.
* gnu/system/vm.scm (expression->derivation-in-linux-vm): Add target
argument and turn inputs into native-inputs. Pass target to qemu-command
and gexp->derivation calls.
(iso9660-image): Add target argument and pass it to
expression->derivation-in-linux-vm. Remove qemu from inputs as it
is not necessary.
(qemu-image): Add target argument, also remove qemu from inputs. Pass
target argument to expression->derivation-in-linux-vm call.
---
gnu/system.scm | 15 ++++++++-------
gnu/system/vm.scm | 18 +++++++++++++-----
2 files changed, 21 insertions(+), 12 deletions(-)
diff --git a/gnu/system.scm b/gnu/system.scm
index a353b1a..96c2b5a 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -447,20 +447,21 @@ from the initrd."
"Return the list of swap services for OS."
(map swap-service (operating-system-swap-devices os)))
-(define* (system-linux-image-file-name #:optional (system (%current-system)))
+(define* (system-linux-image-file-name)
"Return the basename of the kernel image file for SYSTEM."
;; FIXME: Evaluate the conditional based on the actual current system.
- (cond
- ((string-prefix? "arm" (%current-system)) "zImage")
- ((string-prefix? "mips" (%current-system)) "vmlinuz")
- ((string-prefix? "aarch64" (%current-system)) "Image")
- (else "bzImage")))
+ (let ((target (or (%current-target-system) (%current-system))))
+ (cond
+ ((string-prefix? "arm" target) "zImage")
+ ((string-prefix? "mips" target) "vmlinuz")
+ ((string-prefix? "aarch64" target) "Image")
+ (else "bzImage"))))
(define (operating-system-kernel-file os)
"Return an object representing the absolute file name of the kernel image of
OS."
(file-append (operating-system-kernel os)
- "/" (system-linux-image-file-name os)))
+ "/" (system-linux-image-file-name)))
(define* (operating-system-directory-base-entries os)
"Return the basic entries of the 'system' directory of OS for use as the
diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm
index de20030..c900b2d 100644
--- a/gnu/system/vm.scm
+++ b/gnu/system/vm.scm
@@ -143,7 +143,7 @@
(define* (expression->derivation-in-linux-vm name exp
#:key
- (system (%current-system))
+ (system (%current-system)) target
(linux linux-libre)
initrd
(qemu qemu-minimal)
@@ -214,7 +214,8 @@ made available under the /xchg CIFS share."
(use-modules (guix build utils)
(gnu build vm))
- (let* ((inputs '#$(list qemu (canonical-package coreutils)))
+ (let* ((native-inputs
+ '#+(list qemu (canonical-package coreutils)))
(linux (string-append #$linux "/"
#$(system-linux-image-file-name)))
(initrd #$initrd)
@@ -222,16 +223,18 @@ made available under the /xchg CIFS share."
(graphs '#$(match references-graphs
(((graph-files . _) ...) graph-files)
(_ #f)))
+ (target #$(or (%current-target-system)
(%current-system)))
(size #$(if (eq? 'guess disk-image-size)
#~(+ (* 70 (expt 2 20)) ;ESP
(estimated-partition-size graphs))
disk-image-size)))
- (set-path-environment-variable "PATH" '("bin") inputs)
+ (set-path-environment-variable "PATH" '("bin") native-inputs)
(load-in-linux-vm loader
#:output #$output
#:linux linux #:initrd initrd
+ #:qemu (qemu-command target)
#:memory-size #$memory-size
#:make-disk-image? #$make-disk-image?
#:single-file-output? #$single-file-output?
@@ -248,6 +251,7 @@ made available under the /xchg CIFS share."
(gexp->derivation name builder
;; TODO: Require the "kvm" feature.
#:system system
+ #:target target
#:env-vars env-vars
#:guile-for-build guile-for-build
#:references-graphs references-graphs)))
@@ -263,6 +267,7 @@ made available under the /xchg CIFS share."
file-system-label
file-system-uuid
(system (%current-system))
+ (target (%current-target-system))
(qemu qemu-minimal)
os
bootcfg-drv
@@ -299,7 +304,7 @@ INPUTS is a list of inputs (as for packages)."
(setlocale LC_ALL "en_US.utf8")
(let ((inputs
- '#$(append (list qemu parted e2fsprogs dosfstools xorriso)
+ '#$(append (list parted e2fsprogs dosfstools xorriso)
(map canonical-package
(list sed grep coreutils findutils gawk))))
@@ -328,6 +333,7 @@ INPUTS is a list of inputs (as for packages)."
#:volume-uuid #$(and=> file-system-uuid
uuid-bytevector))))))
#:system system
+ #:target target
;; Keep a local file system for /tmp so that we can populate it directly as
;; root and have files owned by root. See <https://bugs.gnu.org/31752>.
@@ -346,6 +352,7 @@ INPUTS is a list of inputs (as for packages)."
(define* (qemu-image #:key
(name "qemu-image")
(system (%current-system))
+ (target (%current-target-system))
(qemu qemu-minimal)
(disk-image-size 'guess)
(disk-image-format "qcow2")
@@ -404,7 +411,7 @@ system."
(setlocale LC_ALL "en_US.utf8")
(let ((inputs
- '#$(append (list qemu parted e2fsprogs dosfstools)
+ '#$(append (list parted e2fsprogs dosfstools)
(map canonical-package
(list sed grep coreutils findutils gawk))))
@@ -481,6 +488,7 @@ system."
#:bootloader-installer
#$(bootloader-installer bootloader)))))))
#:system system
+ #:target target
#:make-disk-image? #t
#:disk-image-size disk-image-size
#:disk-image-format disk-image-format
- 04/22: gnu: cyrus-sasl: Fix cross-compilation., (continued)
- 04/22: gnu: cyrus-sasl: Fix cross-compilation., guix-commits, 2019/11/15
- 17/22: gnu: cmake: Fix cross-compilation., guix-commits, 2019/11/15
- 13/22: gnu: guile-gcrypt: Fix cross-compilation., guix-commits, 2019/11/15
- 12/22: gnu: doxygen: Fix cross-compilation., guix-commits, 2019/11/15
- 08/22: gnu: bdb: Fix cross-compilation., guix-commits, 2019/11/15
- 07/22: gnu: eudev: Fix cross-compilation., guix-commits, 2019/11/15
- 18/22: utils: Use target-aarch64? and target-arm? helpers., guix-commits, 2019/11/15
- 15/22: gnu: libnl: Move python outputs to separate packages., guix-commits, 2019/11/15
- 09/22: gnu: openldap: Fix cross-compilation., guix-commits, 2019/11/15
- 19/22: build: vm: Fix arm32 support., guix-commits, 2019/11/15
- 21/22: system: vm: Support cross-compilation.,
guix-commits <=
- 20/22: system: vm: Add arm64 support., guix-commits, 2019/11/15
- 06/22: gnu: boost: Fix cross-compilation., guix-commits, 2019/11/15
- 22/22: scripts: system: Add --target option., guix-commits, 2019/11/15
- 16/22: gnu: crda: Fix cross-compilation, guix-commits, 2019/11/15
- 03/22: gnu: groff: Fix cross compilation., guix-commits, 2019/11/15
- 14/22: gnu: guile-sqlite3: Fix cross-compilation., guix-commits, 2019/11/15