From 79363655e5dbc5253ae9b469be3c8c5e27bd15c4 Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Thu, 12 Jan 2017 19:32:11 +0100 Subject: [PATCH] kernel: Fix GPT detection a bit. Having a legacy MBR partition of type 0xef aka EFI system partition is a perfectly legal case, and it is covered by the UEFI specification too (in version 2.6, see section 12.3.1). That means it is not a sufficient indicator that this is a disk with a GPT, so don't automatically treat it as one. For the partition in the PMBR on actual GPT disks, type 0xee will always be used, so that check alone is sufficient for what is intended here. Background: Using legacy MBR and having an EFI system partition at the same time is the layout most USB installation media use in order to boot on both UEFI and legacy BIOS systems. The upcoming UEFI installation support work will do the same. --- sys/kern/subr_diskmbr.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/kern/subr_diskmbr.c b/sys/kern/subr_diskmbr.c index 54f582a960..c87cd60197 100644 --- a/sys/kern/subr_diskmbr.c +++ b/sys/kern/subr_diskmbr.c @@ -166,8 +166,7 @@ reread_mbr: * to GPT processing. */ for (dospart = 0, dp = dp0; dospart < NDOSPART; dospart++, dp++) { - if (dospart == 0 && - (dp->dp_typ == DOSPTYP_PMBR || dp->dp_typ == DOSPTYP_GPT)) { + if (dospart == 0 && dp->dp_typ == DOSPTYP_PMBR) { if (bootverbose) kprintf( "%s: Found GPT in slice #%d\n", sname, dospart + 1); -- 2.11.4.GIT