exit (retval);
}
- dfd = open(params.datafile, O_RDONLY | O_BINARY);
- if (dfd < 0) {
- fprintf(stderr, "%s: Can't open %s: %s\n",
- params.cmdname, params.datafile, strerror(errno));
- exit(EXIT_FAILURE);
- }
+ if ((params.type != IH_TYPE_MULTI) && (params.type != IH_TYPE_SCRIPT)) {
+ dfd = open(params.datafile, O_RDONLY | O_BINARY);
+ if (dfd < 0) {
+ fprintf(stderr, "%s: Can't open %s: %s\n",
+ params.cmdname, params.datafile,
+ strerror(errno));
+ exit(EXIT_FAILURE);
+ }
- if (fstat(dfd, &sbuf) < 0) {
- fprintf(stderr, "%s: Can't stat %s: %s\n",
- params.cmdname, params.datafile, strerror(errno));
- exit(EXIT_FAILURE);
- }
+ if (fstat(dfd, &sbuf) < 0) {
+ fprintf(stderr, "%s: Can't stat %s: %s\n",
+ params.cmdname, params.datafile,
+ strerror(errno));
+ exit(EXIT_FAILURE);
+ }
- params.file_size = sbuf.st_size + tparams->header_size;
- close(dfd);
+ params.file_size = sbuf.st_size + tparams->header_size;
+ close(dfd);
+ }
/*
* In case there an header with a variable
int size;
struct image_type_params *tparams = imagetool_get_type(params.type);
- if (pad >= sizeof(zeros)) {
- fprintf(stderr, "%s: Can't pad to %d\n",
- params.cmdname, pad);
- exit(EXIT_FAILURE);
- }
-
memset(zeros, 0, sizeof(zeros));
if (params.vflag) {
exit (EXIT_FAILURE);
}
} else if (pad > 1) {
- if (write(ifd, (char *)&zeros, pad) != pad) {
- fprintf(stderr, "%s: Write error on %s: %s\n",
- params.cmdname, params.imagefile,
- strerror(errno));
- exit(EXIT_FAILURE);
+ while (pad > 0) {
+ int todo = sizeof(zeros);
+
+ if (todo > pad)
+ todo = pad;
+ if (write(ifd, (char *)&zeros, todo) != todo) {
+ fprintf(stderr, "%s: Write error on %s: %s\n",
+ params.cmdname, params.imagefile,
+ strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+ pad -= todo;
}
}
params.cmdname);
fprintf(stderr, " %s [-D dtc_options] [-f fit-image.its|-F] fit-image\n",
params.cmdname);
- fprintf(stderr, " -D => set options for device tree compiler\n"
+ fprintf(stderr, " -D => set all options for device tree compiler\n"
" -f => input filename for FIT source\n");
#ifdef CONFIG_FIT_SIGNATURE
fprintf(stderr, "Signing / verified boot options: [-k keydir] [-K dtb] [ -c <comment>] [-r]\n"