uboot: do not erase ubi if fip volume is found (#112)

In this case FIP and all other data are stored in ubi.

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen
2025-08-19 16:26:14 +08:00
committed by GitHub
parent b220b09755
commit 4e54179aba
2 changed files with 3 additions and 2 deletions

View File

@@ -477,7 +477,7 @@ static int write_ubi_fit_image(const void *data, size_t size,
if (ret)
return ret;
if (!find_ubi_volume("fit")) {
if (!find_ubi_volume("fit") && !find_ubi_volume("fip")) {
/* ubi is dirty, erase ubi and recreate volumes */
umount_ubi();
ubi_mtd_param_parse(mtd->name, NULL);

View File

@@ -28,6 +28,7 @@
#include "untar.h"
#define PART_UBI_NAME "ubi"
#define PART_FIP_NAME "fip"
#define PART_FIRMWARE_NAME "firmware"
#define PART_FIT_NAME "fit"
#define PART_KERNEL_NAME "kernel"
@@ -654,7 +655,7 @@ static int write_ubi_fit_image(const void *data, size_t size,
if (ret)
return ret;
if (!ubi_find_volume(PART_FIT_NAME)) {
if (!ubi_find_volume(PART_FIT_NAME) && !ubi_find_volume(PART_FIP_NAME)) {
/* ubi is dirty, erase ubi and recreate volumes */
ubi_exit();
ret = mtd_erase_skip_bad(mtd, 0, mtd->size, mtd->size, NULL, NULL, false);