Subject: Re: Two NetBSDs on one (i386) drive
To: None <tech-kern@netbsd.org>
From: David Laight <david@nohope.l8s.co.uk>
List: tech-kern
Date: 01/16/2002 22:30:20
If anyone is interested I now have the bootselector loading different
netbsd system off partitions 1 and 3 (unfortunately I can't escape
having to boot win98 sometimes).
The changes are relatively minor, and basically involve passing the
sector number of the boot partition through the various layers, and have
it used as hint as to where to find the label.
During my travels I've discovered a few interesting 'features':
1) It is almost impossible to write the second disklabel - but very
easy to trash your filestore playing with disklabel (in kernel
blocks of a mounted filesystem can get dumped to the wrong sectors)
2) You cannot write to sector 1 of slice c (one bit of code stops
direct writes to what is likely to be the disklabel)
3) There is a load of code that makes slices 'e-h' match the disk
partitions only to immediately, and unconditionally replace it
with the netbsd label from disk.
4) fdisk doesn't really want to let you update the bootselector code
The kernel changes were restricted to i386/i386/disksubr.c and
autoconf.c. Elsewhere I had to modify the 16bit code parts of
mbr_bootsel.S, start_bootsect.S (I've fixed a few other bugs in these),
minor tweaks to the 'c' bits of biosboot, and fdisk (to let me load in
new bootsel code).
The fdisk changes are definitely a bug fix, I'll try to work out how to
send-pr them. The mbr_bootsel changes include a massive improvement in
usability. The start_bootsect.S code executes 0x00 0x00 (addb
%al,[%bx+%si] at least once) - dunno whether this overwrite ever
matters!
David