Subject: Re: Bootability eludes me once again
To: <>
From: David Laight <david@l8s.co.uk>
List: port-i386
Date: 05/02/2002 10:45:14
On Wed, May 01, 2002 at 11:04:53PM -0400, Anne Bennett wrote:
> 
> >> Hum, there's a problem here. If you want to boot from scsi, I guess
> >> the first SCSI disk should appear as C: (80h) not D:.
> >> It appears as D: because the BIOS already assigned C: to the IDE drive.
> 
> Definitely the hardware's start-up messages show the three SCSI disks
> as 81h, 82h, 83h, which suggests that the IDE disk is 80h.  Since you
> folks tell me that the boot code accepts the numbering set by the BIOS,
> then we would expect to see what the floppy's boot code reports (with
> "ls"), i.e. that the disks are ordered "wd0, sd0, sd1, sd2".  How it
> is that the boot code loaded from sd1 reports "sd0, sd1, sd2, wd0"
> is rather a mystery.

At a guess, the BIOS is trying to be helpful and making the boot disk
disk 0x80 whether you boot from scsi or ata.  The floppy gets the
'default' assignment of ata first.

> Urg.  I just did "fdisk sd0" again.  Yesterday, it reported:
> 
> |  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)
> 
> Just now, it reported:
> 
> |  NetBSD disklabel disk geometry:
> |  cylinders: 4826 heads: 4 sectors/track: 107 (428 sectors/cylinder)
> |  
> |  BIOS disk geometry:
> |  cylinders: 1010 heads: 64 sectors/track: 32 (2048 sectors/cylinder)
> |  
 
> Note the difference in the BIOS geometry.

Something is screwy there.  I think you have lost CHS translation
(for large disks).  How big should the disk be?
4826x4x107 is 1Gb
1023x255x63 is 8Gb (abs. max!)
1010x64x32 is 1Gb

> Both cases
> show sector 64 at CHS 0/1/2, which is correct if there are 63 sectors
> per track (I think, though I would have thought that track 0 contained
> sectors 0-62, with 63 as the first, #0, sector of track 1 (i.e. cyl.0,
> head 0), and 64 as sector 1, not sector 2, of that track).

sector numbers count from 1 (not zero), so the 63 sectors are
numbered 1..63.

> I really don't think I dreamed this.  Assuming I'm not totally off my
> rocker (no comments from the peanut gallery, please!), "fdisk" is
> reporting a different number for sectors/track today than it did
> yesterday.  I definitely did not try to mess with the values myself.

Does it depend on whether you have booted from the floppy or hard disk?
Whether you have tried to boot from the SCSi disk?

> I must admit that I wonder why CHS are used instead of block number from
> the start of the disk -- I thought that disks were addressed by block
> number anyway?


> 
> I suppose that if the CHS translation is the problem, then a workaround
> would be to make sure that the first sector of the NetBSD partition is
> on track zero of the disk (using the smaller of the BIOS and NetBSD
> sectors/track number).

A better 'workaround' is to hack out all the code from the mbr
and start_bootsect.S code that uses CHS!

> I can put my NetBSD partition as early as sector one, which leads me
> to wonder why the default installation of NetBSD these days seems to
> leave many sectors unused at the start of the disk.

It is 'traditional' to start the first partition on a track boundary.
(even though the boot code isn't allowed to use the rest of the
first track!)

	David

-- 
David Laight: david@l8s.co.uk