소스 검색

[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 9 년 전
부모
커밋
47dcd392dc
2개의 변경된 파일11개의 추가작업 그리고 5개의 파일을 삭제
  1. 2
    2
      src/Makefile.housekeeping
  2. 9
    3
      src/core/debug.c

+ 2
- 2
src/Makefile.housekeeping 파일 보기

734
 VERYCLEANUP += $(DBGCOL_LIST)
734
 VERYCLEANUP += $(DBGCOL_LIST)
735
 
735
 
736
 DBGCOL_COLOURS := $(subst -, ,$(DBGCOL))
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
 debug_DEPS += $(DBGCOL_LIST)
740
 debug_DEPS += $(DBGCOL_LIST)
741
 
741
 

+ 9
- 3
src/core/debug.c 파일 보기

194
  * @v stream		Message stream ID
194
  * @v stream		Message stream ID
195
  */
195
  */
196
 void dbg_autocolourise ( unsigned long stream ) {
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
  *
207
  *
204
  */
208
  */
205
 void dbg_decolourise ( void ) {
209
 void dbg_decolourise ( void ) {
206
-	dbg_printf ( "\033[0m" );
210
+
211
+	if ( DBGCOL_MIN )
212
+		dbg_printf ( "\033[0m" );
207
 }
213
 }

Loading…
취소
저장