Subject: Re: Boot loader limitations
To: None <rhialto@polder.ubc.kun.nl, vax@linkdead.paranoia.com>
From: Olaf Seibert <rhialto@polder.ubc.kun.nl>
List: port-i386
Date: 01/31/1996 16:52:52
From: VaX#n8 <vax@linkdead.paranoia.com> wrote:
> In message <199601292221.XAA01166@polder.ubc.kun.nl>, Olaf Seibert writes:
> >I've been looking at the source of the bootloader code in 1.1.  When it
> >asks you for the boot device, it only allows unit numbers 0 or 1. I
> >think this is too limiting, since I recently ran into a situation where
> >this is not sufficient.
>
> I thought this was a limitation of the BIOS, not of the bootloader code
> itself.

In /usr/src/sys/arch/i386/boot/sys.c there is, near line 164:

                /*******************************************************\
                * Look inside brackets for unit number, and partition   *
                \*******************************************************/
                if (*cp >= '0' && *cp <= '9')
                        if ((unit = *cp++ - '0') > 1) {
                                printf("Bad unit\n");
                                return 1;
                        }

This check is the limitation. After I changed it to check for > 9,
the following boot prompt command got me where I wanted:

sd(3,a)/netbsd -r

(for a kernel with root on sd1a and one other scsi disk present).

The SCSI controller is an Adaptec 1542-CF with its SCSI BIOS enabled.
It maps scsi target 0 to BIOS drive 0x82 and target 4
(the MO drive with NetBSD) to 0x83. 

Note that for a simpler case, there is some workaround in place:
(a few lines lower)

        if (maj == 1) {
                dosdev = unit | 0x80;
                unit = 0;
        } ...

This allows you to boot from hd(0,a) or hd(1,a) where the 0 or 1
represents the BIOS drive number (- 0x80) and the same drive is
supposed to end up as sd0 in NetBSD's idea of the world.

Something like this would be useful, if it can be easily detected
how many IDE drives are present (which represents the difference
in drive numbers between the BIOS scheme and the NetBSD scheme),
and if all SCSI BIOSes work in a way comparable to the Adaptec one.

-Olaf.
--
___ Olaf 'Rhialto' Seibert      D787B44DFC896063 4CBB95A5BD1DAA96 
\X/ There are no lemurs in this post    rhialto@polder.ubc.kun.nl