guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ARM VM with networking support?


From: Mathieu Othacehe
Subject: Re: ARM VM with networking support?
Date: Sun, 01 Dec 2019 17:30:12 +0100
User-agent: mu4e 1.2.0; emacs 26.3

Hey Ludo,

> Here’s my tentative config file.

I just generated a disk-image with your config file! Just like you, I did
hit the "unsupported ioctl" issue on both master and core-updates
branch.

The reason is that the command run when producing the disk image is:

          qemu-arm qemu-system-arm disk-image-builder
            ^           ^
            |           |-- Native qemu (so for armhf-linux architecture).
            |
            Run by binfmt because qemu-system-arm is a binary for armhf
            architecture.

So a syscall issued somewhere in disk-image-builder goes through the
kernel emulated by qemu-system-arm and via qemu-arm to your host kernel.

The failing syscall is number 47601 (FS_IOC32_GETVERSION), I don't know
why it is not supported by our host kernel. However, using a
qemu-system-arm built for arm doesn't make much sense here, because we
add an unecessary (and failing) layer of emulation.

So what I would propose is to produce a disk-image using a qemu-system-*
built for the host architecture (and not the system specified by
--system argument). This remains true when cross-compiling a system.

The attached patch does thin in an ugly way but that solves the issue.

WDYT?

Mathieu
>From e107692f3a98c19d2457050635818226ee675c52 Mon Sep 17 00:00:00 2001
From: Mathieu Othacehe <address@hidden>
Date: Sun, 1 Dec 2019 16:49:36 +0100
Subject: [PATCH] vm: Force native qemu usage.

---
 gnu/system/vm.scm | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm
index 8609bd2ace..e760e7f42d 100644
--- a/gnu/system/vm.scm
+++ b/gnu/system/vm.scm
@@ -68,6 +68,7 @@
   #:use-module (gnu system uuid)
 
   #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-9)
   #:use-module (srfi srfi-26)
   #:use-module (rnrs bytevectors)
   #:use-module (ice-9 match)
@@ -141,6 +142,16 @@
                          packages))))
               (list guile-gcrypt guile-sqlite3)))
 
+(define-record-type <native-qemu>
+  (%native-qemu qemu system)
+  native-qemu?
+  (qemu native-qemu-qemu)
+  (system native-qemu-system))
+
+(define-gexp-compiler (native-qemu-compiler (native-qemu <native-qemu>) system 
target)
+  (package->derivation (native-qemu-qemu native-qemu)
+                       (native-qemu-system native-qemu)))
+
 (define* (expression->derivation-in-linux-vm name exp
                                              #:key
                                              (system (%current-system)) target
@@ -193,6 +204,9 @@ made available under the /xchg CIFS share."
                         (reboot)
                         (exit 1))))
 
+  (define qemu-native
+    (%native-qemu qemu (@ (guix config) %system)))
+
   (let ((initrd (or initrd
                     (base-initrd file-systems
                                  #:on-error 'backtrace
@@ -215,7 +229,7 @@ made available under the /xchg CIFS share."
                            (gnu build vm))
 
               (let* ((native-inputs
-                      '#+(list qemu (canonical-package coreutils)))
+                      '#+(list qemu-native (canonical-package coreutils)))
                      (linux   (string-append #$linux "/"
                                              #$(system-linux-image-file-name)))
                      (initrd  #$initrd)
-- 
2.24.0


reply via email to

[Prev in Thread] Current Thread [Next in Thread]