diff --git a/sys/i386/boot/biosboot/Makefile b/sys/i386/boot/biosboot/Makefile index 77e963c6ac6e..de2f40338bcf 100644 --- a/sys/i386/boot/biosboot/Makefile +++ b/sys/i386/boot/biosboot/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.37 1996/02/03 21:12:27 joerg Exp $ +# $Id: Makefile,v 1.38 1996/03/08 06:29:05 bde Exp $ # PROG= boot @@ -20,10 +20,12 @@ CFLAGS+= -DBOOTSEG=${BOOTSEG} -DBOOTSTACK=${BOOTSTACK} # PROBE_KEYBOARD is defined). #CFLAGS+= -DFORCE_COMCONSOLE -# Assume hd(*,a) instead of wd(*,a) if the boot seems to happen from -# a hard disk. -# This can be useful for people booting in a mixed IDE/SCSI environment. -#CFLAGS+= -DBOOT_HD +# Bias the conversion from the BIOS drive number to the FreeBSD unit number +# for hard disks to save typing. E.g., BOOT_HD_BIAS=1 makes BIOS drive 1 +# correspond to 1:sd(0,a) instead of 1:sd(1,a). +# This may be useful for people booting in a mixed IDE/SCSI environment +# (set BOOT_HD_BIAS to the number of IDE drives). +#CFLAGS+= -DBOOT_HD_BIAS=1 CLEANFILES+= boot.nohdr boot.strip boot1 boot2 sizetest DPADD= ${LIBC} diff --git a/sys/i386/boot/biosboot/README.386BSD b/sys/i386/boot/biosboot/README.386BSD index e8e7d028747f..ebcdb65fab2c 100644 --- a/sys/i386/boot/biosboot/README.386BSD +++ b/sys/i386/boot/biosboot/README.386BSD @@ -102,16 +102,19 @@ boot some other partition, possibly on the second drive, as root. ########################################################################## -In the case you have two drives the same type (both scsi or bith IDE/ESDI), -wd(0,a)xxx - will boot xxx from drive 0, a partition. -wd(1,a)xxx - will boot xxx from drive 1, a partition. +In the case you have several drives the same type (all scsi or all IDE/ESDI), + wd(0,a)xxx +will boot xxx from drive 0, a partition. + wd(1,a)xxx +will boot xxx from drive 1, a partition. -similarly for sd. +similarly for sd and for higher drive numbers (if the BIOS supports them). -if you have one wd drive and one scsi drive, then you MUST -use device 'hd' +if you have one or more wd drives and one or more scsi drives, then you +MUST specify the BIOS drive number for booting the scsi drives: + 2:sd(0,a)xxx +will boot xxx from scsi drive 0, a partition, provided `2' is the correct +BIOS drive number for sd0. otherwise the following will happen: @@ -119,10 +122,6 @@ with wd0 and sd0, you specify sd1 or wd1 to indicate the 2nd drive. it boots the kernel correctly, then tells the kernel to use sd1 as root. you however may not have an sd1, and problems arise. -hd is special in that the kernel is always told to use unit 0, -The correct TYPE of device will be specified too, so the kernel -will be told either sd0 or wd0. - Whether sd or wd is specified to the kernel is read from the disklabel, so ensure that all SCSI disks have type SCSI in their disklabel or the boot code will assume they are ESDI or IDE. (Remember, because it is @@ -149,4 +148,4 @@ Before you do this ensure you have a booting floppy with correct disktab and bootblock files on it so that if it doesn't work, you can re-disklabel from the floppy. -$Id: README.386BSD,v 1.2 1993/10/16 19:11:25 rgrimes Exp $ +$Id: README.386BSD,v 1.3 1995/02/16 12:02:08 jkh Exp $ diff --git a/sys/i386/boot/biosboot/README.serial b/sys/i386/boot/biosboot/README.serial index d2a24afda35d..c9af4d1ae9a5 100644 --- a/sys/i386/boot/biosboot/README.serial +++ b/sys/i386/boot/biosboot/README.serial @@ -76,9 +76,9 @@ To boot FreeBSD in serial console mode, you must do the following: No keyboard found. >> FreeBSD BOOT @ 0x10000: 640/7168 k of memory - Use hd(1,a)/kernel to boot sd0 when wd0 is also installed. - Usage: [[[fd(0,a)]/kernel][-s][-r][-a][-c][-d][-b][-v][-h]] - Use ? for file list or simply press Return for defaults + Usage: [[[0:][fd](0,a)]/kernel][-abcCdhrsv] + Use 1:sd(0,a)kernel to boot sd0 if it is BIOS drive 1 + Use ? for file list or press Enter for defaults Boot: This is identical to the prompt that normally appears on the VGA console, @@ -152,4 +152,4 @@ CAVEATS: from the new kernel. -$Id: README.serial,v 1.2 1995/02/16 07:37:35 wpaul Exp $ +$Id: README.serial,v 1.3 1995/04/20 23:15:07 joerg Exp $ diff --git a/sys/i386/boot/biosboot/boot.c b/sys/i386/boot/biosboot/boot.c index 5a8247e19115..b32df606233c 100644 --- a/sys/i386/boot/biosboot/boot.c +++ b/sys/i386/boot/biosboot/boot.c @@ -24,7 +24,7 @@ * the rights to redistribute these changes. * * from: Mach, [92/04/03 16:51:14 rvb] - * $Id: boot.c,v 1.46 1995/07/22 22:32:49 joerg Exp $ + * $Id: boot.c,v 1.47 1996/03/08 06:29:06 bde Exp $ */ @@ -100,29 +100,38 @@ boot(int drive) gateA20(); - - /***************************************************************\ - * As a default set it to the first partition of the boot * - * floppy or hard drive * - * Define BOOT_HT to boot sd0 when wd0 is also installed * - \***************************************************************/ - part = 0; + /* + * The default boot device is the first partition in the + * compatibility slice on the boot drive. + */ + dosdev = drive; + maj = 2; unit = drive & 0x7f; -#ifdef BOOT_HD - maj = (drive&0x80 ? 1 : 2); /* a good first bet */ -#else - maj = (drive&0x80 ? 0 : 2); /* a good first bet */ +#ifdef dontneed + slice = 0; + part = 0; #endif + if (drive & 0x80) { + /* + * Hard drive. Adjust. Guess that the FreeBSD unit number + * is the BIOS drive number biased by BOOT_HD_BIAS, + */ + maj = 0; +#if BOOT_HD_BIAS > 0 + if (BOOT_HD_BIAS <= unit) + unit -= BOOT_HD_BIAS; +#endif + } loadstart: /* print this all each time.. (saves space to do so) */ /* If we have looped, use the previous entries as defaults */ printf("\n>> FreeBSD BOOT @ 0x%x: %d/%d k of memory\n" - "Use hd(1,a)/kernel to boot sd0 when wd0 is also installed.\n" - "Usage: [[%s(%d,a)]%s][-abcCdhrsv]\n" + "Usage: [[[%d:][%s](%d,a)]%s][-abcCdhrsv]\n" + "Use 1:sd(0,a)kernel to boot sd0 if it is BIOS drive 1\n" "Use ? for file list or press Enter for defaults\n\nBoot: ", ouraddr, bootinfo.bi_basemem, bootinfo.bi_extmem, - devs[maj], unit, name); + dosdev & 0x7f, devs[maj], unit, name); name = dflname; /* re-initialize in case of loop */ loadflags &= RB_SERIAL; /* clear all, but leave serial console */ @@ -166,7 +175,8 @@ loadprog(void) */ startaddr = head.a_entry & 0x00FFFFFF; addr = startaddr; - printf("Booting %s(%d,%c)%s @ 0x%x\n" + printf("Booting %d:%s(%d,%c)%s @ 0x%x\n" + , dosdev & 0x7f , devs[maj] , unit , 'a'+part diff --git a/sys/i386/boot/biosboot/sys.c b/sys/i386/boot/biosboot/sys.c index e04110e4be58..399b907e9f42 100644 --- a/sys/i386/boot/biosboot/sys.c +++ b/sys/i386/boot/biosboot/sys.c @@ -24,7 +24,7 @@ * the rights to redistribute these changes. * * from: Mach, Revision 2.2 92/04/04 11:36:34 rpd - * $Id: sys.c,v 1.9 1995/05/30 07:58:34 rgrimes Exp $ + * $Id: sys.c,v 1.10 1995/06/25 14:02:55 joerg Exp $ */ #include "boot.h" @@ -38,6 +38,8 @@ char buf[BUFSIZE], fsbuf[SBSIZE], iobuf[MAXBSIZE]; #endif +static char biosdrivedigit; + #define BUFSIZE 8192 #define MAPBUFSIZE BUFSIZE char buf[BUFSIZE], fsbuf[BUFSIZE], iobuf[BUFSIZE]; @@ -164,7 +166,8 @@ int openrd(void) { char **devp, *cp = name; - int ret; + int biosdrive, ret; + /*******************************************************\ * If bracket given look for preceding device name * \*******************************************************/ @@ -176,6 +179,16 @@ openrd(void) } else { + /* + * Look for a BIOS drive number (a leading digit followed + * by a colon). + */ + if (*(name + 1) == ':' && *name >= '0' && *name <= '9') { + biosdrivedigit = *name; + name += 2; + } else + biosdrivedigit = '\0'; + if (cp++ != name) { for (devp = devs; *devp; devp++) @@ -210,25 +223,33 @@ openrd(void) if (!*cp) return 1; } + if (biosdrivedigit != '\0') + biosdrive = biosdrivedigit - '0'; + else { + biosdrive = unit; +#if BOOT_HD_BIAS > 0 + /* XXX */ + if (maj == 4) + biosdrive += BOOT_HD_BIAS; +#endif + } switch(maj) { - case 1: - dosdev = unit | 0x80; - unit = 0; - break; case 0: case 4: - dosdev = unit | 0x80; + dosdev = biosdrive | 0x80; break; case 2: - dosdev = unit; + dosdev = biosdrive; break; - case 3: - printf("Wangtek unsupported\n"); + default: + printf("Unknown device\n"); return 1; - break; } + printf("dosdev = %x, biosdrive = %d, unit = %d, maj = %d\n", + dosdev, biosdrive, unit, maj); inode.i_dev = dosdev; + /***********************************************\ * Now we know the disk unit and part, * * Load disk info, (open the device) * diff --git a/sys/i386/boot/biosboot/table.c b/sys/i386/boot/biosboot/table.c index 7faa9a8930bf..ba304a873315 100644 --- a/sys/i386/boot/biosboot/table.c +++ b/sys/i386/boot/biosboot/table.c @@ -24,7 +24,7 @@ * the rights to redistribute these changes. * * from: Mach, Revision 2.2 92/04/04 11:36:43 rpd - * $Id: table.c,v 1.8 1995/06/25 14:02:57 joerg Exp $ + * $Id: table.c,v 1.9 1996/03/08 05:15:54 bde Exp $ */ /* @@ -136,7 +136,7 @@ struct pseudo_desc Idtr_real = { 0x400 - 1, 0x0, 0x0 }; * All initialized data is defined in one file to reduce space wastage from * fragmentation. */ -char *devs[] = { "wd", "hd", "fd", "wt", "sd", 0 }; +char *devs[] = { "wd", "dk", "fd", "wt", "sd", 0 }; char dflname[] = "/kernel"; char *name = dflname; unsigned long tw_chars = 0x5C2D2F7C; /* "\-/|" */