firmware-utils/mktplinkfw: add TL-WR741ND v4
[openwrt.git] / tools / firmware-utils / src / mkzynfw.c
index 5c1bc24..36c176f 100644 (file)
@@ -121,6 +121,9 @@ int num_blocks = 0;
 #define ATHEROS_FLASH_BASE     0xBFC00000
 #define ATHEROS_CODE_START     0x80e00000
 
+#define AR71XX_FLASH_BASE      0xBFC00000
+#define AR71XX_CODE_START      0x81E00000
+
 #define BOARD(n, d, v, m, fb, fs, cs, fo) {            \
        .name = (n), .desc=(d),                         \
        .vendor = (v), .model = (m),                    \
@@ -141,6 +144,15 @@ int num_blocks = 0;
 #define ATHEROSBOARD1(n, d, m, fs) BOARD(n, d, ZYNOS_VENDOR_ID_ZYXEL, m, \
        ATHEROS_FLASH_BASE, fs, ATHEROS_CODE_START, 0x30000)
 
+#define AR71XXBOARD1(n, d, m, fs) {            \
+       .name = (n), .desc=(d),                         \
+       .vendor = (ZYNOS_VENDOR_ID_ZYXEL), .model = (m),                        \
+       .flash_base = (AR71XX_FLASH_BASE), .flash_size = (fs)<<20,      \
+       .code_start = (AR71XX_CODE_START), .romio_offs = (0x40000),             \
+       .bootext_size = 0x30000         \
+       }
+
+
 static struct board_info boards[] = {
        /*
         * Infineon/ADMtek ADM5120 based boards
@@ -215,6 +227,11 @@ static struct board_info boards[] = {
         */
        ATHEROSBOARD1("NBG-318S", "ZyXEL NBG-318S", ZYNOS_MODEL_NBG_318S, 4),
 
+       /*
+        * Atheros ar71xx based boards
+        */
+       AR71XXBOARD1("NBG-460N", "ZyXEL NBG-460N", ZYNOS_MODEL_NBG_460N, 4),
+
        {.name = NULL}
 };
 
@@ -982,12 +999,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;
-               if (next_offs + block->file_size > avail) {
+               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;
This page took 0.028679 seconds and 4 git commands to generate.