firmware-utils: tplink-safeloader: switch RE350 to dynamic partitions
[openwrt/openwrt.git] / tools / firmware-utils / src / mkzynfw.c
index f3343df7269a93e03ddeb67f19e7625b45690186..ccbabfe7f20b2bfb3155eaa053b6e1dff3b8d15a 100644 (file)
@@ -27,6 +27,7 @@
 #if defined(__CYGWIN__)
 #  include <byteswap.h>
 #endif
+#include <inttypes.h>
 
 #include "zynos.h"
 
@@ -687,7 +688,7 @@ write_out_file(FILE *outfile, char *name, size_t len, struct csum_state *css)
        FILE *f;
        int res;
 
-       DBG(2, "writing out file, name=%s, len=%d",
+       DBG(2, "writing out file, name=%s, len=%zu",
                name, len);
 
        errno = 0;
@@ -988,7 +989,7 @@ calc_block_offsets(int type, uint32_t *offset)
        uint32_t avail;
        int i, res;
 
-       DBG(1,"calculating block offsets, starting with %lu",
+       DBG(1,"calculating block offsets, starting with %" PRIu32,
                *offset);
 
        res = 0;
@@ -999,12 +1000,13 @@ calc_block_offsets(int type, uint32_t *offset)
                        continue;
 
                next_offs = ALIGN(*offset, block->align);
-               avail = board->flash_size - board->romio_offs - next_offs;
+               avail = board->flash_size - next_offs;
                if (block->file_size > avail) {
                        ERR("file %s is too big, offset = %u, size=%u,"
-                               " align = %u", block->file_name,
+                               " avail = %u, align = %u", block->file_name,
                                (unsigned)next_offs,
                                (unsigned)block->file_size,
+                               (unsigned)avail,
                                (unsigned)block->align);
                        res = -1;
                        break;