]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
env: Allow to set default_environment[] from board code via compile option DEFAULT_EN...
authorPali Rohár <pali@kernel.org>
Wed, 23 Dec 2020 11:21:28 +0000 (12:21 +0100)
committerStefan Roese <sr@denx.de>
Mon, 8 Feb 2021 07:52:50 +0000 (08:52 +0100)
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>
Acked-by: Andre Heider <a.heider@gmail.com>
include/env_default.h
include/env_internal.h

index 8a0c3057f0aa4ffecde15c98e8dccacbcf6066f5..ea31a8eddfa0da35a842565992ddede40eb6a17d 100644 (file)
@@ -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
index b26dc6239c82bd3004c564f10e31a08390cf24bf..708c833a5504a8f9c8b9225688aac4869eb28605 100644 (file)
@@ -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