diff options
| author | Toomas Soome <tsoome@me.com> | 2019-11-15 21:18:31 +0200 |
|---|---|---|
| committer | Toomas Soome <tsoome@me.com> | 2020-01-17 08:43:17 +0200 |
| commit | 28a0ed2750bebd6af4595605f02abded76fbef18 (patch) | |
| tree | 474d189ad717257cc882aac26617504e7dbec723 /usr/src | |
| parent | 6dcdaa03d6dbb08e16fd2b10e01cceb9a729c050 (diff) | |
| download | illumos-joyent-28a0ed2750bebd6af4595605f02abded76fbef18.tar.gz | |
11974 loader: add support for hybrid PMBR for GPT partition table
Reviewed by: Robert Mustacchi <rm@fingolfin.org>
Approved by: Dan McDonald <danmcd@joyent.com>
Diffstat (limited to 'usr/src')
| -rw-r--r-- | usr/src/boot/Makefile.version | 2 | ||||
| -rw-r--r-- | usr/src/boot/sys/boot/common/part.c | 23 |
2 files changed, 10 insertions, 15 deletions
diff --git a/usr/src/boot/Makefile.version b/usr/src/boot/Makefile.version index 95c2115b2b..aea43f7797 100644 --- a/usr/src/boot/Makefile.version +++ b/usr/src/boot/Makefile.version @@ -33,4 +33,4 @@ LOADER_VERSION = 1.1 # Use date like formatting here, YYYY.MM.DD.XX, without leading zeroes. # The version is processed from left to right, the version number can only # be increased. -BOOT_VERSION = $(LOADER_VERSION)-2020.01.09.1 +BOOT_VERSION = $(LOADER_VERSION)-2020.01.15.1 diff --git a/usr/src/boot/sys/boot/common/part.c b/usr/src/boot/sys/boot/common/part.c index 23c3dce452..c2573d1d84 100644 --- a/usr/src/boot/sys/boot/common/part.c +++ b/usr/src/boot/sys/boot/common/part.c @@ -762,7 +762,7 @@ ptable_open(void *dev, uint64_t sectors, uint16_t sectorsize, diskread_t *dread) struct dos_partition *dp; struct ptable *table; uint8_t *buf; - int i, count; + int i; #ifdef LOADER_MBR_SUPPORT struct pentry *entry; uint32_t start, end; @@ -830,28 +830,23 @@ ptable_open(void *dev, uint64_t sectors, uint16_t sectorsize, diskread_t *dread) } /* Check that we have PMBR. Also do some validation. */ dp = (struct dos_partition *)(buf + DOSPARTOFF); - for (i = 0, count = 0; i < NDOSPART; i++) { + /* + * macOS can create PMBR partition in a hybrid MBR; that is, an MBR + * partition which has a DOSTYP_PMBR entry defined to start at sector 1. + * After the DOSTYP_PMBR, there may be other paritions. A UEFI + * compliant PMBR has no other partitions. + */ + for (i = 0; i < NDOSPART; i++) { if (dp[i].dp_flag != 0 && dp[i].dp_flag != 0x80) { DPRINTF("invalid partition flag %x", dp[i].dp_flag); goto out; } #ifdef LOADER_GPT_SUPPORT - if (dp[i].dp_typ == DOSPTYP_PMBR) { + if (dp[i].dp_typ == DOSPTYP_PMBR && dp[i].dp_start == 1) { table->type = PTABLE_GPT; DPRINTF("PMBR detected"); } #endif - if (dp[i].dp_typ != 0) - count++; - } - /* Do we have some invalid values? */ - if (table->type == PTABLE_GPT && count > 1) { - if (dp[1].dp_typ != DOSPTYP_HFS) { - table->type = PTABLE_NONE; - DPRINTF("Incorrect PMBR, ignore it"); - } else { - DPRINTF("Bootcamp detected"); - } } #ifdef LOADER_GPT_SUPPORT if (table->type == PTABLE_GPT) { |
