Remove target dependent partition information 32/158032/3
authorKichan Kwon <k_c.kwon@samsung.com>
Fri, 27 Oct 2017 05:19:06 +0000 (14:19 +0900)
committerKichan Kwon <k_c.kwon@samsung.com>
Fri, 3 Nov 2017 03:44:35 +0000 (12:44 +0900)
- To target independent, we remove these below
  - Default partition configuration
  - Partition-dependent error value

- UPG always make config file if successful, so
  UA doesn't have to know it already
- If config file is not found, stop upgrade and return error

- NOTICE : it must be merged along with the libtota patch
  - https://review.tizen.org/gerrit/#/c/158166/

Change-Id: I9ca5665b06cf8066f701016309d6b22712db492c
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
src/rpi3/ua.c
src/rpi3/ua.h
src/wearable/ua.c
src/wearable/ua.h

index dda68be..f537a36 100644 (file)
@@ -56,55 +56,17 @@ static char log_folder[MAX_FILE_PATH];
 static char result_folder[MAX_FILE_PATH];
 static char temp_folder[MAX_FILE_PATH];
 
-
-static ua_part_info_t def_part_info[UA_PARTI_MAX] = {
-       { "KERNEL",  "boot.img/",        "", 0 },
-       { "ROOTFS",  "rootfs.img/",      "", 0 },
-       { "SYSDATA", "system-data.img/", "", 0 },
-       { "USER",    "user.img/",        "", 0 },
-       { "MODULE",  "modules.img/",     "", 0 },
-};
-
-static ua_update_cfg_t def_update_cfg[UA_PARTI_MAX] = {
-       { DELTA_FS, UA_KERNEL,  0, 0 },
-       { DELTA_FS, UA_ROOTFS,  0, 0 },
-       { DELTA_FS, UA_SYSDATA, 0, 0 },
-       { DELTA_FS, UA_USER,    0, 0 },
-       { DELTA_FS, UA_MODULE,  0, 0 },
-};
-
 static ua_part_info_t s_part_info[UA_PARTI_MAX];
 
 static ua_update_cfg_t s_update_cfg[UA_PARTI_MAX];
 
-static ua_update_data_t s_update_data[UA_PARTI_MAX] = {
-       { 0, 0, 0, 0, 0, 0, NULL, NULL },
-       { 0, 0, 0, 0, 0, 0, NULL, NULL },
-       { 0, 0, 0, 0, 0, 0, NULL, NULL },
-       { 0, 0, 0, 0, 0, 0, NULL, NULL },
-       { 0, 0, 0, 0, 0, 0, NULL, NULL },
-};
-
-static int g_verify_error[] = {
-       [UA_KERNEL]  = UPI_KERNEL_VERIFY_ERROR,
-       [UA_ROOTFS]  = UPI_ROOTFS_VERIFY_ERROR,
-       [UA_SYSDATA] = UPI_SYSDATA_VERIFY_ERROR,
-       [UA_USER]    = UPI_USER_VERIFY_ERROR,
-       [UA_MODULE]  = UPI_MODULE_VERIFY_ERROR,
-};
-
-static int g_update_error[] = {
-       [UA_KERNEL]  = UPI_KERNEL_UPDATE_ERROR,
-       [UA_ROOTFS]  = UPI_ROOTFS_UPDATE_ERROR,
-       [UA_SYSDATA] = UPI_SYSDATA_UPDATE_ERROR,
-       [UA_USER]    = UPI_USER_UPDATE_ERROR,
-       [UA_MODULE]  = UPI_MODULE_UPDATE_ERROR,
-};
+static ua_update_data_t s_update_data[UA_PARTI_MAX];
 
 static int s_part_num = 0;
 
 static int s_initrd_version = 1;
 static ua_delta_info_t s_delta_info;
+
 unsigned int __log_level__ =
        (LOG_DEBUG | LOG_FLASH | LOG_FILE | LOG_FUNCS | LOG_GUI | LOG_ENGINE | LOG_INFO);
 FILE *__log_out_file__;
