Silent u-boot (was Re: Current firmware)

Andrea Bolognani eof at
Thu Aug 25 12:08:55 EDT 2011

On Thu, Aug 25, 2011 at 08:47:03AM +0800, Xiangfu Liu wrote:

> I believe it's the LCD driver problem. not that patch problem.
> the boot is still verbose, here is the binary file:

I tried flashing it and playing around a bit with the various environment
variables, but I didn’t achieve much.

Both silent boot and nulldev are certainly compiled in:

	$ strings openwrt-xburst-qi_lb60-u-boot.silent.bin | grep silent
	$ strings openwrt-xburst-qi_lb60-u-boot.silent.bin | grep nulldev

Running the same commands against the u-boot.bin from the current release
results in no output, so at least we know that the additional configuration
options were not ignored.

I’ve dug a little further in u-boot’s code. The messages displayed during
u-boot startup are not generated by the xburst specific code, but by the
generic u-boot code, using printf() statements.

Defining CONFIG_SILENT_CONSOLE enables a lot of new code paths; one of the
most interesting is in common/console.c: printf() is defined in terms of
puts(), which in turn starts with the following code:

		if (gd->flags & GD_FLG_SILENT)

that is, if the GD_FLG_SILENT bit is enabled in gd->flags, puts() exits

The GD_FLG_SILENT flag is checked in various places around the code; the
place where it is set is in common/console.c, in function console_init_f(),
with the following code:

	if (getenv("silent") != NULL)
		gd->flags |= GD_FLG_SILENT;

console_init_f() is not called by the xburst specific u-boot code. For
comparison, the following boards[1] have CONFIG_SILENT_CONSOLE enabled but
do not seem to call console_init_f():


The right place to call console_init_f() seems to be the board_init()
function; however, that function is only defined on ARM. MIPS has
board_init_f() and board_init_r(), among which the former seems more
likely to be the correct one.

A tentative patch (03-init-console.diff, agains openwrt-xburst.git)
is attached; just to get an idea of what exactly is going on, in case
the patch is still not enough to achieve a silent u-boot, another patch
(04-debug-printf.diff, against u-boot-2010.06 source) should print
diagnostic on the serial console every time printf() is called.

[1] List generated using the following command sequence inside the
    u-boot-2010.06 directory:

	  BOARDS=$(grep -r CONFIG_SILENT_CONSOLE include/configs | \
	           cut -f1 -d: | \
	           uniq); \
	  BOARDS=$(for board in ${BOARDS}; do \
	             find board -name $(basename "${board}" .h); \
	           done); \
	  for board in ${BOARDS}; do \
	    grep -r console_init_f "${board}" >/dev/null || \
	                                      echo "${board}"; \
Andrea Bolognani <eof at>
Resistance is futile, you will be garbage collected.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 03-init-console.diff
Type: text/x-diff
Size: 541 bytes
Desc: not available
URL: <>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 04-debug-printf.diff
Type: text/x-diff
Size: 669 bytes
Desc: not available
URL: <>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <>

More information about the discussion mailing list