[Feature][task-view-306]merge P56U08(patch6) version
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: I8e809511ac30c97228dd110c304b4a08f4af36d7
diff --git a/boot/common/src/uboot/downloader/cmd_compat_write.c b/boot/common/src/uboot/downloader/cmd_compat_write.c
index 4d5e339..4d6ae9d 100755
--- a/boot/common/src/uboot/downloader/cmd_compat_write.c
+++ b/boot/common/src/uboot/downloader/cmd_compat_write.c
@@ -34,9 +34,10 @@
/****************************************************************************
* Global Function Prototypes
****************************************************************************/
-T_IMG_SIZE img_size[IMG_NUM] = {{"uboot",0,0},{"imagefs",0,0},{"rootfs",0,0},{"caprootfs",0,0},{"oem",0,0}};
+//T_IMG_SIZE img_size[IMG_NUM] = {{"uboot",0,0},{"imagefs",0,0},{"rootfs",0,0},{"caprootfs",0,0},{"oem",0,0}};
+T_IMG_SIZE img_size[IMG_NUM_MAX];
+int img_num = 0;
int flags_partiton_write = 0;
-
extern int g_iftype;
extern partition_table_t * g_partition_table_dl;
/*******************************************************************************
@@ -56,11 +57,14 @@
{
partition_entry_t *part = NULL;
char *par = NULL;
+ char *par_tmp = NULL;
char ack[64]={0};
unsigned int offset = 0;
unsigned int size = 0;
unsigned int ret = 0;
unsigned int i = 0;
+ unsigned int len = 0;
+ unsigned int found = 0;
flags_partiton_write = 1;
if(argc<4)
@@ -80,23 +84,55 @@
}
/*record image size*/
- for(i=0; i<IMG_NUM; i++)
+ len = strlen(par);
+/* Started by AICoder, pid:q5743g3f62rd9291419e086de0327502c5d710ce */
+ par_tmp = (char *)malloc(len + 1);
+ if (par[len - 1] == '2') {
+ strncpy(par_tmp, par, len - 1);
+ par_tmp[len - 1] = '\0';
+ } else {
+ strcpy(par_tmp, par);
+ }
+/* Ended by AICoder, pid:q5743g3f62rd9291419e086de0327502c5d710ce */
+
+/* Started by AICoder, pid:ye4dcm700en8c6e14cdf0ac390813e36dc075765 */
+ for(i=0; i<img_num; i++)
{
- if(memcmp((char *)img_size[i].name , par, strlen(img_size[i].name)) == 0){
- if(!memcmp(par,"oemdata",7))
- break;
- if(strlen(img_size[i].name) == strlen(par))
- {
- img_size[i].size_a = size;
- printf("partition is %s,size_a is 0x%x.\n",par,size);
- }
- else
- {
- img_size[i].size_b = size;
- printf("partition is %s,size_b is 0x%x.\n",par,size);
- }
- }
+ if(strcmp((char *)img_size[i].name, par_tmp) == 0 && strlen((char *)img_size[i].name) == strlen(par_tmp))
+ {
+ found = 1;
+ if(strcmp(par_tmp,par) == 0)
+ {
+ img_size[i].size_a = size;
+ printf("partition is %s,size_a is 0x%x.\n",par,size);
+ }
+ else
+ {
+ img_size[i].size_b = size;
+ printf("partition is %s,size_b is 0x%x.\n",par,size);
+ }
+
+ break;
+ }
}
+ if (!found)
+ {
+ strcpy(img_size[img_num].name,par_tmp);
+ if(strcmp(par_tmp,par) == 0)
+ {
+ img_size[img_num].size_a = size;
+ printf("partition is %s,size_a is 0x%x.\n",par,size);
+ }
+ else
+ {
+ img_size[img_num].size_b = size;
+ printf("partition is %s,size_b is 0x%x.\n",par,size);
+ }
+
+ img_num += 1;
+ }
+ free(par_tmp);
+/* Ended by AICoder, pid:ye4dcm700en8c6e14cdf0ac390813e36dc075765 */
#if defined (CONFIG_ZX297520V3E_VEHICLE_DC) || defined (CONFIG_ZX297520V3E_VEHICLE_DC_REF)
if(g_nor_flag == 1)
diff --git a/boot/common/src/uboot/include/partition_table.h b/boot/common/src/uboot/include/partition_table.h
index 306a64c..febd365 100755
--- a/boot/common/src/uboot/include/partition_table.h
+++ b/boot/common/src/uboot/include/partition_table.h
@@ -211,7 +211,7 @@
#define PARTITION_CRC 0x12345678
#define PARTITION_SIZE 0X1000 /* ·ÖÇø±íµÄ´óС */
-#define IMG_NUM 5
+#define IMG_NUM 15
typedef struct partition_entry {
unsigned char part_name[16];