-/* $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
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;
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))