Subject: Re: Copy_Kernel Aggravation!
To: Erik M. Theisen <etheisen@teclink.net>
From: Greg Hudson <ghudson@MIT.EDU>
List: port-i386
Date: 02/24/1996 16:34:44
> 2) The default 24MB partion gets installed by disklabel because the
> offset of the BSD partion is set to 0 and the 1st stage boot loader
> contains the default partion table (MBR) gets installed here.

I've been considering checking in a change to fdisk() to change both
of the init_sector0(1) calls to init_sector0(dos_sectors), so that
fdisk's default initialization behavior is to leave a whole track
free at the beginning.

I've also been considering checking in a change to prevent disklabel
from writing to the first track of the disk on the i386 port without a
-f option.  Since disklabel is not i386-specific, I'm not sure of the
wisdom of this approach.  (The installation script also needs to be
modified, I think.)

> You are seeing BIOS/DOS/Net{Open}BSD differences in the way drive
> geometry is calculated.  Partion tables should always be built with
> the same geometry that DOS uses.

More precisely, with the same geometry that the BIOS uses.  I checked
in some changes (pre-1.1) to get fdisk to figure out the DOS geometry
based on existing partition table entries, but it won't work on an
empty disk, and it won't fix whatever disklabel is doing.

> Could we please get this fixed.

It's a little tough.  It requires the boot loader to pass information
to the kernel about the geometry of the BIOS disks (since the only
reliable way to get this information is through the BIOS, as far as I
can tell), and then it requires the kernel to figure out which IDE and
SCSI disk corresponds to which BIOS disk.  I think Linux does this for
IDE disks but not SCSI disks (there's code in the Linux kernel to
intuit the geometry of SCSI disks using existing partition table
entries, and to guess if it can't do that), but it's dangerous to
assume that what Linux does is correct.  I may be lacking some
information which would make this task easier.