[syslinux] BIOS disk geometry and Linux 2.6

Patrick J. LoPresti patl at users.sourceforge.net
Fri Feb 27 09:00:16 PST 2004


"H. Peter Anvin" <hpa at zytor.com> writes:

> The thing is... the kernel does call these functions during early
> boot,

Where, exactly?  Are they visible to userspace?

> however, as Michael pointed out, there is no general way to
> correlate this data with specific drives without examining the
> contents of the disk.

True, but that is a different problem which I need to solve anyway to
decide where to install everything, not just the partition table.

For 99% of my users, there is only one hard drive.  BIOSes which
support EDD 3.0 are not a problem thanks to the EDD module.  Other
people...  Can update their BIOS or submit a patch.

> Here is a thought, though:
> 
> a) If the disk already has a partition table, you should be able to
> get the H/S by examining the ending of the partitions;

This fails if the disk has been moved (or recycled) from another
system.

I need to be able to say "wipe this disk and repartition it" without
regard to what is already there.  So I really do need to know the
heads/sectors from the legacy INT13/AH=08h call in the BIOS.  (The
cylinders I can calculate myself, of course.)

> b) If it doesn't, you could write a small COMBOOT which simply creates
> a dummy partition table.
> 
> Since this data would be written to the disk itself, it would handle
> the correlation.

This assumes that I can reliably detect whether the existing partition
table is valid.

Also, I need to solve the BIOS/Linux disk mapping problem anyway, so
it does not help to kill two birds with one stone here.  (Even if the
disk encodes its own geometry in the partition table, I still have to
figure out that the boot disk is "/dev/hda" before I can partition
it.)

On the bright side, it looks like COM32 provides a fantastic interface
for this.  And the samples are great.

A better solution, as Michael points out, is probably for setup.S to
do this work and make the results visible via /sys.  But the COM32
interface is so nice...

I am envisioning a COM32 program which passes a kernel parameter like
so:

    legacy_chs=1033/255/63,2048/240/63,...

Where the comma-separated fields are C/H/S values for drive 80h, 81h,
and so on.

 - Pat




More information about the Syslinux mailing list