Date: Sun, 10 Mar 1996 20:15:55 +1100 From: Bruce Evans <bde@zeta.org.au> To: current@freebsd.org Subject: booting from sd5 when wd3 is also installed Message-ID: <199603100915.UAA20728@godzilla.zeta.org.au>
next in thread | raw e-mail | index | archive | help
These changes should allow specifying the BIOS drive number independently of the FreeBSD unit number. E.g., `9:sd(5,a)' describes the drive with BIOS drive number 9 and sd unit number 5. hd(N,a) is no longer supported because it doesn't fit and it only works for unit number 0. Use N:sd(0,a) instead. I haven't decided exactly how to handle these points: - how sticky should the drive number be? What is the default drive number after 1:sd(0,a)/nonesuch followed by /kernel? - option BOOT_HD_BIAS. This replaces option BOOT_HD. The BIOS drive number for unit N is currently BOOT_HD_BIAS + N. Should the bias only be added for sd drives? How does biasing interact with previously specified drive numbers? Please test the changes on systems with mixed IDE and SCSI drives. I don't have any. Bruce diff -c2 src/sys/i386/boot/biosboot/Makefile~ src/sys/i386/boot/biosboot/Makefile *** src/sys/i386/boot/biosboot/Makefile~ Sat Mar 9 04:42:23 1996 --- src/sys/i386/boot/biosboot/Makefile Sun Mar 10 17:26:35 1996 *************** *** 21,28 **** #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 CLEANFILES+= boot.nohdr boot.strip boot1 boot2 sizetest --- 22,31 ---- #CFLAGS+= -DFORCE_COMCONSOLE ! # 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 diff -c2 src/sys/i386/boot/biosboot/README.386BSD~ src/sys/i386/boot/biosboot/README.386BSD *** src/sys/i386/boot/biosboot/README.386BSD~ Fri Feb 17 08:57:51 1995 --- src/sys/i386/boot/biosboot/README.386BSD Sun Mar 10 16:59:28 1996 *************** *** 103,116 **** ########################################################################## ! 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. ! similarly for sd. ! if you have one wd drive and one scsi drive, then you MUST ! use device 'hd' otherwise the following will happen: --- 103,119 ---- ########################################################################## ! 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 and for higher drive numbers (if the BIOS supports them). ! if you have one or more wd drives and one or more scsi drives, then yo ! 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,126 **** 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, --- 122,125 ---- diff -c2 src/sys/i386/boot/biosboot/README.serial~ src/sys/i386/boot/biosboot/README.serial *** src/sys/i386/boot/biosboot/README.serial~ Fri Apr 21 19:43:53 1995 --- src/sys/i386/boot/biosboot/README.serial Sun Mar 10 18:08:25 1996 *************** *** 77,83 **** >> 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 Boot: --- 77,83 ---- >> FreeBSD BOOT @ 0x10000: 640/7168 k of memory ! 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: diff -c2 src/sys/i386/boot/biosboot/boot.c~ src/sys/i386/boot/biosboot/boot.c *** src/sys/i386/boot/biosboot/boot.c~ Sat Mar 9 04:42:24 1996 --- src/sys/i386/boot/biosboot/boot.c Sun Mar 10 18:24:39 1996 *************** *** 101,117 **** 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; 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 */ #endif loadstart: --- 110,135 ---- gateA20(); ! /* ! * The default boot device is the first partition in the ! * compatibility slice on the boot drive. ! */ ! dosdev = drive; ! maj = 2; unit = drive & 0x7f; ! #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: *************** *** 119,127 **** /* 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" "Use ? for file list or press Enter for defaults\n\nBoot: ", ouraddr, bootinfo.bi_basemem, bootinfo.bi_extmem, ! devs[maj], unit, name); name = dflname; /* re-initialize in case of loop */ --- 137,145 ---- /* If we have looped, use the previous entries as defaults */ printf("\n>> FreeBSD BOOT @ 0x%x: %d/%d k of memory\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, ! dosdev & 0x7f, devs[maj], unit, name); name = dflname; /* re-initialize in case of loop */ *************** *** 167,171 **** startaddr = head.a_entry & 0x00FFFFFF; addr = startaddr; ! printf("Booting %s(%d,%c)%s @ 0x%x\n" , devs[maj] , unit --- 185,190 ---- startaddr = head.a_entry & 0x00FFFFFF; addr = startaddr; ! printf("Booting %d:%s(%d,%c)%s @ 0x%x\n" ! , dosdev & 0x7f , devs[maj] , unit diff -c2 src/sys/i386/boot/biosboot/sys.c~ src/sys/i386/boot/biosboot/sys.c *** src/sys/i386/boot/biosboot/sys.c~ Mon Jun 26 15:07:31 1995 --- src/sys/i386/boot/biosboot/sys.c Sun Mar 10 18:18:30 1996 *************** *** 39,42 **** --- 39,44 ---- #endif + static char biosdrivedigit; + #define BUFSIZE 8192 #define MAPBUFSIZE BUFSIZE *************** *** 165,169 **** { char **devp, *cp = name; ! int ret; /*******************************************************\ * If bracket given look for preceding device name * --- 167,172 ---- { char **devp, *cp = name; ! int biosdrive, ret; ! /*******************************************************\ * If bracket given look for preceding device name * *************** *** 177,180 **** --- 180,193 ---- 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) { *************** *** 211,232 **** return 1; } switch(maj) { - case 1: - dosdev = unit | 0x80; - unit = 0; - break; case 0: case 4: ! dosdev = unit | 0x80; break; case 2: ! dosdev = unit; break; ! case 3: ! printf("Wangtek unsupported\n"); return 1; - break; } inode.i_dev = dosdev; /***********************************************\ --- 224,254 ---- 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 0: case 4: ! dosdev = biosdrive | 0x80; break; case 2: ! dosdev = biosdrive; break; ! default: ! printf("Unknown device\n"); return 1; } + printf("dosdev = %x, biosdrive = %d, unit = %d, maj = %d\n", + dosdev, biosdrive, unit, maj); + getchar(0); + inode.i_dev = dosdev; /***********************************************\ diff -c2 src/sys/i386/boot/biosboot/table.c~ src/sys/i386/boot/biosboot/table.c *** src/sys/i386/boot/biosboot/table.c~ Sat Mar 9 04:42:24 1996 --- src/sys/i386/boot/biosboot/table.c Sun Mar 10 15:47:40 1996 *************** *** 137,141 **** * fragmentation. */ ! char *devs[] = { "wd", "hd", "fd", "wt", "sd", 0 }; char dflname[] = "/kernel"; char *name = dflname; --- 137,141 ---- * fragmentation. */ ! char *devs[] = { "wd", "dk", "fd", "wt", "sd", 0 }; char dflname[] = "/kernel"; char *name = dflname;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199603100915.UAA20728>