aboutsummaryrefslogtreecommitdiff
path: root/gnu/build
diff options
context:
space:
mode:
authorMathieu Othacehe <m.othacehe@gmail.com>2019-08-20 18:00:40 +0200
committerMathieu Othacehe <m.othacehe@gmail.com>2019-11-22 16:33:43 +0100
commit1ee72bb55b69796abc69d56a51b8eb3f42438be6 (patch)
tree7852c88b4595ef6ee5682acba2e65dab3eb4d2f1 /gnu/build
parent2608417ab8889cf8c1a61032633c474228141e78 (diff)
downloadguix-1ee72bb55b69796abc69d56a51b8eb3f42438be6.tar
guix-1ee72bb55b69796abc69d56a51b8eb3f42438be6.tar.gz
system: vm: Add arm64 support.
* gnu/build/vm.scm (load-in-linux-vm): Add target-arm64? argument and use it to pass correct arguments to qemu. * gnu/system/vm.scm (expression->derivation-in-linux-vm): Pass the new target-arm64? argument added above. Do not add ESP partition on all ARM targets. Do not pass grub-efi package to initialize-hard-disk on ARM targets.
Diffstat (limited to 'gnu/build')
-rw-r--r--gnu/build/vm.scm19
1 files changed, 13 insertions, 6 deletions
diff --git a/gnu/build/vm.scm b/gnu/build/vm.scm
index b85398ed24..6f920aec9e 100644
--- a/gnu/build/vm.scm
+++ b/gnu/build/vm.scm
@@ -82,6 +82,7 @@
make-disk-image?
single-file-output?
target-arm32?
+ target-aarch64?
(disk-image-size (* 100 (expt 2 20)))
(disk-image-format "qcow2")
(references-graphs '()))
@@ -97,10 +98,14 @@ access it via /dev/hda.
REFERENCES-GRAPHS can specify a list of reference-graph files as produced by
the #:references-graphs parameter of 'derivation'."
+ (define target-arm? (or target-arm32? target-aarch64?))
+
(define arch-specific-flags
`(;; On ARM, a machine has to be specified. Use "virt" machine to avoid
;; hardware limits imposed by other machines.
- ,@(if target-arm32? '("-M" "virt") '())
+ ,@(if target-arm?
+ '("-M" "virt")
+ '())
;; On ARM32, if the kernel is built without LPAE support, ECAM conflicts
;; with VIRT_PCIE_MMIO causing PCI devices not to show up. Disable
@@ -112,9 +117,9 @@ the #:references-graphs parameter of 'derivation'."
;; Only enable kvm if we see /dev/kvm exists. This allows users without
;; hardware virtualization to still use these commands. KVM support is
- ;; still buggy on some ARM32 boards. Do not use it even if available.
+ ;; still buggy on some ARM boards. Do not use it even if available.
,@(if (and (file-exists? "/dev/kvm")
- (not target-arm32?))
+ (not target-arm?))
'("-enable-kvm")
'())
@@ -125,11 +130,11 @@ the #:references-graphs parameter of 'derivation'."
;; The serial port name differs between emulated
;; architectures/machines.
" console="
- (if target-arm32? "ttyAMA0" "ttyS0"))
+ (if target-arm? "ttyAMA0" "ttyS0"))
;; NIC is not supported on ARM "virt" machine, so use a user mode
;; network stack instead.
- ,@(if target-arm32?
+ ,@(if target-arm?
'("-device" "virtio-net-pci,netdev=mynet"
"-netdev" "user,id=mynet")
'("-net" "nic,model=virtio"))))
@@ -153,7 +158,9 @@ the #:references-graphs parameter of 'derivation'."
(_ #f))
(apply invoke qemu "-nographic" "-no-reboot"
- "-smp" (number->string (parallel-job-count))
+ ;; CPU "max" behaves as "host" when KVM is enabled, and like a system
+ ;; CPU with the maximum possible feature set otherwise.
+ "-cpu" "max"
"-m" (number->string memory-size)
"-object" "rng-random,filename=/dev/urandom,id=guixsd-vm-rng"
"-device" "virtio-rng-pci,rng=guixsd-vm-rng"