Subject: Re: problems making an IDE drive bootable....
To: NetBSD/i386 Discussion List <port-i386@netbsd.org>
From: Greg A. Woods <woods@weird.com>
List: port-i386
Date: 03/29/2001 15:34:14
[ On Thursday, March 29, 2001 at 18:21:13 (+0200), Manuel Bouyer wrote: ]
> Subject: Re: problems making an IDE drive bootable....
>
> You NetBSD partition should not start at 0, but at 51 (yes, fisrt trak unused).

Do you mean the fdisk active partition should start at 63?

What difference does it make about where that partition starts?  I
thought that as long as the NetBSD partition was at the start of the
disk then everything should start at zero.  I thought that installboot
wrote the *absolute* disk sector numbers into the MBR code.  If that's
not the case then some documentation needs serious updating.  The
example in the fdisk(8) manual page is somewhat misleading, and
installboot(8) doesn't really make any distinction, and boot(8) is about
as devoid of information on this topic as could be possible, and mbr(8)
only makes indirect reference of it.

If I now understand mbr(8) correctly there are in fact three stages to
booting the system:

	1. load and run the first sector (#0) from the boot device

	2. load and run the first sector of the active (or selected, in
           the case of the bootselector MBR) partition.

	3. load and run the sectors of the /boot program encoded in the
           partition booter.

Unfortunately installboot(8) seems to confuse the MBR (i.e. sector zero)
with whatever boot sector code which might be put in the first sector of
the active partition (presumably in there with the OS partition table).

What puts the second-stage code in the first sector of the active
partition?  Installboot? Is it part of the disk label?  Where is the
disk label really at?  Why should I have to read the source to learn
this magic?

I think I again sort of understand this sentence from installboot(8)
again:

	The name of the special object file (typically
	/usr/mdec/biosboot.sym) where the first and second stage boot
	programs to be installed reside

It really needs to be made more explicit though.  It's way to easy to
confuse that with MBR, especially since MBR is mentioned in the BUGS
section.

Why are PCs so stupid?  My old 3B2 used an almost identical scheme but
managed to make everything about the offsets and partition tables as
clear as day.  On the 3B2 there was no magic -- it was all very obvious
and very well documented and there could be no screw-ups because all of
the partitions were explicitly offset to accomodate all boot sectors,
partition tables, etc.  The only weird part was that sector zero (the
first 512 bytes) of a filesystem was unused and could in theory have
hidden a virus because nothing legitimate ever touched that sector.

I'll try fixing this (i.e. adjusting the start of the fdisk active
partition to be at sector 51) and see what happens....

Am I now correct in assuming that installboot does not need to be re-run
after the fdisk MBR is re-initialised?

> You disklabel says the c partition starts at 51 anyway.

So...?

-- 
							Greg A. Woods

+1 416 218-0098      VE3TCP      <gwoods@acm.org>      <robohack!woods>
Planix, Inc. <woods@planix.com>; Secrets of the Weird <woods@weird.com>