On Thu, Aug 25, 2011 at 06:08:55PM +0200, Andrea Bolognani wrote:
> 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.I’ve finally found out why GD_FLG_SILENT doesn’t get set. console_init_f() is actually called by the generic MIPS code in arch/mips/lib/board.c before relocation; however, the NAND chip is initialized *after* relocation, and since the environment is saved to the NAND, it hasn’t been loaded yet when console_init_f() is called. (Please correct me if anything is wrong with my analysis.) To make sure the “silent” environment variable is checked after the NAND environment has been loaded, I’ve added the same code used in console_init_f() inside console_init_r(), which is the function that completes initialization of the console after relocation. I’ve tested the modified u-boot, and I’m glad to report it works great: if the “silent” environment variable is set, u-boot doesn’t show any output; if it is not set, everything works just as before. I’ve attached two patches: one (310-enable-silent-console.patch) can be dropped in openwrt-xburst.git/package/uboot-xburst/patches, the other one (silent-u-boot-by-default.patch) can be applied to mtd.nn in openwrt-packages.git to make u-boot silent by default. -- Andrea Bolognani <[email protected]> Resistance is futile, you will be garbage collected.
Index: u-boot-2010.06/include/configs/nanonote.h
===================================================================
--- u-boot-2010.06.orig/include/configs/nanonote.h 2011-08-29 12:59:47.520570290 +0200
+++ u-boot-2010.06/include/configs/nanonote.h 2011-08-29 13:55:48.958207218 +0200
@@ -99,6 +99,8 @@
#define CONFIG_SYS_MEMTEST_START 0x80100000
#define CONFIG_SYS_MEMTEST_END 0x80800000
+#define CONFIG_SILENT_CONSOLE 1 /* Enable silent console */
+
/*
* Environment
*/
Index: u-boot-2010.06/common/console.c
===================================================================
--- u-boot-2010.06.orig/common/console.c 2011-08-29 13:18:53.987163122 +0200
+++ u-boot-2010.06/common/console.c 2011-08-29 14:15:26.303638381 +0200
@@ -628,6 +628,14 @@
gd->flags |= GD_FLG_DEVINIT; /* device initialization completed */
+#ifdef CONFIG_SILENT_CONSOLE
+ /* Check one more time the contents of the silent environment
+ * variable, because if the environment is loaded from NAND it was
+ * not available when console_init_f() was called */
+ if (getenv("silent") != NULL)
+ gd->flags |= GD_FLG_SILENT;
+#endif
+
stdio_print_current_devices();
#ifdef CONFIG_SYS_CONSOLE_ENV_OVERWRITE
@@ -703,6 +711,14 @@
gd->flags |= GD_FLG_DEVINIT; /* device initialization completed */
+#ifdef CONFIG_SILENT_CONSOLE
+ /* Check one more time the contents of the silent environment
+ * variable, because if the environment is loaded from NAND it was
+ * not available when console_init_f() was called */
+ if (getenv("silent") != NULL)
+ gd->flags |= GD_FLG_SILENT;
+#endif
+
stdio_print_current_devices();
/* Setting environment variables */
diff -Naru a/nanonote-files/script-files/usr/bin/mtd.nn b/nanonote-files/script-files/usr/bin/mtd.nn
--- a/nanonote-files/script-files/usr/bin/mtd.nn 2011-08-29 22:22:17.767494108 +0200
+++ b/nanonote-files/script-files/usr/bin/mtd.nn 2011-08-29 22:22:39.667757090 +0200
@@ -78,6 +78,7 @@
fw_setenv bootargsf3 mem=32M console=tty0 console=ttyS0,57600n8 rootfstype=ext2 root=/dev/mmcblk0p3 rw rootwait
fw_setenv bootcmdf4 mtdparts default\;ubi part rootfs\;ubifsmount rootfs\;ubifsload 0x80600000 /boot/uImage\; bootm
fw_setenv bootargsf4 mem=32M console=tty0 console=ttyS0,57600n8 ubi.mtd=2 rootfstype=ubifs root=ubi0:rootfs rw rootwait
+ fw_setenv silent 1
echo "fw_setenv finished, check u-boot env by fw_printenv"
exit 0
fi
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

