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 <[email protected]>
Resistance is futile, you will be garbage collected.
diff --git a/package/uboot-xburst/files/board/xburst/nanonote/nanonote.c b/package/uboot-xburst/files/board/xburst/nanonote/nanonote.c
index ef9552a..15402d2 100644
--- a/package/uboot-xburst/files/board/xburst/nanonote/nanonote.c
+++ b/package/uboot-xburst/files/board/xburst/nanonote/nanonote.c
@@ -115,6 +115,11 @@ void board_early_init(void)
 
 /* U-Boot common routines */
 
+void board_init_f (ulong bootflag)
+{
+	console_init_f();
+}
+
 int checkboard (void)
 {
 	printf("Board: Qi LB60 (Ingenic XBurst Jz4740 SoC, Speed %d MHz)\n",
diff -Naru a/common/console.c b/common/console.c
--- a/common/console.c	2011-08-25 18:06:24.921866323 +0200
+++ b/common/console.c	2011-08-25 18:05:30.145322129 +0200
@@ -373,6 +373,22 @@
 	uint i;
 	char printbuffer[CONFIG_SYS_PBSIZE];
 
+#ifdef CONFIG_SILENT_CONSOLE
+	puts("CONFIG_SILENT_CONSOLE enabled\n");
+
+	if (gd->flags & GD_FLG_SILENT)
+		puts("  GD_FLG_SILENT enabled\n");
+	else
+		puts("  GD_FLG_SILENT disabled\n");
+
+	if (getenv("silent") != NULL)
+		puts("  silent set\n");
+	else
+		puts("  silent unset\n");
+#else
+	puts("CONFIG_SILENT_CONSOLE disabled\n");
+#endif
+
 	va_start(args, fmt);
 
 	/* For this to work, printbuffer must be larger than

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Qi Hardware Discussion List
Mail to list (members only): [email protected]
Subscribe or Unsubscribe: 
http://lists.en.qi-hardware.com/mailman/listinfo/discussion

Reply via email to