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

Simon Glass sjg at chromium.org
Thu Mar 12 23:18:30 CET 2015


Hi Chris,

On 10 March 2015 at 20:22, Chris Packham <judge.packham at gmail.com> wrote:
> 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
>

We have something similar in console_init_f() so should probably put
this code in a separate (common) function called from both places.

But as you say, I cannot see where else this happens.

Regards,
Simon


More information about the U-Boot mailing list