mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-06-09 23:36:03 +09:00
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>
This commit is contained in:
parent
a9221f3ebd
commit
985186d1f2
7
env/Kconfig
vendored
7
env/Kconfig
vendored
|
@ -516,6 +516,13 @@ config ENV_UBI_VOLUME_REDUND
|
||||||
help
|
help
|
||||||
Name of the redundant volume that you want to store the environment in.
|
Name of the redundant volume that you want to store the environment in.
|
||||||
|
|
||||||
|
config ENV_UBI_VID_OFFSET
|
||||||
|
int "ubi environment VID offset"
|
||||||
|
depends on ENV_IS_IN_UBI
|
||||||
|
default 0
|
||||||
|
help
|
||||||
|
UBI VID offset for environment. If 0, no custom VID offset is used.
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
config USE_DEFAULT_ENV_FILE
|
config USE_DEFAULT_ENV_FILE
|
||||||
|
|
17
env/ubi.c
vendored
17
env/ubi.c
vendored
|
@ -15,6 +15,15 @@
|
||||||
#include <ubi_uboot.h>
|
#include <ubi_uboot.h>
|
||||||
#undef crc32
|
#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;
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
|
||||||
#ifdef CONFIG_CMD_SAVEENV
|
#ifdef CONFIG_CMD_SAVEENV
|
||||||
|
@ -28,7 +37,7 @@ static int env_ubi_save(void)
|
||||||
if (ret)
|
if (ret)
|
||||||
return 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",
|
printf("\n** Cannot find mtd partition \"%s\"\n",
|
||||||
CONFIG_ENV_UBI_PART);
|
CONFIG_ENV_UBI_PART);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -70,7 +79,7 @@ static int env_ubi_save(void)
|
||||||
if (ret)
|
if (ret)
|
||||||
return 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",
|
printf("\n** Cannot find mtd partition \"%s\"\n",
|
||||||
CONFIG_ENV_UBI_PART);
|
CONFIG_ENV_UBI_PART);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -111,7 +120,7 @@ static int env_ubi_load(void)
|
||||||
tmp_env1 = (env_t *)env1_buf;
|
tmp_env1 = (env_t *)env1_buf;
|
||||||
tmp_env2 = (env_t *)env2_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",
|
printf("\n** Cannot find mtd partition \"%s\"\n",
|
||||||
CONFIG_ENV_UBI_PART);
|
CONFIG_ENV_UBI_PART);
|
||||||
set_default_env(NULL, 0);
|
set_default_env(NULL, 0);
|
||||||
|
@ -148,7 +157,7 @@ static int env_ubi_load(void)
|
||||||
*/
|
*/
|
||||||
memset(buf, 0x0, CONFIG_ENV_SIZE);
|
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",
|
printf("\n** Cannot find mtd partition \"%s\"\n",
|
||||||
CONFIG_ENV_UBI_PART);
|
CONFIG_ENV_UBI_PART);
|
||||||
set_default_env(NULL, 0);
|
set_default_env(NULL, 0);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user