From mboxrd@z Thu Jan 1 00:00:00 1970 From: Steve Rae Date: Thu, 8 Jan 2015 13:23:01 -0800 Subject: [U-Boot] [PATCH] gpt: Fix the protective MBR partition size In-Reply-To: <1420716404-710-1-git-send-email-maxime.ripard@free-electrons.com> References: <1420716404-710-1-git-send-email-maxime.ripard@free-electrons.com> Message-ID: <54AEF535.2020405@broadcom.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de (+ Lukasz) Interesting - I'll defer to Lukasz... Thanks, Steve On 15-01-08 03:26 AM, Maxime Ripard wrote: > According to the UEFI Spec (Table 16, section 5.2.3 of the version 2.4 Errata > B), the protective MBR partition record size must be set to the size of the > disk minus one, in LBAs. > > However, the current code was setting the size as the total number of LBAs on > the disk, resulting in an off-by-one error. > > This confused the AM335x ROM code, and will probably confuse other tools as > well. > > Signed-off-by: Maxime Ripard > --- > disk/part_efi.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/disk/part_efi.c b/disk/part_efi.c > index 612f0926b62b..5ca17c138e96 100644 > --- a/disk/part_efi.c > +++ b/disk/part_efi.c > @@ -240,7 +240,7 @@ static int set_protective_mbr(block_dev_desc_t *dev_desc) > p_mbr->signature = MSDOS_MBR_SIGNATURE; > p_mbr->partition_record[0].sys_ind = EFI_PMBR_OSTYPE_EFI_GPT; > p_mbr->partition_record[0].start_sect = 1; > - p_mbr->partition_record[0].nr_sects = (u32) dev_desc->lba; > + p_mbr->partition_record[0].nr_sects = (u32) dev_desc->lba - 1; > > /* Write MBR sector to the MMC device */ > if (dev_desc->block_write(dev_desc->dev, 0, 1, p_mbr) != 1) { >