From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id SMyUC9o4xV4iDAAA0tVLHw (envelope-from ) for ; Wed, 20 May 2020 14:04:10 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id OFOQB9o4xV5BKwAA1q6Kng (envelope-from ) for ; Wed, 20 May 2020 14:04:10 +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 3DE0994038E for ; Wed, 20 May 2020 14:04:09 +0000 (UTC) Received: from localhost ([::1]:50588 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbPKI-0005lk-WF for larch@yhetil.org; Wed, 20 May 2020 10:04:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54614) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbPKE-0005l4-Pd for guix-patches@gnu.org; Wed, 20 May 2020 10:04:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:42301) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jbPKE-0001D6-Eu for guix-patches@gnu.org; Wed, 20 May 2020 10:04:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jbPKE-00028S-7h for guix-patches@gnu.org; Wed, 20 May 2020 10:04: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: Wed, 20 May 2020 14:04:02 +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.15899834328192 (code B ref 41350); Wed, 20 May 2020 14:04:02 +0000 Received: (at 41350) by debbugs.gnu.org; 20 May 2020 14:03:52 +0000 Received: from localhost ([127.0.0.1]:53847 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jbPK4-000284-5x for submit@debbugs.gnu.org; Wed, 20 May 2020 10:03:52 -0400 Received: from eggs.gnu.org ([209.51.188.92]:47180) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jbPK2-00027q-UM for 41350@debbugs.gnu.org; Wed, 20 May 2020 10:03:51 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:49598) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbPJw-00016h-IN; Wed, 20 May 2020 10:03:45 -0400 Received: from [2a01:e0a:fa:a50:5d6:6d3d:8a6c:226b] (port=48738 helo=meru) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jbPJv-0007A3-EB; Wed, 20 May 2020 10:03:44 -0400 From: Mathieu Othacehe References: <87mu66q3rt.fsf@gnu.org> <87y2ppfw28.fsf@gnu.org> <87367wbd82.fsf@gnu.org> <874ksctf85.fsf@gnu.org> Date: Wed, 20 May 2020 16:03:41 +0200 In-Reply-To: <874ksctf85.fsf@gnu.org> (Mathieu Othacehe's message of "Tue, 19 May 2020 12:02:18 +0200") Message-ID: <87blmivh36.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: V+1fL8R93NRU Hey, > 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). Ok, I made further progress. Turns out the Hurd EFI solution was a dead-end, because I have a "no console will be available to os" message in Qemu, instead of Hurd console output. I don't feel like debugging this. So, back to the MBR solution. I had another look to what OpenWrt is doing. They found a really nice work-around! As I stated, we cannot use "grub-install", but this command is in reality a wrapper around "grub-mkimage" and "grub-bios-setup". --8<---------------cut here---------------start------------->8--- ####################################### # # # # # MBR # MBR-GAP # FIRST PARTITION # # # # # ####################################### --8<---------------cut here---------------end--------------->8--- grub-mkimage generates a Grub image, small enough so that it can fit in the MBR-GAP (the space between the MBR and the first partition). It cannot contain all Grub modules, but that's not an issue, because Grub will be able to find missing modules from the first partition when started. They also patched grub-bios-setup[1] so that it can work on a raw disk-image, and install the previously generated "grub.img". So with the following commands: --8<---------------cut here---------------start------------->8--- grub-mkimage -O i386-pc -o core.img biosdisk part_msdos ext2 echo "(hd0) /tmp/my-disk-image" > device.map grub-bios-setup -m device.map -r "hd0,msdos1" -d tmp /tmp/qemu-image2 --8<---------------cut here---------------end--------------->8--- I'm able to make a Guix system image bootable, without root permissions. It then starts the Hurd kernel and crashes, but that's another story :p So, if it's ok for you, I can integrate this stuff cleanly, and we won't need the vm-image stuff anymore. WDYT? Thanks, Mathieu [1]: https://github.com/openwrt/openwrt/blob/master/package/boot/grub2/patches/100-grub_setup_root.patch