@@ -218,7 +180,6 @@ int write_data_to_blkdev(char* dev_name, int blk_start, int blk_cnt, char* data)
        return SUCCESS;
 }
 
-
 /*-----------------------------------------------------------------------------
   write_full_image
  ----------------------------------------------------------------------------*/
@@ -320,7 +281,6 @@ int verify_Full_Image(int part_idx)
                fota_gui_progress(&ua_dataSS, 100);
        }
        return ret;
-
 }
 
 /*-----------------------------------------------------------------------------
@@ -362,7 +322,6 @@ int update_Full_Image(int part_idx)
 int verify_Delta_FS(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];
@@ -374,6 +333,7 @@ int verify_Delta_FS(int part_idx)
        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) {
                LOG("Verifying %s \n", ua_dataSS.parti_info->ua_parti_name);
                ret = SS_FSVerifyPartition(&ua_dataSS, part_idx);
@@ -413,11 +373,11 @@ 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;
@@ -441,6 +401,7 @@ int update_Delta_IMG(int part_idx, unsigned long ui32Operation)
        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;
@@ -505,9 +466,9 @@ int update_RecoveryDelta_IMG(int part_idx, int update_type)
                }
        return ret;
 }
-
 #endif
 
+
 /*-----------------------------------------------------------------------------
   set_data_weight
  ----------------------------------------------------------------------------*/
@@ -559,6 +520,7 @@ static void set_data_weight_offset(void)
        for (i = 0; i < s_part_num; i++) {
                for (k = 0; k < i; k++)
                        s_update_data[i].weight_offset += s_update_data[k].weight;
+
                LOG("s_update_data[%d].weight_offset=%u\n", i, s_update_data[i].weight_offset);
        }
 
@@ -683,7 +645,7 @@ static int get_last_update_status(void)
                return UP_START_NONE;
 
        status = atoi(buf);
-       if ((status > UP_START_NONE) && (status < UP_START_MAX))
+       if ((status > UP_START_NONE) && (status < s_part_num))
                return status;
        else
                return UP_START_NONE;
@@ -728,7 +690,6 @@ int update_all()
        int last_update_status = UP_START_NONE;
        int update_status = UP_START_NONE;
        int part_idx = UA_PARTI_MAX;
-       int err_idx = UA_PARTI_MAX;
        unsigned int update_type = 0;
        unsigned long ui32Operation = UI_OP_SCOUT;
 
@@ -742,6 +703,7 @@ int update_all()
                        s_update_data[i].data_size = (unsigned int)item_size;
                else
                        s_update_data[i].data_size = 0;
+
                LOGL(LOG_DEBUG, "s_update_data[%d].data_size=%lu, ua_delta_path=%s, "
                        "ua_blk_name = %s, ua_subject_name=%s\n",
                        i,
@@ -757,9 +719,9 @@ int update_all()
                        total_data_size += s_update_data[i].data_size;
 
                        LOGL(LOG_DEBUG,
-                            "Check Delta : part_idx(%d), file_path(%s), total data cnt(%lu)\n",
-                            i, s_update_data[i].ua_delta_path,
-                             (long unsigned int)data_count);
+                               "Check Delta : part_idx(%d), file_path(%s), total data cnt(%lu)\n",
+                               i, s_update_data[i].ua_delta_path,
+                               (long unsigned int)data_count);
                }
        }
 
@@ -806,8 +768,7 @@ int update_all()
 
                                if (ret != OK) {
                                        cause = ret;
-                                       err_idx = s_update_cfg[part_idx].part_idx;
-                                       ret = g_verify_error[err_idx];
+                                       ret = UPI_VERIFY_ERROR;
                                        LOG("%s verify fail", s_part_info[part_idx].ua_parti_name);
                                        goto CleanUp;
                                }
