Subject: Re: [PATCH v2 3/3] system: vm: Build vm-image using native qemu, for the Hurd.

From: Ludovic Courtès <[email-masked]>
Date: Wed, 20 May 2020 23:58:52 +0200

Howdy!

"Jan (janneke) Nieuwenhuizen" <[email-masked]> skribis:

> Cross-building a vm-image is usually done using a cross-qemu, e.g, qemu-ARM,
> because, e.g., a native, x86_64 Grub cannot install an armhf-Grub.  That
> solution does not work for the Hurd, as there is no qemu-HURD.
>
> This patch enables cross building vm-images for the Hurd using a native qemu
> vm.
>
> * gnu/system/vm.scm (expression->derivation-in-linux-vm): Run native
> qemu-command; use native linux, initrd, bootloader-package and
> bootloader-installer, for the Hurd.
> [preserve-target]: New helper to install cross-packages into the native vm.
> * gnu/bootloader/grub.scm (eye-candy): Use native font, for the Hurd.
>
> Co-authored-by: Ludovic Courtès <[email-masked]>

I think the big question here, not Hurd-specific, is about the
abstractions:

  1. When cross-compiling, can the ‘qemu-image’ procedure to its job by
     running exclusively native software (in particular using a native
     QEMU, native kernel, etc.)?

  2. What should ‘expression->derivation-in-linux-vm’ do when
     cross-compiling?

I think the answer to (1) is yes, right?  That is, we can build a QEMU
image for AArch64/EFI from an x86_64 box.  That means we’d run the
x86_64/EFI ‘grub-install’ in the final step, an x86_64 ‘mke2fs’ and
‘parted’ to create the partitions, and so on.  Likewise, we can create a
QEMU GNU/Hurd image without entirely on GNU/Linux.

As for (2), I’d say that when cross-compiling, it should just run native
software but simply preserve references to cross-compiled software,
which is what janneke’s patch does.

How does that sound?  Mathieu?

(I guess I’m rewording what janneke wrote, but my mind became fuzzy last
time I looked at it, so I thought it’s best to double-check.  :-))

Thanks!

Ludo’.