boot (and kernel) message background and color

fluca1978

Aspiring Daemon

Reaction score: 70
Messages: 735

Hi all,
I was wondering if there is any way to configure the color and the background of kernel messages, that on the console are printed as light white (37m) while, for instance, in OpenBSD are yellow on blue background. Moreover I don't see where this trick is done, since the kernel uses the normal printf(2) (or at least I think so) as in the following snippet from sys/kern/vfs_mountroot.c:

Code:
 if (strcmp(fs, "zfs") != 0 && dev[0] != '\0' &&                                    
            !parse_mount_dev_present(dev)) {                                               
                printf("mountroot: waiting for device %s ...\n", dev);                     
                delay = hz / 10;
It should not be a console setting, since on the console are printed also normal chars, therefore if anyone can provide me some clues it will be very interesting for me.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 7,562
Messages: 30,279

It's a kernel option. Have a look in /usr/src/sys/conf/NOTES:
Code:
# The following options will let you change the default colors of syscons.
options         SC_NORM_ATTR=(FG_GREEN|BG_BLACK)
options         SC_NORM_REV_ATTR=(FG_YELLOW|BG_GREEN)
options         SC_KERNEL_CONS_ATTR=(FG_RED|BG_BLACK)
options         SC_KERNEL_CONS_REV_ATTR=(FG_BLACK|BG_RED)
 
Top