From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1hSjRU-0002XX-Vg for mharc-grub-devel@gnu.org; Mon, 20 May 2019 10:39:08 -0400 Received: from eggs.gnu.org ([209.51.188.92]:40179) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSjRR-0002VO-Bq for grub-devel@gnu.org; Mon, 20 May 2019 10:39:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hSjRP-0006NZ-SZ for grub-devel@gnu.org; Mon, 20 May 2019 10:39:05 -0400 Received: from mout.gmx.net ([212.227.17.22]:42757) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hSjRP-0006MM-Gf for grub-devel@gnu.org; Mon, 20 May 2019 10:39:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1558363140; bh=yp6QgWBXW07lyNyUP8VxcC8vjfuz1h68tLODHdK60rI=; h=X-UI-Sender-Class:Date:From:To:Subject:References:In-Reply-To; b=RIg8YHVDJx8xBMEF8QqJ2vejPTKTJJSNdXUNL0+g0LUsoGHBYM+eJd+XA9uTM75dm yzNml47rv959dRSr+JH3ev3T8OcMdK1jWV/lU2puwIlYIijrl66lV1fkSN/H8WRULa o41PHR9Ri9gdy1JvTfJLOc/HZOU2xb9DibUsQ0A4= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from scdbackup.webframe.org ([79.222.46.132]) by mail.gmx.com (mrgmx101 [212.227.17.168]) with ESMTPSA (Nemesis) id 0M6eTo-1ghLUG2LMy-00wRdK for ; Mon, 20 May 2019 16:39:00 +0200 Date: Mon, 20 May 2019 16:37:47 +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 References: <20190520123555.qvmguvdqygefujbz@tomti.i.net-space.pl> In-Reply-To: <20190520123555.qvmguvdqygefujbz@tomti.i.net-space.pl> Message-Id: <6703675778695817334@scdbackup.webframe.org> X-Provags-ID: V03:K1:6Lte6jinsBHoJgGxvEcEa/3oH8+Yhh1NqP7wepZbUkhSW99Bkw8 cAl7g5wVXFYr9Z5sr6Qwbb+RxiHlJ//eRLYB3Im9wF/0Ckat/Y/qT7Xl8A+9BINHvqaoctW 0xwvQ7eCO2ZfyQw0kzOCliUSGZzNo5GQWF9s9BK7pauqKrDcOe4sH6ZzGJmxhD9mFa9Brrz jkpdumeam67dgebK0f5kg== X-UI-Out-Filterresults: notjunk:1;V03:K0:oYoOULp7N+o=:6Gpm6xDG09U1oVFEqFeDoG niWxzTKKhT3kQ70OyPJSiuYwamsWwJGyizZY5Y0ciTuwttwvVhYsXXPtzcgrJouEVpX89xPqZ s4n+dl9K77sNxaBPJkbiYg844M3bQXKnxr3aNWtoxRhcTOeKpLKlekgrLnAJ6/GBqBVMyW/+F eFkEjsdGH1SK8rwDHZf3ky4rRhF6JMSbEYXAcjpGmlLvJ+g8Nkr/cw4dqbF1bsjUKUV483psg M9yuS08nAOP3iJaibADmrR+DmlQ2otayUSatYFMFbG3XMJDLUfCUKZEn5wGRO6I70HctITbUo wIYT35D70PcZaGLSNWdNt24y0P4CH6D4ppPe62LoXHgCY5XNu1cHZP9212auGEqoB547oYHe6 dfaWiCRltJMdeiSHYkuEcBPyInx2qubMwfWaceRB5m+5AE8nQPXH1aS5J8sPWxM5ZlzGSrzFU XMSND1mep62ku3KjCewc4dBKHXBZgSjZX6WKNSxa0flfm93g5r0RKmzIeTXDCITL4Hb/ZqnSP 2ZaxHWO1l4HrykZrIpt153Ah8FTwkgocfpt3urfAf+gcwzvorCR+B9VKlBU076FmiNtmxmFq/ h+eez3+T/XWn4JTOSAKmt2KFgW0AyTOqx1p0CUGKIHMEfa+POz6Dmob+Qa06SJreerxIl490K vMDzQT3E/L8hv2EZ2070iAqt2vkDJAKHQSsQlC3L47Fvfs6Df4EOPcUJ8Y2anNL6iPtpJzpGx ln1BG6VR+ZBO26yRi9Ewav46Cb6Zk0hEdXDPsqUjyhGxMqhyracim/e9GgHm3u9oBLCGeaYYi +gpCo6lmTdQZs5m0Abde1k2Egj0jzBONdoxMDkiOrmE5d2mBB66dPLYpmebwhwXnmq1tFg3nC cEwTDAsyo2f2lu9ZHx8yhaXWo5CZBcwUcj7XG1jIQbOu96UovpKfUJdqspADKQ/GhKnL+uAKC 9CpXvsUOTzSHUUKwxjieYmCDLVmlY4U7yLHACU9sgUjyfqlFRmFga X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.17.22 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: Mon, 20 May 2019 14:39:06 -0000 Hi, i wrote: > > So i propose the change as fine tuning of the original developer's > > intention. (Vladimir will correct me if i'm wrong.) Daniel Kiper wrote: > After some thinking I have an itching to add the "-k" option to the > mformat. I am not courageous enough to go that far. > So, I would suggest to make this as a known issue and fix > it after the release. Does it make sense? Sure. There is a workaround, after all. > > https://savannah.gnu.org/users/alainknaff > > Maybe he still can remember why he added the partition entry. > Could you ask him about that? Please keep grub-devel in the loop. Will do. > > I was not happy with Vladimir's decision to use GPT instead of MBR par= tition > > table. (Because of non-mountable partitions and the GPT backup, which = needs > > to be relocated after copying the ISO onto USB stick.) > I am not sure I understand. Which GPT do you refer to? The GPT in the grub-mkrescue ISO, which xorriso creates according to the options sent from grub-mkrescue. An ISO made by grub-mkrescue on Debian with "i386-efi", "i386-pc", and "x86_64-efi" in /usr/lib/grub gets this partition table $ /sbin/fdisk -l output.iso ... Disklabel type: gpt Disk identifier: 8E0B9F07-AB1F-4B0B-BA12-764F83FF76EC Device Start End Sectors Size Type output.iso1 64 339 276 138K Microsoft basic data output.iso2 340 6099 5760 2.8M EFI System output.iso3 6100 34131 28032 13.7M Apple HFS/HFS+ output.iso4 34132 34731 600 300K Microsoft basic data Partitions 1 and 4 are fillers. Not mountable. Whether partition 3 is mountable depends on the kernel's capability to work with HFS+ block size 2048. It is supposed show a HFS+ version of the ISO's file tree. But i am not sure whether this was ever challanged. The ISO is only mountable via the base device (start 0). The fillers are necessary because the EFI partition image is a file inside the ISO filesystem. Number 1 protects vital parts of the ISO from being claimed by user-made partitions. Number 4 protects cargo cult padding to prevent the TAO CD Linux read-ahead bug caused by ambiguous specs for SCSI command READ CAPACITY ... whew, without breathing. I prefer this layout Disklabel type: dos Disk identifier: 0x00000000 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) It gets achieved by export MKRESCUE_SED_MODE=3Dmbr_hfs grub-mkrescue --xorriso=3D./grub-mkrescue-sed.sh -o output.iso minimal \ -partition_offset 16 -iso_mbr_part_type 0x83 where "minimal" is a dummy directory with a dummy file. The pseudo-xorriso moves the EFI image out of the GRUB-prepared tree (e.g. /tmp/grub.Q98DOe) and replaces the xorrisofs options for EFI-in-ISO and GPT by options for EFI-appended and MBR partition table. The options in the second line get forwarded by grub-mkrescue as xorrisofs options. Partition 1 is mountable as ISO 9660 filesystem. This run produces HFS+ and Apple Partition Map. The HFS+ range is not represented in the MBR partition table, because it is inside the ISO range= . =2D--------------------------------------------------------------------- History and motivation: Back in 2012, xorriso offered no way to put an El Torito image outside the ISO filesystem's range. So the choice was to have two EFI images or to have the EFI partition inside the ISO's data file range. I am not aware how much Vladimir considered the duplication. His wishes were for the EFI partition inside the ISO. Since a while, xorriso can point by an El Torito catalog entry to an appended partition. So the EFI image can be stored outside the ISO's claimed range and a mountable ISO partition does not have to overlap with the EFI partition. There remains the problem that tools inquire the ISO's claimed size to determine the size of the overall ISO+EFI image, but the partition's filesystem must not claim more than the partition's size. Other tools hate the start LBA 0 of the mountable ISO partition. Both can be solved at the cost of a second ISO superblock and directory tree which match a partition start at 64 * 512 bytes. That's the job of -partition_offset 16 It creates an ISO superblock for the whole device, which claims the whole ISO+EFI image as its range. The second superblock claims only the ISO partition as its range. We had an example of an EFI implementation, which hated any MBR partition table type except 0x00 and 0xef. So grub-mkrescue-sed.sh uses type 0x00 by default. Nevertheless, for the purpose of grub-mkrescue plus data partition on a USB stick, it is better to have a non-zero MBR partition type. So my above example uses -iso_mbr_part_type 0x83 =2D--------------------------------------------------------------------- Have a nice day :) Thomas