summaryrefslogtreecommitdiff
path: root/disk
diff options
context:
space:
mode:
authorMaxime Ripard <maxime.ripard@free-electrons.com>2015-01-08 12:26:44 +0100
committerTom Rini <trini@ti.com>2015-01-08 11:00:45 -0500
commitb349abbfe95972ee7770d8ffef0eaf45cc84f419 (patch)
tree4f9e1e781ae9ad07fd977c449b6eef0b82253f22 /disk
parentb6b1b44586778885f37e1a2f2b17da7ddb04d565 (diff)
downloadu-boot-imx-b349abbfe95972ee7770d8ffef0eaf45cc84f419.zip
u-boot-imx-b349abbfe95972ee7770d8ffef0eaf45cc84f419.tar.gz
u-boot-imx-b349abbfe95972ee7770d8ffef0eaf45cc84f419.tar.bz2
gpt: Fix the protective MBR partition size
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 <maxime.ripard@free-electrons.com>
Diffstat (limited to 'disk')
-rw-r--r--disk/part_efi.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/disk/part_efi.c b/disk/part_efi.c
index 338010e..5856f93 100644
--- a/disk/part_efi.c
+++ b/disk/part_efi.c
@@ -342,7 +342,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) {