[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
62/64: system: vm: Add arm64 support.
From: |
guix-commits |
Subject: |
62/64: system: vm: Add arm64 support. |
Date: |
Fri, 23 Aug 2019 04:10:26 -0400 (EDT) |
mothacehe pushed a commit to branch wip-cross-system
in repository guix.
commit d1e25a381f5c34c17b1fc9891c9554a0664a89e8
Author: Mathieu Othacehe <address@hidden>
Date: Tue Aug 20 18:00:40 2019 +0200
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.
---
gnu/build/vm.scm | 22 +++++++++++++++++-----
gnu/system/vm.scm | 17 +++++++++++------
2 files changed, 28 insertions(+), 11 deletions(-)
diff --git a/gnu/build/vm.scm b/gnu/build/vm.scm
index b85398e..e57917a 100644
--- a/gnu/build/vm.scm
+++ b/gnu/build/vm.scm
@@ -82,6 +82,7 @@
make-disk-image?
single-file-output?
target-arm32?
+ target-arm64?
(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-arm64?))
+
(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
@@ -110,11 +115,18 @@ the #:references-graphs parameter of 'derivation'."
'("-machine" "highmem=off")
'())
+ ;; On ARM64, we have to specify the CPU. "max" behaves as "host" when
+ ;; KVM is enabled, and like a system CPU with the maximum possible
+ ;; feature set otherwise.
+ ,@(if target-arm64?
+ '("-cpu" "max")
+ '())
+
;; 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 +137,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"))))
diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm
index ac6e4de..07cee2d 100644
--- a/gnu/system/vm.scm
+++ b/gnu/system/vm.scm
@@ -235,10 +235,12 @@ made available under the /xchg CIFS share."
#:memory-size #$memory-size
#:make-disk-image? #$make-disk-image?
#:single-file-output? #$single-file-output?
- ;; FIXME: ‘target-arm32?’ may not operate on
- ;; the right system/target values. Rewrite
+ ;; FIXME: ‘target-arm32?’ and
+ ;; ‘target-arm64?’ may not operate on the
+ ;; right system/target values. Rewrite
;; using ‘let-system’ when available.
#:target-arm32? #$(target-arm32?)
+ #:target-arm64? #$(target-arm64?)
#:disk-image-format #$disk-image-format
#:disk-image-size size
#:references-graphs graphs))))))
@@ -452,10 +454,10 @@ system."
;; bootloaders if we are not targeting ARM because UEFI
;; support in U-Boot is experimental.
;;
- ;; FIXME: ‘target-arm32?’ may be not operate on the right
+ ;; FIXME: ‘target-arm?’ may be not operate on the right
;; system/target values. Rewrite using ‘let-system’ when
;; available.
- (if #$(target-arm32?)
+ (if #$(target-arm?)
'()
(list (partition
;; The standalone grub image is about 10MiB,
but
@@ -466,10 +468,13 @@ system."
;; when mounting. The actual FAT-ness is based
;; on file system size (16 in this case).
(file-system "vfat")
- (flags '(esp))))))))
+ (flags '(esp)))))))
+ (grub-efi #$@(if (target-arm?)
+ '(#f)
+ #~(#$grub-efi))))
(initialize-hard-disk "/dev/vda"
#:partitions partitions
- #:grub-efi #$grub-efi
+ #:grub-efi grub-efi
#:bootloader-package
#$(bootloader-package bootloader)
#:bootcfg #$bootcfg-drv
- 28/64: gnu: mkfontdir: Fix aarch64 cross-compilation., (continued)
- 28/64: gnu: mkfontdir: Fix aarch64 cross-compilation., guix-commits, 2019/08/23
- 35/64: gnu: nghttp2: Fix cross-compilation., guix-commits, 2019/08/23
- 38/64: gnu: swig: Fix cross-compilation., guix-commits, 2019/08/23
- 37/64: gnu: openldap: Fix cross-compilation., guix-commits, 2019/08/23
- 57/64: gnu: linux-libre: Enable built-in ext4 support., guix-commits, 2019/08/23
- 61/64: build: vm: Fix arm32 support., guix-commits, 2019/08/23
- 16/64: gnu: groff: Fix cross compilation., guix-commits, 2019/08/23
- 34/64: gnu: lvm2: Fix cross-compilation., guix-commits, 2019/08/23
- 36/64: gnu: bdb: Fix cross-compilation., guix-commits, 2019/08/23
- 40/64: gnu: make-linux-libre: Fix cross-compilation., guix-commits, 2019/08/23
- 62/64: system: vm: Add arm64 support.,
guix-commits <=
- 15/64: gnu: libpaper: Fix aarch64 cross-compilation., guix-commits, 2019/08/23
- 14/64: gnu: ath9k-htc-firmware: Fix cross compilation., guix-commits, 2019/08/23
- 12/64: gnu: cmake: Fix cross-compilation., guix-commits, 2019/08/23
- 32/64: gnu: boost: Fix cross-compilation., guix-commits, 2019/08/23
- 39/64: gnu: git: Fix cross-compilation., guix-commits, 2019/08/23
- 50/64: gnu: guile-xcb: Fix cross-compilation., guix-commits, 2019/08/23
- 49/64: gnu: crda: Fix cross-compilation, guix-commits, 2019/08/23
- 55/64: gnu: grub: Fix cross-compilation., guix-commits, 2019/08/23
- 46/64: gnu: texinfo-4: Fix cross compilation, guix-commits, 2019/08/23
- 53/64: gnu: console-setup: Fix cross-compilation., guix-commits, 2019/08/23