[coreboot] Tinycurses depends on active video console.

Ulf Jordan jordan at chalmers.se
Wed Oct 1 22:37:16 CEST 2008


On Wed, 1 Oct 2008, Patrick Georgi wrote:

> Mats Erik Andersson schrieb:
>> Index: libpayload/curses/tinycurses.c
>> ===================================================================
>> --- libpayload/curses/tinycurses.c	(revision 3623)
>> +++ libpayload/curses/tinycurses.c	(arbetskopia)
>> @@ -736,8 +736,10 @@
>>  		for (x = win->_line[y].firstchar; x <= 
>> win->_line[y].lastchar; x++) {
>>  			attr_t attr = win->_line[y].text[x].attr;
>>  +#ifdef CONFIG_VIDEO_CONSOLE
>>  			unsigned int c =
>>  				((int)color_pairs[PAIR_NUMBER(attr)]) << 8;
>> +#endif
>>   #ifdef CONFIG_SERIAL_CONSOLE
>>  			if (curses_flags & F_ENABLE_SERIAL) {
>> 
> how about just moving that variable down to the #ifdef block that uses it? 
> color_pairs[] or attr aren't changed inbetween, afaics.

I agree, it seems better to move it down to the video console block where 
it is actually used. The attached patch does exactly that, and is compile 
and runtime tested with coreinfo+libpayload+coreboot-v3 under QEMU.

/ulf
-------------- next part --------------
Fix tinycurses compilation when only serial console is enabled (unused variable
c caught by -Wall -Werror). Thanks to Mats Erik Andersson for spotting this.

Signed-off-by: Ulf Jordan <jordan at chalmers.se>

Index: libpayload/curses/tinycurses.c
===================================================================
--- libpayload/curses/tinycurses.c	(revision 3625)
+++ libpayload/curses/tinycurses.c	(working copy)
@@ -736,9 +736,6 @@
 		for (x = win->_line[y].firstchar; x <= win->_line[y].lastchar; x++) {
 			attr_t attr = win->_line[y].text[x].attr;
 
-			unsigned int c =
-				((int)color_pairs[PAIR_NUMBER(attr)]) << 8;
-
 #ifdef CONFIG_SERIAL_CONSOLE
 			if (curses_flags & F_ENABLE_SERIAL) {
 				ch = win->_line[y].text[x].chars[0];
@@ -806,6 +803,9 @@
 			}
 #endif
 #ifdef CONFIG_VIDEO_CONSOLE
+			unsigned int c =
+				((int)color_pairs[PAIR_NUMBER(attr)]) << 8;
+
 			c = SWAP_RED_BLUE(c);
 
 			if (curses_flags & F_ENABLE_CONSOLE) {


More information about the coreboot mailing list