diff mbox series

[1/3] env: Allow to set default_environment[] from board code via compile option DEFAULT_ENV_IS_RW

Message ID 20201223112130.31389-2-pali@kernel.org
State Accepted
Commit 93f4048bc2f00d2d1bda962701077ad1afbfacdf
Delegated to: Stefan Roese
Headers show
Series arm: mvebu: Espressobin: Set default env values at runtime | expand

Commit Message

Pali Rohár Dec. 23, 2020, 11:21 a.m. UTC
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 mbox series

Patch

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