Re: bootxx needs to fit within 0th track of MBR partition?

Greg Troxel <[email protected]> Fri, 25 Aug 2023 09:36:43 -0400
Newsgroups gmane.os.netbsd.ports.x86-64,gmane.os.netbsd.ports.i386
Message-ID <[email protected]>
Mouse <[email protected]> writes:

>>> I'm fairly sure that, yes, the distance from "beginning of drive" to
>>> "beginning of UFS" is 8K for UFS1, assuming of course that there is
>>> a filesystem partition starting at start-of-disk.  With one sector
>>> occupied by MBR and label, that left 7.5K for the bootblocks.
>> one each, so 14s = 7K?
>
> Teal deer: 7K, but for slightly different reasons.
>
> There's 8K of space not used by UFS1 - that is, the filesystem doesn't
> care what's in the first 8K of its partition.  On i386 and amd64, my
> experience is that the MBR is in (absolute) sector zero, the first MBR
> partition does not begin at offset 0 (usually offset 8 or 63, in my
> experience), and the space between sector zero and the start of the
> first MBR partition is unused.  The boot partition then has a PBR in
> (partition-relative) sector zero and a label in sector 1.  Sectors 2
> through 7 are available for bootblocks, hence 7K, but at a different
> place.
>
> I have a fuzzy memory of using an MBR partition beginning at offset
> zero, but I can't recall what for.  It might not have been a bootable
> disk, in which case most of this discussion is irrelevant.

That matches my memory, except that I find the first partition at zero
to be relatively normal.  At least that's what we did on real computers
before PCs :-)

> I suspect CHS addressing may complicate this some.  My grasp of how CHS
> addressing works is fuzzy at best; the above is almost entirely about
> LBA-addressed disks, or CHS well-behaved enough to think of it as LBA
> in a funny variable-radix representation.

I think it is just a funny representation and of no consequence for this
discussion.