[U-Boot] Clearing silent environment variable not taking affect at boot

Chris Packham judge.packham at gmail.com
Wed Mar 11 04:22:47 CET 2015


Hi,

I have a board using SPI flash for it's boot-loader and environment,
I'm currently based of u-boot 2014.01. In my boards config file I have
the following

#define CONFIG_SILENT_CONSOLE
#define CONFIG_SILENT_U_BOOT_ONLY
#define CONFIG_SILENT_CONSOLE_UPDATE_ON_RELOC
#define CONFIG_BOARD_EXTRA_ENV_SETTINGS "silent=1"

By default I want u-boot to be silent, and that's what I get. But for
debugging I do want to be able to run "setenv silent; saveenv; reset"
to enable non-silent mode. Unfortunately this doesn't work for me.

I _think_ the problem is that when console_init_f() is called the
environment can't be read from SPI flash so I get the default silent=1
behaviour (and that's OK). After relocation the environment is read
from SPI flash for some reason the on_silent() callback isn't called
I'm not sure why but I'm guessing that hdelete_r() is bypassed
(possibly because the whole default environment is dropped) thus the
callback for silent being deleted is not invoked.

Is my thinking along the right lines?

Would there be any objection to doing something like this:

diff --git a/common/console.c b/common/console.c
index 29560c3..6719019 100644
--- a/common/console.c
+++ b/common/console.c
@@ -808,6 +808,11 @@ int console_init_r(void)
        struct list_head *pos;
        struct stdio_dev *dev;

+#ifdef CONFIG_SILENT_CONSOLE
+       if (getenv("silent") == NULL)
+               gd->flags &= ~GD_FLG_SILENT;
+#endif
+
 #ifdef CONFIG_SPLASH_SCREEN
        /*
         * suppress all output if splash screen is enabled and we have

Thanks,
Chris


More information about the U-Boot mailing list