unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Mathieu Othacehe <m.othacehe@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: guix-devel <guix-devel@gnu.org>
Subject: Re: ARM VM with networking support?
Date: Sun, 01 Dec 2019 17:30:12 +0100	[thread overview]
Message-ID: <878snwvwiz.fsf@gmail.com> (raw)
In-Reply-To: <878soeo2c5.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 1267 bytes --]


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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-vm-Force-native-qemu-usage.patch --]
[-- Type: text/x-diff, Size: 2116 bytes --]

From e107692f3a98c19d2457050635818226ee675c52 Mon Sep 17 00:00:00 2001
From: Mathieu Othacehe <m.othacehe@gmail.com>
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


  parent reply	other threads:[~2019-12-01 16:30 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-03 14:43 ARM VM with networking support? Ludovic Courtès
2019-11-03 17:09 ` Mathieu Othacehe
2019-11-09 17:24   ` Ludovic Courtès
2019-11-11  7:23     ` Danny Milosavljevic
2019-11-17 17:06       ` Ludovic Courtès
2019-11-11 17:34     ` Mathieu Othacehe
2019-11-17 17:11       ` Ludovic Courtès
2019-11-23 19:01         ` Mathieu Othacehe
2019-11-25 14:04           ` Marius Bakke
2019-11-25 14:39             ` Mathieu Othacehe
2019-11-26 10:26               ` Ludovic Courtès
2019-12-01 16:30         ` Mathieu Othacehe [this message]
2019-12-09 17:35           ` Ludovic Courtès
2019-12-30 21:16             ` Building a bootable disk image for A20-OLinuXino Ludovic Courtès
2019-12-31  9:26               ` Mathieu Othacehe
2019-12-31 11:23                 ` Mathieu Othacehe
2020-01-12 11:55                 ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878snwvwiz.fsf@gmail.com \
    --to=m.othacehe@gmail.com \
    --cc=guix-devel@gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).