summaryrefslogtreecommitdiff
path: root/sys/arch/i386
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2014-07-13 15:32:29 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2014-07-13 15:32:29 +0000
commit0fa720d98fcf9b047def908e44c201d604070625 (patch)
treec76b37e1f3d93ba79bbfc0c92000f57cf4e99c64 /sys/arch/i386
parent404419091445133a6cc8f6ce628deeabc100968f (diff)
Initial support to read GPT partition tables in the kernel, if option GPT.
Contributed by Markus Mueller; code based upon Bitrig's GPT support, with stricter GPT structures validation and support for alternate header places. ok deraadt@ jsing@ krw@
Diffstat (limited to 'sys/arch/i386')
-rw-r--r--sys/arch/i386/conf/GENERIC3
-rw-r--r--sys/arch/i386/i386/disksubr.c8
2 files changed, 9 insertions, 2 deletions
diff --git a/sys/arch/i386/conf/GENERIC b/sys/arch/i386/conf/GENERIC
index 87300279bb4..76556799dfb 100644
--- a/sys/arch/i386/conf/GENERIC
+++ b/sys/arch/i386/conf/GENERIC
@@ -1,4 +1,4 @@
-# $OpenBSD: GENERIC,v 1.780 2014/07/12 21:56:56 tedu Exp $
+# $OpenBSD: GENERIC,v 1.781 2014/07/13 15:32:28 miod Exp $
#
# For further information on compiling OpenBSD kernels, see the config(8)
# man page.
@@ -27,6 +27,7 @@ option MTRR # CPU memory range attributes control
option COMPAT_LINUX # binary compatibility with Linux
#option PROCFS # /proc, currently broken
+option GPT # GPT partition table support
option NTFS # NTFS support
option HIBERNATE # Hibernate support
diff --git a/sys/arch/i386/i386/disksubr.c b/sys/arch/i386/i386/disksubr.c
index 6da9f77a7bd..a8bf13d7bb0 100644
--- a/sys/arch/i386/i386/disksubr.c
+++ b/sys/arch/i386/i386/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.106 2014/06/15 11:43:24 sf Exp $ */
+/* $OpenBSD: disksubr.c,v 1.107 2014/07/13 15:32:28 miod Exp $ */
/* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */
/*
@@ -93,6 +93,12 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *),
bp = geteblk((int)lp->d_secsize);
bp->b_dev = dev;
+#if defined(GPT)
+ error = readgptlabel(bp, strat, lp, NULL, spoofonly);
+ if (error == 0)
+ goto done;
+#endif
+
error = readdoslabel(bp, strat, lp, NULL, spoofonly);
if (error == 0)
goto done;