@@ -850,8 +811,7 @@ int update_all()
 
                                if (ret != OK) {
                                        cause = ret;
-                                       err_idx = s_update_cfg[part_idx].part_idx;
-                                       ret = g_update_error[err_idx];
+                                       ret = UPI_UPDATE_ERROR;
                                        LOG("%s update fail", s_part_info[part_idx].ua_parti_name);
                                        goto CleanUp;
                                }
@@ -1192,21 +1152,6 @@ int get_update_type(char* part_name)
 }
 
 /*-----------------------------------------------------------------------------
-  get_part_idx
- ----------------------------------------------------------------------------*/
-int get_part_idx(char* part_name)
-{
-       int i;
-
-       for (i = UA_PARTI_START; i < UA_PARTI_MAX; i++) {
-               if (strcmp(part_name, def_part_info[i].ua_parti_name) == 0)
-                       return i;
-       }
-
-       return UA_PARTI_MAX;
-}
-
-/*-----------------------------------------------------------------------------
   fota_blkid_update
  ----------------------------------------------------------------------------*/
 int fota_blkid_update(void)
@@ -1269,7 +1214,6 @@ int fota_configure_update(void)
        char* part_name = NULL;
        char* subj_name = NULL;
        int update_type = EXTRA;
-       int part_idx = UA_PARTI_MAX;
        char *blk_name = NULL;
        int blk_offset = 0;
        int src_img_size = 0;
@@ -1290,7 +1234,6 @@ int fota_configure_update(void)
                part_name = NULL;
                subj_name = NULL;
                update_type = EXTRA;
-               part_idx = UA_PARTI_MAX;
                blk_name = NULL;
                blk_offset = 0;
                src_img_size = 0;
@@ -1304,7 +1247,6 @@ int fota_configure_update(void)
                        switch (field_num) {
                        case 0:
                                part_name = strdup(field);
-                               part_idx = get_part_idx(field);
                                break;
                        case 1:
                                subj_name = strdup(field);
@@ -1336,6 +1278,7 @@ int fota_configure_update(void)
                        field = strtok_r(NULL, "\t", &ctx2);
                }
                LOG("\n");
+
                if (!part_name)
                        return -1;
                if (update_type != EXTRA
@@ -1349,7 +1292,6 @@ int fota_configure_update(void)
                        s_part_info[line_num].ua_blk_offset = blk_offset;
 
                        s_update_cfg[line_num].update_type = update_type;
-                       s_update_cfg[line_num].part_idx = part_idx;
                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;
@@ -1434,10 +1376,9 @@ int main(int argc, char **argv)
        if (ret > 0) {
                s_part_num = ret;
        } else {
-               LOG("Update Configuration fail. Use default.\n");
-               memcpy(s_part_info, def_part_info, sizeof(s_part_info));
-               memcpy(s_update_cfg, def_update_cfg, sizeof(s_update_cfg));
-               s_part_num = UA_PARTI_MAX;
+               LOG("Update Configuration fail.\n");
+               ret = UPI_CONFIG_ERROR;
+               goto Results;
        }
 
        /* load block device number at run-time */
@@ -1491,35 +1432,8 @@ int main(int argc, char **argv)
        /* GUI initialized */
        case UPI_VERSION_ERROR:
        case UPI_DELTACOUNT_ERROR:
-
-       case UPI_BOOT_VERIFY_ERROR:
-       case UPI_SBOOT_VERIFY_ERROR:
-       case UPI_FIXNV2_VERIFY_ERROR:
-       case UPI_PARAM_VERIFY_ERROR:
-       case UPI_ROOTFS_VERIFY_ERROR:
-       case UPI_KERNEL_VERIFY_ERROR:
-       case UPI_MODULE_VERIFY_ERROR:
-       case UPI_MODEM_VERIFY_ERROR:
-       case UPI_DSP_VERIFY_ERROR:
-       case UPI_WCNMODEM_VERIFY_ERROR:
-       case UPI_RAMDISK1_VERIFY_ERROR:
-       case UPI_SYSDATA_VERIFY_ERROR:
-       case UPI_USER_VERIFY_ERROR:
-
-       case UPI_BOOT_UPDATE_ERROR:
-       case UPI_SBOOT_UPDATE_ERROR:
-       case UPI_FIXNV2_UPDATE_ERROR:
-       case UPI_PARAM_UPDATE_ERROR:
-       case UPI_ROOTFS_UPDATE_ERROR:
-       case UPI_KERNEL_UPDATE_ERROR:
-       case UPI_MODULE_UPDATE_ERROR:
-       case UPI_MODEM_UPDATE_ERROR:
-       case UPI_DSP_UPDATE_ERROR:
-       case UPI_WCNMODEM_UPDATE_ERROR:
-       case UPI_RAMDISK1_UPDATE_ERROR:
-       case UPI_SYSDATA_UPDATE_ERROR:
-       case UPI_USER_UPDATE_ERROR:
-
+       case UPI_VERIFY_ERROR:
+       case UPI_UPDATE_ERROR:
                sleep(1);
                fota_gui_update_end();
                fota_path_deinit();
index f316f5b..c105e47 100644 (file)
 #define FAIL 1
 #define RESTORING 2
 
+#define UPI_CONFIG_ERROR       0xFD9A
+
 #define UPI_DELTA_PATH_ERROR                   0xFDAA
 #define UPI_DELTA_PATH_LENGTH_ERROR    0xFDAB
 
 #define UPI_GUI_INIT_ERROR                             0xFDBA
 #define UPI_VERSION_ERROR                              0xFDBB
 
-#define UPI_BOOT_VERIFY_ERROR                  0xFDC1
-#define UPI_SBOOT_VERIFY_ERROR         0xFDC2
-#define UPI_FIXNV2_VERIFY_ERROR                0xFDC3
-#define UPI_PARAM_VERIFY_ERROR         0xFDC6
-#define UPI_ROOTFS_VERIFY_ERROR                0xFDC7
-#define UPI_KERNEL_VERIFY_ERROR                0xFDC9
-#define UPI_MODULE_VERIFY_ERROR                0xFDCA
-#define UPI_MODEM_VERIFY_ERROR         0xFDCB
-#define UPI_DSP_VERIFY_ERROR                   0xFDCC
-#define UPI_WCNMODEM_VERIFY_ERROR              0xFDCD
-#define UPI_RAMDISK1_VERIFY_ERROR              0xFDCE
-#define UPI_SYSDATA_VERIFY_ERROR               0xFDCF
-#define UPI_USER_VERIFY_ERROR          0xFDD0
-
-#define UPI_BOOT_UPDATE_ERROR                  0xFDD1
-#define UPI_SBOOT_UPDATE_ERROR         0xFDD2
-#define UPI_FIXNV2_UPDATE_ERROR                0xFDD3
-#define UPI_PARAM_UPDATE_ERROR         0xFDD6
-#define UPI_ROOTFS_UPDATE_ERROR                0xFDD7
-#define UPI_KERNEL_UPDATE_ERROR                0xFDD9
-#define UPI_MODULE_UPDATE_ERROR                0xFDDA
-#define UPI_MODEM_UPDATE_ERROR         0xFDDB
-#define UPI_DSP_UPDATE_ERROR                   0xFDDC
-#define UPI_WCNMODEM_UPDATE_ERROR              0xFDDD
-#define UPI_RAMDISK1_UPDATE_ERROR              0xFDDE
-#define UPI_SYSDATA_UPDATE_ERROR               0xFDDF
-#define UPI_USER_UPDATE_ERROR          0xFDE0
+#define UPI_VERIFY_ERROR       0xFDC0
+#define UPI_UPDATE_ERROR       0xFDD0
 
 #define UPI_INVALID_PARAM_ERROR                0xFDEA
 #define UPI_STATUSFLAG_ERROR                   0xFDEB
 #define UI_OP_SCOUT_UPDATE             0
 #define UI_OP_SCOUT                    1
 #define UI_OP_UPDATE                   3
+
+#define UA_PARTI_MAX           20
+
+#define UP_STATUS_FILE "UP.STATUS"
+#define UP_START_NONE  0
+
 #define SS_RECOVERYRAMDISK
 enum {
        UA_OP_MODE_FG = 0,
@@ -110,27 +93,6 @@ enum {
 };
 
 typedef enum {
-       UA_KERNEL = 0,
-       UA_ROOTFS,
-       UA_SYSDATA,
-       UA_USER,
-       UA_MODULE,
-       UA_PARTI_MAX
-} UA_PART_IDX;
-#define UA_PARTI_START 0
-
-#define UP_STATUS_FILE         "UP.STATUS"
-typedef enum {
-       UP_START_NONE = 0,
-       UP_START_KERNEL,
-       UP_START_ROOTFS,
-       UP_START_SYSDATA,
-       UP_START_USER,
-       UP_START_MODULE,
-       UP_START_MAX
-} UP_STATUS;
-
-typedef enum {
        FULL_IMG,
        DELTA_IMG,
        DELTA_FS,
@@ -158,7 +120,6 @@ typedef struct _ua_update_data_t {
 
 typedef struct _ua_update_cfg_t {
        unsigned int update_type;
-       unsigned int part_idx;
        int skip_verify;
        int skip_update;
        int soure_img_size;//TOTA
@@ -205,4 +166,5 @@ typedef struct _ua_dataSS_t {       // partition operations
        int (*write_data_to_blkdev)(char *, int, int, char *);
 } ua_dataSS_t;
 void log_deinit(void);
+
 #endif
index dd5ca4a..e0c315a 100755 (executable)
@@ -56,53 +56,11 @@ static char result_folder[MAX_FILE_PATH];
 static char temp_folder[MAX_FILE_PATH];
 static char log_path[MAX_FILE_PATH];
 
-
-static ua_part_info_t def_part_info[UA_PARTI_MAX] = {
-       {"ROOTFS",              "delta.rootfs", "",     0},
-
-       {"BOOT",                "delta.boot",   "",     0},
-       {"RAMDISK1",    "delta.ramdisk1",       "",     0}
-#ifdef SS_RECOVERYRAMDISK
-       , {"RAMDISK2",  "delta.ramdisk2", "/dev/mmcblk0p4",     0}
-#endif
-};
-
-
-static ua_update_cfg_t def_update_cfg[UA_PARTI_MAX] = {
-       {DELTA_FS,      UA_ROOTFS,      0,      0},
-       {DELTA_IMG,     UA_BOOT,        0,      0},
-       {DELTA_IMG,     UA_RAMDISK1,    0,      0}
-#ifdef SS_RECOVERYRAMDISK
-       , {EXTRA,       UA_RAMDISK2,    0,      0}
-#endif
-};
-
 static ua_part_info_t s_part_info[UA_PARTI_MAX];
 
 static ua_update_cfg_t s_update_cfg[UA_PARTI_MAX];
 
-static ua_update_data_t s_update_data[UA_PARTI_MAX] = {
-       {0, 0, 0, 0, 0, 0,      NULL,   NULL},
-       {0, 0, 0, 0, 0, 0,      NULL,   NULL},
-       {0, 0, 0, 0, 0, 0,      NULL,   NULL}
-#ifdef SS_RECOVERYRAMDISK
-       , {0, 0, 0, 0, 0, 0,    NULL,   NULL}
-#endif
-};
-
-static int g_verify_error[] = {
-       UPI_ROOTFS_VERIFY_ERROR,
-       UPI_BOOT_VERIFY_ERROR,
-       UPI_RAMDISK1_VERIFY_ERROR,
-       UPI_RAMDISK2_VERIFY_ERROR
-};
-
-static int g_update_error[] = {
-       UPI_ROOTFS_UPDATE_ERROR,
-       UPI_BOOT_UPDATE_ERROR,
-       UPI_RAMDISK1_UPDATE_ERROR,
-       UPI_RAMDISK2_UPDATE_ERROR
-};
+static ua_update_data_t s_update_data[UA_PARTI_MAX];
 
 static int s_part_num = 0;
 static ua_delta_info_t s_delta_info;
@@ -641,7 +599,7 @@ static int get_last_update_status(void)
                return UP_START_NONE;
 
        status = atoi(buf);
-       if ((status > UP_START_NONE) && (status < UP_START_MAX))
+       if ((status > UP_START_NONE) && (status < s_part_num))
                return status;
        else
                return UP_START_NONE;
@@ -686,7 +644,6 @@ int update_all()
        int last_update_status = UP_START_NONE;
        int update_status = UP_START_NONE;
        int part_idx = UA_PARTI_MAX;
-       int err_idx = UA_PARTI_MAX;
        unsigned int update_type = 0;
        unsigned long ui32Operation = UI_OP_SCOUT;
 
@@ -769,8 +726,7 @@ int update_all()
 
                                if (ret != OK) {
                                        cause = ret;
-                                       err_idx = s_update_cfg[part_idx].part_idx;
-                                       ret = g_verify_error[err_idx];
+                                       ret = UPI_VERIFY_ERROR;
                                        LOG("%s verify fail", s_part_info[part_idx].ua_parti_name);
                                        goto CleanUp;
                                }
@@ -817,8 +773,7 @@ int update_all()
 
                                if (ret != OK) {
                                        cause = ret;
-                                       err_idx = s_update_cfg[part_idx].part_idx;
-                                       ret = g_update_error[err_idx];
+                                       ret = UPI_UPDATE_ERROR;
                                        LOG("%s update fail", s_part_info[part_idx].ua_parti_name);
                                        goto CleanUp;
                                }
@@ -828,7 +783,7 @@ int update_all()
        }
 
        if (part_idx == s_part_num)
-               set_last_update_status(UP_START_MAX);
+               set_last_update_status(s_part_num);
 
        get_time_stamp();
        LOG("[%s] Update End ..............................................................\n", ts);
@@ -1129,21 +1084,6 @@ int get_update_type(char* part_name)
 }
 
 /*-----------------------------------------------------------------------------
-  get_part_idx
- ----------------------------------------------------------------------------*/
-int get_part_idx(char* part_name)
-{
-       int i;
-
-       for (i = UA_ROOTFS; i < UA_PARTI_MAX; i++) {
-               if (strcmp(part_name, def_part_info[i].ua_parti_name) == 0)
-                       return i;
-       }
-
-       return UA_PARTI_MAX;
-}
-
-/*-----------------------------------------------------------------------------
   fota_blkid_update
  ----------------------------------------------------------------------------*/
 int fota_blkid_update(void)
@@ -1206,7 +1146,6 @@ int fota_configure_update(void)
        char* part_name = NULL;
        char* subj_name = NULL;
        int update_type = EXTRA;
-       int part_idx = UA_PARTI_MAX;
        char *blk_name = NULL;
        int blk_offset = 0;
        int src_img_size = 0;
@@ -1227,7 +1166,6 @@ int fota_configure_update(void)
                part_name = NULL;
                subj_name = NULL;
                update_type = EXTRA;
-               part_idx = UA_PARTI_MAX;
                blk_name = NULL;
                blk_offset = 0;
                src_img_size = 0;
@@ -1241,7 +1179,6 @@ int fota_configure_update(void)
                        switch (field_num) {
                        case 0:
                                part_name = strdup(field);
-                               part_idx = get_part_idx(field);
                                break;
                        case 1:
                                subj_name = strdup(field);
@@ -1288,7 +1225,6 @@ int fota_configure_update(void)
                        s_part_info[line_num].ua_blk_offset = blk_offset;
 
                        s_update_cfg[line_num].update_type = update_type;
-                       s_update_cfg[line_num].part_idx = part_idx;
                        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;
@@ -1361,10 +1297,9 @@ int main(int argc, char **argv)
        if (ret > 0) {
                s_part_num = ret;
        } else {
-               LOG("Update Configuration fail. Use default.\n");
-               memcpy(s_part_info, def_part_info, sizeof(s_part_info));
-               memcpy(s_update_cfg, def_update_cfg, sizeof(s_update_cfg));
-               s_part_num = UA_PARTI_MAX;
+               LOG("Update Configuration fail.\n");
+               ret = UPI_CONFIG_ERROR;
+               goto Results;
        }
 
        /* load block device number at run-time */
@@ -1415,13 +1350,8 @@ int main(int argc, char **argv)
        /* GUI initialized */
        case UPI_VERSION_ERROR:
        case UPI_DELTACOUNT_ERROR:
-
-       case UPI_ROOTFS_VERIFY_ERROR:
-       case UPI_BOOT_VERIFY_ERROR:
-
-       case UPI_ROOTFS_UPDATE_ERROR:
-       case UPI_BOOT_UPDATE_ERROR:
-
+       case UPI_VERIFY_ERROR:
+       case UPI_UPDATE_ERROR:
                sleep(1);
                fota_path_deinit();
                log_deinit();
index ecd05ef..f1221dd 100755 (executable)
 #define FAIL 1
 #define RESTORING 2
 
+#define UPI_CONFIG_ERROR       0xFD9A
+
 #define UPI_DELTA_PATH_ERROR                   0xFDAA
 #define UPI_DELTA_PATH_LENGTH_ERROR    0xFDAB
 
 #define UPI_GUI_INIT_ERROR                             0xFDBA
 #define UPI_VERSION_ERROR                              0xFDBB
 
-#define UPI_ROOTFS_VERIFY_ERROR                0xFDC7
-#define UPI_BOOT_VERIFY_ERROR                  0xFDC9
-#define UPI_RAMDISK1_VERIFY_ERROR              0xFDCC
-#define UPI_DELTA_VERIFY_ERROR         0xFDCD
-#define UPI_RAMDISK2_VERIFY_ERROR              0xFDCE
-
-#define UPI_ROOTFS_UPDATE_ERROR                0xFDD7
-#define UPI_BOOT_UPDATE_ERROR                  0xFDD9
-#define UPI_RAMDISK1_UPDATE_ERROR              0xFDDC
-#define UPI_RAMDISK2_UPDATE_ERROR              0xFDDE
+#define UPI_VERIFY_ERROR       0xFDC0
+#define UPI_UPDATE_ERROR       0xFDD0
 
 #define UPI_INVALID_PARAM_ERROR                0xFDEA
 #define UPI_STATUSFLAG_ERROR                   0xFDEB
 #define UI_OP_SCOUT_UPDATE             0
 #define UI_OP_SCOUT                    1
 #define UI_OP_UPDATE                   3
+
+#define UA_PARTI_MAX           20
+
+#define UP_STATUS_FILE "UP.STATUS"
+#define UP_START_NONE  0
+
 #define SS_RECOVERYRAMDISK
 enum {
        UA_OP_MODE_FG = 0,
@@ -91,28 +91,6 @@ enum {
 };
 
 typedef enum {
-       UA_ROOTFS = 0,
-       UA_BOOT,
-       UA_RAMDISK1,
-#ifdef SS_RECOVERYRAMDISK
-       UA_RAMDISK2,
-#endif
-       UA_PARTI_MAX
-} UA_PART_IDX;
-
-#define UP_STATUS_FILE         "UP.STATUS"
-typedef enum {
-       UP_START_NONE = 0,
-       UP_START_ROOTFS,
-       UP_START_BOOT,
-       UP_START_RAMDISK1,
-#ifdef SS_RECOVERYRAMDISK
-       UP_START_RAMDISK2,
-#endif
-       UP_START_MAX
-} UP_STATUS;
-
-typedef enum {
        FULL_IMG,
        DELTA_IMG,
        DELTA_FS,
@@ -140,7 +118,6 @@ typedef struct _ua_update_data_t {
 
 typedef struct _ua_update_cfg_t {
        unsigned int update_type;
-       unsigned int part_idx;
        int skip_verify;
        int skip_update;
        int soure_img_size;//TOTA