public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Lukasz Majewski <lukma@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] env: Add CONFIG_ENV_SUPPORT
Date: Wed, 4 Sep 2019 10:51:41 +0200	[thread overview]
Message-ID: <20190904105141.71c20ab0@jawa> (raw)
In-Reply-To: <1567530547-14331-1-git-send-email-patrick.delaunay@st.com>

Hi Patrick,

> Add a new flag CONFIG_ENV_SUPPORT to compile all
> the environment features in U-Boot (attributes, callbacks
> and flags). It is the equivalent of the 2 existing flags
> - CONFIG_SPL_ENV_SUPPORT for SPL
> - CONFIG_TPL_ENV_SUPPORT for TPL

Shouldn't it be the "supplement" ?

I guess that it is possible to define 

CONFIG_SPL_ENV_SUPPORT to have ENV support in SPL

CONFIG_TPL_ENV_SUPPORT to have ENV support in TPL

and there is a third flag - CONFIG_ENV_SUPPORT to enable envs support
in U-Boot proper?

In that way one can enable ENV support only in SPL (via SPL_ENV_SUPPORT)
and disable envs in U-Boot proper (by NOT defining ENV_SUPPORT) and use
build in envs (in the binary).

> 
> 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>
> ---
> 
>  cmd/Kconfig            |  2 ++
>  env/Kconfig            |  7 +++++++
>  env/Makefile           | 11 ++++-------
>  include/env_callback.h |  4 ++++
>  include/env_flags.h    |  4 ++++
>  5 files changed, 21 insertions(+), 7 deletions(-)
> 
> diff --git a/cmd/Kconfig b/cmd/Kconfig
> index 05872fa..f7a1b1f 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 74db2f3..f0c5a7a 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 90144d6..2a468ac 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 982c078..a757fe6 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 e5380f2..ec480e3 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



Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190904/aad48e6f/attachment.sig>

  reply	other threads:[~2019-09-04  8:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-03 17:09 [U-Boot] [PATCH] env: Add CONFIG_ENV_SUPPORT Patrick Delaunay
2019-09-04  8:51 ` Lukasz Majewski [this message]
2019-09-05  7:56   ` Patrick DELAUNAY
2019-09-07 11:51 ` Wolfgang Denk
2019-09-10 11:01   ` Patrick DELAUNAY
2019-09-10 14:33     ` Tom Rini
2019-09-10 16:30     ` Wolfgang Denk
2019-09-11 13:54       ` Patrick DELAUNAY

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190904105141.71c20ab0@jawa \
    --to=lukma@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox