]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[debug] Allow debug colourisation to be disabled
authorMichael Brown <mcb30@ipxe.org>
Tue, 12 Jan 2016 15:35:06 +0000 (15:35 +0000)
committerMichael Brown <mcb30@ipxe.org>
Tue, 12 Jan 2016 15:39:14 +0000 (15:39 +0000)
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>
src/Makefile.housekeeping
src/core/debug.c

index 70ec50c5e730b19b23515930a70d921d4f2566d0..0a80d2ac9a202456b066edd9db45efce1581ba4a 100644 (file)
@@ -734,8 +734,8 @@ $(DBGCOL_LIST) : $(MAKEDEPS)
 VERYCLEANUP += $(DBGCOL_LIST)
 
 DBGCOL_COLOURS := $(subst -, ,$(DBGCOL))
-DBGCOL_MIN := $(word 1,$(DBGCOL_COLOURS))
-DBGCOL_MAX := $(word 2,$(DBGCOL_COLOURS))
+DBGCOL_MIN := $(firstword $(DBGCOL_COLOURS))
+DBGCOL_MAX := $(lastword $(DBGCOL_COLOURS))
 
 debug_DEPS += $(DBGCOL_LIST)
 
index def5d8b09068f4cd2bebb1cab96aec21806790bf..9b2a823f5677acaebb102c2dce7b6c35cb15dee5 100644 (file)
@@ -194,8 +194,12 @@ static int dbg_autocolour ( unsigned long stream ) {
  * @v stream           Message stream ID
  */
 void dbg_autocolourise ( unsigned long stream ) {
-       dbg_printf ( "\033[%dm",
-                    ( stream ? ( DBGCOL_MIN + dbg_autocolour ( stream ) ) :0));
+
+       if ( DBGCOL_MIN ) {
+               dbg_printf ( "\033[%dm",
+                            ( stream ?
+                              ( DBGCOL_MIN + dbg_autocolour ( stream ) ) : 0));
+       }
 }
 
 /**
@@ -203,5 +207,7 @@ void dbg_autocolourise ( unsigned long stream ) {
  *
  */
 void dbg_decolourise ( void ) {
-       dbg_printf ( "\033[0m" );
+
+       if ( DBGCOL_MIN )
+               dbg_printf ( "\033[0m" );
 }