Subject: Re: Adding cd9660 support to the i386/amd64 BIOS bootloader
To: Martin Husemann <martin@duskware.de>
From: Bang Jun-Young <junyoung@netbsd.org>
List: port-amd64
Date: 06/22/2005 14:11:38
Martin Husemann wrote:
> +		/*
> +		 * There seems to be no standard way of numbering BIOS
> +		 * CD-ROM drives. The following method is a little tricky
> +		 * but works nicely.
> +		 */
> +		if (biosdev >= 0x80 + get_harddrives()) {
> +			*devname = "cd";
> +			*unit = 0;		/* override default */
> +		} else
> 
> Shouldn't that be something like
> 
> +		int nhds = get_harddrives();
> +		if (biosdev >= 0x80 + nhds) {
> +			*devname = "cd";
> +			*unit = biosdev - 0x80 - nhds;
> +		} else
> 
> ?

No, cdboot won't work with your patch. CD drive numbering varies between
BIOSes for unknown reason I can't guess. For example, on one of my machines
the first CD-ROM drive is numbered 0x9f, while on another it's 0xe0. So

*unit = biosdev - 0x80 - nhds;

yields 0x9f - 0x80 - 1 = 0x1e = devname of cd30a, that's the 30th CD drive
on the machine. :-)

> 
> I do have machines that have two "CD drives" (and can boot from either)

Give it a try and you'll find that there's no problem with booting on
the 2nd CD drive.

The problem is when you try to boot an image in CD from the bootloader
installed on the hard disk. In this case, you won't be able to boot with
the current patch (neither with the current bootloader in the CVS). It's
not very difficult to fix, but it causes a bit of slowdown on boot 
(0.1s-1s?).

Jun-Young