Subject: i386 booting
To: None <>
From: Charles M. Hannum <>
List: tech-install
Date: 09/20/1998 16:03:25
So I wrote a rough draft of an installation manual section explaining
this, and the method I proprosed for getting the BIOS info.


The BIOS and Booting

The NetBSD boot process relies on the BIOS built into your PC.  It
serves two functions: to automatically load the initial part of the
NetBSD boot program, and to act as a backend for the boot program to
read the root file system and load the kernel.

Due to constraints in the BIOS, the geometry used by the BIOS must
have 1024 or fewer `cylinders'.  The `automatic configuration' for IDE
and ATA disks in most BIOSes will offer a geometry that meets this
constraint.  Extension BIOSes for SCSI disks typically hide this from
you but do the right thing.

(Note that these `geometries' are all fake; they do not correspond to
the real media used in the disk drive.  Using completely fictitious
values is not a `bug', and you shouldn't be concerned about this.)

In addition, the disk `geometries' in the BIOS, MBR and NetBSD
disklabel on the boot disk must match.  To make this easier, the
kernel generates a prototype (or `default') NetBSD disklabel for a new
disk, containing parameters obtained from the BIOS.  In most cases,
this prototype disklabel should be used and will work.

[Begin part that relies on the method I proposed.]

Unfortunately, there is no way for the kernel to directly determine
which hardware devices correspond to the devices the BIOS knows about.
We use the following heuristic, which works on all `off the shelf'
machines with preformatted disks.

* Read the first sector and the geometry from the first 16 BIOS disk
  devices, using the BIOS.

* During autoconfiguration (device detection), when we find a disk,
  read the first sector and look for a BIOS device with an identical
  first sector.  If one is found, use the geometry that the BIOS
  reported for that device.

* If no matching BIOS device was found, query the geometry in whatever
  device-specific fashion is appropriate and use that.

* If more than one matching BIOS device was found, use the geometry
  from the one with the lowest BIOS device number which has not
  already been used.

If you are installing NetBSD on a disk other than the first BIOS
device, and it has not previously been formatted under DOS, then you
will need to determine the `geometry' for this device manually.  For
an IDE/ATA disk, this information is available in the `standard
configuration' section of the BIOS setup program.  For a SCSI disk, it
may be available from the SCSI setup utility, or it may not be
available at all.  [Should we also add a mechanism to query the BIOS
data from the kernel and present this as a list of options in the
installation program?]

[End part that relies on the method I proposed.]