Fix Uboot can't find boot/rootfs image then don't setup
This commit is contained in:
parent
e427d1dad6
commit
2739631b44
|
@ -303,10 +303,7 @@ static int run_ota_upgrade(POTA_PARAMS pInfo)
|
||||||
|
|
||||||
memset(&upgInfo, 0, sizeof(OTA_PARAMS));
|
memset(&upgInfo, 0, sizeof(OTA_PARAMS));
|
||||||
|
|
||||||
SET_STA_FLAG(pInfo->otaStatus, FLAG_EXEC_OTA);
|
|
||||||
|
|
||||||
upgInfo.bootfileSize = ota_read_boot_image();
|
upgInfo.bootfileSize = ota_read_boot_image();
|
||||||
ota_calc_boot_image_chksum(upgInfo.bootfileSize, upgInfo.bootChksum);
|
|
||||||
|
|
||||||
if(upgInfo.bootfileSize != pInfo->bootfileSize)
|
if(upgInfo.bootfileSize != pInfo->bootfileSize)
|
||||||
{
|
{
|
||||||
|
@ -318,7 +315,9 @@ static int run_ota_upgrade(POTA_PARAMS pInfo)
|
||||||
ota_save_params(pInfo);
|
ota_save_params(pInfo);
|
||||||
return -ERR_BAD_BOOT_CHKSUM;
|
return -ERR_BAD_BOOT_CHKSUM;
|
||||||
}
|
}
|
||||||
else if(strcmp(upgInfo.bootChksum, pInfo->bootChksum) != 0)
|
|
||||||
|
ota_calc_boot_image_chksum(upgInfo.bootfileSize, upgInfo.bootChksum);
|
||||||
|
if(strcmp(upgInfo.bootChksum, pInfo->bootChksum) != 0)
|
||||||
{
|
{
|
||||||
printf("Upgrade boot image maybe error:\n\t%s --> %s\n\t%u-%u\n",
|
printf("Upgrade boot image maybe error:\n\t%s --> %s\n\t%u-%u\n",
|
||||||
upgInfo.bootChksum, pInfo->bootChksum,
|
upgInfo.bootChksum, pInfo->bootChksum,
|
||||||
|
@ -329,16 +328,7 @@ static int run_ota_upgrade(POTA_PARAMS pInfo)
|
||||||
return -ERR_BAD_BOOT_FILESIZE;
|
return -ERR_BAD_BOOT_FILESIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ota_upgrade_boot_image() != 0)
|
|
||||||
{
|
|
||||||
printf("Write boot image error\n");
|
|
||||||
SET_STA_ERR(pInfo->otaStatus, ERR_WRITE_BOOTIMG);
|
|
||||||
ota_save_params(pInfo);
|
|
||||||
return -ERR_WRITE_BOOTIMG;
|
|
||||||
}
|
|
||||||
|
|
||||||
upgInfo.rootfsfileSize = ota_read_rootfs_image();
|
upgInfo.rootfsfileSize = ota_read_rootfs_image();
|
||||||
ota_calc_rootfs_image_chksum(upgInfo.rootfsfileSize, upgInfo.rootfsChksum);
|
|
||||||
|
|
||||||
if(upgInfo.rootfsfileSize != pInfo->rootfsfileSize)
|
if(upgInfo.rootfsfileSize != pInfo->rootfsfileSize)
|
||||||
{
|
{
|
||||||
|
@ -350,7 +340,9 @@ static int run_ota_upgrade(POTA_PARAMS pInfo)
|
||||||
ota_save_params(pInfo);
|
ota_save_params(pInfo);
|
||||||
return -ERR_BAD_ROOTFS_FILESIZE;
|
return -ERR_BAD_ROOTFS_FILESIZE;
|
||||||
}
|
}
|
||||||
else if(strcmp(upgInfo.rootfsChksum, pInfo->rootfsChksum) != 0)
|
|
||||||
|
ota_calc_rootfs_image_chksum(upgInfo.rootfsfileSize, upgInfo.rootfsChksum);
|
||||||
|
if(strcmp(upgInfo.rootfsChksum, pInfo->rootfsChksum) != 0)
|
||||||
{
|
{
|
||||||
printf("Upgrade rootfs image maybe error:\n\t%s --> %s\n\t%u-%u\n",
|
printf("Upgrade rootfs image maybe error:\n\t%s --> %s\n\t%u-%u\n",
|
||||||
upgInfo.rootfsChksum, pInfo->rootfsChksum,
|
upgInfo.rootfsChksum, pInfo->rootfsChksum,
|
||||||
|
@ -361,6 +353,16 @@ static int run_ota_upgrade(POTA_PARAMS pInfo)
|
||||||
return -ERR_BAD_ROOTFS_CHKSUM;
|
return -ERR_BAD_ROOTFS_CHKSUM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SET_STA_FLAG(pInfo->otaStatus, FLAG_EXEC_OTA);
|
||||||
|
|
||||||
|
if(ota_upgrade_boot_image() != 0)
|
||||||
|
{
|
||||||
|
printf("Write boot image error\n");
|
||||||
|
SET_STA_ERR(pInfo->otaStatus, ERR_WRITE_BOOTIMG);
|
||||||
|
ota_save_params(pInfo);
|
||||||
|
return -ERR_WRITE_BOOTIMG;
|
||||||
|
}
|
||||||
|
|
||||||
if(ota_upgrade_rootfs_image() != 0)
|
if(ota_upgrade_rootfs_image() != 0)
|
||||||
{
|
{
|
||||||
printf("Write rootfs image error\n");
|
printf("Write rootfs image error\n");
|
||||||
|
@ -418,7 +420,9 @@ static int verify_ota_upgrade(POTA_PARAMS pInfo)
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int run_ota_task(void)
|
static int
|
||||||
|
|
||||||
|
run_ota_task(void)
|
||||||
{
|
{
|
||||||
OTA_PARAMS otaInfo;
|
OTA_PARAMS otaInfo;
|
||||||
|
|
||||||
|
@ -441,8 +445,18 @@ static int run_ota_task(void)
|
||||||
if(run_ota_upgrade(&otaInfo) != ERR_OK)
|
if(run_ota_upgrade(&otaInfo) != ERR_OK)
|
||||||
{
|
{
|
||||||
int val = GET_STA_CNT(otaInfo.otaStatus) + 1;
|
int val = GET_STA_CNT(otaInfo.otaStatus) + 1;
|
||||||
|
|
||||||
|
if(val > 3)
|
||||||
|
{
|
||||||
|
SET_STA_CNT(otaInfo.otaStatus, 0);
|
||||||
|
SET_STA_CMD(otaInfo.otaStatus, CMD_RUN_BOOT);
|
||||||
|
SET_STA_FLAG(otaInfo.otaStatus, FLAG_NORMAL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
SET_STA_CNT(otaInfo.otaStatus, val);
|
SET_STA_CNT(otaInfo.otaStatus, val);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SET_STA_CNT(otaInfo.otaStatus, 0);
|
SET_STA_CNT(otaInfo.otaStatus, 0);
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue