Subject: CVS commit: src
To: None <source-changes@NetBSD.org>
From: Luke Mewburn <lukem@netbsd.org>
List: source-changes
Date: 03/22/2004 07:11:00
Module Name:	src
Committed By:	lukem
Date:		Mon Mar 22 07:11:00 UTC 2004

Modified Files:
	src/distrib/utils/sysinst: mbr.c
	src/distrib/utils/sysinst/arch/i386: md.c
	src/sbin/fdisk: fdisk.c
	src/sys/arch/i386/stand/bootxx: pbr.S
	src/sys/arch/i386/stand/mbr: mbr.S
	src/sys/sys: bootblock.h

Log Message:
Move mbr_bootsel from offset 404 to offset 400 in struct mbr_sector to
leave 4 bytes for the Windows NT Drive Serial Number (DSN) at 440-443
(as mbr_sector.mbr_dsn).

Ensure that all the MBR & PBR code reserves space for mbr_sector.mbr_dsn.

Leave the bootsel magic number at 444-445 as mbr_sector.mbr_bootsel_magic
(instead of mbr_sector.mbr_bootsel.mbrbs_magic), but use 0xb5e1 (MBR_BS_MAGIC)
instead of 0xaa55 (MBR_MAGIC) to indicate that this change has occurred.

Rework MBR_BS_NEWMBR to mean "mbr_bootsel has moved to 400".

Modify fdisk(8) to automatically relocate the mbr_bootsel from 404 to 400
if mbr_bootsel_magic is the old value (0xaa55), and unset MBR_BS_NEWMBR
to flag that new mbr_bootsel code must be used if updating the MBR.

These changes fixes a problem where Windows 2000 or Windows XP would corrupt
the last 3 bytes + NUL of MBR partition 3's bootsel name if the bootsel name
was 5 characters long, replacing bytes 6-9 with the DSN.
Also, by explicitly reserving the space for the DSN we prevent problems in the
future if non bootsel MBR or PBR code had other information at bytes 440-443.


To generate a diff of this commit:
cvs rdiff -r1.58 -r1.59 src/distrib/utils/sysinst/mbr.c
cvs rdiff -r1.99 -r1.100 src/distrib/utils/sysinst/arch/i386/md.c
cvs rdiff -r1.75 -r1.76 src/sbin/fdisk/fdisk.c
cvs rdiff -r1.10 -r1.11 src/sys/arch/i386/stand/bootxx/pbr.S
cvs rdiff -r1.4 -r1.5 src/sys/arch/i386/stand/mbr/mbr.S
cvs rdiff -r1.23 -r1.24 src/sys/sys/bootblock.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.