summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2008-06-25 15:26:45 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2008-06-25 15:26:45 +0000
commite8081b48c75a0706b31e6d542ae4a6476fab5ce2 (patch)
treefa0c25e24ebdfb4956aba1541e71e1633f11290f /sys/kern
parentb5284be880007f164a2487415ab161a259150927 (diff)
allow to install and boot the OpenBSD A6 partition and disklabel in an
extended DOS partition. the concept of extended partitions is very simple, it is just another mbr at the partition offset (well, the standard "EBR" is a linked list with a few limitations, but this diff works with both variants). this diff has been in the snapshots for a while. with input from weingart@ and krw@ ok deraadt@
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/subr_disk.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/sys/kern/subr_disk.c b/sys/kern/subr_disk.c
index e3d80ae69ff..186ff615e10 100644
--- a/sys/kern/subr_disk.c
+++ b/sys/kern/subr_disk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_disk.c,v 1.78 2008/06/12 06:58:39 deraadt Exp $ */
+/* $OpenBSD: subr_disk.c,v 1.79 2008/06/25 15:26:43 reyk Exp $ */
/* $NetBSD: subr_disk.c,v 1.17 1996/03/16 23:17:08 christos Exp $ */
/*
@@ -409,7 +409,7 @@ readdoslabel(struct buf *bp, void (*strat)(struct buf *),
bcopy(bp->b_data + DOSPARTOFF, dp, sizeof(dp));
- if (ourpart == -1 && part_blkno == DOSBBSECTOR) {
+ if (ourpart == -1) {
/* Search for our MBR partition */
for (dp2=dp, i=0; i < NDOSPART && ourpart == -1;
i++, dp2++)
@@ -454,11 +454,6 @@ donot:
continue;
if (letoh32(dp2->dp_size) == 0)
continue;
- if (letoh32(dp2->dp_start))
- DL_SETPOFFSET(pp,
- letoh32(dp2->dp_start) + part_blkno);
-
- DL_SETPSIZE(pp, letoh32(dp2->dp_size));
switch (dp2->dp_typ) {
case DOSPTYP_UNUSED:
@@ -499,6 +494,19 @@ donot:
n++;
break;
}
+
+ /*
+ * There is no need to set the offset/size when
+ * wandering; it would also invalidate the
+ * disklabel checksum.
+ */
+ if (wander)
+ continue;
+
+ if (letoh32(dp2->dp_start))
+ DL_SETPOFFSET(pp,
+ letoh32(dp2->dp_start) + part_blkno);
+ DL_SETPSIZE(pp, letoh32(dp2->dp_size));
}
}
lp->d_npartitions = MAXPARTITIONS;