Commit 61d4dcbd1862a4a77a527df3fd8853787cfe0c0c
Committed by
Zhang Bo
1 parent
0a69b314b6
Exists in
smarc-n7.1.2_2.0.0-ga
and in
2 other branches
MA-9382 [Android]uboot: fix compiler issue and command line issue.
Fix compile error when enable CONFIG_NAND_BOOT. Fix data abort issue in uboot. Change-Id: If41a7fafa40a2c851882c723a201ac5cdf31284f Signed-off-by: zhang sanshan <sanshan.zhang@nxp.com>
Showing 3 changed files with 23 additions and 39 deletions Side-by-side Diff
common/image-android.c
... | ... | @@ -77,64 +77,46 @@ |
77 | 77 | printf("Kernel load addr 0x%08x size %u KiB\n", |
78 | 78 | kernel_addr, DIV_ROUND_UP(hdr->kernel_size, 1024)); |
79 | 79 | |
80 | - int len = 0; | |
81 | - if (*hdr->cmdline) { | |
82 | - len += strlen(hdr->cmdline); | |
83 | - } | |
84 | - | |
80 | + char newbootargs[512] = {0}; | |
81 | + char commandline[1024] = {0}; | |
85 | 82 | char *bootargs = getenv("bootargs"); |
86 | - if (bootargs) | |
87 | - len += strlen(bootargs); | |
88 | 83 | |
89 | - char *newbootargs = malloc(len + 2); | |
90 | - if (!newbootargs) { | |
91 | - puts("Error: malloc in android_image_get_kernel failed!\n"); | |
92 | - return -ENOMEM; | |
93 | - } | |
94 | - *newbootargs = '\0'; | |
95 | - | |
96 | 84 | if (bootargs) { |
97 | - strcpy(newbootargs, bootargs); | |
85 | + strcpy(commandline, bootargs); | |
98 | 86 | } else if (*hdr->cmdline) { |
99 | - strcat(newbootargs, hdr->cmdline); | |
87 | + strcat(commandline, hdr->cmdline); | |
100 | 88 | } |
101 | 89 | |
102 | - printf("Kernel command line: %s\n", newbootargs); | |
103 | - char commandline[ANDR_BOOT_ARGS_SIZE]; | |
104 | - strcpy(commandline, newbootargs); | |
90 | + printf("Kernel command line: %s\n", commandline); | |
105 | 91 | #ifdef CONFIG_SERIAL_TAG |
106 | 92 | struct tag_serialnr serialnr; |
107 | 93 | get_board_serial(&serialnr); |
108 | 94 | |
109 | - sprintf(commandline, | |
110 | - "%s androidboot.serialno=%08x%08x", | |
111 | - newbootargs, | |
95 | + sprintf(newbootargs, | |
96 | + " androidboot.serialno=%08x%08x", | |
112 | 97 | serialnr.high, |
113 | 98 | serialnr.low); |
114 | - strcpy(newbootargs, commandline); | |
99 | + strcat(commandline, newbootargs); | |
115 | 100 | #endif |
116 | 101 | int bootdev = get_boot_device(); |
117 | 102 | if (bootdev == SD1_BOOT || bootdev == SD2_BOOT || |
118 | 103 | bootdev == SD3_BOOT || bootdev == SD4_BOOT) { |
119 | - sprintf(commandline, | |
120 | - "%s androidboot.storage_type=sd gpt", | |
121 | - newbootargs); | |
104 | + sprintf(newbootargs, | |
105 | + " androidboot.storage_type=sd gpt"); | |
122 | 106 | } else if (bootdev == MMC1_BOOT || bootdev == MMC2_BOOT || |
123 | 107 | bootdev == MMC3_BOOT || bootdev == MMC4_BOOT) { |
124 | - sprintf(commandline, | |
125 | - "%s androidboot.storage_type=emmc", | |
126 | - newbootargs); | |
108 | + sprintf(newbootargs, | |
109 | + " androidboot.storage_type=emmc"); | |
127 | 110 | } else if (bootdev == NAND_BOOT) { |
128 | - sprintf(commandline, | |
129 | - "%s androidboot.storage_type=nand", | |
130 | - newbootargs); | |
111 | + sprintf(newbootargs, | |
112 | + " androidboot.storage_type=nand"); | |
131 | 113 | } else |
132 | 114 | printf("boot device type is incorrect.\n"); |
115 | + strcat(commandline, newbootargs); | |
133 | 116 | |
134 | 117 | #ifdef CONFIG_FSL_BOOTCTL |
135 | - char suffixStr[64]; | |
136 | - sprintf(suffixStr, " androidboot.slot_suffix=%s", get_slot_suffix()); | |
137 | - strcat(commandline, suffixStr); | |
118 | + sprintf(newbootargs, " androidboot.slot_suffix=%s", get_slot_suffix()); | |
119 | + strcat(commandline, newbootargs); | |
138 | 120 | #endif |
139 | 121 | setenv("bootargs", commandline); |
140 | 122 |
drivers/usb/gadget/command.c
... | ... | @@ -73,7 +73,7 @@ |
73 | 73 | char *addr_str; |
74 | 74 | char *nand_str; |
75 | 75 | ulong misc_info_size; |
76 | - nand_info_t *nand = &nand_info[0]; | |
76 | + struct mtd_info *nand = &nand_info[0]; | |
77 | 77 | if (command == NULL) |
78 | 78 | return -1; |
79 | 79 | memset(read_cmd, 0, 128); |
... | ... | @@ -97,7 +97,7 @@ |
97 | 97 | char *addr_str; |
98 | 98 | char *nand_str; |
99 | 99 | ulong misc_info_size; |
100 | - nand_info_t *nand = &nand_info[0]; | |
100 | + struct mtd_info *nand = &nand_info[0]; | |
101 | 101 | if (command == NULL) |
102 | 102 | return -1; |
103 | 103 | memset(cmd, 0, 128); |
drivers/usb/gadget/f_fastboot.c
... | ... | @@ -424,7 +424,7 @@ |
424 | 424 | transfer_buffer should already be aligned */ |
425 | 425 | if (interface.nand_block_size) { |
426 | 426 | if (0 == nand_curr_device) { |
427 | - nand_info_t *nand; | |
427 | + struct mtd_info *nand; | |
428 | 428 | unsigned long off; |
429 | 429 | unsigned int ok_start; |
430 | 430 | |
... | ... | @@ -1137,7 +1137,7 @@ |
1137 | 1137 | { |
1138 | 1138 | interface.nand_block_size = 0; |
1139 | 1139 | #if defined(CONFIG_FASTBOOT_STORAGE_NAND) |
1140 | - nand_info_t *nand = &nand_info[0]; | |
1140 | + struct mtd_info *nand = &nand_info[0]; | |
1141 | 1141 | if (nand) |
1142 | 1142 | interface.nand_block_size = nand->writesize; |
1143 | 1143 | #endif |
1144 | 1144 | |
... | ... | @@ -1163,9 +1163,11 @@ |
1163 | 1163 | } else if (!strcmp(fastboot_env, "nand")) { |
1164 | 1164 | fastboot_devinfo.type = DEV_NAND; |
1165 | 1165 | fastboot_devinfo.dev_id = 0; |
1166 | +#if defined(CONFIG_FASTBOOT_STORAGE_MMC) | |
1166 | 1167 | } else if (!strncmp(fastboot_env, "mmc", 3)) { |
1167 | 1168 | fastboot_devinfo.type = DEV_MMC; |
1168 | 1169 | fastboot_devinfo.dev_id = mmc_get_env_dev(); |
1170 | +#endif | |
1169 | 1171 | } |
1170 | 1172 | } else { |
1171 | 1173 | return 1; |