otrx: always align image to 0x1000
authorRafał Miłecki <rafal@milecki.pl>
Mon, 13 Nov 2017 22:54:18 +0000 (23:54 +0100)
committerRafał Miłecki <rafal@milecki.pl>
Thu, 16 Nov 2017 08:33:56 +0000 (09:33 +0100)
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

index 7e117c6e0db7ab97933cd9cc220a09765c6b6349..add111aa61f5aa8be8c3e93b66b398dbaa2d2a69 100644 (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
  * under the terms of the GNU General Public License as published by the Free
  *
  * 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
@@ -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;
        otrx_create_write_hdr(trx, &hdr);
 err_close:
        hdr.length = curr_offset;
        otrx_create_write_hdr(trx, &hdr);
 err_close: