uboot: fix erasing ubi when flash fit firmware
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
@@ -480,7 +480,8 @@ static int write_ubi_fit_image(const void *data, size_t size,
|
||||
if (!find_ubi_volume("fit")) {
|
||||
/* ubi is dirty, erase ubi and recreate volumes */
|
||||
umount_ubi();
|
||||
ret = mtd_erase_skip_bad(mtd, 0, size, mtd->size, NULL, NULL, true);
|
||||
ubi_mtd_param_parse(mtd->name, NULL);
|
||||
ret = mtd_erase_skip_bad(mtd, 0, mtd->size, mtd->size, NULL, NULL, false);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@@ -496,8 +497,8 @@ static int write_ubi_fit_image(const void *data, size_t size,
|
||||
ret = create_ubi_volume(CONFIG_ENV_UBI_VOLUME_REDUND, CONFIG_ENV_SIZE, -1, false);
|
||||
if (ret)
|
||||
goto out;
|
||||
#endif
|
||||
#endif
|
||||
#endif /* CONFIG_SYS_REDUNDAND_ENVIRONMENT */
|
||||
#endif /* CONFIG_ENV_IS_IN_UBI */
|
||||
}
|
||||
|
||||
/* Remove this volume first in case of no enough PEBs */
|
||||
|
||||
@@ -657,7 +657,7 @@ static int write_ubi_fit_image(const void *data, size_t size,
|
||||
if (!ubi_find_volume(PART_FIT_NAME)) {
|
||||
/* ubi is dirty, erase ubi and recreate volumes */
|
||||
ubi_exit();
|
||||
ret = mtd_erase_skip_bad(mtd, 0, size, mtd->size, NULL, NULL, true);
|
||||
ret = mtd_erase_skip_bad(mtd, 0, mtd->size, mtd->size, NULL, NULL, false);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@@ -674,8 +674,8 @@ static int write_ubi_fit_image(const void *data, size_t size,
|
||||
ret = create_ubi_volume(CONFIG_ENV_UBI_VOLUME_REDUND, CONFIG_ENV_SIZE, UBI_VOL_NUM_AUTO, false);
|
||||
if (ret)
|
||||
goto out;
|
||||
#endif
|
||||
#endif
|
||||
#endif /* CONFIG_SYS_REDUNDAND_ENVIRONMENT */
|
||||
#endif /* CONFIG_ENV_IS_IN_UBI */
|
||||
}
|
||||
|
||||
/* Remove this volume first in case of no enough PEBs */
|
||||
|
||||
Reference in New Issue
Block a user