Browse Source

[debug] Allow debug colourisation to be disabled

Some BIOS console redirection capabilities do not work well with the
colourised debug messages used by iPXE.  We already allow the range of
colours to be controlled via the DBGCOL=... build parameter.  Extend
this syntax to allow DBGCOL=0 to be used to mean "disable colours".

Requested-by: Wissam Shoukair <wissams@mellanox.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 8 years ago
parent
commit
47dcd392dc
2 changed files with 11 additions and 5 deletions
  1. 2
    2
      src/Makefile.housekeeping
  2. 9
    3
      src/core/debug.c

+ 2
- 2
src/Makefile.housekeeping View File

@@ -734,8 +734,8 @@ $(DBGCOL_LIST) : $(MAKEDEPS)
734 734
 VERYCLEANUP += $(DBGCOL_LIST)
735 735
 
736 736
 DBGCOL_COLOURS := $(subst -, ,$(DBGCOL))
737
-DBGCOL_MIN := $(word 1,$(DBGCOL_COLOURS))
738
-DBGCOL_MAX := $(word 2,$(DBGCOL_COLOURS))
737
+DBGCOL_MIN := $(firstword $(DBGCOL_COLOURS))
738
+DBGCOL_MAX := $(lastword $(DBGCOL_COLOURS))
739 739
 
740 740
 debug_DEPS += $(DBGCOL_LIST)
741 741
 

+ 9
- 3
src/core/debug.c View File

@@ -194,8 +194,12 @@ static int dbg_autocolour ( unsigned long stream ) {
194 194
  * @v stream		Message stream ID
195 195
  */
196 196
 void dbg_autocolourise ( unsigned long stream ) {
197
-	dbg_printf ( "\033[%dm",
198
-		     ( stream ? ( DBGCOL_MIN + dbg_autocolour ( stream ) ) :0));
197
+
198
+	if ( DBGCOL_MIN ) {
199
+		dbg_printf ( "\033[%dm",
200
+			     ( stream ?
201
+			       ( DBGCOL_MIN + dbg_autocolour ( stream ) ) : 0));
202
+	}
199 203
 }
200 204
 
201 205
 /**
@@ -203,5 +207,7 @@ void dbg_autocolourise ( unsigned long stream ) {
203 207
  *
204 208
  */
205 209
 void dbg_decolourise ( void ) {
206
-	dbg_printf ( "\033[0m" );
210
+
211
+	if ( DBGCOL_MIN )
212
+		dbg_printf ( "\033[0m" );
207 213
 }

Loading…
Cancel
Save