uboot-mtk-20250711: support mainline FIT partition
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
@@ -45,6 +45,8 @@
|
||||
|
||||
#define GPT_PRIMARY_PARTITION_ENTRY_LBA 2ULL
|
||||
|
||||
#define PART_PRODUCTION_NAME "production"
|
||||
|
||||
struct mmc_image_read_priv {
|
||||
struct image_read_priv p;
|
||||
struct mmc *mmc;
|
||||
@@ -1214,11 +1216,11 @@ int mmc_boot_image(u32 dev, bool do_boot)
|
||||
return mmc_dual_boot(dev, do_boot);
|
||||
|
||||
if (strcmp(CONFIG_MTK_DEFAULT_FIT_BOOT_CONF, "")) {
|
||||
part_primary = PART_FIRMWARE_NAME;
|
||||
part_primary = PART_PRODUCTION_NAME;
|
||||
part_secondary = PART_KERNEL_NAME;
|
||||
} else {
|
||||
part_primary = PART_KERNEL_NAME;
|
||||
part_secondary = PART_FIRMWARE_NAME;
|
||||
part_secondary = PART_PRODUCTION_NAME;
|
||||
}
|
||||
|
||||
ret = boot_from_mmc_partition(dev, 0, part_primary, do_boot);
|
||||
@@ -1336,7 +1338,7 @@ static int mmc_upgrade_image_itb(u32 dev, const void *data, size_t size,
|
||||
|
||||
do_dual_boot_post = true;
|
||||
} else {
|
||||
part = PART_FIRMWARE_NAME;
|
||||
part = PART_PRODUCTION_NAME;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "rootdisk.h"
|
||||
#include "untar.h"
|
||||
|
||||
#define PART_FIT_NAME "fit"
|
||||
#define PART_UBI_NAME "ubi"
|
||||
|
||||
#define UBI_MOUNT_RECREATE (!IS_ENABLED(CONFIG_MTK_DUAL_BOOT) && \
|
||||
@@ -933,7 +934,7 @@ static int write_ubi2_tar_image(const void *data, size_t size,
|
||||
return ret;
|
||||
|
||||
/* Remove possibly existed firmware volume */
|
||||
remove_ubi_volume(PART_FIRMWARE_NAME);
|
||||
remove_ubi_volume(PART_FIT_NAME);
|
||||
|
||||
if (!IS_ENABLED(CONFIG_MTK_DUAL_BOOT)) {
|
||||
/* Remove this volume first in case of no enough PEBs */
|
||||
@@ -976,7 +977,7 @@ static int write_ubi_itb_image(const void *data, size_t size,
|
||||
else
|
||||
rootfs_data_part = dual_boot_slots[slot].rootfs_data;
|
||||
} else {
|
||||
firmware_part = PART_FIRMWARE_NAME;
|
||||
firmware_part = PART_FIT_NAME;
|
||||
rootfs_data_part = PART_ROOTFS_DATA_NAME;
|
||||
}
|
||||
|
||||
@@ -1291,11 +1292,11 @@ static int boot_from_ubi(struct mtd_info *mtd, bool do_boot)
|
||||
return ret;
|
||||
|
||||
if (strcmp(CONFIG_MTK_DEFAULT_FIT_BOOT_CONF, "")) {
|
||||
volname_primary = PART_FIRMWARE_NAME;
|
||||
volname_primary = PART_FIT_NAME;
|
||||
volname_secondary = PART_KERNEL_NAME;
|
||||
} else {
|
||||
volname_primary = PART_KERNEL_NAME;
|
||||
volname_secondary = PART_FIRMWARE_NAME;
|
||||
volname_secondary = PART_FIT_NAME;
|
||||
}
|
||||
|
||||
ret = read_ubi_volume(volname_primary, (void *)data_load_addr, 0);
|
||||
@@ -1616,7 +1617,7 @@ int mtd_upgrade_image(const void *data, size_t size)
|
||||
#endif /* CONFIG_CMD_UBI */
|
||||
|
||||
#ifndef CONFIG_MTK_DUAL_BOOT
|
||||
mtd = get_mtd_device_nm(PART_FIRMWARE_NAME);
|
||||
mtd = get_mtd_device_nm(PART_FIT_NAME);
|
||||
if (!IS_ERR_OR_NULL(mtd)) {
|
||||
put_mtd_device(mtd);
|
||||
|
||||
@@ -1684,7 +1685,7 @@ int mtd_boot_image(bool do_boot)
|
||||
#endif /* CONFIG_CMD_UBI */
|
||||
|
||||
#ifndef CONFIG_MTK_DUAL_BOOT
|
||||
mtd = get_mtd_device_nm(PART_FIRMWARE_NAME);
|
||||
mtd = get_mtd_device_nm(PART_FIT_NAME);
|
||||
if (!IS_ERR_OR_NULL(mtd)) {
|
||||
put_mtd_device(mtd);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user