From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Thomas Schmitt" Subject: Re: ISO installer image: GPT versus MBR partitions Date: Sat, 20 Apr 2019 18:32:07 +0200 Message-ID: <426673079995361965@scdbackup.webframe.org> References: <20190420153357.xmrp6hgudipvlhxj@pelzflorian.localdomain> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([209.51.188.92]:33672) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hHt09-0001TI-3Z for guix-devel@gnu.org; Sat, 20 Apr 2019 12:38:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hHssG-00066o-Nr for guix-devel@gnu.org; Sat, 20 Apr 2019 12:29:58 -0400 In-Reply-To: <20190420153357.xmrp6hgudipvlhxj@pelzflorian.localdomain> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: bug-xorriso@gnu.org Cc: guix-devel@gnu.org Hi, Florian Pelz wrote: > mkfs.fat fatfs.img > sudo mount fatfs.img /mnt/img > sudo cp -r /mnt/efiimg/efi /mnt/img/ > Hooray! It boots! So it is indeed the filesystem hull, which is to blame. We still need to find out whether the partition entry is the culprit. So please do the experiment with the Guix EFI partition image in partition 2 of the USB stick and dd if=3D/dev/zero bs=3D1 count=3D16 seek=3D446 of=3D/dev/sdc2 The partition entry in the Guix EFI partition image has all the properties of the thing we are looking for: - Not in the FAT filesystem, but also not outside of it. - Plausible to be differently approached from USB stick and DVD. - Self referring enough for an endless inspection loop in EFI. > It uses mkfs.fat for creating FAT partitions, but maybe this > particular EFI partition is created by grub-mkrescue? Yes. http://git.savannah.gnu.org/cgit/grub.git/tree/util/grub-mkrescue.c#n812 has: rv =3D grub_util_exec ((const char * []) { "mformat", "-C", "-f", "2= 880", "-L", "16", "-i", efiimgfat, "::", NULL }); This run produces an image file with partition 1, starting at LBA 0. A remark below https://sources.debian.org/src/mtools/4.0.23-1/mformat.c/#L1373 says: /* install fake partition table pointing to itself */ (But why does grub-mkrescue.c create a 2.8 MB floppy where Guix has a 1.4 MB floppy image ? Does Guix use a patched version of grub-mkrescue ?) =2D-----------------------------------------------------------------------= --- Under the assumption that it is really the partition entry, i snooped ahea= d: mformat options -2 and -k can suppress the production of the partition entry. Option -2 is for some exotic floppy format from the 1990s. Option -k seems better, but if i use it, program "file" becomes sparing with words: $ file /u/test/mformat.fat /u/test/mformat.fat: DOS floppy 1440k $ It can be mounted by Linux and offers free space, though. More similar to the current FAT image hull is the result of dd if=3D/dev/zero bs=3D1 count=3D16 seek=3D446 of=3D/dev/sdc2 I actually did with a copy of partition 2: dd if=3D/dev/zero bs=3D1 count=3D16 seek=3D446 conv=3Dnotrunc of=3Dtest= .img and the report of "file" did not change. fdisk reports no partitions in test.img any more. Assuming that we cannot easily convince GRUB to use mformat -k or to switch to some other FAT creator, i currently ponder the opportunity to let my man-in-the-middle script do this dd patching of the EFI image before it gets copied into the ISO. =2D-----------------------------------------------------------------------= - Second correction of my statement about zapping the partition entry: i wrote: > The 16 bytes written to /dev/sdc1 would deface the GPT's "protective" MB= R > and thus make the GPT invalid. Wrong again. Because it is a grub-mkrescue ISO, it hit byte 446 ff of the ISO Primary Volume Descriptor. Funnily this is the place where xorriso placed its hallmark: XORRISO-1.5.0 2018... So the misplaced dd was effectively without effect. =2D-----------------------------------------------------------------------= - Have a nice day :) Thomas