summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>1996-09-05 21:12:06 +0000
committerjulian <julian@FreeBSD.org>1996-09-05 21:12:06 +0000
commit34657c737b0ff73e8b22204f4fabbfbd67fb63c2 (patch)
tree1fd7dc78749cae296a02b1574de86e82c67bb3ff
parentbdff9a8fc25f189e0e2102c399bc4c080e633273 (diff)
downloadFreeBSD-src-34657c737b0ff73e8b22204f4fabbfbd67fb63c2.zip
FreeBSD-src-34657c737b0ff73e8b22204f4fabbfbd67fb63c2.tar.gz
Back out the previous changes
I just couldn't get the code to be as small as it should have gotten.. atill a LITTLE bigger than before as I need to allow the default string to have options as well
-rw-r--r--sys/i386/boot/biosboot/Makefile4
-rw-r--r--sys/i386/boot/biosboot/boot.c157
2 files changed, 75 insertions, 86 deletions
diff --git a/sys/i386/boot/biosboot/Makefile b/sys/i386/boot/biosboot/Makefile
index 6eb76a6..4efe003 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 1f2e870..7aa19e9 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;
+ }
+ }
+ }
+}
OpenPOWER on IntegriCloud