diff options
| author | Julian Elischer <julian@FreeBSD.org> | 1996-09-05 21:12:06 +0000 |
|---|---|---|
| committer | Julian Elischer <julian@FreeBSD.org> | 1996-09-05 21:12:06 +0000 |
| commit | 7fae9bcd248176191d46c94d274553ce7f9c03cd (patch) | |
| tree | 1fd7dc78749cae296a02b1574de86e82c67bb3ff /sys | |
| parent | 693b16fcbf0ae8b62cbd94cdf33d8253eec08b2a (diff) | |
Notes
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/i386/boot/biosboot/Makefile | 4 | ||||
| -rw-r--r-- | sys/i386/boot/biosboot/boot.c | 157 |
2 files changed, 75 insertions, 86 deletions
diff --git a/sys/i386/boot/biosboot/Makefile b/sys/i386/boot/biosboot/Makefile index 6eb76a6afa295..4efe0034d09c0 100644 --- a/sys/i386/boot/biosboot/Makefile +++ b/sys/i386/boot/biosboot/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.42 1996/07/12 05:17:36 bde Exp $ +# $Id: Makefile,v 1.43 1996/09/04 18:28:33 julian Exp $ # PROG= boot @@ -75,7 +75,7 @@ boot1: boot.nohdr boot2: boot.nohdr dd if=boot.nohdr of=boot2 bs=512 skip=1 - @dd if=boot2 skip=15 of=sizetest 2> /dev/null + @dd if=boot2 skip=14 of=sizetest 2> /dev/null @if [ -s sizetest ] ; then \ echo "*** Boot2 is too BIG ***" ; exit 2 ; \ fi diff --git a/sys/i386/boot/biosboot/boot.c b/sys/i386/boot/biosboot/boot.c index 1f2e870c84aec..7aa19e914d24d 100644 --- a/sys/i386/boot/biosboot/boot.c +++ b/sys/i386/boot/biosboot/boot.c @@ -62,36 +62,33 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #define NAMEBUF_LEN (8*1024) #ifdef NAMEBLOCK -char *dflt_name ; -/*char *dflt_name = (char *)0x0000ffb0; */ /* force it to not be in the BSS */ +char *dflt_name; #endif char namebuf[NAMEBUF_LEN]; struct exec head; struct bootinfo bootinfo; int loadflags; +static void getbootdev(char *ptr, int *howto); static void loadprog(void); /* NORETURN */ void boot(int drive) { - char *ptr; - int howto; - char c; int ret; #ifdef PROBE_KEYBOARD if (probe_keyboard()) { init_serial(); - loadflags = RB_SERIAL; + loadflags |= RB_SERIAL; printf("\nNo keyboard found."); } #endif #ifdef FORCE_COMCONSOLE init_serial(); - loadflags = RB_SERIAL; + loadflags |= RB_SERIAL; printf("\nSerial console forced."); #endif @@ -134,15 +131,17 @@ boot(int drive) } #ifdef NAMEBLOCK /* - * this is set by the code in boot2.S + * XXX + * DAMN! I don't understand why this is not being set + * by the code in boot2.S */ + dflt_name= (char *)0x0000ffb0; if( (*dflt_name++ == 'D') && (*dflt_name++ == 'N')) { - strcpy(namebuf,dflt_name); + name = dflt_name; } else #endif /*NAMEBLOCK*/ loadstart: - strcpy(namebuf,dflname);/* re-initialize in case of loop */ - name = dflname; /* XXX check if needed */ + name = dflname; /* re-initialize in case of loop */ /* 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" @@ -152,85 +151,17 @@ loadstart: ouraddr, bootinfo.bi_basemem, bootinfo.bi_extmem, dosdev & 0x7f, devs[maj], unit, name); - /* - * Be paranoid and make doubly sure that the input buffer is empty. - */ - if(howto = (loadflags &= RB_SERIAL)) - init_serial(); /* clear all, but leave serial console */ - - if (!gets(namebuf)) { - putchar('\n'); - } - ptr = namebuf; - /* - * now parse out the boot options from what was given to us - * (or was read from the default string) - */ - while ((c = *ptr) != '\0') { - /* - * pass any leading (or inter-arg) spaces - */ - if (c == ' ') { - ptr++; - continue; - } - /* - * If it's an arg, take as many letters as we can - */ - if (c == '-') { - while ((c = *++ptr) != '\0') { - if (c == ' ') - break; - if (c == 'C') - howto |= RB_CDROM; - if (c == 'a') - howto |= RB_ASKNAME; - if (c == 'b') - howto |= RB_HALT; - if (c == 'c') - howto |= RB_CONFIG; - if (c == 'd') - howto |= RB_KDB; - if (c == 'h') { - howto ^= RB_SERIAL; - if (howto & RB_SERIAL) - init_serial(); - } - if (c == 'g') - howto |= RB_GDB; - if (c == 'r') - howto |= RB_DFLTROOT; - if (c == 's') - howto |= RB_SINGLE; - if (c == 'v') - howto |= RB_VERBOSE; - } - continue; - } - /* - * we have struck something that's not an arg, - * nor a space. - * break it off into a separate string.. "name" - * The default string will at least hit this.. - */ - name = ptr; - while (*++ptr != '\0') { - if (*ptr == ' ') { - *ptr++ = '\0'; - break; - } - } - } - loadflags = howto; - /* - * Now use "name" to try open the device and file for reading - */ + loadflags &= RB_SERIAL; /* clear all, but leave serial console */ + getbootdev(namebuf, &loadflags); ret = openrd(); if (ret != 0) { if (ret > 0) printf("Can't find %s\n", name); goto loadstart; } +/* if (inode.i_mode&IEXEC) + loadflags |= RB_KDB; +*/ loadprog(); goto loadstart; } @@ -363,3 +294,61 @@ loadprog(void) (int)&bootinfo + ouraddr); } +void +getbootdev(char *ptr, int *howto) +{ + char c; + + /* + * Be paranoid and make doubly sure that the input buffer is empty. + */ + if (*howto & RB_SERIAL) + init_serial(); + + if (!gets(ptr)) { + putchar('\n'); + return; + } + while ((c = *ptr) != '\0') { +nextarg: + while (c == ' ') + c = *++ptr; + if (c == '-') + while ((c = *++ptr) != '\0') { + if (c == ' ') + goto nextarg; + if (c == 'C') + *howto |= RB_CDROM; + if (c == 'a') + *howto |= RB_ASKNAME; + if (c == 'b') + *howto |= RB_HALT; + if (c == 'c') + *howto |= RB_CONFIG; + if (c == 'd') + *howto |= RB_KDB; + if (c == 'h') { + *howto ^= RB_SERIAL; + if (*howto & RB_SERIAL) + init_serial(); + } + if (c == 'g') + *howto |= RB_GDB; + if (c == 'r') + *howto |= RB_DFLTROOT; + if (c == 's') + *howto |= RB_SINGLE; + if (c == 'v') + *howto |= RB_VERBOSE; + } + if (c == '\0') + return; + name = ptr; + while (*++ptr != '\0') { + if (*ptr == ' ') { + *ptr++ = '\0'; + break; + } + } + } +} |
