[PATCH v3 12/32] env: Split out non-command code into a new file

Tom Rini trini at konsulko.com
Tue Oct 17 15:40:05 CEST 2023


On Mon, Oct 16, 2023 at 04:28:03PM -0600, Simon Glass wrote:

> It is not possible to set environment variables without having
> CONFIG_CMD_NVEDIT enabled. When CONFIG_CMDLINE is disabled, we need a
> way to set variables.
> 
> Split the setting code out into its own file, so that env_set() is
> available even when CONFIG_CMDLINE is not. If it is never called, the
> code will be dropped at link time.
> 
> Update the Makefile rule to only include the env commands when
> CONFIG_CMD_NVEDIT is enabled.
> 
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
> 
> (no changes since v1)
> 
>  cmd/Makefile           |   2 +-
>  cmd/nvedit.c           | 122 ++-----------------------------------
>  env/Makefile           |   1 +
>  env/env_set.c          | 132 +++++++++++++++++++++++++++++++++++++++++
>  include/env_internal.h |  23 +++++++
>  5 files changed, 161 insertions(+), 119 deletions(-)
>  create mode 100644 env/env_set.c

This feels like it's partly but not entirely correct.  We need to split
cmd/nvedit.c in to cmd/env.c and env/nvedit.c instead I think.  And keep
in mind that SPL + ENV (and so - CMDLINE I believe) does work today.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20231017/43661e41/attachment.sig>


More information about the U-Boot mailing list