summaryrefslogtreecommitdiffstats
path: root/sys/boot
diff options
context:
space:
mode:
authorae <ae@FreeBSD.org>2016-01-10 13:53:57 +0000
committerae <ae@FreeBSD.org>2016-01-10 13:53:57 +0000
commit09204e767089d0d9f6f376551f8c1b9a2eade3ee (patch)
tree51330d250c62d20d1fbc444485aa78943e7ce23d /sys/boot
parentfdecbaeff59263df5ae9b87a90264a9eebdec0a3 (diff)
downloadFreeBSD-src-09204e767089d0d9f6f376551f8c1b9a2eade3ee.zip
FreeBSD-src-09204e767089d0d9f6f376551f8c1b9a2eade3ee.tar.gz
MFC r292057:
Make detection of GPT a bit more reliable. When we are detecting a partition table and didn't find PMBR, try to read backup GPT header from the last sector and if it is correct, assume that we have GPT. Differential Revision: https://reviews.freebsd.org/D4282 MFC r292058: Remove a note about damaged PMBR. Now GPT will be detected automatically with such corruption. Relnotes: yes
Diffstat (limited to 'sys/boot')
-rw-r--r--sys/boot/common/part.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/boot/common/part.c b/sys/boot/common/part.c
index 4457619..518df1a 100644
--- a/sys/boot/common/part.c
+++ b/sys/boot/common/part.c
@@ -306,6 +306,7 @@ ptable_gptread(struct ptable *table, void *dev, diskread_t dread)
table->type = PTABLE_NONE;
goto out;
}
+ DEBUG("GPT detected");
size = MIN(hdr.hdr_entries * hdr.hdr_entsz,
MAXTBLSZ * table->sectorsize);
for (i = 0; i < size / hdr.hdr_entsz; i++) {
@@ -631,6 +632,11 @@ ptable_open(void *dev, off_t sectors, uint16_t sectorsize,
if (buf[DOSMAGICOFFSET] != 0x55 ||
buf[DOSMAGICOFFSET + 1] != 0xaa) {
DEBUG("magic sequence not found");
+#if defined(LOADER_GPT_SUPPORT)
+ /* There is no PMBR, check that we have backup GPT */
+ table->type = PTABLE_GPT;
+ table = ptable_gptread(table, dev, dread);
+#endif
goto out;
}
/* Check that we have PMBR. Also do some validation. */
OpenPOWER on IntegriCloud