diff options
Diffstat (limited to 'sbin/fdisk/mbr.c')
-rw-r--r-- | sbin/fdisk/mbr.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/sbin/fdisk/mbr.c b/sbin/fdisk/mbr.c index 67b2eda71df..ac911074f5c 100644 --- a/sbin/fdisk/mbr.c +++ b/sbin/fdisk/mbr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mbr.c,v 1.111 2021/11/25 15:40:26 krw Exp $ */ +/* $OpenBSD: mbr.c,v 1.112 2021/12/01 22:37:30 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -63,8 +63,12 @@ MBR_init(struct mbr *mbr) memset(&bootprt, 0, sizeof(bootprt)); disksz = disk.dk_cylinders * spc; /* Use only complete cylinders. */ - memcpy(&dp, &default_dmbr.dmbr_parts[0], sizeof(dp)); - PRT_parse(&dp, 0, 0, &bootprt); + if (disk.dk_bootprt.prt_ns > 0) { + bootprt = disk.dk_bootprt; + } else { + memcpy(&dp, &default_dmbr.dmbr_parts[0], sizeof(dp)); + PRT_parse(&dp, 0, 0, &bootprt); + } if (bootprt.prt_ns > 0) obsdprt.prt_bs = bootprt.prt_bs + bootprt.prt_ns; @@ -73,17 +77,6 @@ MBR_init(struct mbr *mbr) else obsdprt.prt_bs = 1; -#if defined(__powerpc__) || defined(__mips__) - /* Now fix up for the MS-DOS boot partition on PowerPC/MIPS. */ - if (obsdprt.prt_bs % spc != 0) - obsdprt.prt_bs += spc - (obsdprt.prt_bs % spc); -#else - if (disk.dk_bootprt.prt_ns > 0) { - bootprt = disk.dk_bootprt; - obsdprt.prt_bs = bootprt.prt_bs + bootprt.prt_ns; - } -#endif - /* Start OpenBSD MBR partition on a power of 2 block number. */ daddr = 1; while (daddr < DL_SECTOBLK(&dl, obsdprt.prt_bs)) |