From b5bc2b2dfbcc038eaad78158b03cb5acd901463b Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Wed, 13 Aug 2025 03:19:41 +0800 Subject: [PATCH] uboot-mtk-20250711: make use of fit_get_totalsize func `itb_external_image_data_info` inside `parse_image_itb` is broken, needs investigation. Disable for now. Signed-off-by: Tianling Shen --- .../board/mediatek/common/image_helper.c | 10 +++++----- uboot-mtk-20250711/board/mediatek/common/mmc_helper.c | 4 ++-- uboot-mtk-20250711/board/mediatek/common/mtd_helper.c | 4 ++-- .../board/mediatek/common/verify_helper.c | 5 +++-- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/uboot-mtk-20250711/board/mediatek/common/image_helper.c b/uboot-mtk-20250711/board/mediatek/common/image_helper.c index 82b30625a..a15175586 100644 --- a/uboot-mtk-20250711/board/mediatek/common/image_helper.c +++ b/uboot-mtk-20250711/board/mediatek/common/image_helper.c @@ -401,12 +401,12 @@ static int parse_image_itb(const void *fit, size_t size, u32 blocksize, struct owrt_image_info *ii) { int ret, cfg_noffset; - u32 image_size; + size_t image_size; - image_size = itb_image_size(fit); + image_size = fit_get_totalsize(fit); if (!image_size || image_size > size) { if (image_size) { - printf("itb image size is invalid (%u >= %zu)\n", + printf("itb image size is invalid (%lu >= %zu)\n", image_size, size); } @@ -512,8 +512,8 @@ int parse_image_ram(const void *data, size_t size, u32 blocksize, #endif #if defined(CONFIG_FIT) case IMAGE_FORMAT_FIT: - if (!parse_image_itb(data, size, blocksize, ii)) - return 0; + // if (!parse_image_itb(data, size, blocksize, ii)) + // return 0; ii->header_type = HEADER_FIT; ii->kernel_size = fit_get_size(data); diff --git a/uboot-mtk-20250711/board/mediatek/common/mmc_helper.c b/uboot-mtk-20250711/board/mediatek/common/mmc_helper.c index 2a1843aaa..ee0dfb9c1 100644 --- a/uboot-mtk-20250711/board/mediatek/common/mmc_helper.c +++ b/uboot-mtk-20250711/board/mediatek/common/mmc_helper.c @@ -856,7 +856,7 @@ static int _boot_from_mmc(struct mmc *mmc, u64 offset, bool do_boot) if (ret) return ret; - itb_size = itb_image_size((const void *)data_load_addr); + itb_size = fit_get_totalsize((const void *)data_load_addr); if (itb_size > size) { ret = _mmc_read(mmc, offset + size, (void *)(data_load_addr + size), @@ -1428,7 +1428,7 @@ int mmc_upgrade_image_cust(u32 dev, const void *data, size_t size, if (ret) return ret; - if (ii.type == IMAGE_ITB) + if (ii.header_type == HEADER_FIT) return mmc_upgrade_image_itb(dev, data, size, kernel_part); if (IS_ENABLED(CONFIG_MTK_DUAL_BOOT_ITB_IMAGE) || diff --git a/uboot-mtk-20250711/board/mediatek/common/mtd_helper.c b/uboot-mtk-20250711/board/mediatek/common/mtd_helper.c index de4584d97..5647f34db 100644 --- a/uboot-mtk-20250711/board/mediatek/common/mtd_helper.c +++ b/uboot-mtk-20250711/board/mediatek/common/mtd_helper.c @@ -571,7 +571,7 @@ int boot_from_mtd(struct mtd_info *mtd, u64 offset, bool do_boot) if (ret) return ret; - itb_size = itb_image_size((const void *)data_load_addr); + itb_size = fit_get_totalsize((const void *)data_load_addr); if (itb_size > size) { ret = mtd_read_skip_bad(mtd, offset + size, itb_size - size, @@ -1610,7 +1610,7 @@ int mtd_upgrade_image(const void *data, size_t size) #endif return write_ubi2_tar_image(data, size, mtd); } - if (!ret && ii.type == IMAGE_ITB) + if (ii.header_type == HEADER_FIT) return write_ubi_itb_image(data, size, mtd); } } diff --git a/uboot-mtk-20250711/board/mediatek/common/verify_helper.c b/uboot-mtk-20250711/board/mediatek/common/verify_helper.c index 82f973e4e..fb6199dd9 100644 --- a/uboot-mtk-20250711/board/mediatek/common/verify_helper.c +++ b/uboot-mtk-20250711/board/mediatek/common/verify_helper.c @@ -675,7 +675,8 @@ bool read_verify_rootfs(struct image_read_priv *rpriv, const void *fit, bool read_verify_itb_image(struct image_read_priv *rpriv, void *ptr, u64 addr, size_t max_size, size_t *actual_size) { - ulong probe_size, fit_size, image_size; + ulong probe_size, fit_size; + size_t image_size; int ret; if (!rpriv || !ptr) @@ -710,7 +711,7 @@ bool read_verify_itb_image(struct image_read_priv *rpriv, void *ptr, u64 addr, return false; } - image_size = itb_image_size(ptr); + image_size = fit_get_totalsize(ptr); if (!image_size || (max_size && image_size > max_size)) { if (image_size && max_size) { printf("itb image size is invalid (%lu >= %zu)\n",