aboutsummaryrefslogtreecommitdiff
path: root/env/ubi.c
diff options
context:
space:
mode:
authorHamish Guthrie <hamish.guthrie@kistler.com>2019-05-15 15:15:55 +0200
committerHeiko Schocher <hs@denx.de>2019-07-09 07:00:22 +0200
commit985186d1f2539c002c8482b2b164d59026d1bea3 (patch)
tree3cf0da0ef3a822bba5025a2fd281146980ee43f8 /env/ubi.c
parenta9221f3ebd6dc71b33c14055504446d8e08f372b (diff)
downloadu-boot-985186d1f2539c002c8482b2b164d59026d1bea3.zip
u-boot-985186d1f2539c002c8482b2b164d59026d1bea3.tar.gz
u-boot-985186d1f2539c002c8482b2b164d59026d1bea3.tar.bz2
env: ubi: support configurable VID offset
Introduce KConfig CONFIG_ENV_UBI_VID_OFFSET to allow providing custom VID header offsets for the environment on UBI. Signed-off-by: Hamish Guthrie <hamish.guthrie@kistler.com> Signed-off-by: Markus Klotzbuecher <markus.klotzbuecher@kistler.com> Reviewed-by: Heiko Schocher <hs@denx.de> Cc: Kyungmin Park <kmpark@infradead.org>
Diffstat (limited to 'env/ubi.c')
-rw-r--r--env/ubi.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/env/ubi.c b/env/ubi.c
index 1dfdf0a..e4b8516 100644
--- a/env/ubi.c
+++ b/env/ubi.c
@@ -15,6 +15,15 @@
#include <ubi_uboot.h>
#undef crc32
+#define _QUOTE(x) #x
+#define QUOTE(x) _QUOTE(x)
+
+#if (CONFIG_ENV_UBI_VID_OFFSET == 0)
+ #define UBI_VID_OFFSET NULL
+#else
+ #define UBI_VID_OFFSET QUOTE(CONFIG_ENV_UBI_VID_OFFSET)
+#endif
+
DECLARE_GLOBAL_DATA_PTR;
#ifdef CONFIG_CMD_SAVEENV
@@ -28,7 +37,7 @@ static int env_ubi_save(void)
if (ret)
return ret;
- if (ubi_part(CONFIG_ENV_UBI_PART, NULL)) {
+ if (ubi_part(CONFIG_ENV_UBI_PART, UBI_VID_OFFSET)) {
printf("\n** Cannot find mtd partition \"%s\"\n",
CONFIG_ENV_UBI_PART);
return 1;
@@ -70,7 +79,7 @@ static int env_ubi_save(void)
if (ret)
return ret;
- if (ubi_part(CONFIG_ENV_UBI_PART, NULL)) {
+ if (ubi_part(CONFIG_ENV_UBI_PART, UBI_VID_OFFSET)) {
printf("\n** Cannot find mtd partition \"%s\"\n",
CONFIG_ENV_UBI_PART);
return 1;
@@ -111,7 +120,7 @@ static int env_ubi_load(void)
tmp_env1 = (env_t *)env1_buf;
tmp_env2 = (env_t *)env2_buf;
- if (ubi_part(CONFIG_ENV_UBI_PART, NULL)) {
+ if (ubi_part(CONFIG_ENV_UBI_PART, UBI_VID_OFFSET)) {
printf("\n** Cannot find mtd partition \"%s\"\n",
CONFIG_ENV_UBI_PART);
set_default_env(NULL, 0);
@@ -148,7 +157,7 @@ static int env_ubi_load(void)
*/
memset(buf, 0x0, CONFIG_ENV_SIZE);
- if (ubi_part(CONFIG_ENV_UBI_PART, NULL)) {
+ if (ubi_part(CONFIG_ENV_UBI_PART, UBI_VID_OFFSET)) {
printf("\n** Cannot find mtd partition \"%s\"\n",
CONFIG_ENV_UBI_PART);
set_default_env(NULL, 0);