diff --git a/uboot-mtk-20220606/board/mediatek/common/ubi_helper.c b/uboot-mtk-20220606/board/mediatek/common/ubi_helper.c index 1e5e2d812..be8ca5b97 100644 --- a/uboot-mtk-20220606/board/mediatek/common/ubi_helper.c +++ b/uboot-mtk-20220606/board/mediatek/common/ubi_helper.c @@ -531,13 +531,16 @@ static int write_ubi_fit_image(const void *data, size_t size, if (ret) return ret; - ret = create_ubi_volume("ubootenv", 0x100000, -1, false); +#ifdef CONFIG_ENV_IS_IN_UBI + ret = create_ubi_volume(CONFIG_ENV_UBI_VOLUME, CONFIG_ENV_SIZE, -1, false); if (ret) goto out; - - ret = create_ubi_volume("ubootenv2", 0x100000, -1, false); +#ifdef CONFIG_SYS_REDUNDAND_ENVIRONMENT + ret = create_ubi_volume(CONFIG_ENV_UBI_VOLUME_REDUND, CONFIG_ENV_SIZE, -1, false); if (ret) goto out; +#endif +#endif } /* Remove this volume first in case of no enough PEBs */ diff --git a/uboot-mtk-20230718-09eda825/board/mediatek/common/mtd_helper.c b/uboot-mtk-20230718-09eda825/board/mediatek/common/mtd_helper.c index 87b8b3741..e3636e1b6 100644 --- a/uboot-mtk-20230718-09eda825/board/mediatek/common/mtd_helper.c +++ b/uboot-mtk-20230718-09eda825/board/mediatek/common/mtd_helper.c @@ -655,13 +655,17 @@ static int write_ubi_fit_image(const void *data, size_t size, if (ret) return ret; - ret = create_ubi_volume("ubootenv", 0x100000, -1, false); +#ifdef CONFIG_ENV_IS_IN_UBI + ret = create_ubi_volume(CONFIG_ENV_UBI_VOLUME, CONFIG_ENV_SIZE, UBI_VOL_NUM_AUTO, false); if (ret) goto out; - ret = create_ubi_volume("ubootenv2", 0x100000, -1, false); +#ifdef CONFIG_SYS_REDUNDAND_ENVIRONMENT + ret = create_ubi_volume(CONFIG_ENV_UBI_VOLUME_REDUND, CONFIG_ENV_SIZE, UBI_VOL_NUM_AUTO, false); if (ret) goto out; +#endif +#endif } /* Remove this volume first in case of no enough PEBs */