Subject: Re: Support for starting NetBSD partitions with sector 0
To: ws@tools.de (Wolfgang Solfrank), Todd Whitesel <toddpw@best.com>
From: Matthias Drochner <drochner@zelux6.zel.kfa-juelich.de>
List: port-i386
Date: 10/11/1998 20:57:18
Excerpts from netbsd: 9-Oct-98 Re: Support for starting Ne.. Todd
Whitesel@best.com (965*)

> Hmm, I think I was being overly conservative there, the BIOS pitfall of
> not reliably handling more than one full track in a single BIOS call may
> only apply to floppies, which for our supported densities always have at
> least 15 sectors per track.

I tried it once, and I found that a track couldn't be crossed
even on a harddisk. It's a while ago, and I don't remember the
details.
The real problem here is how these first 15 sectors are found:
The MBR code (either a generic one as installed by DOS
or what NetBSD's "fdisk" puts there) uses the CHS information
in the partition table to locate it. So, unless the NetBSD partition
starts at 0 (which makes it trivial), this information must comply
to the LBA information.

The ways out are:
a) ask BIOS for the geometry before this - ie while executing
  the first 512 bytes, which is a technical problem
b) use LBA access, which is not very portable

The bottom line is that the PC platform is junk...

> I think it's a good idea for the PRIM_LOADSZ (which bbinfo.h says is 15,
> did I miss a +1 in there somewhere?) sectors to all be in one track, so
> keeping the partition entry bigger than 15 sectors sounds like a winner.

There are indeed 15 sectors loaded as the "second stage".
(It could be less - I'm sure it works with 9.)
But this "16" does not mean much; the length in the BIOS partition table
is not used anywhere but by these crappy BIOSes.
We can do _anything_ if it serves the purpose to get the BIOS quiet.

best regards
Matthias