diff options
author | Maxim Sobolev <sobomax@FreeBSD.org> | 2005-05-19 23:03:02 +0000 |
---|---|---|
committer | Maxim Sobolev <sobomax@FreeBSD.org> | 2005-05-19 23:03:02 +0000 |
commit | 4d87b291ad993a6d5bd6bef337fdff61d9b336be (patch) | |
tree | 8e5490c9d15ae0ad031a22eae3ccbd92f650349c | |
parent | cf87ad7afd8bec145966abb7b603380e8904684a (diff) |
Notes
-rw-r--r-- | sys/boot/common/boot.c | 61 | ||||
-rw-r--r-- | sys/boot/common/help.common | 2 | ||||
-rw-r--r-- | sys/boot/common/loader.8 | 31 | ||||
-rw-r--r-- | sys/boot/forth/loader.conf | 5 |
4 files changed, 70 insertions, 29 deletions
diff --git a/sys/boot/common/boot.c b/sys/boot/common/boot.c index ca5c15d2dd23..515d0fa1f4a0 100644 --- a/sys/boot/common/boot.c +++ b/sys/boot/common/boot.c @@ -166,15 +166,14 @@ autoboot(int timeout, char *prompt) autoboot_tried = 1; if (timeout == -1) { + timeout = 10; /* try to get a delay from the environment */ if ((cp = getenv("autoboot_delay"))) { timeout = strtol(cp, &ep, 0); if (cp == ep) - timeout = -1; + timeout = 10; /* Unparseable? Set default! */ } } - if (timeout == -1) /* all else fails */ - timeout = 10; kernelname = getenv("kernelname"); if (kernelname == NULL) { @@ -187,32 +186,38 @@ autoboot(int timeout, char *prompt) } } - otime = time(NULL); - when = otime + timeout; /* when to boot */ - yes = 0; - - printf("%s\n", (prompt == NULL) ? "Hit [Enter] to boot immediately, or any other key for command prompt." : prompt); - - for (;;) { - if (ischar()) { - c = getchar(); - if ((c == '\r') || (c == '\n')) - yes = 1; - break; - } - ntime = time(NULL); - if (ntime >= when) { - yes = 1; - break; - } - - if (ntime != otime) { - printf("\rBooting [%s] in %d second%s... ", - kernelname, (int)(when - ntime), - (when-ntime)==1?"":"s"); - otime = ntime; - } + if (timeout >= 0) { + otime = time(NULL); + when = otime + timeout; /* when to boot */ + + yes = 0; + + printf("%s\n", (prompt == NULL) ? "Hit [Enter] to boot immediately, or any other key for command prompt." : prompt); + + for (;;) { + if (ischar()) { + c = getchar(); + if ((c == '\r') || (c == '\n')) + yes = 1; + break; + } + ntime = time(NULL); + if (ntime >= when) { + yes = 1; + break; + } + + if (ntime != otime) { + printf("\rBooting [%s] in %d second%s... ", + kernelname, (int)(when - ntime), + (when-ntime)==1?"":"s"); + otime = ntime; + } + } + } else { + yes = 1; } + if (yes) printf("\rBooting [%s]... ", kernelname); putchar('\n'); diff --git a/sys/boot/common/help.common b/sys/boot/common/help.common index 02bc3769ea04..036f06b54778 100644 --- a/sys/boot/common/help.common +++ b/sys/boot/common/help.common @@ -133,6 +133,8 @@ set autoboot_delay=<value> Sets the default delay for the autoboot command to <value> seconds. + Set value to -1 if you don't want to allow user to interrupt autoboot + process and escape to the loader prompt. ################################################################################ # Tset Sbootfile DSet the default boot file set diff --git a/sys/boot/common/loader.8 b/sys/boot/common/loader.8 index 67a5869b4233..b67f8bf28ec2 100644 --- a/sys/boot/common/loader.8 +++ b/sys/boot/common/loader.8 @@ -111,6 +111,21 @@ If the system gets past this point, will be set and .Nm will engage interactive mode. +Please note that historically even when +.Va autoboot_delay +is set to +.Dq 0 +user will be able to interrupt autoboot process by pressing some key +on the console while kernel and modules are being loaded. In some +cases such behaviour may be undesirable, to prevent it set +.Va autoboot_delay +to +.Dq -1 , +in this case +.Nm +will engage interactive mode only if +.Ic autoboot +has failed. .Sh BUILTIN COMMANDS In .Nm , @@ -329,6 +344,22 @@ will be automatically attempted after processing though explicit .Ic autoboot Ns 's will be processed normally, defaulting to 10 seconds delay. +.Pp +If set to +.Dq 0 +no delay will inserted, but user still will be able to interrupt +.Ic autoboot +process and escape into the interactive mode by pressing some key +on the console while kernel and +modules are being loaded. +.Pp +If set to +.Dq -1 +no delay will inserted and +.Nm +will engange interactive mode only if +.Ic autoboot +has failed for some reason. .It Va boot_askname Instructs the kernel to prompt the user for the name of the root device when the kernel is booted. diff --git a/sys/boot/forth/loader.conf b/sys/boot/forth/loader.conf index 44963575efe6..9b0c9cd927e5 100644 --- a/sys/boot/forth/loader.conf +++ b/sys/boot/forth/loader.conf @@ -42,7 +42,10 @@ loader_color="NO" # Set this to YES to enable splash screen colors ### Loader settings ######################################## ############################################################## -#autoboot_delay="10" # Delay in seconds before autobooting +#autoboot_delay="10" # Delay in seconds before autobooting, + # set to -1 if you don't want user to be + # allowed to interrupt autoboot process and + # escape to the loader prompt #beastie_disable="NO" # Turn the beastie boot menu on and off #console="vidconsole" # Set the current console #currdev="disk1s1a" # Set the current device |