diff options
author | Pali Rohár <pali.rohar@gmail.com> | 2012-07-14 09:21:34 +0200 |
---|---|---|
committer | Pali Rohár <pali.rohar@gmail.com> | 2012-07-14 09:21:34 +0200 |
commit | 8301455a5bf9db54a91c9dd4cdecce5366e20ec2 (patch) | |
tree | 7f547919affca4ec8b1430409da7f569b85eb950 /src/hash.c | |
parent | 860d71d18a8ac8739d1671f5c7a20c2a93c25d82 (diff) | |
download | 0xFFFF-8301455a5bf9db54a91c9dd4cdecce5366e20ec2.tar.bz2 |
Align also kernel image
Diffstat (limited to 'src/hash.c')
-rw-r--r-- | src/hash.c | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -33,6 +33,7 @@ usho do_hash_file(const char *filename, const char *type) unsigned char buf[BSIZE]; FILE *fd = fopen(filename, "r"); usho hash = 0; + int align = 0; int size; int ret; @@ -51,9 +52,15 @@ usho do_hash_file(const char *filename, const char *type) size = ftell(fd); fclose(fd); - /* mmc image must be aligned */ - if (type && strcmp(type, "mmc") == 0) { - int align = ((size >> 8) + 1) << 8; + /* mmc and kernel image must be aligned */ + if (type) { + if (strcmp(type, "mmc") == 0) + align = ((size >> 8) + 1) << 8; + else if (strcmp(type, "kernel") == 0) + align = ((size >> 7) + 1) << 7; + } + + if (align) { printf("align from %d to %d\n", size, align); buf[0] = 0xff; while (size < align) { |