Commit 33ed57495ae7b442b364ff3ab55a836544700d5e
Committed by
York Sun
1 parent
dd48f0bfb5
Exists in
smarc_8mq_lf_v2020.04
and in
17 other branches
tools: plbimage support generate rcw file
some system will not generate pbl format u-boot, but require rcw. Signed-off-by: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn> Reviewed-by: Alison Wang <alison.wang@nxp.com> Reviewed-by: York Sun <york.sun@nxp.com>
Showing 1 changed file with 27 additions and 21 deletions Side-by-side Diff
tools/pblimage.c
... | ... | @@ -194,17 +194,20 @@ |
194 | 194 | pbl_parser(params->imagename); |
195 | 195 | |
196 | 196 | /* parse the pbi.cfg file. */ |
197 | - pbl_parser(params->imagename2); | |
197 | + if (params->imagename2[0] != '\0') | |
198 | + pbl_parser(params->imagename2); | |
198 | 199 | |
199 | - fp_uboot = fopen(params->datafile, "r"); | |
200 | - if (fp_uboot == NULL) { | |
201 | - printf("Error: %s open failed\n", params->datafile); | |
202 | - exit(EXIT_FAILURE); | |
203 | - } | |
200 | + if (params->datafile) { | |
201 | + fp_uboot = fopen(params->datafile, "r"); | |
202 | + if (fp_uboot == NULL) { | |
203 | + printf("Error: %s open failed\n", params->datafile); | |
204 | + exit(EXIT_FAILURE); | |
205 | + } | |
204 | 206 | |
205 | - load_uboot(fp_uboot); | |
207 | + load_uboot(fp_uboot); | |
208 | + fclose(fp_uboot); | |
209 | + } | |
206 | 210 | add_end_cmd(); |
207 | - fclose(fp_uboot); | |
208 | 211 | lseek(ifd, 0, SEEK_SET); |
209 | 212 | |
210 | 213 | size = pbl_size; |
211 | 214 | |
212 | 215 | |
... | ... | @@ -265,21 +268,24 @@ |
265 | 268 | if (!params) |
266 | 269 | return EXIT_FAILURE; |
267 | 270 | |
268 | - fp_uboot = fopen(params->datafile, "r"); | |
269 | - if (fp_uboot == NULL) { | |
270 | - printf("Error: %s open failed\n", params->datafile); | |
271 | - exit(EXIT_FAILURE); | |
272 | - } | |
273 | - fd = fileno(fp_uboot); | |
271 | + if (params->datafile) { | |
272 | + fp_uboot = fopen(params->datafile, "r"); | |
273 | + if (fp_uboot == NULL) { | |
274 | + printf("Error: %s open failed\n", params->datafile); | |
275 | + exit(EXIT_FAILURE); | |
276 | + } | |
277 | + fd = fileno(fp_uboot); | |
274 | 278 | |
275 | - if (fstat(fd, &st) == -1) { | |
276 | - printf("Error: Could not determine u-boot image size. %s\n", | |
277 | - strerror(errno)); | |
278 | - exit(EXIT_FAILURE); | |
279 | - } | |
279 | + if (fstat(fd, &st) == -1) { | |
280 | + printf("Error: Could not determine u-boot image size. %s\n", | |
281 | + strerror(errno)); | |
282 | + exit(EXIT_FAILURE); | |
283 | + } | |
280 | 284 | |
281 | - /* For the variable size, we need to pad it to 64 byte boundary */ | |
282 | - uboot_size = roundup(st.st_size, 64); | |
285 | + /* For the variable size, pad it to 64 byte boundary */ | |
286 | + uboot_size = roundup(st.st_size, 64); | |
287 | + fclose(fp_uboot); | |
288 | + } | |
283 | 289 | |
284 | 290 | if (params->arch == IH_ARCH_ARM) { |
285 | 291 | arch_flag = IH_ARCH_ARM; |