Colored kernel message output Gives kernel messages on the console an OpenBSD-esque color to distinguish them from regular tty (as long as that's not colored too) text. Inspired by cko (iirc http://freshmeat.net/p/cko/), but better implementation done by myself (handles newlines correctly). Signed-off-by: Jan Engelhardt <jengelh@gmx.de> Kconfig | 28 ++++++++++++++++++++++++++++ vt.c | 22 ++++++++++++++++++++++ 2 files changed, 50 insertions(+) Index: linux-2.6.21-rc5/drivers/char/Kconfig =================================================================== --- linux-2.6.21-rc5.orig/drivers/char/Kconfig +++ linux-2.6.21-rc5/drivers/char/Kconfig @@ -57,6 +57,34 @@ config VT_CONSOLE If unsure, say Y. +config VT_CKO + hex "Colored kernel message output" + range 0x00 0xFF + depends on VT_CONSOLE + default 0x17 + ---help--- + This option will give you ability to change the color of + kernel messages. + + The value you need to enter here is the ASCII color value + composed (OR'ed) by one foreground color, one background + color and any number of attributes as follows: + + Foreground: Background: Attributes: + 0x01 blue 0x10 blue 0x08 highlight foreground + 0x02 green 0x20 green 0x80 blinking foreground + 0x03 cyan 0x30 cyan + 0x04 red 0x40 red + 0x05 magenta 0x50 red + 0x06 brown 0x60 brown + 0x07 gray 0x70 gray + + Thus, 0x17 will yield gray-on-blue like you can see in + OpenBSD, 0x02 the green-on-black like on NetBSD. + Using "highlight foreground" does not work when you use + VGA Console and fonts with 512 glyphs. + VGA Framebuffer is not affected. + config HW_CONSOLE bool depends on VT && !S390 && !UML Index: linux-2.6.21-rc5/drivers/char/vt.c =================================================================== --- linux-2.6.21-rc5.orig/drivers/char/vt.c +++ linux-2.6.21-rc5/drivers/char/vt.c @@ -73,6 +73,7 @@ */ #include <linux/module.h> +#include <linux/moduleparam.h> #include <linux/types.h> #include <linux/sched.h> #include <linux/tty.h> @@ -2234,6 +2235,17 @@ struct tty_driver *console_driver; #ifdef CONFIG_VT_CONSOLE +static unsigned int cko_color = CONFIG_VT_CKO; + +static __init int set_cko(char *str) +{ + cko_color = simple_strtoul(str, NULL, 0); + return 1; +} + +__setup("cko=", set_cko); +module_param(cko_color, uint, S_IRUGO | S_IWUSR); + /* * Console on virtual terminal * @@ -2274,12 +2286,16 @@ static void vt_console_print(struct cons hide_cursor(vc); start = (ushort *)vc->vc_pos; + vc->vc_color = cko_color; + update_attr(vc); /* Contrived structure to try to emulate original need_wrap behaviour * Problems caused when we have need_wrap set on '\n' character */ while (count--) { c = *b++; if (c == 10 || c == 13 || c == 8 || vc->vc_need_wrap) { + vc->vc_color = vc->vc_def_color; + update_attr(vc); if (cnt > 0) { if (CON_IS_VISIBLE(vc)) vc->vc_sw->con_putcs(vc, start, cnt, vc->vc_y, vc->vc_x); @@ -2292,6 +2308,8 @@ static void vt_console_print(struct cons bs(vc); start = (ushort *)vc->vc_pos; myx = vc->vc_x; + vc->vc_color = cko_color; + update_attr(vc); continue; } if (c != 13) @@ -2299,6 +2317,8 @@ static void vt_console_print(struct cons cr(vc); start = (ushort *)vc->vc_pos; myx = vc->vc_x; + vc->vc_color = cko_color; + update_attr(vc); if (c == 10 || c == 13) continue; } @@ -2320,6 +2340,8 @@ static void vt_console_print(struct cons vc->vc_need_wrap = 1; } } + vc->vc_color = vc->vc_def_color; + update_attr(vc); set_cursor(vc); quit: #<EOF> -
| Tarkan Erimer | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| Greg KH | [GIT PATCH] driver core patches against 2.6.24 |
| Jeff Garzik | Re: [Patch v2] Make PCI extended config space (MMCONFIG) a driver opt-in |
| Bart Van Assche | Integration of SCST in the mainstream Linux kernel |
git: | |
| Jakub Narebski | Re: VCS comparison table |
| Junio C Hamano | Re: [PATCH] Teach remote machinery about remotes.default config variable |
| Ping Yin | why still no empty directory support in git |
| Jon Smirl | ! [rejected] master -> master (non-fast forward) |
| Richard Stallman | Real men don't attack straw men |
| Theo de Raadt | That whole "Linux stealing our code" thing |
| Diana Eichert | Re: bcw(4) is gone |
| Didier Wiroth | win32-codecs, avi and amd64 question |
| Jarek Poplawski | [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Gerrit Renker | [PATCH 27/37] dccp: Integration of dynamic feature activation - part 2 (server side) |
| Ayaz Abdulla | [PATCH] forcedeth: msi interrupts |
| KOVACS Krisztian | [PATCH 10/14] iptables socket match |
