summaryrefslogtreecommitdiff
path: root/tools/pblimage.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2017-04-04 09:17:08 -0400
committerTom Rini <trini@konsulko.com>2017-04-04 09:17:08 -0400
commit797f165f7ae90a75579ae3df7932d8d1518e8544 (patch)
tree620b82acccf043481b25e5fca589aefcea0109c1 /tools/pblimage.c
parent234d12985ae1a5d878de6445187ec0b888772511 (diff)
parent78be6222b01efa12d9267876ad1d1d0daf38dfa0 (diff)
Merge git://git.denx.de/u-boot-fsl-qoriq
Diffstat (limited to 'tools/pblimage.c')
-rw-r--r--tools/pblimage.c48
1 files changed, 27 insertions, 21 deletions
diff --git a/tools/pblimage.c b/tools/pblimage.c
index 16d94c98c6..ffc3268209 100644
--- a/tools/pblimage.c
+++ b/tools/pblimage.c
@@ -194,17 +194,20 @@ void pbl_load_uboot(int ifd, struct image_tool_params *params)
pbl_parser(params->imagename);
/* parse the pbi.cfg file. */
- pbl_parser(params->imagename2);
+ if (params->imagename2[0] != '\0')
+ pbl_parser(params->imagename2);
+
+ if (params->datafile) {
+ fp_uboot = fopen(params->datafile, "r");
+ if (fp_uboot == NULL) {
+ printf("Error: %s open failed\n", params->datafile);
+ exit(EXIT_FAILURE);
+ }
- fp_uboot = fopen(params->datafile, "r");
- if (fp_uboot == NULL) {
- printf("Error: %s open failed\n", params->datafile);
- exit(EXIT_FAILURE);
+ load_uboot(fp_uboot);
+ fclose(fp_uboot);
}
-
- load_uboot(fp_uboot);
add_end_cmd();
- fclose(fp_uboot);
lseek(ifd, 0, SEEK_SET);
size = pbl_size;
@@ -265,21 +268,24 @@ int pblimage_check_params(struct image_tool_params *params)
if (!params)
return EXIT_FAILURE;
- fp_uboot = fopen(params->datafile, "r");
- if (fp_uboot == NULL) {
- printf("Error: %s open failed\n", params->datafile);
- exit(EXIT_FAILURE);
- }
- fd = fileno(fp_uboot);
+ if (params->datafile) {
+ fp_uboot = fopen(params->datafile, "r");
+ if (fp_uboot == NULL) {
+ printf("Error: %s open failed\n", params->datafile);
+ exit(EXIT_FAILURE);
+ }
+ fd = fileno(fp_uboot);
- if (fstat(fd, &st) == -1) {
- printf("Error: Could not determine u-boot image size. %s\n",
- strerror(errno));
- exit(EXIT_FAILURE);
- }
+ if (fstat(fd, &st) == -1) {
+ printf("Error: Could not determine u-boot image size. %s\n",
+ strerror(errno));
+ exit(EXIT_FAILURE);
+ }
- /* For the variable size, we need to pad it to 64 byte boundary */
- uboot_size = roundup(st.st_size, 64);
+ /* For the variable size, pad it to 64 byte boundary */
+ uboot_size = roundup(st.st_size, 64);
+ fclose(fp_uboot);
+ }
if (params->arch == IH_ARCH_ARM) {
arch_flag = IH_ARCH_ARM;