[Feature][T106_eSDK]update from T106-V2.01.01.02P56U06.AP.15.11_CAP.15.11.01 to T106-V2.01.01.02P56U09.AP.17.02_CAP.17.02.02 -- Uboot
Only Configure: No
Affected branch: master
Affected module: unknow
Is it affected on both ZXIC and MTK: only ZXIC
Self-test: Yes
Doc Update: No
Change-Id: I0d82c355a0fe633dc3ce2770f3091d496abfa89b
diff --git a/Uboot/boot/common/src/loader/lib/board.c b/Uboot/boot/common/src/loader/lib/board.c
index b72ce93..3ddc41f 100755
--- a/Uboot/boot/common/src/loader/lib/board.c
+++ b/Uboot/boot/common/src/loader/lib/board.c
@@ -146,6 +146,7 @@
int32_t add;
uint32_t amt_value = 0;
int32_t err_flag = 0;
+ int32_t switch_flag = 0;
T_BOOT_TARGET bootTarget;
T_FLAGS flagsData;
T_FLAGS_INFO *fotaFlag;
@@ -267,44 +268,127 @@
if (fotaFlag->boot_fota_flag.system.status == DUALSYSTEM_STATUS_UNBOOTABLE)
{
printf("dual_system status is unbootable!");
- goto error;
+ //goto error;
+ if(fotaFlag->boot_fota_flag.system2.status == DUALSYSTEM_STATUS_UNBOOTABLE)
+ {
+ printf("system status is both unbootable,restart system1!");
+ err_flag = 1;
+ /*ĬÈÏflags·ÖÇøÊý¾Ý*/
+ flagsData.magic_start = FLAGS_MAGIC;
+ flagsData.boot_fota_flag.boot_to = DUAL_SYSTEM;
+ flagsData.boot_fota_flag.fota_status = 1;
+ flagsData.boot_fota_flag.system.status = DUALSYSTEM_STATUS_BOOTABLE;
+ flagsData.boot_fota_flag.system2.status = DUALSYSTEM_STATUS_BOOTABLE;
+ flagsData.magic_end = FLAGS_MAGIC;
+ fotaFlag = &flagsData;
+ }
+ else
+ {
+ writel(DUALSYSTEM_STATUS_UNBOOTABLE, BOOT_FLAG_ADDR);
+ printf("restart system2!");
+ switch_flag = 1;
+ }
+
}
- ret = read_uboot_image((uint8_t *)UBOOT_IMAGE, &uboot_entry_point);
- if( ret != 0)
- {
- printf("read uboot1 image error, goto uboot2!");
- writel(DUALSYSTEM_STATUS_UNBOOTABLE, BOOT_FLAG_ADDR);
- ret = read_uboot_image((uint8_t *)UBOOT2_IMAGE, &uboot_entry_point);
+
+ if(1 == switch_flag)
+ {
+ ret = read_uboot_image((uint8_t *)UBOOT2_IMAGE, &uboot_entry_point);
if( ret != 0)
{
- printf("read uboot2 iamge error!");
- goto error;
+ printf("read uboot2 image error, goto uboot!");
+ writel(DUALSYSTEM_STATUS_UNBOOTABLE, BOOT_FLAG_ADDR);
+ ret = read_uboot_image((uint8_t *)UBOOT_IMAGE, &uboot_entry_point);
+ if( ret != 0)
+ {
+ printf("read uboot image error!");
+ goto error;
+ }
}
+ else
+ printf("goto uboot2!");
}
- else
- printf("goto uboot!");
+ else
+ {
+ ret = read_uboot_image((uint8_t *)UBOOT_IMAGE, &uboot_entry_point);
+ if( ret != 0)
+ {
+ printf("read uboot1 image error, goto uboot2!");
+ writel(DUALSYSTEM_STATUS_UNBOOTABLE, BOOT_FLAG_ADDR);
+ ret = read_uboot_image((uint8_t *)UBOOT2_IMAGE, &uboot_entry_point);
+ if( ret != 0)
+ {
+ printf("read uboot2 image error!");
+ goto error;
+ }
+ }
+ else
+ printf("goto uboot!");
+ }
+
}
else if(bootTarget == DUAL_SYSTEM2)
{
if (fotaFlag->boot_fota_flag.system2.status == DUALSYSTEM_STATUS_UNBOOTABLE)
{
printf("dual_system2 status is unbootable!");
- goto error;
- }
- ret = read_uboot_image((uint8_t *)UBOOT2_IMAGE, &uboot_entry_point);
- if( ret != 0)
- {
- printf("read uboot2 iamge error, goto uboot!");
- writel(DUALSYSTEM_STATUS_UNBOOTABLE, BOOT_FLAG_ADDR);
- ret = read_uboot_image((uint8_t *)UBOOT_IMAGE, &uboot_entry_point);
- if( ret != 0)
- {
- printf("read uboot iamge error!");
- goto error;
+ //goto error;
+ if(fotaFlag->boot_fota_flag.system.status == DUALSYSTEM_STATUS_UNBOOTABLE)
+ {
+ printf("system status is both unbootable,restart system2!");
+ err_flag = 1;
+ /*ĬÈÏflags·ÖÇøÊý¾Ý*/
+ flagsData.magic_start = FLAGS_MAGIC;
+ flagsData.boot_fota_flag.boot_to = DUAL_SYSTEM2;
+ flagsData.boot_fota_flag.fota_status = 1;
+ flagsData.boot_fota_flag.system.status = DUALSYSTEM_STATUS_BOOTABLE;
+ flagsData.boot_fota_flag.system2.status = DUALSYSTEM_STATUS_BOOTABLE;
+ flagsData.magic_end = FLAGS_MAGIC;
+ fotaFlag = &flagsData;
+ }
+ else
+ {
+ writel(DUALSYSTEM_STATUS_UNBOOTABLE, BOOT_FLAG_ADDR);
+ printf("restart system1!");
+ switch_flag = 1;
}
}
+
+ if(1 == switch_flag)
+ {
+ ret = read_uboot_image((uint8_t *)UBOOT_IMAGE, &uboot_entry_point);
+ if( ret != 0)
+ {
+ printf("read uboot image error, goto uboot2!");
+ writel(DUALSYSTEM_STATUS_UNBOOTABLE, BOOT_FLAG_ADDR);
+ ret = read_uboot_image((uint8_t *)UBOOT2_IMAGE, &uboot_entry_point);
+ if( ret != 0)
+ {
+ printf("read uboot2 image error!");
+ goto error;
+ }
+ }
+ else
+ printf("goto uboot!");
+ }
else
- printf("goto uboot2!");
+ {
+ ret = read_uboot_image((uint8_t *)UBOOT2_IMAGE, &uboot_entry_point);
+ if( ret != 0)
+ {
+ printf("read uboot2 image error, goto uboot!");
+ writel(DUALSYSTEM_STATUS_UNBOOTABLE, BOOT_FLAG_ADDR);
+ ret = read_uboot_image((uint8_t *)UBOOT_IMAGE, &uboot_entry_point);
+ if( ret != 0)
+ {
+ printf("read uboot image error!");
+ goto error;
+ }
+ }
+ else
+ printf("goto uboot2!");
+ }
+
}
else
{