summaryrefslogtreecommitdiff
path: root/sys/arch/i386/boot/boot.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1995-12-26 20:27:57 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1995-12-26 20:27:57 +0000
commitab136f3b0281b670e205bb6668de0216921c1ac4 (patch)
tree57fc515e3425b93be3b43b2d72f919a6aa950146 /sys/arch/i386/boot/boot.c
parent1761d011b4a83a9818c0a207dae66dbcbf764e69 (diff)
from perry:
fix my own pr 1762, in which it was noted that boot2 used a busy loop to time out the boot prompt. Now uses a usleep() routine that calls the BIOS and the functionality is separate from gets(). Timeout is #defined to 5 seconds. Also did some minor cleanup in preparation to prototype/ANSIfy everything. (problem was originally reported by deraadt a number of years ago)
Diffstat (limited to 'sys/arch/i386/boot/boot.c')
-rw-r--r--sys/arch/i386/boot/boot.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/sys/arch/i386/boot/boot.c b/sys/arch/i386/boot/boot.c
index a3350b21001..ff5de40769a 100644
--- a/sys/arch/i386/boot/boot.c
+++ b/sys/arch/i386/boot/boot.c
@@ -1,4 +1,4 @@
-/* $NetBSD: boot.c,v 1.28 1995/03/12 00:10:57 mycroft Exp $ */
+/* $NetBSD: boot.c,v 1.29 1995/12/23 17:21:27 perry Exp $ */
/*
* Ported to boot 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
@@ -63,22 +63,29 @@ int cflag;
#endif
char *name;
char *names[] = {
- "/bsd", "/obsd", "/bsd.old",
+ "/netbsd", "/onetbsd", "/netbsd.old",
};
#define NUMNAMES (sizeof(names)/sizeof(char *))
-extern char *version;
+/* Number of seconds that prompt should wait during boot */
+#define PROMPTWAIT 5
+
+static void getbootdev __P((int *howto));
+static void loadprog __P((int howto));
+extern char *version;
extern int end;
+
+void
boot(drive)
-int drive;
+ int drive;
{
int loadflags, currname = 0;
char *t;
printf("\n"
- ">> OpenBSD BOOT: %d/%d k [%s]\n"
- "use hd(1,a)/bsd to boot sd0 when wd0 is also installed\n",
+ ">> NetBSD BOOT: %d/%d k [%s]\n"
+ "use hd(1,a)/netbsd to boot sd0 when wd0 is also installed\n",
argv[7] = memsize(0),
argv[8] = memsize(1),
version);
@@ -106,8 +113,9 @@ loadstart:
goto loadstart;
}
+static void
loadprog(howto)
- int howto;
+ int howto;
{
long int startaddr;
long int addr; /* physical address.. not directly useable */
@@ -265,17 +273,18 @@ nosyms:
startprog((int)startaddr, argv);
}
-char namebuf[100];
+static void
getbootdev(howto)
int *howto;
{
+ static char namebuf[100]; /* don't allocate on stack! */
char c, *ptr = namebuf;
printf("Boot: [[[%s(%d,%c)]%s][-adrs]] :- ",
devs[maj], unit, 'a'+part, name);
#ifdef CHECKSUM
cflag = 0;
#endif
- if (gets(namebuf)) {
+ if (awaitkey(PROMPTWAIT) && gets(namebuf)) {
while (c = *ptr) {
while (c == ' ')
c = *++ptr;