[LEDE-DEV] otrx: always align image to 0x1000

Message ID 20171113225418.10825-1-zajec5@gmail.com
State Accepted
Delegated to: Rafał Miłecki
Headers show
Series
  • [LEDE-DEV] otrx: always align image to 0x1000
Related show

Commit Message

Rafał Miłecki Nov. 13, 2017, 10:54 p.m.
From: Rafał Miłecki <rafal@milecki.pl>

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

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
 package/utils/otrx/src/otrx.c | 6 ++++++
 1 file changed, 6 insertions(+)

Patch

diff --git a/package/utils/otrx/src/otrx.c b/package/utils/otrx/src/otrx.c
index 7e117c6e0d..8833e43a89 100644
--- a/package/utils/otrx/src/otrx.c
+++ b/package/utils/otrx/src/otrx.c
@@ -408,6 +408,12 @@  static int otrx_create(int argc, char **argv) {
 			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;
 	otrx_create_write_hdr(trx, &hdr);
 err_close: