}
/*-----------------------------------------------------------------------------
- verify_Delta_IMG
+ verify_Delta_IMAGE
----------------------------------------------------------------------------*/
-int verify_Delta_IMG(int part_idx)
-{
- int ret = SUCCESS;
- ua_dataSS_t ua_dataSS;
- ua_part_info_t *ua_part_info = &s_part_info[part_idx];
- ua_update_cfg_t *ua_update_cfg = &s_update_cfg[part_idx];
- ua_update_data_t *ua_update_data = &s_update_data[part_idx];
- ua_delta_info_t *ua_delta_info = &s_delta_info;
-
- ua_dataSS.parti_info = ua_part_info;
- ua_dataSS.update_cfg = ua_update_cfg;
- ua_dataSS.update_data = ua_update_data;
- ua_dataSS.update_delta = ua_delta_info;
- ua_dataSS.ua_operation = UI_OP_SCOUT;
- ua_dataSS.ui_progress = fota_gui_progress;
-
- if (ua_update_data->ua_delta_path != NULL)
- ret = SS_IMGVerfiyPartition(&ua_dataSS, ua_dataSS.parti_info->ua_blk_name, true);
-
- return ret;
-}
-
-/*-----------------------------------------------------------------------------
- verify_Delta_IMGAB
- ----------------------------------------------------------------------------*/
-int verify_Delta_IMGAB(int part_idx)
+int verify_Delta_IMAGE(int part_idx)
{
int ret = SUCCESS;
ua_dataSS_t ua_dataSS;
}
/*-----------------------------------------------------------------------------
- update_Delta_IMG
+ update_Delta_IMAGE
----------------------------------------------------------------------------*/
-int update_Delta_IMG(int part_idx, unsigned long ui32Operation)
+int update_Delta_IMAGE(int part_idx, unsigned long ui32Operation)
{
int ret = SUCCESS;
ua_dataSS_t ua_dataSS;
ua_dataSS.ui_progress = fota_gui_progress;
ua_dataSS.write_data_to_blkdev = write_data_to_blkdev;
if (ua_update_data->ua_delta_path != NULL)
- ret = SS_IMGUpdatemain(&ua_dataSS, DELTA_IMG);
+ ret = SS_IMGUpdatemain(&ua_dataSS, DELTA_IMAGE);
return ret;
}
-/*-----------------------------------------------------------------------------
- update_Delta_IMG_AB
- ----------------------------------------------------------------------------*/
-int update_Delta_IMG_AB(int part_idx, unsigned long ui32Operation)
-{
- int ret = SUCCESS;
- ua_dataSS_t ua_dataSS;
- ua_part_info_t *ua_part_info = &s_part_info[part_idx];
- ua_update_cfg_t *ua_update_cfg = &s_update_cfg[part_idx];
- ua_update_data_t *ua_update_data = &s_update_data[part_idx];
-
- ua_delta_info_t *ua_delta_info = &s_delta_info;
- ua_dataSS.parti_info = ua_part_info;
- ua_dataSS.update_cfg = ua_update_cfg;
- ua_dataSS.update_data = ua_update_data;
- ua_dataSS.update_delta = ua_delta_info;
- ua_dataSS.ua_operation = ui32Operation;
- ua_dataSS.ui_progress = fota_gui_progress;
- ua_dataSS.write_data_to_blkdev = write_data_to_blkdev;
- if (ua_update_data->ua_delta_path != NULL)
- ret = SS_IMGUpdatemain(&ua_dataSS, DELTA_IMG_AB);
- return ret;
-}
-
-int verify_RecoveryDelta_IMG(int part_idx, int update_type)
+int verify_RecoveryDelta_IMAGE(int part_idx, int update_type)
{
int ret = SUCCESS;
ua_dataSS_t ua_dataSS;
ua_dataSS.update_delta = ua_delta_info;
ua_dataSS.ua_operation = UI_OP_SCOUT;
ua_dataSS.ui_progress = fota_gui_progress;
- if (update_type == FULL_IMG) {
+ if (update_type == FULL_IMAGE) {
if (ua_update_data->ua_delta_path != NULL) {
ret = SUCCESS;
fota_gui_progress(&ua_dataSS, 100);
}
- } else if (update_type == DELTA_IMG) {
+ } else if (update_type == DELTA_IMAGE) {
if (ua_update_data->ua_delta_path != NULL)
ret = SS_IMGVerfiyPartition(&ua_dataSS, ua_dataSS.parti_info->ua_blk_name, true);
}
}
-int update_RecoveryDelta_IMG(int part_idx, int update_type)
+int update_RecoveryDelta_IMAGE(int part_idx, int update_type)
{
int ret = SUCCESS;
ua_dataSS_t ua_dataSS;
ua_dataSS.ui_progress = fota_gui_progress;
if (ua_update_data->ua_delta_path != NULL && ua_dataSS.update_data->ua_temp_path) {
snprintf(ua_dataSS.update_data->ua_temp_path, MAX_FILE_PATH, "%s/%s", RAMDISK_PATH, ua_dataSS.parti_info->ua_parti_name);
- LOG("update_RecoveryDelta_IMG() [%s] temp path [%s]\n", ua_dataSS.parti_info->ua_parti_name, ua_dataSS.update_data->ua_temp_path);
+ LOG("update_RecoveryDelta_IMAGE() [%s] temp path [%s]\n", ua_dataSS.parti_info->ua_parti_name, ua_dataSS.update_data->ua_temp_path);
ret = SS_IMGUpdatemain(&ua_dataSS, update_type); //PASS temp path whr file has to be written, Once written it should be UNLINKED after upgrade.
}
return ret;
LOG("[%s] Verify %s ..............................................................\n", ts,
s_part_info[part_idx].ua_parti_name);
update_type = s_update_cfg[part_idx].update_type;
- if (update_type == FULL_IMG)
+ if (s_update_cfg[part_idx].update_when != AT_BOOT_FOTA) {
+ LOG("ignore %s - should be modified BEFORE_BOOT_FOTA", s_part_info[part_idx].ua_parti_name);
+ continue;
+ }
+ if (update_type == FULL_IMAGE)
ret = verify_Full_Image(part_idx);
- else if (update_type == DELTA_IMG)
- ret = verify_Delta_IMG(part_idx);
- else if (update_type == DELTA_IMG_AB)
- ret = verify_Delta_IMGAB(part_idx);
+ else if (update_type == DELTA_IMAGE)
+ ret = verify_Delta_IMAGE(part_idx);
else if (update_type == DELTA_FS)
ret = verify_Delta_FS(part_idx);
else if (update_type == EXTRA)
- ret = verify_RecoveryDelta_IMG(part_idx, FULL_IMG);
+ ret = verify_RecoveryDelta_IMAGE(part_idx, FULL_IMAGE);
else
ret = -1;
SS_Set_last_update_status(update_status, del_type);
+ if (s_update_cfg[part_idx].update_when != AT_BOOT_FOTA) {
+ LOG("ignore %s - should be modified BEFORE_BOOT_FOTA", s_part_info[part_idx].ua_parti_name);
+ continue;
+ }
update_type = s_update_cfg[part_idx].update_type;
- if (update_type == FULL_IMG)
+ if (update_type == FULL_IMAGE)
ret = update_Full_Image(part_idx);
- else if (update_type == DELTA_IMG)
- ret = update_Delta_IMG(part_idx, ui32Operation);
- else if (update_type == DELTA_IMG_AB)
- ret = update_Delta_IMG_AB(part_idx, ui32Operation);
+ else if (update_type == DELTA_IMAGE)
+ ret = update_Delta_IMAGE(part_idx, ui32Operation);
else if (update_type == DELTA_FS)
ret = update_Delta_FS(part_idx, ui32Operation);
else if (update_type == EXTRA) //TOTA
- ret = update_RecoveryDelta_IMG(part_idx, FULL_IMG);
+ ret = update_RecoveryDelta_IMAGE(part_idx, FULL_IMAGE);
else
ret = -1;
----------------------------------------------------------------------------*/
int get_update_type(char* part_name)
{
- if (strcmp(part_name, "FULL_IMG") == 0)
- return FULL_IMG;
- if (strcmp(part_name, "DELTA_IMG") == 0)
- return DELTA_IMG;
- if (strcmp(part_name, "DELTA_IMG_AB") == 0)
- return DELTA_IMG_AB;
- if (strcmp(part_name, "DELTA_FS") == 0)
- return DELTA_FS;
+ char *ctx;
+ char *part = strtok_r(part_name, ":", &ctx);
+ if (part) {
+ if (strcmp(part, "FULL_IMAGE") == 0)
+ return FULL_IMAGE;
+ if (strcmp(part, "DELTA_IMAGE") == 0)
+ return DELTA_IMAGE;
+ if (strcmp(part, "DELTA_FS") == 0)
+ return DELTA_FS;
+ }
return EXTRA;
}
/*-----------------------------------------------------------------------------
+ get_update_when
+ ----------------------------------------------------------------------------*/
+int get_update_when(char* part_name)
+{
+ char *ctx;
+ char *part = strtok_r(part_name, ":", &ctx);
+
+ if (part) // ignore the first element
+ part = strtok_r(NULL, ":", &ctx);
+
+ if (part) {
+ if (strcmp(part, "BEFORE_BOOT_FOTA") == 0)
+ return BEFORE_BOOT_FOTA;
+ if (strcmp(part, "AT_BOOT_FOTA") == 0)
+ return AT_BOOT_FOTA;
+ }
+ return -1;
+}
+
+
+/*-----------------------------------------------------------------------------
fota_blkid_update
----------------------------------------------------------------------------*/
int fota_blkid_update(void)
char* part_name = NULL;
char* subj_name = NULL;
int update_type = EXTRA;
+ int update_when = -1;
char *blk_name = NULL;
int blk_offset = 0;
int src_img_size = 0;
break;
case 2:
update_type = get_update_type(field);
+ update_when = get_update_when(field);
+ if (update_when < 0) {
+ LOG("unknown update type: %s", field);
+ return -1;
+ }
break;
case 3:
blk_name = strdup(field);
s_part_info[line_num].ua_blk_offset = blk_offset;
s_update_cfg[line_num].update_type = update_type;
+ s_update_cfg[line_num].update_when = update_when;
s_update_cfg[line_num].soure_img_size = src_img_size;
s_update_cfg[line_num].target_img_size = trg_img_size;
s_update_cfg[line_num].soure_sha1 = src_img_sha1;