From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: redhat.com, ip: 209.132.183.28, mailfrom: lersek@redhat.com) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by groups.io with SMTP; Wed, 24 Apr 2019 11:11:25 -0700 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C5E7BD4784; Wed, 24 Apr 2019 18:11:24 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-123.rdu2.redhat.com [10.10.120.123]) by smtp.corp.redhat.com (Postfix) with ESMTP id E4D2417CEF; Wed, 24 Apr 2019 18:11:23 +0000 (UTC) Subject: Re: [edk2-devel] Question about the Protective MBR in RedHat/Ubuntu To: "Xu, Wei6" Cc: "devel@edk2.groups.io" , "Kinney, Michael D" References: <59B8EAB3797CDB4091332F0685A110ED50D6B722@SHSMSX104.ccr.corp.intel.com> From: "Laszlo Ersek" Message-ID: <5cb3f755-6485-fe4f-26a7-6a60f43dcb4a@redhat.com> Date: Wed, 24 Apr 2019 20:11:22 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <59B8EAB3797CDB4091332F0685A110ED50D6B722@SHSMSX104.ccr.corp.intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 24 Apr 2019 18:11:24 +0000 (UTC) Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit On 04/24/19 13:36, Xu, Wei6 wrote: > Hi, > > I have a question about protective MBR. Thanks a lot for your time. > Why is the StartingCHS of protective MBR partition record set to 0x000100 in RedHat / Ubuntu? While UEFI spec defines it as 0x000200. > > Problem Statement: > I met a problem when trying to use FatPei to fetch a file on the GPT partition of RedHat/Ubuntu in TCB. > FatPei has a check about Partition Record of protective MBR: StartingCHS should to 0x000200. > But I find the StartingCHS in both RedHat and Ubuntu is 0x000100, so that the check fails. > > According to UEFI spec, StartingCHS should be 0x000200. > > [cid:image001.png@01D4FACC.71570DF0] > Anaconda (the RHEL & Fedora installer) uses GNU Parted for creating GPT partitions. This utility creates the protective MBR as well. GNU Parted used to have a bug in setting the sector in "StartingCHS" -- in C/H/S, sectors are 1-based, not 0-based. The problem was fixed in upstream parted commit df6770d213b6 ("libparted: Fix starting CHS in protective MBR", 2016-12-22): http://git.savannah.gnu.org/cgit/parted.git/commit/?id=df6770d213b6 As far as I can determine, this fix has been included in Fedora 27 and later. (The oldest supported Fedora release at this point is Fedora 28, so I think we can consider "Fedora" fixed.) The fix is also included in RHEL-8.0. RHEL-7.7 however lacks the fix (as of build "parted-3.1-31.el7"). I've now filed a Red Hat Bugzilla for you: https://bugzilla.redhat.com/show_bug.cgi?id=1702778 Please register in the Red Hat Bugzilla instance, subscribe to the bug, and assist with testing the fix, if the BZ assignee requests that. Thank you for reporting this issue, Laszlo