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>
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)
* @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));
+ }
}
/**
*
*/
void dbg_decolourise ( void ) {
- dbg_printf ( "\033[0m" );
+
+ if ( DBGCOL_MIN )
+ dbg_printf ( "\033[0m" );
}