[ipxe-devel] iPXE: Coloring of debug output

Michael Brown mcb30 at ipxe.org
Tue Dec 5 00:20:44 UTC 2017

On 04/12/17 17:15, Heinrich Schuchardt wrote:
> the colors used by iPXE seem to depend on random addresses:
> interface/efi/efi_wrap.c:47:#define colour &efi_systab_wrapper
> interface/efi/efi_timer.c:53:#define colour &efi_jiffies
> arch/x86/core/runtime.c:84:#define colour &cmdline_image
> arch/x86/core/cachedhcp.c:48:#define colour &cached_dhcpack_phys
> arch/x86/core/rdtsc_timer.c:57:#define colour &tsc_per_us
> The actual colors did not help me to better understand the output.
> Wouldn't it be preferable to use the severity of the message for color
> coding?

Colourised messages in iPXE are used only for debugging, not for end 
user error reporting.

The colours are intended to allow for quick visual separation of 
multiple debug streams.  For example, if you have DEBUG=tcp:3 with two 
TCP connections open, then one colour will be assigned to each TCP 

The actual assignment is performed by an LRU cache in dbg_autocolour(), 
using whatever "colour key" was specified as the first argument to 
DBGC() as a disambiguator between debug streams.  In the common case 
that there are six or fewer concurrent debug streams, the logic ensures 
that each stream will be assigned a unique colour that remains 
consistent over time.


More information about the ipxe-devel mailing list