summaryrefslogtreecommitdiff
path: root/sbin/fdisk
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2021-11-25 15:40:27 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2021-11-25 15:40:27 +0000
commit0309112dda4dc4528165e0e27ac8f218b2295c69 (patch)
tree1d52df517921bba7baf1de82663bfc63916eecae /sbin/fdisk
parent299d2dc9db84094c2e8352f8162732716d517d1b (diff)
Honour /usr/mdec/mbr or -f partition 0 information even outside
of _powerpc__ and __mips__, preventing the possible creation of MBRs with overlapping partitions 0 and 3. Don't set bootprt DOSACTIVE flag if no partition 0 information was provided via /usr/mdec/mbr or -f. Lets octeon fdisk(8) set DOSACTIVE on the OpenBSD partition in the default MBR like every other fdisk(8) does.
Diffstat (limited to 'sbin/fdisk')
-rw-r--r--sbin/fdisk/mbr.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/sbin/fdisk/mbr.c b/sbin/fdisk/mbr.c
index 251bf8d6158..67b2eda71df 100644
--- a/sbin/fdisk/mbr.c
+++ b/sbin/fdisk/mbr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mbr.c,v 1.110 2021/11/20 21:35:52 krw Exp $ */
+/* $OpenBSD: mbr.c,v 1.111 2021/11/25 15:40:26 krw Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
@@ -66,17 +66,15 @@ MBR_init(struct mbr *mbr)
memcpy(&dp, &default_dmbr.dmbr_parts[0], sizeof(dp));
PRT_parse(&dp, 0, 0, &bootprt);
- /* Reserve first track, or first cyl, if possible. */
- if (disk.dk_heads > 1 || disk.dk_cylinders > 1)
+ if (bootprt.prt_ns > 0)
+ obsdprt.prt_bs = bootprt.prt_bs + bootprt.prt_ns;
+ else if (disk.dk_heads > 1 || disk.dk_cylinders > 1)
obsdprt.prt_bs = disk.dk_sectors;
else
obsdprt.prt_bs = 1;
#if defined(__powerpc__) || defined(__mips__)
/* Now fix up for the MS-DOS boot partition on PowerPC/MIPS. */
- bootprt.prt_flag = DOSACTIVE; /* Boot from dos part */
- if (bootprt.prt_ns > 0)
- obsdprt.prt_bs = bootprt.prt_bs + bootprt.prt_ns;
if (obsdprt.prt_bs % spc != 0)
obsdprt.prt_bs += spc - (obsdprt.prt_bs % spc);
#else