Silent u-boot (was Re: Current firmware)
Andrea Bolognani
eof at kiyuko.org
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:
> http://downloads.qi-hardware.com/people/xiangfu/tmp/openwrt-xburst-qi_lb60-u-boot.silent.bin
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
silent
$ strings openwrt-xburst-qi_lb60-u-boot.silent.bin | grep nulldev
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:
#ifdef CONFIG_SILENT_CONSOLE
if (gd->flags & GD_FLG_SILENT)
return;
#endif
that is, if the GD_FLG_SILENT bit is enabled in gd->flags, puts() exits
immediately.
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:
#ifdef CONFIG_SILENT_CONSOLE
if (getenv("silent") != NULL)
gd->flags |= GD_FLG_SILENT;
#endif
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():
board/sc3
board/trab
board/netstar
board/mx1ads
board/mimc/mimc200
board/cm5200
board/mx1fs2
board/mcc200
board/pdm360ng
board/voiceblue
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}"; \
done
--
Andrea Bolognani <eof at kiyuko.org>
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: <http://lists.en.qi-hardware.com/pipermail/discussion/attachments/20110825/46de8d19/attachment.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 04-debug-printf.diff
Type: text/x-diff
Size: 669 bytes
Desc: not available
URL: <http://lists.en.qi-hardware.com/pipermail/discussion/attachments/20110825/46de8d19/attachment-0001.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.en.qi-hardware.com/pipermail/discussion/attachments/20110825/46de8d19/attachment.pgp>
More information about the discussion
mailing list