Subject: Re: BIOS partitions, MBR, and bootstraps, oh my...
To: Joel Baker <lucifer@lightbearer.com>
From: David Laight <david@l8s.co.uk>
List: netbsd-help
Date: 08/29/2002 09:28:25
> > Hopefully this works - since you WILL be using it later...
> 
> Wasn't a lot of choice. If it doesn't work, the next stop for the board
> would be the round file, since I have no drives that *don't* require INT13
> support at this point, and buying one would be... silly, when I can buy a
> vastly faster MB/CPU pair for not much more than a drive would cost...

If that is a dual MB, don't bin it!

> > > Secondary/Master.
> > > 
> > > Two BIOS partitions (0 and 1), both id 169 (NetBSD). fdisk sees these and
> > > displays them just fine.
> > 
> > You won't be able to boot the second - unless you get all my
> > changes to the boot code...
> 
> Hmmm. Bleah. Sounds like it may be simpler to reinstall and use multiple
> disklabel partitions instead of BIOS partitions; I could still boot off
> of the other partition (which is the eventual goal - a standalone boot
> of Debian/NetBSD - don't shoot me, please).

Now I'm confused!
The 'problem' is that the bios partition number isn't passed between
the layers of the bootstrap.  So eack layer searches for a BIOS
partition of the correct type.  So with 2 netbsd bios partitions, even
if you load the partition boot record from the second one, it wont
know and will read the boot code from the first...
If you have different OS then it is ok (but then they wouldn't both
had id 169).

> > > Partition 0 is 10g, set active, and has a disklabel and NetBSD filesystems
> > > (a = /, b = 512M swap, c&d standard, no others)
> > > 
> > > Partition 1 has not yet been set up in any way, other than it's existance
> > > in the BIOS partition table, and has the other ~30g of the drive.
> > > 
> > > fdisk -i -c /usr/mdec/mbr_bootsel (configured to boot partition 0 after
> > > 10 seconds, has an named option for partition 1 as well)
> > 
> > Ok the presence of the the entry for partition 1 beyong 8Gb will
> > have made fdisk set the flag that causes the mbr_bootsel code
> > to use the int 13 entensions to do LBA reads.
> > (You can't clear this flag using the standard fdisk)
> 
> Noted.

> > I'd double check that the first sector of the netbsd partition
> > contains the boot code.

Try dumping it from unix, something like:
dd if=/dev/rwd0a count=1 | hexdump -C

Also wd0c must give the same data.

> > 
> > Note that the root filesystem (or rather the one passed to
> > installboot that contain /boot) must be at the start of the
> > bios partition.
> 
> It was; wd0a, first partition on the BIOS partition; the only thing
> ahead of it was the standard 63-sector first track reservation for boot
> code.
> 
> > With a few code tweaks you can get the mbr_bootsel code to
> > select a different boot partition and hence root partition...
> 
> Will look into this. I'm thinking the sanest thing to do (since I have only
> a few hours invested right now) is to start over and do it all as partition
> 0 (or even full-disk), and disklabel partitions... / on a at 10g, swap on b
> at 512M, and, /debian or whatever I call it as e...

I'm not sure what debian/netbsd is doing, but with the standard netbsd
you can't have 2 disklabels (ok I did for a while but....).
However the changes required to get the mbr_bootsel code to boot
wd0f:/netbsd when F2 is pressed are relatively easy (my system works
that way).  Just requires you make wd0f be the start of a bios prt.

Do remember that the netbsd disklabel can reference anywhere on the
disk.  So you don't need to change too much.

	David

-- 
David Laight: david@l8s.co.uk