mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-28 01:51:33 +00:00
mkimage: Allow padding to any length
At present there is an arbitrary limit of 4KB for padding. Rockchip needs more than that, so remove this restriction. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
This commit is contained in:
parent
73a88d0e44
commit
424b86ae59
1 changed files with 12 additions and 11 deletions
|
@ -488,12 +488,6 @@ copy_file (int ifd, const char *datafile, int pad)
|
||||||
int size;
|
int size;
|
||||||
struct image_type_params *tparams = imagetool_get_type(params.type);
|
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));
|
memset(zeros, 0, sizeof(zeros));
|
||||||
|
|
||||||
if (params.vflag) {
|
if (params.vflag) {
|
||||||
|
@ -563,11 +557,18 @@ copy_file (int ifd, const char *datafile, int pad)
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
} else if (pad > 1) {
|
} else if (pad > 1) {
|
||||||
if (write(ifd, (char *)&zeros, pad) != pad) {
|
while (pad > 0) {
|
||||||
fprintf(stderr, "%s: Write error on %s: %s\n",
|
int todo = sizeof(zeros);
|
||||||
params.cmdname, params.imagefile,
|
|
||||||
strerror(errno));
|
if (todo > pad)
|
||||||
exit(EXIT_FAILURE);
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue