Re: Colored kernel messages on serial console

"Jonathan A. Kollasch" <[email protected]> Mon, 27 Jul 2026 12:22:16 -0500
Newsgroups gmane.os.netbsd.devel.kernel
Message-ID <[email protected]>
On Mon, Jul 27, 2026 at 06:55:41PM +0200, Timo Buhrmester wrote:
> Without *really* knowing what I'm doing, I've just changed the kprintf
> to produce ANSI color sequences so that I'll get my familiar green
> kernel messages (after migrating from wscons to a serial console setup
> recently).
> 
> How insane is this?  It seems to work fine, but like I said, I'm not
> really familiar with the code.  And would NetBSD be interested in this,
> if it was implemented cleanly (i.e. color being configurable, etc.)?
> 
> (I realize it still needs something to stop it if the console is, say,
> wscons.  I figured a sysctl might be an okay choice, but if there is
> maybe a more automatic way to tell what console actually is...?)
> 
> I'd appreciate any input.

This is a bad idea; not every terminal is ANSI-compatible.  Furthermore,
it likely will foul up any curses programs on the console even more than
kernel printout already does.