[FreeBSD] Kernel fonts and colors. - BSD

Users browsing this thread: 2 Guest(s)
yrmt
Grey Hair Nixers
These changes require you to recompile your kernel.

- Change the colors, add this to your kernel configuration.


options SC_KERNEL_CONS_ATTR=(FG_LIGHTRED|BG_BLACK)
options SC_KERNEL_CONS_REV_ATTR=(FG_BLACK|BG_RED)

This will set a light red kernel foreground output and black background.
If you want to emulate NetBSD colors, use a green foreground :P

colors are from a raw palette in C. ( u_char palette[256 * 3]; (syscons.h)

- Change the kernel font, add this in your kernel configuration:

options SC_DFLT_FONT
makeoptions SC_DFLT_FONT=iso15-thin

I wanted to have a thin font for kernel messages.

It failed the first time I ran it, saying I didn't have a font.h. We'll generate the font manually.

I found the part talking about our font.h missing in the kernel source:
(/usr/src/sys/conf/files.i386)

-- change this:
font.h optional sc_dflt_font \
compile-with "uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x16.fnt && file2c 'static u_char dflt_font_16[16*256] = {' '};' < ${SC_DFLT_FONT}-8x16 > font.h && uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x14.fnt && file2c 'static u_char dflt_font_14[14*256] = {' '};' < ${SC_DFLT_FONT}-8x14 >> font.h && uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x8.fnt && file2c 'static u_char dflt_font_8[8*256] = {' '};' < ${SC_DFLT_FONT}-8x8 >> font.h" \
no-obj no-implicit-rule before-depend \
clean "font.h ${SC_DFLT_FONT}-8x14 ${SC_DFLT_FONT}-8x16 ${SC_DFLT_FONT}-8x8"
#
-- to this:
font.h optional sc_dflt_font \
compile-with "uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x16.fnt && file2c 'static u_char dflt_font_16[16*256] = {' '};' < ${SC_DFLT_FONT}-8x16 > font.h" \
no-obj no-implicit-rule before-depend \
#clean "font.h ${SC_DFLT_FONT}-8x14 ${SC_DFLT_FONT}-8x16 ${SC_DFLT_FONT}-8x8"
#

Now we must generate the font.h file with the instructions found above:

uudecode < /usr/share/syscons/fonts/iso15-thin-8x16.fnt > ~/font.h

then we convert this file to a c file:

file2c 'static u_char dflt_font_16[16*256] = {' '};' < iso15-thin-8x16 > font.h

then we can move the font.h file to /usr/src/sys/dev/syscons and compile the kernel. The font won't look as thin as normally because the framebuffer size during boot is fixed at 640x380 but it still looks much nicer.
CrossFold
Long time nixers
Thank you so much ! :D I was wondering when you would reveal the secret of your customization !
yrmt
Grey Hair Nixers
Haha no problem.
ducpfp
Registered
Dear, Beastie.
Thanks for the useful info. I successfully change the color.
I'm currently having problem with font upon recompiling kernel. I got the error message as follow:

/usr/src/sys/dev/syscons/syscons.c: In function 'scinit':
/usr/src/sys/dev/syscons/syscons.c:2913: error: 'dflt_font_8' undeclared (first use in this function)
/usr/src/sys/dev/syscons/syscons.c:2913: error: (Each undeclared identifier is reported only once
/usr/src/sys/dev/syscons/syscons.c:2913: error: for each function it appears in.)
/usr/src/sys/dev/syscons/syscons.c:2914: error: 'dflt_font_14' undeclared (first use in this function)
*** Error code 1

I'm using FreeBSD 9.0p4.
Could you give me some comment on this ? Thanks.
yrmt
Grey Hair Nixers
it means, this part

file2c 'static u_char dflt_font_16[16256] = {' '};' < ${SC_DFLT_FONT}-8x16 > font.h"

didn't go well, check the font.h manually
ducpfp
Registered
Thanks, I fixed the issue by commenting out these two lines from syscons.c:

bcopy(dflt_font_8, sc->font_8, sizeof(dflt_font_8));
bcopy(dflt_font_14, sc->font_14, sizeof(dflt_font_14));
yrmt
Grey Hair Nixers
Great ;) Now the thing I really want is a ramdisk with higher framebuffer size at boot.
yrmt
Grey Hair Nixers