summaryrefslogtreecommitdiffstats
path: root/sbin/newfs_msdos
diff options
context:
space:
mode:
authortrhodes <trhodes@FreeBSD.org>2007-05-31 20:06:46 +0000
committertrhodes <trhodes@FreeBSD.org>2007-05-31 20:06:46 +0000
commit53cf3b5f4aea6ec96d6a88fc3ad206f03efedcab (patch)
tree501d9837cd3cf9e7140275f64d03b68eaf4b10cf /sbin/newfs_msdos
parentd0c5d82ee372bf7702877156c3e1a1076cb3c194 (diff)
downloadFreeBSD-src-53cf3b5f4aea6ec96d6a88fc3ad206f03efedcab.zip
FreeBSD-src-53cf3b5f4aea6ec96d6a88fc3ad206f03efedcab.tar.gz
The newfs_msdos utility does not store the boot signature in the
correct place on large sector disks. The boot signature should be at offset 0x1fe in the BPB; newfs_msdos currently stores it 2 bytes from the end of the sector. Taken from: NetBSD
Diffstat (limited to 'sbin/newfs_msdos')
-rw-r--r--sbin/newfs_msdos/newfs_msdos.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sbin/newfs_msdos/newfs_msdos.c b/sbin/newfs_msdos/newfs_msdos.c
index b645fb7..1c23b24 100644
--- a/sbin/newfs_msdos/newfs_msdos.c
+++ b/sbin/newfs_msdos/newfs_msdos.c
@@ -54,7 +54,7 @@ static const char rcsid[] =
#define NPB 2 /* nibbles per byte */
#define DOSMAGIC 0xaa55 /* DOS magic number */
-#define MINBPS 128 /* minimum bytes per sector */
+#define MINBPS 512 /* minimum bytes per sector */
#define MAXSPC 128 /* maximum sectors per cluster */
#define MAXNFT 16 /* maximum number of FATs */
#define DEFBLK 4096 /* default block size */
@@ -623,17 +623,17 @@ main(int argc, char *argv[])
setstr(bs->oem, opt_O ? opt_O : "BSD 4.4",
sizeof(bs->oem));
memcpy(img + x1, bootcode, sizeof(bootcode));
- mk2(img + bpb.bps - 2, DOSMAGIC);
+ mk2(img + MINBPS - 2, DOSMAGIC);
}
} else if (fat == 32 && bpb.infs != MAXU16 &&
(lsn == bpb.infs ||
(bpb.bkbs != MAXU16 &&
lsn == bpb.bkbs + bpb.infs))) {
mk4(img, 0x41615252);
- mk4(img + bpb.bps - 28, 0x61417272);
- mk4(img + bpb.bps - 24, 0xffffffff);
- mk4(img + bpb.bps - 20, bpb.rdcl);
- mk2(img + bpb.bps - 2, DOSMAGIC);
+ mk4(img + MINBPS - 28, 0x61417272);
+ mk4(img + MINBPS - 24, 0xffffffff);
+ mk4(img + MINBPS - 20, bpb.rdcl);
+ mk2(img + MINBPS - 2, DOSMAGIC);
} else if (lsn >= bpb.res && lsn < dir &&
!((lsn - bpb.res) %
(bpb.spf ? bpb.spf : bpb.bspf))) {
OpenPOWER on IntegriCloud