|
@@ -95,6 +95,7 @@ static int env_ubi_load(void)
|
|
{
|
|
{
|
|
ALLOC_CACHE_ALIGN_BUFFER(char, env1_buf, CONFIG_ENV_SIZE);
|
|
ALLOC_CACHE_ALIGN_BUFFER(char, env1_buf, CONFIG_ENV_SIZE);
|
|
ALLOC_CACHE_ALIGN_BUFFER(char, env2_buf, CONFIG_ENV_SIZE);
|
|
ALLOC_CACHE_ALIGN_BUFFER(char, env2_buf, CONFIG_ENV_SIZE);
|
|
|
|
+ int read1_fail, read2_fail;
|
|
env_t *tmp_env1, *tmp_env2;
|
|
env_t *tmp_env1, *tmp_env2;
|
|
|
|
|
|
/*
|
|
/*
|
|
@@ -118,21 +119,20 @@ static int env_ubi_load(void)
|
|
return -EIO;
|
|
return -EIO;
|
|
}
|
|
}
|
|
|
|
|
|
- if (ubi_volume_read(CONFIG_ENV_UBI_VOLUME, (void *)tmp_env1,
|
|
|
|
- CONFIG_ENV_SIZE)) {
|
|
|
|
|
|
+ read1_fail = ubi_volume_read(CONFIG_ENV_UBI_VOLUME, (void *)tmp_env1,
|
|
|
|
+ CONFIG_ENV_SIZE);
|
|
|
|
+ if (read1_fail)
|
|
printf("\n** Unable to read env from %s:%s **\n",
|
|
printf("\n** Unable to read env from %s:%s **\n",
|
|
CONFIG_ENV_UBI_PART, CONFIG_ENV_UBI_VOLUME);
|
|
CONFIG_ENV_UBI_PART, CONFIG_ENV_UBI_VOLUME);
|
|
- }
|
|
|
|
|
|
|
|
- if (ubi_volume_read(CONFIG_ENV_UBI_VOLUME_REDUND, (void *)tmp_env2,
|
|
|
|
- CONFIG_ENV_SIZE)) {
|
|
|
|
|
|
+ read2_fail = ubi_volume_read(CONFIG_ENV_UBI_VOLUME_REDUND,
|
|
|
|
+ (void *)tmp_env2, CONFIG_ENV_SIZE);
|
|
|
|
+ if (read2_fail)
|
|
printf("\n** Unable to read redundant env from %s:%s **\n",
|
|
printf("\n** Unable to read redundant env from %s:%s **\n",
|
|
CONFIG_ENV_UBI_PART, CONFIG_ENV_UBI_VOLUME_REDUND);
|
|
CONFIG_ENV_UBI_PART, CONFIG_ENV_UBI_VOLUME_REDUND);
|
|
- }
|
|
|
|
|
|
|
|
- env_import_redund((char *)tmp_env1, (char *)tmp_env2);
|
|
|
|
-
|
|
|
|
- return 0;
|
|
|
|
|
|
+ return env_import_redund((char *)tmp_env1, read1_fail, (char *)tmp_env2,
|
|
|
|
+ read2_fail);
|
|
}
|
|
}
|
|
#else /* ! CONFIG_SYS_REDUNDAND_ENVIRONMENT */
|
|
#else /* ! CONFIG_SYS_REDUNDAND_ENVIRONMENT */
|
|
static int env_ubi_load(void)
|
|
static int env_ubi_load(void)
|