From 67873bb7a8246bf8d6726b0912d5d7de275e340a Mon Sep 17 00:00:00 2001 From: pb Date: Sat, 23 Mar 2002 19:40:27 +0000 Subject: Add option -n to i386 boot2 to disallow boot interruption by keypress. PR: i386/36016 Submitted by: Thomas Quinot Reviewed by: rnordier MFC after: 1 week --- sbin/reboot/boot_i386.8 | 6 +++++- sys/boot/i386/boot2/boot2.c | 10 ++++++++-- sys/boot/i386/gptboot/gptboot.c | 10 ++++++++-- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/sbin/reboot/boot_i386.8 b/sbin/reboot/boot_i386.8 index 81ab28e..3521fd0 100644 --- a/sbin/reboot/boot_i386.8 +++ b/sbin/reboot/boot_i386.8 @@ -71,7 +71,9 @@ However, it is possible to dispense with the third stage altogether, either by specifying a kernel name in the boot block parameter file, .Pa /boot.config , -or by hitting a key during a brief pause (while one of the characters +or, unless option +.Fl n +is set, by hitting a key during a brief pause (while one of the characters .Sy - , .Sy \e , .Sy \&| , @@ -230,6 +232,8 @@ option described here. See the man page for for more details. .It Fl m mute the console. +.It Fl n +ignore key press to interrupt boot before loader(8) is invoked. .It Fl P probe the keyboard. If no keyboard is found, the .Fl D diff --git a/sys/boot/i386/boot2/boot2.c b/sys/boot/i386/boot2/boot2.c index 520753d..955c592 100644 --- a/sys/boot/i386/boot2/boot2.c +++ b/sys/boot/i386/boot2/boot2.c @@ -50,6 +50,7 @@ #define RBX_PAUSE 0x12 /* -p */ #define RBX_DUAL 0x1d /* -D */ #define RBX_PROBEKBD 0x1e /* -P */ +#define RBX_NOINTR 0x1f /* -n */ #define RBX_MASK 0x2005ffff @@ -58,7 +59,7 @@ #define PATH_KERNEL "/kernel" #define ARGS 0x900 -#define NOPT 13 +#define NOPT 14 #define NDEV 5 #define MEM_BASE 0x12 #define MEM_EXT 0x15 @@ -100,7 +101,7 @@ static struct dmadat { extern uint32_t _end; -static const char optstr[NOPT] = "DhaCcdgmPprsv"; +static const char optstr[NOPT] = "DhaCcdgmnPprsv"; static const unsigned char flags[NOPT] = { RBX_DUAL, RBX_SERIAL, @@ -110,6 +111,7 @@ static const unsigned char flags[NOPT] = { RBX_KDB, RBX_GDB, RBX_MUTE, + RBX_NOINTR, RBX_PROBEKBD, RBX_PAUSE, RBX_DFLTROOT, @@ -775,6 +777,8 @@ keyhit(unsigned ticks) { uint32_t t0, t1; + if (opts & 1 << RBX_NOINTR) + return 0; t0 = 0; for (;;) { if (xgetc(1)) @@ -800,6 +804,8 @@ xputc(int c) static int xgetc(int fn) { + if (opts & 1 << RBX_NOINTR) + return 0; for (;;) { if (ioctrl & 0x1 && getc(1)) return fn ? 1 : getc(0); diff --git a/sys/boot/i386/gptboot/gptboot.c b/sys/boot/i386/gptboot/gptboot.c index 520753d..955c592 100644 --- a/sys/boot/i386/gptboot/gptboot.c +++ b/sys/boot/i386/gptboot/gptboot.c @@ -50,6 +50,7 @@ #define RBX_PAUSE 0x12 /* -p */ #define RBX_DUAL 0x1d /* -D */ #define RBX_PROBEKBD 0x1e /* -P */ +#define RBX_NOINTR 0x1f /* -n */ #define RBX_MASK 0x2005ffff @@ -58,7 +59,7 @@ #define PATH_KERNEL "/kernel" #define ARGS 0x900 -#define NOPT 13 +#define NOPT 14 #define NDEV 5 #define MEM_BASE 0x12 #define MEM_EXT 0x15 @@ -100,7 +101,7 @@ static struct dmadat { extern uint32_t _end; -static const char optstr[NOPT] = "DhaCcdgmPprsv"; +static const char optstr[NOPT] = "DhaCcdgmnPprsv"; static const unsigned char flags[NOPT] = { RBX_DUAL, RBX_SERIAL, @@ -110,6 +111,7 @@ static const unsigned char flags[NOPT] = { RBX_KDB, RBX_GDB, RBX_MUTE, + RBX_NOINTR, RBX_PROBEKBD, RBX_PAUSE, RBX_DFLTROOT, @@ -775,6 +777,8 @@ keyhit(unsigned ticks) { uint32_t t0, t1; + if (opts & 1 << RBX_NOINTR) + return 0; t0 = 0; for (;;) { if (xgetc(1)) @@ -800,6 +804,8 @@ xputc(int c) static int xgetc(int fn) { + if (opts & 1 << RBX_NOINTR) + return 0; for (;;) { if (ioctrl & 0x1 && getc(1)) return fn ? 1 : getc(0); -- cgit v1.1