From 90fd259afd781d6e1e27abcb697fd5316b885bf0 Mon Sep 17 00:00:00 2001 From: ae Date: Mon, 31 Mar 2014 09:37:11 +0000 Subject: [PATCH] MFC r263468: When loader(8) inspects MBR, it chooses GPT as main partition table, when MBR contains only PMBR entry or it is bootcamp-compatible. If MBR has PMBR entry and some other, the loader rejects it. Make these checks to be less strict. If loader decided that PMBR isn't suitable for GPT, it will use MBR. Reported by: Paul Thornton git-svn-id: svn://svn.freebsd.org/base/stable/9@263965 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/boot/common/part.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/sys/boot/common/part.c b/sys/boot/common/part.c index d37eee52c..55153aa4d 100644 --- a/sys/boot/common/part.c +++ b/sys/boot/common/part.c @@ -634,7 +634,7 @@ ptable_open(void *dev, off_t sectors, uint16_t sectorsize, for (i = 0, count = 0; i < NDOSPART; i++) { if (dp[i].dp_flag != 0 && dp[i].dp_flag != 0x80) { DEBUG("invalid partition flag %x", dp[i].dp_flag); - break; + goto out; } #ifdef LOADER_GPT_SUPPORT if (dp[i].dp_typ == DOSPTYP_PMBR) { @@ -646,15 +646,12 @@ ptable_open(void *dev, off_t sectors, uint16_t sectorsize, count++; } /* Do we have some invalid values? */ - if (i != NDOSPART || - (table->type == PTABLE_GPT && count > 1)) { + if (table->type == PTABLE_GPT && count > 1) { if (dp[1].dp_typ != DOSPTYP_HFS) { table->type = PTABLE_NONE; - DEBUG("invalid values detected, ignore " - "partition table"); - goto out; - } - DEBUG("Bootcamp detected"); + DEBUG("Incorrect PMBR, ignore it"); + } else + DEBUG("Bootcamp detected"); } #ifdef LOADER_GPT_SUPPORT if (table->type == PTABLE_GPT) { -- 2.45.0