[U-Boot] [PATCH] ubi: env: fix redundand management

We check (with a #if defined()) the config ENV_UBI_VOLUME_REDUND to know if there is a redundant env. But this config is a string and is always defined with env is in ubi, so we always condider that a redundand env is used.
To fix this issue, I've added a hidden flag ENV_UBI_IS_VOLUME_REDUND that is true when ENV_UBI_VOLUME_REDUND is not "". Then, I check this flag in the code, instead of the string ENV_UBI_VOLUME_REDUND.
Signed-off-by: Philippe Reynes philippe.reynes@softathome.com --- env/Kconfig | 6 ++++++ include/env_internal.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/env/Kconfig b/env/Kconfig index e4ba12e..bc03816 100644 --- a/env/Kconfig +++ b/env/Kconfig @@ -516,6 +516,12 @@ config ENV_UBI_VOLUME_REDUND help Name of the redundant volume that you want to store the environment in.
+config ENV_UBI_IS_VOLUME_REDUND + bool + depends on ENV_IS_IN_UBI + default y if ENV_UBI_VOLUME_REDUND != "" + default n + config ENV_UBI_VID_OFFSET int "ubi environment VID offset" depends on ENV_IS_IN_UBI diff --git a/include/env_internal.h b/include/env_internal.h index b1ddcb5..88c36b3 100644 --- a/include/env_internal.h +++ b/include/env_internal.h @@ -101,7 +101,7 @@ extern unsigned long nand_env_oob_offset; # ifndef CONFIG_ENV_UBI_VOLUME # error "Need to define CONFIG_ENV_UBI_VOLUME when using CONFIG_ENV_IS_IN_UBI" # endif -# if defined(CONFIG_ENV_UBI_VOLUME_REDUND) +# if defined(CONFIG_ENV_UBI_IS_VOLUME_REDUND) # define CONFIG_SYS_REDUNDAND_ENVIRONMENT # endif # ifndef CONFIG_ENV_SIZE

Hello Philippe,
Am 14.10.2019 um 19:41 schrieb Philippe Reynes:
We check (with a #if defined()) the config ENV_UBI_VOLUME_REDUND to know if there is a redundant env. But this config is a string and is always defined with env is in ubi, so we always condider
typo.
that a redundand env is used.
To fix this issue, I've added a hidden flag ENV_UBI_IS_VOLUME_REDUND that is true when ENV_UBI_VOLUME_REDUND is not "". Then, I check this flag in the code, instead of the string ENV_UBI_VOLUME_REDUND.
Signed-off-by: Philippe Reynes philippe.reynes@softathome.com
env/Kconfig | 6 ++++++ include/env_internal.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-)
Thanks!
Reviewed-by: Heiko Schocher hs@denx.de
I fix the typo when applying this patch.
bye, Heiko

Hello Philippe,
Am 14.10.2019 um 19:41 schrieb Philippe Reynes:
We check (with a #if defined()) the config ENV_UBI_VOLUME_REDUND to know if there is a redundant env. But this config is a string and is always defined with env is in ubi, so we always condider that a redundand env is used.
To fix this issue, I've added a hidden flag ENV_UBI_IS_VOLUME_REDUND that is true when ENV_UBI_VOLUME_REDUND is not "". Then, I check this flag in the code, instead of the string ENV_UBI_VOLUME_REDUND.
Signed-off-by: Philippe Reynes philippe.reynes@softathome.com
env/Kconfig | 6 ++++++ include/env_internal.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-)
Thanks!
applied to u-boot-ubi.git master
bye, Heiko
participants (2)
-
Heiko Schocher
-
Philippe Reynes