From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1hJZXp-0006WG-Lr for mharc-grub-devel@gnu.org; Thu, 25 Apr 2019 04:15:49 -0400 Received: from eggs.gnu.org ([209.51.188.92]:50692) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJZXm-0006SB-1N for grub-devel@gnu.org; Thu, 25 Apr 2019 04:15:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJZXk-0003Jy-3E for grub-devel@gnu.org; Thu, 25 Apr 2019 04:15:46 -0400 Received: from mout.gmx.net ([212.227.15.19]:42501) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hJZXj-0003Jg-Oc for grub-devel@gnu.org; Thu, 25 Apr 2019 04:15:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1556180141; bh=l9oi8Z7SDAeNevm+dCb7jZl0rnNzYpP8J2xjsDk5LUY=; h=X-UI-Sender-Class:Date:From:To:Subject:Cc:References:In-Reply-To; b=Jn5Suz5VWM3Mfl+KabHhgZMXMfll12H9bxIiQoj51g5o0DdmSZ6W3AiqsJ6k5Ymyc BWB5XSP6V5LNVlO1+ptVkgIxE0LTLhAJ4a9RdGknRJoopLxzIYtWMbfUUx/tfmOfJ9 zWrvV1gU16zCAOikohVncoiZWhcGbDHjCpsVfuLQ= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from scdbackup.webframe.org ([79.222.46.132]) by mail.gmx.com (mrgmx003 [212.227.17.190]) with ESMTPSA (Nemesis) id 0LnOve-1gsldr1z2s-00hfJ0; Thu, 25 Apr 2019 10:15:41 +0200 Date: Thu, 25 Apr 2019 10:18:08 +0200 From: "Thomas Schmitt" To: grub-devel@gnu.org Subject: Re: grub-mkrescue: Problem with MBR partition table at start of EFI partition Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Cc: References: <20190424203208.5kxbktos4daf2v6y@tomti.i.net-space.pl> In-Reply-To: <20190424203208.5kxbktos4daf2v6y@tomti.i.net-space.pl> Message-Id: <3163677660284636776@scdbackup.webframe.org> X-Provags-ID: V03:K1:Aax21JUhHFUA4ygZUZmgXLz3imkF77YhkAQykt2ZDEHdSvaXj3L jStAiQBe+57ztmtAWK9wBTgHQcnjDOHqFgDtjan54vsmer1+DZRmjDhA2PqSI1kUoC6PsYy J3zDj2IO7uAY7ICP51CiYSorzFTTLQyutIFCDCU5xXGhqCVZsVp1zbBJgLSWaulstja79mw 5807yQnHxYLORBZnGRTyQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:Zmv5mD5u+6g=:Tsj0eCiHtknEfwsOxTvHjq Y/EGMt+rabBC6RyS4IEp1OhP7IfFGcJgKVNmrYI9sEamlBvd/M3uS/xkAWhqoC/K0brb0XdLu MbQREOh3weue/qQc9teAWDsWp2o88UNXsgFusEOFEqFxpGGIPZHi66ECmmgZEKlxQ9FBlTYxx sFKabAkPHaVuikBUubKgx2kTpILcTHbcRY9Y/klx/onh+FqjCV46BcaoEm7KFHlFfax7k9maA mo3fVwl6vM7gBo2Hg/UYRkwF4GnvQwmgSOGVz3TBLOPgnXlqdtPX4HNgTv8f9tp9qQ1noPwaZ bGz5srPP03q9sIGk2vHsggR31HCs+LEp+8LAFsZ1+CXkS22RsIK0CN8jU43HXs8pqaYvkHT/z QLuoMncUWGolv+uSFean7I2f5+P1osno2HxKSHlBXmoJXlVdBevyJdcui4mh5uj5QD01hDRWw +BftGKBHuQjjfI7ES/XYCndCqodQ23s3BMbDp9+DC5bZGW6z+qNZFmoyQWGKaStDkI+4rYNEs 85pYoLe6nhD8BRg4O9ipSE+8LNTN+8c8PE0Wa4PK+l03HgEnbtYxKSYJs5TocJsQ3g2gNVnMU yEL8D3KGaoq+K3I7fqIq4jQkARprzo1BwiS5l1YkwcRxQH8jUcHH1ZAdprxqbrOitvQQk1+iB h6vkc5/WJzQjqx+d15SaqlejZLWfabJdoieB3Ohw41hXILKeV1nnSmYTv/DizpupoDZtMO1dl vTGdtISEIrihx4QedMw5nV9FxeKdqtknrDzbPS/wFdrtjXJRDr8EUeSrFOlnnedBADdhDRb7u RUl9xrbTKuJInsq+C8KZc7S1Cy9WOaa8/xDinka96k8cJH82i9Er+fWAMg39AVMAkP3LuJBUu +g8b+Okf8kH6662O7QzXRXBB3zhxIEnmbk6EdrEi2Ipv9OfWlF06M6tBG02lcSclgJLZ1tQu8 cRAiXQCDAAg== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.15.19 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Apr 2019 08:15:47 -0000 Hi, Daniel Kiper wrote: > How do you create USB stick from ISO image? By plain copy to the base device, as usual for a grub-mkrescue ISO. Like dd if=3Dimage of=3Dusb_stick > Have you tried latest Guix image? Florian builds Guix ISOs locally. So i assume that it was newest Guix. Nevertheless, the problem is clearly not in Guix content but in the Start LBA 0 of the partition table entry inside the EFI partition image. > Numbers here and in another email suggest that this is a floppy image. > And floppy images do not have MBR. They have something called boot > sector which is a bit different thing. Yes. It already has been pointed out to me privately that it should rather be called a "VBR". But EFI specs talk of "MBR" in the System Partition. So i am in good company. As mathematician i always agree to "If it walks like a duck ...". UEFI 2.4, 12.3.1 "System Partition" "A System Partition supports backward compatibility with legacy systems by reserving the first block (sector) of the partition for compatibilit= y code. On legacy systems, the first block (sector) of a partition is loaded into memory and execution is transferred to this code. EFI firmware does not execute the code in the MBR. The EFI firmware contains knowledge about the partition structure of various devices, and can understand legacy MBR, GPT, and =E2=80=9CEl Torito.=E2=80=9D" (The description of BIOS loading partition boot code is wrong. It is a class of device MBRs which contain code to chainload partition boot code. I guess, GRUB has such an MBR variant in its collection, too.) The last sentence might mean that EFI shall support extended MBR partition= s. I doubt that it is an invitation to support a tree of partition tables wit= h arbitrary tree width. I also doubt that the author had a mental relapse to the MBR of the device= , which is mentioned in the paragraph before the one above. "A System Partition is a partition in the conventional sense of a partition on a legacy system. For a hard disk, a partition is a contiguous grouping of sectors on the disk where the starting sector and size are defined by the Master Boot Record (MBR), which resides on LBA 0 (i.e., the first sector of the hard disk) (see Section 5.2), or the GUID Partition Table (GPT), which resides on logical block 1 (the second sector of the hard disk) (see Section 5.3.1). For a diskette (floppy) drive, a partition is defined to be the entire media. A System Partition can reside on any media that is supported by EFI Boot Services." > I have a feeling that simply Macs > tested by you does not like floppy images. If you create regular HDD > images then probably everything will work. It was grub-mkrescue which created that floppy image by mformat and submits it to xorriso as EFI partition. My questions were whether the partition entry is necessary (Vladimir expects that it is not), and whether an MBR signature and the other fields in block 0 are needed, which mformat creates without option -k (Vladimir's answer was less firm). I am now proposing to Guix to use my script-in-the middle https://dev.lovelyhq.com/libburnia/libisoburn/raw/master/frontend/grub-m= krescue-sed.sh which is submitted to grub-mkrescue by option --xorriso=3D. Its main purpose is to achieve other partition layouts with mountable ISO partition. Meanwhile it learned how to zeroize the partition table in the EFI partition and, if desired additionally, to zeroize the MBR signature of the partition. Be invited to try with a BIOS and EFI enabled GRUB configuration: wget https://dev.lovelyhq.com/libburnia/libisoburn/raw/master/frontend/g= rub-mkrescue-sed.sh chmod u+x grub-mkrescue-sed.sh export MKRESCUE_SED_MODE=3Dmbr_hfs export MKRESCUE_SED_IN_EFI_NO_PT=3Dyes grub-mkrescue --xorriso=3D./grub-mkrescue-sed.sh \ -iso_mbr_part_type 0x83 -partition_offset 16 \ ...your usual options to grub-mkrescue... ( export MKRESCUE_SED_DEBUG=3Dyes would let the script print input xorriso arguments and the arguments which it actually hands over to xorriso.) The result has this partition layout: $ /sbin/fdisk -l output.iso ... Disklabel type: dos ... Device Boot Start End Sectors Size Id Type output.iso1 * 64 28695 28632 14M 83 Linux output.iso2 28696 34455 5760 2.8M ef EFI (FAT-12/16/32) Advantages in my eyes are: - No GPT backup which will be misplaced on USB stick after dd. (Linux and partition editors complain.) - Mountable ISO partition with non-zero partition start for pleasing partition editors and being able to claim partition 2 as part of the filesystem range of the base device ISO: $ expr $(/sbin/isosize /dev/sdc) / 512 34456 $ expr $(/sbin/isosize /dev/sdc1) / 512 28632 This maintains the property of the original grub-mkrescue GPT layout, that an ISO image on a USB stick or DVD+RW still can tell its original size for checksumming. - It is supposed to boot on Florian's Macbook because of no partition tabl= e in the EFI partition. (I'm not sure whether Florian aready tested it. Our test results are from byte hacking experiments on a vanilla Guix ISO= .) Have a nice day :) Thomas