Skip to content

Commit 55c198e

Browse files
RDKBACCL-1337:Image download fails after the 1st successful download using Firmware Upgrade method through xconf
Reason For Change: Firmware upgrade failing after 1st successful download using Firmware Upgrade. Test Procedure: Firmware upgrade should pass after 1st successful download using Firmware Upgrade. Risks : None Signed-off-by: mahanteshchitt <[email protected]>
1 parent 6cad201 commit 55c198e

1 file changed

Lines changed: 17 additions & 5 deletions

File tree

source/fwupgrade/fwupgrade_hal.c

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,6 @@ INT fwupgrade_hal_download_reboot_now()
600600
int bs_512 = 512;
601601
int bs_1M = 1024 * 1024;
602602
char decompress_cmd[300];
603-
604603
fprintf(stderr, "Entering %s\n", __func__);
605604
snprintf(wic_path, sizeof(wic_path), "/mnt/bootpart/%s", g_downloaded_file_name);
606605
// Step 1: Check if file exists
@@ -641,7 +640,6 @@ INT fwupgrade_hal_download_reboot_now()
641640
fprintf(stderr, "Currently booted from ROOT-B, switching to ROOT-A\n");
642641
strcpy(target_boot, "/dev/mmcblk0p3");
643642
strcpy(target_root, "/dev/mmcblk0p4");
644-
//umount("/dev/mmcblk0p4");
645643

646644
} else {
647645
fprintf(stderr, "Unsupported root partition_1: %s\n", g_root_partition);
@@ -748,7 +746,8 @@ INT fwupgrade_hal_download_reboot_now()
748746
write_image_to_device("/mnt/bootpart/fip.img", "/dev/mmcblk0p6", bs_512);
749747
sync();
750748
fprintf(stderr,"value of the xconf flag is %d\n", g_xconf_flag);
751-
umount("MOUNT_POINT");
749+
cleanup_mount(MOUNT_POINT_1);
750+
umount(MOUNT_POINT_1);
752751
sync();
753752
fprintf(stderr,"All done. Rebooting...\n");
754753
system("/sbin/reboot");
@@ -1067,7 +1066,6 @@ int check_image_version(const char *g_firmwareVersion,
10671066
if (strcmp(passiveVersion, extractedVersion) == 0) {
10681067
fprintf(stderr,"Passive Partition already has required version (%s). Switching banks...\n",
10691068
extractedVersion);
1070-
10711069
umount(MOUNT_POINT_2);
10721070
fwupgrade_hal_recover_image();
10731071
return -1;
@@ -1077,14 +1075,28 @@ int check_image_version(const char *g_firmwareVersion,
10771075
} else {
10781076
fprintf(stderr, "Mount of passive partition failed\n");
10791077
}
1080-
10811078
umount(MOUNT_POINT_2);
10821079
fprintf(stderr,"Neither active nor passive have the required version. Proceeding with upgrade...\n");
10831080
return RETURN_OK;
10841081

10851082

10861083
}
10871084

1085+
int cleanup_mount(const char *mnt)
1086+
{
1087+
char cmd[256];
1088+
1089+
snprintf(cmd, sizeof(cmd), "rm -rf %s/*", mnt);
1090+
1091+
if (system(cmd) != 0) {
1092+
fprintf(stderr, "Failed to cleanup %s\n", mnt);
1093+
return -1;
1094+
}
1095+
1096+
sync();
1097+
return 0;
1098+
}
1099+
10881100
int get_image_version(const char *filePath, char *outVersion, size_t outSize)
10891101
{
10901102
FILE *fp = fopen(filePath, "r");

0 commit comments

Comments
 (0)