Align also kernel image

This commit is contained in:
Pali Rohár committed 2012-07-14 09:21:34 +02:00
1 parent 860d71d18a
commit 8301455a5b
2 files changed
+26 -8

No files matched your search

+10 -3
View File
@@ -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) {