Received: from list by lists.gnu.org with archive (Exim 4.71) id 1hXMNj-0001my-0L for mharc-grub-devel@gnu.org; Sun, 02 Jun 2019 05:02:23 -0400 Received: from eggs.gnu.org ([209.51.188.92]:37107) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hXKXA-0001hr-M9 for grub-devel@gnu.org; Sun, 02 Jun 2019 03:04:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hXKX8-0005OW-Og for grub-devel@gnu.org; Sun, 02 Jun 2019 03:04:00 -0400 Received: from lucifer.abilit.eu ([85.93.218.208]:47562 helo=lll.lu) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hXKX6-0005GU-57 for grub-devel@gnu.org; Sun, 02 Jun 2019 03:03:56 -0400 Received: from [192.168.178.21] ([85.93.194.142]) (authenticated bits=0) by lll.lu (8.15.2/8.15.2/Debian-8) with ESMTPSA id x5273gdb001813 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 2 Jun 2019 09:03:42 +0200 Subject: Re: Several GNU projects wondering about the reason for mformat partition table To: Thomas Schmitt Cc: grub-devel@gnu.org References: <2969675803234862362@scdbackup.webframe.org> From: Alain Knaff Openpgp: preference=signencrypt Autocrypt: addr=alain@knaff.lu; prefer-encrypt=mutual; keydata= mQGiBEk9qFcRBADO4trPtib39qvAEBlkAIcBGnZ137EmmNLU1pFZC5acLyJ4wYhVdcol97lC 4ZkD0DJek6DVidQfz4hA7JbZy2W8l6O/o2k/Ja2bWkb8qtrcUNVDJzdJjNqXmmxdsyLd5QVt uCHgi3Zz0kq9aJnRCVuAyfrjMdaUsOThi07u1EyEywCgjxVKODAifumqfdjVxS5NoV7x7TkD /0k2F3/5/NYchgLz6Qu3As5MVtPs7NkJ0Mpal4Gy8CaKefHcynY+zCziM/oBw0+PIFxyFud0 uT9HRIdEp1DlaTTU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cQvIdYxO0VUN3wVSEIbRHcNzG2u1UD6ZuF+3bv39dh54m1CQzbzzRepiEkE GBECAAkFAkk9qFoCGwwACgkQyAYxsm9DGWHNLwCfWr4DLrBZMktv9RTGbcIZ+/NgTswAn3aG LBuTFPDEO0bfA+7PlpCctCJT Message-ID: Date: Sun, 2 Jun 2019 09:03:44 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <2969675803234862362@scdbackup.webframe.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 85.93.218.208 X-Mailman-Approved-At: Sun, 02 Jun 2019 05:02:21 -0400 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: Sun, 02 Jun 2019 07:04:02 -0000 Hi, On 20/05/2019 18:52, Thomas Schmitt wrote: > Hi, > > in the course of a problem search between GRUB, Guix, and xorriso we found > the trigger of a problem with some old Macbook EFI firmware in a gesture > of mformat. > Line 1375 of > http://svn.savannah.gnu.org/viewvc/mtools/trunk/mformat.c?revision=506&view=markup > has > > /* install fake partition table pointing to itself */ > > Now we are wondering for which use case there is this MBR partition table > entry starting with LBA 0 and claiming the whole device. > > The SVN at savannah shows that this gesture was introduced with revision 4 > in may 2002 by "aknaff". My hope is that this was you and that you can tell > grub-devel (Cc'ed) more about the motivation. > This was indeed me. As far as I remember this was indeed intended as a convenience when moving removable disks (Zip, Jaz or similar) from platforms that expect the device to be partitions to platforms that expect it to be unpartitioned. A platform that expects the disk to be unpartitioned would just ignore this mini partition table. A platform that expects the disk to be partitioned would see this partition table, follow the "link" to the first partition, and then again fall on the same sector and continue. > --------------------------------------------------------------------------- > In case you are curious about the motivation of this mail: > > Our particular use case is to create a FAT filesystem image for use as EFI > system partition in ISO 9660 images on USB sticks. > grub-mkrescue runs mformat to create this image and then uses mcopy to > populate it with EFI start programs. See > http://git.savannah.gnu.org/cgit/grub.git/tree/util/grub-mkrescue.c#n812 > > The partition entry with start LBA 0 caused the EFI firmware to get stuck, > probably looping endlessly. Experiments with dd reveiled that the partition > entry was to blame, and in it the start LBA 0. > > This is clearly a firmware bug and obviously fixed in later models of > Macbooks. Nevertheless we care for old oddball hardware. > > So the question is which of these alternatives to choose: > > - Keep the partition entry because its removal could break some other > EFI firmware's boot process. > > - Overwrite the partition table in bytes 446 to 509 of the mformat result > by zeros before populating it with files. > > - Use mformat option -k to avoid production of the partition table. > > I personally have scruples to omit the other fields which get written > if option -k is not present. Is there anything written with (!keepBoot) > which we need for a vanilla FAT filesystem to be recognizable or usable ? In the next release I'll provide a new option to just skip this partition table, but still initialize the other fields (jump at beginning of boot sector, mformat "banner", 0xaa55 boot signature, physdrive, mtools boot code, zeroing out unused bytes) If all goes well, I expect to make this new release by the end of the month > > --------------------------------------------------------------------------- > > Have a nice day :) > > Thomas > Thanks, same to you. Alain