otrx: always align image to 0x1000

This seems to match what the original trx tool and mjn3's replacement
do.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
openwrt-18.06
Rafał Miłecki 2017-11-13 23:54:18 +01:00
parent a8a23ca50c
commit b15c563929
1 changed files with 7 additions and 1 deletions

View File

@ -1,7 +1,7 @@
/* /*
* otrx * otrx
* *
* Copyright (C) 2015 Rafał Miłecki <zajec5@gmail.com> * Copyright (C) 2015-2017 Rafał Miłecki <zajec5@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
@ -408,6 +408,12 @@ static int otrx_create(int argc, char **argv) {
break; break;
} }
sbytes = otrx_create_align(trx, curr_offset, 0x1000);
if (sbytes < 0)
fprintf(stderr, "Failed to append zeros\n");
else
curr_offset += sbytes;
hdr.length = curr_offset; hdr.length = curr_offset;
otrx_create_write_hdr(trx, &hdr); otrx_create_write_hdr(trx, &hdr);
err_close: err_close: