diff options
author | Patrick Delaunay <patrick.delaunay@st.com> | 2019-09-06 09:06:11 +0200 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2019-09-27 10:04:35 -0400 |
commit | 9b5efe8906fce2bc5a803e23ba392fa4025a5d69 (patch) | |
tree | 8442e89834d2907df9a0616896efb514b4a23b13 | |
parent | dfd590075ca263d6b3ed22465a94d33a8ee93e07 (diff) | |
download | u-boot-WIP/27Sep2019.tar.gz |
env: Add CONFIG_ENV_SUPPORTWIP/27Sep2019
Add a new flag CONFIG_ENV_SUPPORT to compile all
the environment features in U-Boot (attributes, callbacks
and flags); it is the supplement of the 2 existing flags
for SPL/TPL.
To have ENV support, enable the flag:
- CONFIG_ENV_SUPPORT for U-Boot proper
- CONFIG_SPL_ENV_SUPPORT for SPL
- CONFIG_TPL_ENV_SUPPORT for TPL
This new configuration allows to use the macro
CONFIG_IS_ENABLED(ENV_SUPPORT) in the code without
issue and solves the regression introduced by
commit 7d4776545b0f ("env: solve compilation error
in SPL"); change_ok was always NULL in U-Boot.
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
-rw-r--r-- | cmd/Kconfig | 2 | ||||
-rw-r--r-- | env/Kconfig | 7 | ||||
-rw-r--r-- | env/Makefile | 11 | ||||
-rw-r--r-- | include/env_callback.h | 4 | ||||
-rw-r--r-- | include/env_flags.h | 4 |
5 files changed, 21 insertions, 7 deletions
diff --git a/cmd/Kconfig b/cmd/Kconfig index 98647f58b7..1a102451e6 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -465,6 +465,7 @@ config CMD_ENV_EXISTS config CMD_ENV_CALLBACK bool "env callbacks - print callbacks and their associated variables" + depends on ENV_SUPPORT help Some environment variable have callbacks defined by U_BOOT_ENV_CALLBACK. These are called when the variable changes. @@ -473,6 +474,7 @@ config CMD_ENV_CALLBACK config CMD_ENV_FLAGS bool "env flags -print variables that have non-default flags" + depends on ENV_SUPPORT help Some environment variables have special flags that control their behaviour. For example, serial# can only be written once and cannot diff --git a/env/Kconfig b/env/Kconfig index 74db2f38cc..f0c5a7a39c 100644 --- a/env/Kconfig +++ b/env/Kconfig @@ -1,5 +1,12 @@ menu "Environment" +config ENV_SUPPORT + bool "Support all environment features" + default y + help + Enable full environment support in U-Boot, + including attributes, callbacks and flags. + config ENV_IS_NOWHERE bool "Environment is not stored" default y if !ENV_IS_IN_EEPROM && !ENV_IS_IN_EXT4 && \ diff --git a/env/Makefile b/env/Makefile index 90144d6caf..2a468ac16b 100644 --- a/env/Makefile +++ b/env/Makefile @@ -5,10 +5,11 @@ obj-y += common.o env.o +obj-$(CONFIG_$(SPL_TPL_)ENV_SUPPORT) += attr.o +obj-$(CONFIG_$(SPL_TPL_)ENV_SUPPORT) += flags.o +obj-$(CONFIG_$(SPL_TPL_)ENV_SUPPORT) += callback.o + ifndef CONFIG_SPL_BUILD -obj-y += attr.o -obj-y += callback.o -obj-y += flags.o obj-$(CONFIG_ENV_IS_IN_EEPROM) += eeprom.o extra-$(CONFIG_ENV_IS_EMBEDDED) += embedded.o obj-$(CONFIG_ENV_IS_IN_EEPROM) += embedded.o @@ -19,10 +20,6 @@ obj-$(CONFIG_ENV_IS_IN_ONENAND) += onenand.o obj-$(CONFIG_ENV_IS_IN_SATA) += sata.o obj-$(CONFIG_ENV_IS_IN_REMOTE) += remote.o obj-$(CONFIG_ENV_IS_IN_UBI) += ubi.o -else -obj-$(CONFIG_$(SPL_TPL_)ENV_SUPPORT) += attr.o -obj-$(CONFIG_$(SPL_TPL_)ENV_SUPPORT) += flags.o -obj-$(CONFIG_$(SPL_TPL_)ENV_SUPPORT) += callback.o endif obj-$(CONFIG_$(SPL_TPL_)ENV_IS_NOWHERE) += nowhere.o diff --git a/include/env_callback.h b/include/env_callback.h index 74da20eec3..4fdb6e647c 100644 --- a/include/env_callback.h +++ b/include/env_callback.h @@ -72,6 +72,10 @@ "serial#:serialno," \ CONFIG_ENV_CALLBACK_LIST_STATIC +#if CONFIG_IS_ENABLED(ENV_SUPPORT) void env_callback_init(struct env_entry *var_entry); +#else +static inline void env_callback_init(struct env_entry *var_entry) { } +#endif #endif /* __ENV_CALLBACK_H__ */ diff --git a/include/env_flags.h b/include/env_flags.h index 725841a891..0da9c54f77 100644 --- a/include/env_flags.h +++ b/include/env_flags.h @@ -153,7 +153,11 @@ int env_flags_validate_env_set_params(char *name, char *const val[], int count); * When adding a variable to the environment, initialize the flags for that * variable. */ +#if CONFIG_IS_ENABLED(ENV_SUPPORT) void env_flags_init(struct env_entry *var_entry); +#else +static inline void env_flags_init(struct env_entry *var_entry) { } +#endif /* * Validate the newval for to conform with the requirements defined by its flags |