From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [PATCH 4/5] env: allow default environment to be amended from control dtb
Date: Fri, 20 Nov 2020 11:53:59 +0100 [thread overview]
Message-ID: <13749.1605869639@gemini.denx.de> (raw)
In-Reply-To: <2edc1fb5-e723-fbd6-56da-bc0dea282343@prevas.dk>
Dear Rasmus,
In message <2edc1fb5-e723-fbd6-56da-bc0dea282343@prevas.dk> you wrote:
>
> >> set CONFIG_ENV_IS_NOWHERE, I'd get what I have now. The only problem
> >
> > Can't you see that this is not logical? If the environment is
> > nowhere, then how can you add something to it?
>
> That's silly. Even with CONFIG_ENV_IS_NOWHERE, "env set" still works
> just fine. So of course one can add something to the (runtime)
I'm sorry, but it seems you lack basic understanding of the design of
the environment system in U-Boot.
I have explained this repeatedly in the last few weeks, so here once
more:
CONFIG_ENV_IS_* defines, where the persistent storage for the
environment is located, that is where it is initialized from at
reset, and where it is saved to when you use the "env save" command.
Of course ""env set" still works perfectly fine on the in-memory
copy of the environment, as this has nothing to do with whether you
can save this data to some persistent storage or not.
> environment, even if the source of the original runtime environment
> happened to be default_environment[] and those changes cannot be persisted.
And this is where the mis-use starts. default_environment[] has
never been intended to be used as regular data to initialize the
in-memory copy of the environment from. It was there to be used in
emergency cases only, like then there were I/O errors on the storage
device or the saved copy of the environment had been corrupted, so
the checksum would not macth.
> > I see no difference here. "env import" into an empty environment
> > does just that.
>
> The problem is, by the time it's possible to do an "env import" (no
> sooner than $preboot is executed I assume?) or any other shell command,
> U-Boot may already have read a bunch variables affecting its execution
> from the environment.
You can call the C function equivalent of the "env import" shell
command right ater the initialization of the environment - i. e. at
lease as early as any of your code can be used.
> So I think that for my _current_ use cases, doing it via a preboot
> command may be enough - from reading the code, it does seem that e.g.
> bootretry is only read after the preboot command has run.
I was not talking about implementing it by scripts only. I just
wanted to point to the existing functionality - whether you call
this from th shell or from C code is your choice.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"Just think of a computer as hardware you can program."
- Nigel de la Tierre
next prev parent reply other threads:[~2020-11-20 10:53 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-10 20:25 [PATCH 0/5] allow default environment to be amended from dtb Rasmus Villemoes
2020-11-10 20:25 ` [PATCH 1/5] fdtdec: make fdtdec_get_config_string() return const char* Rasmus Villemoes
2020-11-16 23:52 ` Simon Glass
2020-11-10 20:26 ` [PATCH 2/5] fdtdec: introduce fdtdec_get_config_property Rasmus Villemoes
2020-11-16 23:52 ` Simon Glass
2020-11-10 20:26 ` [PATCH 3/5] env: make env_set_default_vars() return void Rasmus Villemoes
2020-11-12 19:51 ` Wolfgang Denk
2020-11-10 20:26 ` [PATCH 4/5] env: allow default environment to be amended from control dtb Rasmus Villemoes
2020-11-12 19:58 ` Wolfgang Denk
2020-11-16 23:52 ` Simon Glass
2020-11-17 9:49 ` Rasmus Villemoes
2020-11-20 10:13 ` Wolfgang Denk
2020-11-20 10:33 ` Rasmus Villemoes
2020-11-20 10:53 ` Wolfgang Denk [this message]
2020-11-17 11:31 ` Wolfgang Denk
2020-11-17 18:23 ` Tom Rini
2020-11-18 14:37 ` Simon Glass
2020-11-20 10:28 ` Wolfgang Denk
2020-11-21 23:07 ` Simon Glass
2020-11-22 16:12 ` Wolfgang Denk
2020-11-20 10:16 ` Wolfgang Denk
2020-11-17 10:01 ` Stefano Babic
2020-11-10 20:26 ` [PATCH 5/5] test: add tests for default environment Rasmus Villemoes
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=13749.1605869639@gemini.denx.de \
--to=wd@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