mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-26 20:12:44 +00:00
cons: Add boot option to mute boot messages after banner
This is useful for embedded systems, where it provides feedback that the kernel has booted, but avoids printing the probe messages. If both mutemsgs and verbose are set, verbose cancels the mute. Additionally, this unmutes the console on panic, so a user can see what happened leading up to the panic. Obtained from: Juniper Networks, Inc.
This commit is contained in:
parent
21aba39655
commit
2cb4909011
@ -103,7 +103,7 @@ int cons_avail_mask = 0; /* Bit mask. Each registered low level console
|
||||
* this bit cleared.
|
||||
*/
|
||||
|
||||
static int cn_mute;
|
||||
int cn_mute;
|
||||
SYSCTL_INT(_kern, OID_AUTO, consmute, CTLFLAG_RW, &cn_mute, 0,
|
||||
"State of the console muting");
|
||||
|
||||
@ -138,6 +138,18 @@ kbdinit(void)
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
mute_console(void *data __unused)
|
||||
{
|
||||
|
||||
if ((boothowto & (RB_MUTEMSGS | RB_VERBOSE)) == 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)
|
||||
{
|
||||
|
@ -942,6 +942,9 @@ vpanic(const char *fmt, va_list ap)
|
||||
newpanic = 1;
|
||||
}
|
||||
|
||||
/* Unmute when panic */
|
||||
cn_mute = 0;
|
||||
|
||||
if (newpanic) {
|
||||
(void)vsnprintf(buf, sizeof(buf), fmt, ap);
|
||||
panicstr = buf;
|
||||
|
@ -70,6 +70,7 @@ static struct
|
||||
{ "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 @@ boot_parse_arg(const char *v)
|
||||
|
||||
#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 @@ static int howto_masks[] = {
|
||||
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;
|
||||
|
@ -94,6 +94,8 @@ struct consdev {
|
||||
|
||||
#ifdef _KERNEL
|
||||
|
||||
extern int cn_mute;
|
||||
|
||||
extern struct msgbuf consmsgbuf; /* Message buffer for constty. */
|
||||
extern struct tty *constty; /* Temporary virtual console. */
|
||||
|
||||
|
@ -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 */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user