diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2012-10-26 08:45:56 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2012-10-26 08:57:11 +0200 |
commit | 3bd35b8993b4a48a3adcbdb132004b7c14923bf6 (patch) | |
tree | 91d7694361fc7225376c2be5bcb1a387f75f5aaa /scripts | |
parent | 5b620bce2e2e028d8cc949681816cbfae44b9ed0 (diff) | |
download | barebox-3bd35b8993b4a48a3adcbdb132004b7c14923bf6.tar.gz barebox-3bd35b8993b4a48a3adcbdb132004b7c14923bf6.tar.xz |
ARM omap spi image: relax size constrains
The omap spi utility requires the image size to be a multiple of four
bytes. This seems unnecessary, we can just pad with a few bytes to
get the required alignment.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/mk-am35xx-spi-image.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/scripts/mk-am35xx-spi-image.c b/scripts/mk-am35xx-spi-image.c index ec311fdd4d..1372fbd152 100644 --- a/scripts/mk-am35xx-spi-image.c +++ b/scripts/mk-am35xx-spi-image.c @@ -95,10 +95,6 @@ int main(int argc, char *argv[]) perror("ftello"); exit(EXIT_FAILURE); } - if (pos % 4) { - printf("error: image size must be a multiple of 4 bytes\n"); - exit(EXIT_FAILURE); - } if (pos > 0x100000) { printf("error: image should be smaller than 1 MiB\n"); exit(EXIT_FAILURE); @@ -109,6 +105,8 @@ int main(int argc, char *argv[]) exit(EXIT_FAILURE); } + pos = (pos + 3) & ~3; + /* image size */ temp = htobe32((uint32_t)pos); fwrite(&temp, sizeof(uint32_t), 1, stdout); @@ -121,7 +119,7 @@ int main(int argc, char *argv[]) size = fread(&temp, 1, sizeof(uint32_t), input); if (!size) break; - if (size != 4) { + if (size < 4 && !feof(input)) { perror("fread"); exit(EXIT_FAILURE); } |