diff options
author | msmith <msmith@FreeBSD.org> | 1999-01-24 00:12:04 +0000 |
---|---|---|
committer | msmith <msmith@FreeBSD.org> | 1999-01-24 00:12:04 +0000 |
commit | 1e566c55054dd9a7be95eade9a296a6b9e0b84be (patch) | |
tree | 57a865dde3e49ea612ba9d8f590c751c126921e6 /sys/boot | |
parent | 13b06fbe36e060830e105ff564d453b0f976cc2a (diff) | |
download | FreeBSD-src-1e566c55054dd9a7be95eade9a296a6b9e0b84be.zip FreeBSD-src-1e566c55054dd9a7be95eade9a296a6b9e0b84be.tar.gz |
biosdisk.c
Implement a new variable 'root_disk_unit' which supersedes
'num_ide_disks' and makes it possible to explicitly set the
root device unit number regardless of type considerations.
bootinfo.c
If we can't calculate a dev_t for the root disk, complain and
don't proceed to boot with an invalid boot device.
Diffstat (limited to 'sys/boot')
-rw-r--r-- | sys/boot/i386/libi386/biosdisk.c | 24 | ||||
-rw-r--r-- | sys/boot/i386/libi386/bootinfo.c | 7 | ||||
-rw-r--r-- | sys/boot/i386/libi386/bootinfo32.c | 7 | ||||
-rw-r--r-- | sys/boot/i386/libi386/bootinfo64.c | 7 |
4 files changed, 32 insertions, 13 deletions
diff --git a/sys/boot/i386/libi386/biosdisk.c b/sys/boot/i386/libi386/biosdisk.c index 8b102ae..6ded4fd 100644 --- a/sys/boot/i386/libi386/biosdisk.c +++ b/sys/boot/i386/libi386/biosdisk.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: biosdisk.c,v 1.19 1999/01/09 02:36:19 msmith Exp $ + * $Id: biosdisk.c,v 1.20 1999/01/10 18:22:23 steve Exp $ */ /* @@ -760,7 +760,7 @@ bd_getdev(struct i386_devdesc *dev) int major; int rootdev; char *nip, *cp; - int unitofs = 0; + int unitofs = 0, i, unit; biosdev = bd_unit2bios(dev->d_kind.biosdisk.unit); DEBUG("unit %d BIOS device %d", dev->d_kind.biosdisk.unit, biosdev); @@ -783,22 +783,32 @@ bd_getdev(struct i386_devdesc *dev) if ((od->od_flags & BD_LABELOK) && (od->od_disklabel.d_type == DTYPE_SCSI)) { /* label OK, disk labelled as SCSI */ major = DAMAJOR; - /* check for unit number correction hint */ + /* check for unit number correction hint, now deprecated */ if ((nip = getenv("num_ide_disks")) != NULL) { - unitofs = strtol(nip, &cp, 0); + i = strtol(nip, &cp, 0); /* check for parse error */ - if ((cp == nip) || (*cp != 0)) - unitofs = 0; + if ((cp != nip) && (*cp == 0)) + unitofs = i; } } else { /* assume an IDE disk */ major = WDMAJOR; } } + /* XXX a better kludge to set the root disk unit number */ + if ((nip = getenv("root_disk_unit")) != NULL) { + i = strtol(nip, &cp, 0); + /* check for parse error */ + if ((cp != nip) && (*cp == 0)) + unit = i; + } else { + (biosdev & 0x7f) - unitofs; /* allow for #wd compenstation in da case */ + } + rootdev = MAKEBOOTDEV(major, (dev->d_kind.biosdisk.slice + 1) >> 4, /* XXX slices may be wrong here */ (dev->d_kind.biosdisk.slice + 1) & 0xf, - (biosdev & 0x7f) - unitofs, /* allow for #wd compenstation in da case */ + unit, dev->d_kind.biosdisk.partition); DEBUG("dev is 0x%x\n", rootdev); return(rootdev); diff --git a/sys/boot/i386/libi386/bootinfo.c b/sys/boot/i386/libi386/bootinfo.c index 77ba8b7..613159d 100644 --- a/sys/boot/i386/libi386/bootinfo.c +++ b/sys/boot/i386/libi386/bootinfo.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: bootinfo.c,v 1.14 1998/10/15 17:06:36 peter Exp $ + * $Id: bootinfo.c,v 1.15 1998/11/13 23:40:02 msmith Exp $ */ #include <stand.h> @@ -255,7 +255,10 @@ bi_load(char *args, int *howtop, int *bootdevp, vm_offset_t *bip) /* pass in the BIOS device number of the current disk */ bi.bi_bios_dev = bd_unit2bios(rootdev->d_kind.biosdisk.unit); bootdevnr = bd_getdev(rootdev); - break; + if (bootdevnr != -1) + break; + printf("root device %s invalid\n", i386_fmtdev(rootdev)); + return(EINVAL); default: printf("aout_exec: WARNING - don't know how to boot from device type %d\n", rootdev->d_type); diff --git a/sys/boot/i386/libi386/bootinfo32.c b/sys/boot/i386/libi386/bootinfo32.c index 77ba8b7..613159d 100644 --- a/sys/boot/i386/libi386/bootinfo32.c +++ b/sys/boot/i386/libi386/bootinfo32.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: bootinfo.c,v 1.14 1998/10/15 17:06:36 peter Exp $ + * $Id: bootinfo.c,v 1.15 1998/11/13 23:40:02 msmith Exp $ */ #include <stand.h> @@ -255,7 +255,10 @@ bi_load(char *args, int *howtop, int *bootdevp, vm_offset_t *bip) /* pass in the BIOS device number of the current disk */ bi.bi_bios_dev = bd_unit2bios(rootdev->d_kind.biosdisk.unit); bootdevnr = bd_getdev(rootdev); - break; + if (bootdevnr != -1) + break; + printf("root device %s invalid\n", i386_fmtdev(rootdev)); + return(EINVAL); default: printf("aout_exec: WARNING - don't know how to boot from device type %d\n", rootdev->d_type); diff --git a/sys/boot/i386/libi386/bootinfo64.c b/sys/boot/i386/libi386/bootinfo64.c index 77ba8b7..613159d 100644 --- a/sys/boot/i386/libi386/bootinfo64.c +++ b/sys/boot/i386/libi386/bootinfo64.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: bootinfo.c,v 1.14 1998/10/15 17:06:36 peter Exp $ + * $Id: bootinfo.c,v 1.15 1998/11/13 23:40:02 msmith Exp $ */ #include <stand.h> @@ -255,7 +255,10 @@ bi_load(char *args, int *howtop, int *bootdevp, vm_offset_t *bip) /* pass in the BIOS device number of the current disk */ bi.bi_bios_dev = bd_unit2bios(rootdev->d_kind.biosdisk.unit); bootdevnr = bd_getdev(rootdev); - break; + if (bootdevnr != -1) + break; + printf("root device %s invalid\n", i386_fmtdev(rootdev)); + return(EINVAL); default: printf("aout_exec: WARNING - don't know how to boot from device type %d\n", rootdev->d_type); |