public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: u-boot@lists.denx.de
Subject: [PATCH 1/3] env: Allow to set default_environment[] from board code via compile option DEFAULT_ENV_IS_RW
Date: Wed, 23 Dec 2020 12:21:28 +0100	[thread overview]
Message-ID: <20201223112130.31389-2-pali@kernel.org> (raw)
In-Reply-To: <20201223112130.31389-1-pali@kernel.org>

This change allows board code to modify default_environment[] array when
compile option DEFAULT_ENV_IS_RW is specified in board config file.

Some board default variables depend on runtime configuration which is not
known at compile time. Therefore allow to set default_environment[] array
as non-const and allow board code to modify it when it is needed.

Signed-off-by: Pali Roh?r <pali@kernel.org>
---
 include/env_default.h  | 2 ++
 include/env_internal.h | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/include/env_default.h b/include/env_default.h
index 8a0c3057f0..ea31a8eddf 100644
--- a/include/env_default.h
+++ b/include/env_default.h
@@ -19,6 +19,8 @@ env_t embedded_environment __UBOOT_ENV_SECTION__(environment) = {
 	{
 #elif defined(DEFAULT_ENV_INSTANCE_STATIC)
 static char default_environment[] = {
+#elif defined(DEFAULT_ENV_IS_RW)
+uchar default_environment[] = {
 #else
 const uchar default_environment[] = {
 #endif
diff --git a/include/env_internal.h b/include/env_internal.h
index b26dc6239c..708c833a55 100644
--- a/include/env_internal.h
+++ b/include/env_internal.h
@@ -111,7 +111,11 @@ typedef struct environment_s {
 extern env_t embedded_environment;
 #endif /* ENV_IS_EMBEDDED */
 
+#ifdef DEFAULT_ENV_IS_RW
+extern unsigned char default_environment[];
+#else
 extern const unsigned char default_environment[];
+#endif
 
 #ifndef DO_DEPS_ONLY
 
-- 
2.20.1

  reply	other threads:[~2020-12-23 11:21 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-23 11:21 [PATCH 0/3] arm: mvebu: Espressobin: Set default env values at runtime Pali Rohár
2020-12-23 11:21 ` Pali Rohár [this message]
2020-12-23 11:21 ` [PATCH 2/3] arm: mvebu: Espressobin: Set default value for $fdtfile env variable Pali Rohár
2020-12-23 11:21 ` [PATCH 3/3] arm: mvebu: Espressobin: Set default value for $ethNaddr " Pali Rohár
2021-01-11 10:51 ` [PATCH 0/3] arm: mvebu: Espressobin: Set default env values at runtime Pali Rohár
2021-01-12  8:18   ` Andre Heider
2021-01-12  8:42     ` Andre Heider
2021-01-12  9:24     ` Pali Rohár
2021-02-02 15:09       ` Stefan Roese
2021-02-02 15:19         ` Pali Rohár
2021-02-02 16:13         ` Andre Heider
2021-02-02 16:32           ` Stefan Roese
2021-02-02 17:24             ` Andre Heider
2021-02-01 15:24 ` Pali Rohár
2021-02-08 11:33 ` Stefan Roese

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=20201223112130.31389-2-pali@kernel.org \
    --to=pali@kernel.org \
    --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