diff --git a/sys/kern/kern_cons.c b/sys/kern/kern_cons.c --- a/sys/kern/kern_cons.c +++ b/sys/kern/kern_cons.c @@ -138,6 +138,17 @@ } +static void +mute_console(void *data __unused) +{ + if ((boothowto & RB_MUTEMSGS) == RB_MUTEMSGS) { + printf("-- Muting boot messages --\n"); + cn_mute = 1; + } +} + +SYSINIT(mute_console, SI_SUB_COPYRIGHT, SI_ORDER_ANY, mute_console, NULL); + void cninit(void) { diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c --- a/sys/kern/kern_shutdown.c +++ b/sys/kern/kern_shutdown.c @@ -942,6 +942,9 @@ newpanic = 1; } + /* Unmute when panic */ + cn_mute = 0; + if (newpanic) { (void)vsnprintf(buf, sizeof(buf), fmt, ap); panicstr = buf; diff --git a/sys/kern/subr_boot.c b/sys/kern/subr_boot.c --- a/sys/kern/subr_boot.c +++ b/sys/kern/subr_boot.c @@ -70,6 +70,7 @@ { "boot_gdb", RB_GDB}, { "boot_multicons", RB_MULTIPLE}, { "boot_mute", RB_MUTE}, + { "boot_mutemsgs", RB_MUTEMSGS}, { "boot_pause", RB_PAUSE}, { "boot_serial", RB_SERIAL}, { "boot_single", RB_SINGLE}, @@ -133,10 +134,10 @@ #if 0 /* Need to see if this is better or worse than the meat of the #else */ -static const char howto_switches[] = "aCdrgDmphsv"; +static const char howto_switches[] = "aCdrgDmMphsv"; static int howto_masks[] = { RB_ASKNAME, RB_CDROM, RB_KDB, RB_DFLTROOT, RB_GDB, RB_MULTIPLE, - RB_MUTE, RB_PAUSE, RB_SERIAL, RB_SINGLE, RB_VERBOSE + RB_MUTE, RB_MUTEMSGS, RB_PAUSE, RB_SERIAL, RB_SINGLE, RB_VERBOSE }; opts = strchr(kargs, '-'); @@ -160,6 +161,7 @@ case 'd': howto |= RB_KDB; break; case 'D': howto |= RB_MULTIPLE; break; case 'm': howto |= RB_MUTE; break; + case 'M': howto |= RB_MUTEMSGS; break; case 'g': howto |= RB_GDB; break; case 'h': howto |= RB_SERIAL; break; case 'p': howto |= RB_PAUSE; break; diff --git a/sys/sys/reboot.h b/sys/sys/reboot.h --- a/sys/sys/reboot.h +++ b/sys/sys/reboot.h @@ -60,6 +60,7 @@ #define RB_PAUSE 0x100000 /* pause after each output line during probe */ #define RB_REROOT 0x200000 /* unmount the rootfs and mount it again */ #define RB_POWERCYCLE 0x400000 /* Power cycle if possible */ +#define RB_MUTEMSGS 0x800000 /* start up with console muted after banner */ #define RB_PROBE 0x10000000 /* Probe multiple consoles */ #define RB_MULTIPLE 0x20000000 /* use multiple consoles */