From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id GLGPM9yuw15oHQAA0tVLHw (envelope-from ) for ; Tue, 19 May 2020 10:03:08 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id GAdwL9yuw15qHQAAB5/wlQ (envelope-from ) for ; Tue, 19 May 2020 10:03:08 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 346DE940145 for ; Tue, 19 May 2020 10:03:08 +0000 (UTC) Received: from localhost ([::1]:58504 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jaz5X-00065W-7e for larch@yhetil.org; Tue, 19 May 2020 06:03:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35752) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jaz5S-00065L-EY for guix-patches@gnu.org; Tue, 19 May 2020 06:03:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:37733) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jaz5S-0005L2-50 for guix-patches@gnu.org; Tue, 19 May 2020 06:03:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jaz5S-0001WZ-1J for guix-patches@gnu.org; Tue, 19 May 2020 06:03:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#41350] [PATCH 0/3] Use native qemu to build vm-image. Resent-From: Mathieu Othacehe Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 19 May 2020 10:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41350 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Jan Nieuwenhuizen Cc: 41350@debbugs.gnu.org Received: via spool by 41350-submit@debbugs.gnu.org id=B41350.15898825495144 (code B ref 41350); Tue, 19 May 2020 10:03:01 +0000 Received: (at 41350) by debbugs.gnu.org; 19 May 2020 10:02:29 +0000 Received: from localhost ([127.0.0.1]:49279 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jaz4v-0001KX-C2 for submit@debbugs.gnu.org; Tue, 19 May 2020 06:02:29 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56504) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jaz4t-0001F2-Dv for 41350@debbugs.gnu.org; Tue, 19 May 2020 06:02:27 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:47800) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jaz4n-0005Hq-Bq; Tue, 19 May 2020 06:02:21 -0400 Received: from [2a01:e0a:fa:a50:7004:8043:e0bd:6eda] (port=36344 helo=meru) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jaz4m-0002Ya-5l; Tue, 19 May 2020 06:02:20 -0400 From: Mathieu Othacehe References: <87mu66q3rt.fsf@gnu.org> <87y2ppfw28.fsf@gnu.org> <87367wbd82.fsf@gnu.org> Date: Tue, 19 May 2020 12:02:18 +0200 In-Reply-To: <87367wbd82.fsf@gnu.org> (Jan Nieuwenhuizen's message of "Tue, 19 May 2020 09:22:53 +0200") Message-ID: <874ksctf85.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -3.3 (---) X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Spam-Score: -1.01 X-TUID: exanVbEt8PgD Hello Jan, >> Well first this 'vm-image' thing should be done in (gnu system image) as >> soon as I have sorted out the bootloader issue. So the solution we will >> find to overcome this Hurd issue will be temporary I hope. > > Can you elaborate a bit on that? Do you think it makes sense to continue > this temporary path some more (as it starts to work right now), or can we > better abandon it and work the permanent solution? How could I contribute? Yes. Besides offering a more modular image creation API, the vocation of (gnu system image) is to offer a way to generate all kind of Guix system images (raw disk-images, ISO9660 images, Qemu images) without resorting to VM for image creation. Dropping VM, means that the image need to be build on the host, without root permissions. This brings several limitations. If is no longer possible to use "mount" for instance, or to call "grub-install". To get around these limitations, I used the same strategy as Buildroot, Yocto and OpenWrt that do not require root permissions to generate disk-images. For ISO9660 images: * I first build the "image-root" derivation. It's a store directory that contains the root file-system. * Then, I call make-iso9660-image that, run GNU Xorriso on this directory. For raw disk-images: * For each partition, I build the "partition-image-root" derivation. This is very similar to "image-root" but for the specified partition. * For each partition root directory, I create the corresponding partition image, using tools such as mke2fs or mkdosfs depending on the partition file-system type. * Then, I need to "assemble" the partitions in a disk-image. For that, I use "genimage" that will roughly use 'dd' to create a final disk-image with the partitions copied at the right offsets. * The missing part here is the bootloader installation. As I mentioned, grub-install refuses to take a disk-image as argument (it requires a mounted partition). For EFI systems there's a work-around. The idea is to call grub-mkstandalone to create a Grub binary in the ESP partition. This Grub is configured to load the Grub configuration file located on the root file-system at /boot/grub/grub.cfg path. Now back to the Hurd. I see that Debian is producing Hurd ISO images. We could try to call `guix system disk-image --target=i586-pc-gnu --file-system-type=iso9660 hurd.scm` and see if it works. Regarding raw disk-image, I think we could try to produce EFI compatible Hurd images. We could set the bootloader to grub-efi-bootloader in %hurd-default-operating-system. Finally, to produce raw disk-images with grub-minimal-bootloader or grub-bootloader (what you are trying to do), we need to find a way to make grub-install work on disk-images (MBR installation and so on). That true for the Hurd but that's also true for Linux. Sorry for the long explanation. Please tell me if something is not clear. The conclusion here is that, I think that we very few adaptations to your branch, we should be able to produce Hurd ISO images or Hurd EFI compatible disk-images. Maybe it would be a first step. Then, we could find a way to create "MBR compatible" Hurd and Linux disk-images in (gnu system image). WDYT? Thanks, Mathieu