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.
This commit is contained in:
Mathieu Othacehe 2019-08-21 09:19:58 +02:00
parent fd02b831ba
commit 4ba3c0da4f
No known key found for this signature in database
GPG key ID: 8354763531769CA6
2 changed files with 21 additions and 12 deletions

View file

@ -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