Re: console color code location?

Marco d'Itri (md@linux.it)
Tue, 2 Nov 1999 11:30:57 +0100


On Nov 02, Alexander Viro <viro@math.psu.edu> wrote:

>D'oh. There is _one_ place where you can't control it with setterm -
>initial messages upon boot. Dunno why it might be needed, but anyway:
>paletter sits in color_table[], default_{red,grn,blu}[], colors are set in
>vc_init() (all in drivers/char/console.c). But really, what's the point of
>that exercise? Use setterm in rc scripts and there you go. It's not like
>you were going to see boot messages that often...
I use this hack to colorize kernel messages.

--- printk.c.orig Tue Aug 10 13:03:03 1999
+++ printk.c Tue Aug 10 13:09:40 1999
@@ -20,6 +20,10 @@

#include <asm/uaccess.h>

+extern int fg_console; /* linux/tty.h */
+#include <linux/console_struct.h> /* vc_cons */
+#define attr (vc_cons[fg_console].d->vc_attr) /*drivers/char/console_macros.h*/
+
#define LOG_BUF_LEN (16384)

static char buf[1024];
@@ -274,11 +278,14 @@
}
if (msg_level < console_loglevel && console_drivers) {
struct console *c = console_drivers;
+ unsigned char s_attr = attr;
+ attr |= 0x08;
while(c) {
if ((c->flags & CON_ENABLED) && c->write)
c->write(c, msg, p - msg + line_feed);
c = c->next;
}
+ attr = s_attr;
}
if (line_feed)
msg_level = -1;

-- 
ciao,
Marco

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/