Add code to parse device name specified in the boot prompt.
Update boot version to 1.3.
This commit is contained in:
parent
f1b7dcd6f3
commit
d1e6cc9002
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: boot.c,v 1.5 2003/10/21 12:18:02 itohy Exp $ */
|
||||
/* $NetBSD: boot.c,v 1.6 2005/10/15 11:34:17 itohy Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1982, 1986, 1990, 1993
|
||||
@ -102,8 +102,6 @@ char *names[] = {
|
||||
};
|
||||
#define NUMNAMES (sizeof(names) / sizeof(char *))
|
||||
|
||||
static int bdev, badapt, bctlr, bunit, bpart;
|
||||
|
||||
void boot(dev_t boot_dev);
|
||||
int main(void);
|
||||
void getbootdev(int *);
|
||||
@ -139,12 +137,6 @@ main(void)
|
||||
printf(">> (%s, %s)\n", bootprog_maker, bootprog_date);
|
||||
printf(">> Enter \"reset\" to reset system.\n");
|
||||
|
||||
bdev = B_TYPE(bootdev);
|
||||
badapt = B_ADAPTOR(bootdev);
|
||||
bctlr = B_CONTROLLER(bootdev);
|
||||
bunit = B_UNIT(bootdev);
|
||||
bpart = B_PARTITION(bootdev);
|
||||
|
||||
for (;;) {
|
||||
name = names[currname++];
|
||||
if (currname == NUMNAMES)
|
||||
@ -172,9 +164,17 @@ void
|
||||
getbootdev(int *boot_howto)
|
||||
{
|
||||
char c, *ptr = line;
|
||||
int bdev, badapt, bctlr, bunit, bpart;
|
||||
|
||||
bdev = B_TYPE(bootdev);
|
||||
badapt = B_ADAPTOR(bootdev);
|
||||
bctlr = B_CONTROLLER(bootdev);
|
||||
bunit = B_UNIT(bootdev);
|
||||
bpart = B_PARTITION(bootdev);
|
||||
|
||||
printf("Boot: [[[%s%d%c:]%s][-a][-c][-d][-s][-v][-q]] :- ",
|
||||
devsw[bdev].dv_name, bctlr + (8 * badapt), 'a' + bpart, name);
|
||||
devsw[bdev].dv_name, badapt << 8 | bctlr << 4 | bunit,
|
||||
'a' + bpart, name);
|
||||
|
||||
if (tgets(line)) {
|
||||
if (strcmp(line, "reset") == 0) {
|
||||
|
@ -1,4 +1,6 @@
|
||||
$NetBSD: version,v 1.2 2003/10/21 12:40:15 itohy Exp $
|
||||
$NetBSD: version,v 1.3 2005/10/15 11:34:17 itohy Exp $
|
||||
|
||||
1.1: Initial version
|
||||
1.2: Support disklabel.
|
||||
1.3: Add support for specifying boot device on the prompt.
|
||||
Allow boot from partitions in the middle of disks.
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dev_hppa.c,v 1.4 2003/10/21 13:10:42 itohy Exp $ */
|
||||
/* $NetBSD: dev_hppa.c,v 1.5 2005/10/15 11:34:17 itohy Exp $ */
|
||||
|
||||
/* $OpenBSD: dev_hppa.c,v 1.5 1999/04/20 20:01:01 mickey Exp $ */
|
||||
|
||||
@ -71,6 +71,9 @@ devopen(struct open_file *f, const char *fname, char **file)
|
||||
{
|
||||
struct hppa_dev *hpd;
|
||||
const struct pdc_devs *dp = pdc_devs;
|
||||
int bdev, badapt, bctlr, bunit, bpart;
|
||||
unsigned long n;
|
||||
char *p;
|
||||
int rc = 1;
|
||||
|
||||
if (!(*file = strchr(fname, ':')))
|
||||
@ -89,6 +92,20 @@ devopen(struct open_file *f, const char *fname, char **file)
|
||||
|
||||
if (dp >= &pdc_devs[NENTS(pdc_devs)] || dp->dev_type < 0)
|
||||
return ENODEV;
|
||||
bdev = dp->dev_type;
|
||||
n = strtoul(fname + sizeof(dp->name)-1, &p, 10);
|
||||
if (n == ULONG_MAX)
|
||||
return ENODEV;
|
||||
bunit = n & 0xf;
|
||||
bctlr = (n >> 4) & 0xf;
|
||||
badapt = (n >> 8) & 0xf;
|
||||
if (*p >= 'a' && *p < 'a' + MAXPARTITIONS) {
|
||||
bpart = *p - 'a';
|
||||
} else {
|
||||
bpart = 0;
|
||||
}
|
||||
bootdev = MAKEBOOTDEV(bdev, badapt, bctlr, bunit, bpart);
|
||||
|
||||
#ifdef DEBUGBUG
|
||||
if (debug)
|
||||
printf("%s\n", dp->name);
|
||||
|
Loading…
Reference in New Issue
Block a user