Subject: Re: Bootability eludes me once again
To: Anne Bennett <anne@alcor.concordia.ca>
From: Ken Hornstein <kenh@cmf.nrl.navy.mil>
List: port-i386
Date: 04/30/2002 23:47:16
>I swear I'm not stupid. Really. What's crazy is that back in November,
>I went through something like this, Wolfgang Solfrank explained to me
>how the i386 boot sequence works, and I was quite sure I understood.
>Certainly, I was able to fix the system last time.
If it makes you feel any better ... every time I have to do a new disklabel
on an i386 system from scratch, I _always_ fuck it up the first time.
> - The above part zero bootcode reads the DOS partition table, finds the
> active partition (in this case, the NetBSD partition) (or, if
> bootselect, it may allow the user to select an alternative partition
> using one of the function keys), then reads the first sector of that
> and jumps to it. This first sector of the NetBSD part of the disk
> should contain part 1 of the NetBSD boot code (the "countdown");
> the next sector contains the NetBSD disk label (including the NetBSD
> partition table).
The magic here is that the I/O at this point is done via the BIOS,
and the DOS disklabel has to be _exactly_ correct. By that I mean
that the beginning in C/H/S notation has to match ... which is my
experience is where the problems lie, because many times you're
using a "translated" geometry, and fdisk and the BIOS can get
confused as to which translated geometry you're using.
>The list of part 2 block locations appears to be hard-coded into part
>1, which suggests that part 1 does *not* read the filesystem to find
>the "/boot" file, but rather knows where the "rest of itself" is. On
>the other hand, I can use a part 2 on sd0a from a part1 obtained from
>fd0a, which suggests that part 1 *can* read the filesystem (it can
>read it enough to do "ls", anyway!). Confusion still reigns. :-(
When you've booted off of fd0a, you've already reached "part 2" (part 2
is what puts up the NetBSD Boot" mesasge). Part 1 knows where part 2 is
because installboot patches in the sectors part 2 occupies.
>What I did
>----------
>
>(a) I used "fdisk -iua" to put an MBR on sd0. "fdisk sd0" reports:
>
>| NetBSD disklabel disk geometry:
>| cylinders: 4826 heads: 4 sectors/track: 107 (428 sectors/cylinder)
>|
>| BIOS disk geometry:
>| cylinders: 1023 heads: 255 sectors/track: 63 (16065 sectors/cylinder)
>|
>| Partition table:
>| 0: <UNUSED>
>| 1: <UNUSED>
>| 2: <UNUSED>
>| 3: sysid 169 (NetBSD)
>| start 64, size 64 (0 MB), flag 0x80
>| beg: cylinder 0, head 1, sector 2
>| end: cylinder 0, head 2, sector 2
This seems ... way too small. I think you want something like:
start 63, size 2065465
beg: cylinder 0, head 1, sector 1
end: cylinder 1022, head 254, sector 63
Just a guess. If those numbers actually work, then I'll explain how
I got them :-)
--Ken