Received: from list by lists.gnu.org with archive (Exim 4.71) id 1hICj4-0007K4-7C for mharc-grub-devel@gnu.org; Sun, 21 Apr 2019 09:41:46 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59496) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hICj1-0007Jw-Gb for grub-devel@gnu.org; Sun, 21 Apr 2019 09:41:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hICiz-0001Df-LU for grub-devel@gnu.org; Sun, 21 Apr 2019 09:41:43 -0400 Received: from mout.gmx.net ([212.227.17.20]:57799) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hICix-0001AD-RK for grub-devel@gnu.org; Sun, 21 Apr 2019 09:41:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1555854095; bh=B46xUcqD7n4hdXFbXNdt6Ry3B0ydKjnuuEmrWfkVkXY=; h=X-UI-Sender-Class:Date:From:To:Subject:Cc; b=AlsoL9vj4ODxzngbONTanp3r71YWZjUFnwh+vSljM+uElrum+Ti54cIt/Kjn171pm zo3gdSoLUeOvO/iePQhBGlxzYh78kIBSaDrbR+F7k1avXiC0dxsbQZMS7awFwZxOzm mGqrgbqCqCFPgNJC0PWbkv7b3fasz7WFNrA9bkDc= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from scdbackup.webframe.org ([79.222.46.132]) by mail.gmx.com (mrgmx102 [212.227.17.168]) with ESMTPSA (Nemesis) id 0MFz0E-1h4PE120ww-00EwQH; Sun, 21 Apr 2019 15:41:35 +0200 Date: Sun, 21 Apr 2019 15:43:52 +0200 From: "Thomas Schmitt" To: grub-devel@gnu.org Subject: grub-mkrescue: Problem with MBR partition table at start of EFI partition Content-Type: text/plain; charset="utf-8" Cc: Message-Id: <279296727497321002080@scdbackup.webframe.org> X-Provags-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j16GeOslaZHZfHZGDSQ crDN4tOZIidQShn9T+zLuFTUCLJHn/6KVfE3n/qraoaFDcC2vQmMzIALqp53sGBpgmcpIVnCR ZdDxiyYoV3fGw+E4uILWO/AMDgX/cZVOr9YPaEFaIJuVd6iVkuyFeHRDxghlb+JEvKoMtRP31 8rZAIb6AlAw== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.17.20 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, 21 Apr 2019 13:41:44 -0000 Hi, this is about how exactly to solve a diagnosed and worked-around problem. Guix is one of the few distros which make their installation ISOs by help of grub-mkrescue. The EFI boot manager of an old Macbook got stuck when such an ISO was presented on USB stick. I.e. it not only did not boot the ISO but showed no other EFI partitions either. A Debian Live 9 ISO does not impose such a problem. The same Guix ISO on DVD rather than USB stick works well, too. The owner of the machine is Florian Pelz (Cc'ed). He characterizes it as: MacBook Pro (13-inch, Mid 2010) MacOS Yosemite reports: Model Name: MacBook Pro Model Identifier: MacBookPro7,1 Boot ROM Version: MBP71.003F.B00 SMC Version (system): 1.62f7 During a longish bug hunt it turned out that the decisive difference is the first block of the FAT filesystem image which Debian creates by mkfs.fat whereas grub-mkrescue creates it by mformat. The mformat-made image has an MBR partition table entry which claims the whole image as partition 1: Device Boot Start End Sectors Size Id Type /mnt/iso/efi.img1 * 0 2879 2880 1.4M 1 FAT12 If this partition entry is zeroed, then the EFI boot manager works even when the USB stick with this modified ISO is plugged in. Actually it suffices to change the start LBA from 0 to 1, so that the partition does not start by the partition table. (I count this as proof of an endless loop in EFI while it is exploring something like extended partitions. Strange is that the main MBR partition 1 of the Debian ISO points to that main MBR, too. So it seems to harm only in sub partition tables. We repacked the Guix ISO to MBR rather than GPT. Still stuck.) The EFI FAT image in Debian Live 9 has no partition table entry in block 0. Production of the partition entry can be suppressed by mformat option -k. But then block 0 of the result is not marked as MBR and also causes program "file" to give out a very sparse characterization: DOS floppy 2880k Here is the "file" report about an image made without -k: DOS/MBR boot sector, code offset 0x3c+2, OEM-ID "MTOO4018", sectors/cluster 2, root entries 240, sectors 5760 (volumes <=32 MB) , sectors/FAT 9, sectors/track 36, serial number 0x6c528b1f, unlabeled, FAT (12 bit), followed by FAT An image made by a modified grub-mkrescue with mformat option -k worked well for Florian Pelz. --------------------------------------------------------------------------- Questions: 1: Is there any use for the partition entry in the EFI partition of a grub-mkrescue ISO ? 2: Is there any use for the information which mformat does not insert if option -k is set ? If the partition entry is not needed but the other MBR-like bytes are needed: 3: Is there a good example in GRUB util sources about how to open a file, seek to its byte 446, and write 16 zero bytes starting there ? (I'd like to propose a patch for grub-mkrescue.c which zeros the partition entry directly after the mformat run.) --------------------------------------------------------------------------- Have a nice day :) Thomas