diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2009-04-30 01:12:45 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2009-04-30 01:12:45 +0000 |
commit | c4e186805a0e3fdc696e564818fa7de1ad3ef1fb (patch) | |
tree | 70cefc826825783780be64ec3a01231ccedc4ffd /sys/stand | |
parent | ae07c46226164af866e3434cd0e57e09dbcbb519 (diff) |
add another settable variable called db_console which the MD parts of a
bootloader will pass to the kernel to allow you to force ddb.console to be
set (and set early) on a machine without having to do it on a per kernel
basis using code or config tweaks.
requested by art@ (who owes me good whiskey now)
no problem! deraadt@
Diffstat (limited to 'sys/stand')
-rw-r--r-- | sys/stand/boot/vars.c | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/sys/stand/boot/vars.c b/sys/stand/boot/vars.c index d889be91945..4cb31d95924 100644 --- a/sys/stand/boot/vars.c +++ b/sys/stand/boot/vars.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vars.c,v 1.13 2005/05/24 20:48:35 uwe Exp $ */ +/* $OpenBSD: vars.c,v 1.14 2009/04/30 01:12:44 dlg Exp $ */ /* * Copyright (c) 1998-2000 Michael Shalayeff @@ -35,12 +35,14 @@ extern char prog_ident[]; extern int debug; +int db_console = -1; static int Xaddr(void); static int Xdevice(void); #ifdef DEBUG static int Xdebug(void); #endif +static int Xdb_console(void); static int Ximage(void); static int Xhowto(void); static int Xtty(void); @@ -58,6 +60,7 @@ const struct cmd_table cmd_set[] = { {"tty", CMDT_VAR, Xtty}, {"image", CMDT_VAR, Ximage}, {"timeout",CMDT_VAR, Xtimeout}, + {"db_console", CMDT_VAR, Xdb_console}, {NULL,0} }; @@ -75,6 +78,33 @@ Xdebug(void) } #endif +int +Xdb_console(void) +{ + if (cmd.argc != 2) { + switch (db_console) { + case 0: + printf("off\n"); + break; + case 1: + printf("on\n"); + break; + default: + printf("unset\n"); + break; + } + } else { + if (strcmp(cmd.argv[1], "0") == 0 || + strcmp(cmd.argv[1], "off") == 0) + db_console = 0; + else if (strcmp(cmd.argv[1], "1") == 0 || + strcmp(cmd.argv[1], "on") == 0) + db_console = 1; + } + + return (0); +} + static int Xtimeout(void) { |