mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-24 21:54:01 +00:00
env: Add a silent env handler
The silent variable now updates the global data flag anytime it is changed as well as after the env relocation (in case its value is different from the default env in such cases as NAND env) Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
This commit is contained in:
parent
849d5d9cda
commit
e080d545f8
3 changed files with 40 additions and 4 deletions
|
@ -73,6 +73,29 @@ static int on_console(const char *name, const char *value, enum env_op op,
|
||||||
}
|
}
|
||||||
U_BOOT_ENV_CALLBACK(console, on_console);
|
U_BOOT_ENV_CALLBACK(console, on_console);
|
||||||
|
|
||||||
|
#ifdef CONFIG_SILENT_CONSOLE
|
||||||
|
static int on_silent(const char *name, const char *value, enum env_op op,
|
||||||
|
int flags)
|
||||||
|
{
|
||||||
|
#ifndef CONFIG_SILENT_CONSOLE_UPDATE_ON_SET
|
||||||
|
if (flags & H_INTERACTIVE)
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
#ifndef CONFIG_SILENT_CONSOLE_UPDATE_ON_RELOC
|
||||||
|
if ((flags & H_INTERACTIVE) == 0)
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (value != NULL)
|
||||||
|
gd->flags |= GD_FLG_SILENT;
|
||||||
|
else
|
||||||
|
gd->flags &= ~GD_FLG_SILENT;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
U_BOOT_ENV_CALLBACK(silent, on_silent);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_SYS_CONSOLE_IS_IN_ENV
|
#ifdef CONFIG_SYS_CONSOLE_IS_IN_ENV
|
||||||
/*
|
/*
|
||||||
* if overwrite_console returns 1, the stdin, stderr and stdout
|
* if overwrite_console returns 1, the stdin, stderr and stdout
|
||||||
|
|
|
@ -1,9 +1,15 @@
|
||||||
The config option CONFIG_SILENT_CONSOLE can be used to quiet messages
|
The config option CONFIG_SILENT_CONSOLE can be used to quiet messages
|
||||||
on the console. If the option has been enabled, the output can be
|
on the console. If the option has been enabled, the output can be
|
||||||
silenced by setting the environment variable "silent". The variable
|
silenced by setting the environment variable "silent".
|
||||||
is latched into the global data at an early stage in the boot process
|
|
||||||
so deleting it with "setenv" will not take effect until the system is
|
- CONFIG_SILENT_CONSOLE_UPDATE_ON_SET
|
||||||
restarted.
|
When the "silent" variable is changed with env set, the change
|
||||||
|
will take effect immediately.
|
||||||
|
|
||||||
|
- CONFIG_SILENT_CONSOLE_UPDATE_ON_RELOC
|
||||||
|
Some environments are not available until relocation (e.g. NAND)
|
||||||
|
so this will make the value in the flash env take effect at
|
||||||
|
relocation.
|
||||||
|
|
||||||
The following actions are taken if "silent" is set at boot time:
|
The following actions are taken if "silent" is set at boot time:
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,12 @@
|
||||||
#define CONFIG_ENV_CALLBACK_LIST_STATIC
|
#define CONFIG_ENV_CALLBACK_LIST_STATIC
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_SILENT_CONSOLE
|
||||||
|
#define SILENT_CALLBACK "silent:silent,"
|
||||||
|
#else
|
||||||
|
#define SILENT_CALLBACK
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This list of callback bindings is static, but may be overridden by defining
|
* This list of callback bindings is static, but may be overridden by defining
|
||||||
* a new association in the ".callbacks" environment variable.
|
* a new association in the ".callbacks" environment variable.
|
||||||
|
@ -42,6 +48,7 @@
|
||||||
"baudrate:baudrate," \
|
"baudrate:baudrate," \
|
||||||
"bootfile:bootfile," \
|
"bootfile:bootfile," \
|
||||||
"loadaddr:loadaddr," \
|
"loadaddr:loadaddr," \
|
||||||
|
SILENT_CALLBACK \
|
||||||
"stdin:console,stdout:console,stderr:console," \
|
"stdin:console,stdout:console,stderr:console," \
|
||||||
CONFIG_ENV_CALLBACK_LIST_STATIC
|
CONFIG_ENV_CALLBACK_LIST_STATIC
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue