Subject: Re: boot message
To: None <tech-embed@netbsd.org>
From: Stephen Borrill <netbsd@precedence.co.uk>
List: tech-kern
Date: 05/11/2005 09:17:12
On Mon, 4 Apr 2005, Hubert Feyrer wrote:
> On Sun, 3 Apr 2005, Marcin Jessa wrote:
> > Is there a way one can make a booting kernel be silent and not to spit
> > out all the info of what's going on? I wish my soekris build to be
> > quiet and display only boot loader's message and then go straight to
> > the login prompt.
>
> There are two ways to get that done:
>
> 1) re-enable console=pc, and make sure you have gettys enabled, esp.
> on your serial port (tty00).
>
> 2) Really tell the kernel to not print anything at all. I don't know to
> what extent that is supported, some support is available: printf(9)
> documents in the aprint_*() functions that you can set a "boothowto"
> variable to values like AB_QUIET, AB_VERBOSE and AB_SILENT.
>
> I think the variable can be set from the bootprompt, setting a default in
> src/sys/kern/init_main.c would make sense to me. You'll need to change the
> C file for that.
>
> In the bootloader, interrupt the countdown and type "boot -q".
> The result is not too impressive though:
>
> > boot -q
> booting hd0a:netbsd (howto 0x10000)
> 6746364+148460+522576 [376144+337471]=0x7c2458
These are from the bootloader, so will need to be dealt with separately.
> BIOS CFG: Model-SubM-Rev: fc-00-01, 0x4074<EBDA,KBDINT,RTC,IC2,KBDF>
> Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
> The NetBSD Foundation, Inc. All rights reserved.
> Copyright (c) 1982, 1986, 1989, 1991, 1993
> The Regents of the University of California. All rights reserved.
>
> NetBSD 2.0.1 (GENERIC_IPSEC) #0: Sun Feb 27 00:57:26 CET 2005
>
> feyrer@vulab.fh-regensburg.de:/disk4/cvs/src-2.0/sys/arch/i386/compile/obj.i386/GENERIC_IPSEC
> total memory = 32380 KB
> avail memory = 23780 KB
> BIOS32 rev. 0 found at 0xf9700
> Found mainbus0 (root)
> Found cpu0 at mainbus0: (uniprocessor)
> cpu0: Intel Pentium Pro (686-class), 801.13 MHz, id 0x613
> cpu0: features a1bd<FPU,DE,PSE,TSC,MSR,MCE,CX8>
> cpu0: features a1bd<PGE,CMOV>
> cpu0: I-cache 8 KB 32B/line 4-way
> cpu0: L2 cache 128 KB 32B/line 4-way
> cpu0: 8 page colors
> Found pci0 at mainbus0: configuration mode 1
> Found pchb0 at pci0
> pchb0: Intel 82441FX PCI and Memory Controller (PMC) (rev. 0x02)
> Found pcib0 at pci0
> pcib0: Intel 82371SB PCI-to-ISA Bridge (PIIX3) (rev. 0x00)
> Found piixide0 at pci0: disk controller
> piixide0: primary channel interrupting at irq 14
> Found atabus0 at piixide0
> piixide0: secondary channel interrupting at irq 15
As Jason says elsewhere, the verbosity here is mainly from various i386
files using printf rather than aprint_normal. The duplication is down to
the standard verbose output coming from print and then the AB_QUIET flag
using aprint_naive to give the "Found" lines.
> I didn't find anything in the boot(8) manpage that indicates how to set
> AB_SILENT (or AB_QUIET?). Try modifying the named .c file.
In an ideal world:
-q = AB_QUIET => Found xx at yy
-z = AB_SILENT => Detecting hardware, twiddle, then done.
A quick hacky work around is to duplicate the console/buffer logic from aprint_normal
to printf as below. If you want it completely silent, comment out the lines in subr_autoconf.c
that print "Detecting hardware", "done" and stick a return in twiddle() (don't just force
config_do_twiddle to 0 as this is logically mixed up with AB_QUIET mode in config_attach()).
--- kern/subr_prf.c.orig 2004-03-23 13:22:04.000000000 +0000
+++ kern/subr_prf.c 2005-05-10 17:02:11.000000000 +0100
@@ -735,12 +754,17 @@
printf(const char *fmt, ...)
{
va_list ap;
- int s;
+ int s, flags = TOLOG;
+
+ if ((boothowto & (AB_SILENT|AB_QUIET)) == 0 ||
+ (boothowto & AB_VERBOSE) != 0)
+ flags |= TOCONS;
+
KPRINTF_MUTEX_ENTER(s);
va_start(ap, fmt);
- kprintf(fmt, TOCONS | TOLOG, NULL, NULL, ap);
+ kprintf(fmt, flags, NULL, NULL, ap);
va_end(ap);
KPRINTF_MUTEX_EXIT(s);
--
Stephen