1

Temat: Problem z obrazem -compilacja wlasna MR3420 v2

Czesc,


Kompiluje sobie MR3420 pod 16m flash i kompiluje mi sie w GG tylko v1 nie wiem co zmienic aby skompilowala mi sie tez v2 - czzy v1 pojdzie na v2 ?

Pozdr

2

Odp: Problem z obrazem -compilacja wlasna MR3420 v2

Nie pójdzie i nawet nie próbuj, bo będzie cegła.

3

Odp: Problem z obrazem -compilacja wlasna MR3420 v2

To jak go skompilowac samemu w GG zeby V2 mi sie skompilowala ?

4

Odp: Problem z obrazem -compilacja wlasna MR3420 v2

Czasami nie zaznaczyłeś za dużo rzeczy? Bo jak przekroczysz 4MB to nie uzyskasz obrazu.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

5

Odp: Problem z obrazem -compilacja wlasna MR3420 v2

Czesc,

1043
941
3220
3040

sie skompilowaly

opcje kompilacji wybieram selektywnie, bo nie ma szans zeby dla 16M zrobil sie profil default (za duzo by komentowac trzeba bylo w custom-src\target\linux\ar71xx\image\Makefile

najgorsze ze nie widze w pliku custom-src\tools\firmware-utils\src\mktplinkfw.c definicji dla HWID_TL_MR3420_V2

jest tylko

#define HWID_TL_MR3420_V1    0x34200001

/*
 * Copyright (C) 2009 Gabor Juhos <juhosg@openwrt.org>
 *
 * This tool was based on:
 *   TP-Link WR941 V2 firmware checksum fixing tool.
 *   Copyright (C) 2008,2009 Wang Jian <lark@linux.net.cn>
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 as published
 * by the Free Software Foundation.
 *
 */

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>     /* for unlink() */
#include <libgen.h>
#include <getopt.h>     /* for getopt() */
#include <stdarg.h>
#include <errno.h>
#include <sys/stat.h>

#include <arpa/inet.h>
#include <netinet/in.h>

#include "md5.h"

#define ALIGN(x,a) ({ typeof(a) __a = (a); (((x) + __a - 1) & ~(__a - 1)); })

#define HEADER_VERSION_V1    0x01000000
#define HWID_TL_MR3020_V1    0x30200001
#define HWID_TL_MR3220_V1    0x32200001
#define HWID_TL_MR3420_V1    0x34200001
#define HWID_TL_WA701N_V1    0x07010001
#define HWID_TL_WA7510N_V1    0x75100001
#define HWID_TL_WA901ND_V1    0x09010001
#define HWID_TL_WA901ND_V2    0x09010002
#define HWID_TL_WR703N_V1    0x07030101
#define HWID_TL_WR741ND_V1    0x07410001
#define HWID_TL_WR741ND_V4    0x07410004
#define HWID_TL_WR740N_V1    0x07400001
#define HWID_TL_WR740N_V3    0x07400003
#define HWID_TL_WR743ND_V1    0x07430001
#define HWID_TL_WR841N_V1_5    0x08410002
#define HWID_TL_WR841ND_V3    0x08410003
#define HWID_TL_WR841ND_V5    0x08410005
#define HWID_TL_WR841ND_V7    0x08410007
#define HWID_TL_WR941ND_V2    0x09410002
#define HWID_TL_WR941ND_V4    0x09410004
#define HWID_TL_WR1043ND_V1    0x10430001
#define HWID_TL_WR1041N_V2    0x10410002
#define HWID_TL_WR2543N_V1    0x25430001

#define MD5SUM_LEN    16

struct file_info {
    char        *file_name;    /* name of the file */
    uint32_t    file_size;    /* length of the file */
};

struct fw_header {
    uint32_t    version;    /* header version */
    char        vendor_name[24];
    char        fw_version[36];
    uint32_t    hw_id;        /* hardware id */
    uint32_t    hw_rev;        /* hardware revision */
    uint32_t    unk1;
    uint8_t        md5sum1[MD5SUM_LEN];
    uint32_t    unk2;
    uint8_t        md5sum2[MD5SUM_LEN];
    uint32_t    unk3;
    uint32_t    kernel_la;    /* kernel load address */
    uint32_t    kernel_ep;    /* kernel entry point */
    uint32_t    fw_length;    /* total length of the firmware */
    uint32_t    kernel_ofs;    /* kernel data offset */
    uint32_t    kernel_len;    /* kernel data length */
    uint32_t    rootfs_ofs;    /* rootfs data offset */
    uint32_t    rootfs_len;    /* rootfs data length */
    uint32_t    boot_ofs;    /* bootloader data offset */
    uint32_t    boot_len;    /* bootloader data length */
    uint16_t    ver_hi;
    uint16_t    ver_mid;
    uint16_t    ver_lo;
    uint8_t        pad[354];
} __attribute__ ((packed));

struct flash_layout {
    char        *id;
    uint32_t    fw_max_len;
    uint32_t    kernel_la;
    uint32_t    kernel_ep;
    uint32_t    rootfs_ofs;
};

struct board_info {
    char        *id;
    uint32_t    hw_id;
    uint32_t    hw_rev;
    char        *layout_id;
};

/*
 * Globals
 */
static char *ofname;
static char *progname;
static char *vendor = "TP-LINK Technologies";
static char *version = "ver. 1.0";
static char *fw_ver = "0.0.0";

static char *board_id;
static struct board_info *board;
static char *layout_id;
static struct flash_layout *layout;
static char *opt_hw_id;
static uint32_t hw_id;
static char *opt_hw_rev;
static uint32_t hw_rev;
static int fw_ver_lo;
static int fw_ver_mid;
static int fw_ver_hi;
static struct file_info kernel_info;
static uint32_t kernel_la = 0;
static uint32_t kernel_ep = 0;
static uint32_t kernel_len = 0;
static struct file_info rootfs_info;
static uint32_t rootfs_ofs = 0;
static uint32_t rootfs_align;
static struct file_info boot_info;
static int combined;
static int strip_padding;
static int add_jffs2_eof;
static unsigned char jffs2_eof_mark[4] = {0xde, 0xad, 0xc0, 0xde};

static struct file_info inspect_info;
static int extract = 0;

char md5salt_normal[MD5SUM_LEN] = {
    0xdc, 0xd7, 0x3a, 0xa5, 0xc3, 0x95, 0x98, 0xfb,
    0xdd, 0xf9, 0xe7, 0xf4, 0x0e, 0xae, 0x47, 0x38,
};

char md5salt_boot[MD5SUM_LEN] = {
    0x8c, 0xef, 0x33, 0x5b, 0xd5, 0xc5, 0xce, 0xfa,
    0xa7, 0x9c, 0x28, 0xda, 0xb2, 0xe9, 0x0f, 0x42,
};

static struct flash_layout layouts[] = {
    {
        .id        = "4M",
        .fw_max_len    = 0x3c0000,
        .kernel_la    = 0x80060000,
        .kernel_ep    = 0x80060000,
        .rootfs_ofs    = 0x140000,
    }, {
        .id        = "4Mlzma",
        .fw_max_len    = 0x3c0000,
        .kernel_la    = 0x80060000,
        .kernel_ep    = 0x80060000,
        .rootfs_ofs    = 0x100000,
    }, {
        .id        = "8M",
        .fw_max_len    = 0x7c0000,
        .kernel_la    = 0x80060000,
        .kernel_ep    = 0x80060000,
        .rootfs_ofs    = 0x140000,
    }, {
        .id        = "8Mlzma",
        .fw_max_len    = 0x7c0000,
        .kernel_la    = 0x80060000,
        .kernel_ep    = 0x80060000,
        .rootfs_ofs    = 0x100000,
    }, {
                .id             = "16M",
                .fw_max_len     = 0xf80000,
                .kernel_la      = 0x80060000,
                .kernel_ep      = 0x80060000,
                .rootfs_ofs     = 0x140000,
        }, {
        /* terminating entry */
    }
};

static struct board_info boards[] = {
    {
        .id        = "TL-MR3020v1",
        .hw_id        = HWID_TL_MR3020_V1,
        .hw_rev        = 1,
        .layout_id    = "4Mlzma",
    }, {
        .id        = "TL-MR3220v1",
        .hw_id        = HWID_TL_MR3220_V1,
        .hw_rev        = 1,
        .layout_id    = "4M",
    }, {
        .id        = "TL-MR3420v1",
        .hw_id        = HWID_TL_MR3420_V1,
        .hw_rev        = 1,
        .layout_id    = "16M",
    }, {
        .id        = "TL-WA701Nv1",
        .hw_id        = HWID_TL_WA701N_V1,
        .hw_rev        = 1,
        .layout_id    = "4M",
    }, {
        .id        = "TL-WA7510N",
        .hw_id        = HWID_TL_WA7510N_V1,
        .hw_rev        = 1,
        .layout_id    = "4M",
    }, {
        .id        = "TL-WA901NDv1",
        .hw_id        = HWID_TL_WA901ND_V1,
        .hw_rev        = 1,
        .layout_id    = "4M",
    }, {
        .id             = "TL-WA901NDv2",
        .hw_id          = HWID_TL_WA901ND_V2,
        .hw_rev         = 1,
        .layout_id    = "4M",
    }, {
        .id        = "TL-WR741NDv1",
        .hw_id        = HWID_TL_WR741ND_V1,
        .hw_rev        = 1,
        .layout_id    = "4M",
    }, {
        .id        = "TL-WR741NDv4",
        .hw_id        = HWID_TL_WR741ND_V4,
        .hw_rev        = 1,
        .layout_id    = "4Mlzma",
    }, {
        .id        = "TL-WR740Nv1",
        .hw_id        = HWID_TL_WR740N_V1,
        .hw_rev        = 1,
        .layout_id    = "4M",
    }, {
        .id        = "TL-WR740Nv3",
        .hw_id        = HWID_TL_WR740N_V3,
        .hw_rev        = 1,
        .layout_id    = "4M",
    }, {
        .id        = "TL-WR743NDv1",
        .hw_id        = HWID_TL_WR743ND_V1,
        .hw_rev        = 1,
        .layout_id    = "4M",
    }, {
        .id        = "TL-WR841Nv1.5",
        .hw_id        = HWID_TL_WR841N_V1_5,
        .hw_rev        = 2,
        .layout_id    = "4M",
    }, {
        .id        = "TL-WR841NDv3",
        .hw_id        = HWID_TL_WR841ND_V3,
        .hw_rev        = 3,
        .layout_id    = "4M",
    }, {
        .id        = "TL-WR841NDv5",
        .hw_id        = HWID_TL_WR841ND_V5,
        .hw_rev        = 1,
        .layout_id    = "4M",
    }, {
        .id        = "TL-WR841NDv7",
        .hw_id        = HWID_TL_WR841ND_V7,
        .hw_rev        = 1,
        .layout_id    = "4M",
    }, {
        .id        = "TL-WR941NDv2",
        .hw_id        = HWID_TL_WR941ND_V2,
        .hw_rev        = 2,
        .layout_id    = "16M",
    }, {
        .id        = "TL-WR941NDv4",
        .hw_id        = HWID_TL_WR941ND_V4,
        .hw_rev        = 1,
        .layout_id    = "16M",
    }, {
        .id        = "TL-WR1041Nv2",
        .hw_id        = HWID_TL_WR1041N_V2,
        .hw_rev        = 1,
        .layout_id    = "4Mlzma",
    }, {
        .id        = "TL-WR1043NDv1",
        .hw_id        = HWID_TL_WR1043ND_V1,
        .hw_rev        = 1,
        .layout_id    = "16M",
    }, {
        .id        = "TL-WR2543Nv1",
        .hw_id        = HWID_TL_WR2543N_V1,
        .hw_rev        = 1,
        .layout_id    = "8Mlzma",
    }, {
        .id        = "TL-WR703Nv1",
        .hw_id        = HWID_TL_WR703N_V1,
        .hw_rev        = 1,
        .layout_id    = "4Mlzma",
    }, {
        /* terminating entry */
    }
};

/*
 * Message macros
 */
#define ERR(fmt, ...) do { \
    fflush(0); \
    fprintf(stderr, "[%s] *** error: " fmt "\n", \
            progname, ## __VA_ARGS__ ); \
} while (0)

#define ERRS(fmt, ...) do { \
    int save = errno; \
    fflush(0); \
    fprintf(stderr, "[%s] *** error: " fmt "\n", \
            progname, ## __VA_ARGS__, strerror(save)); \
} while (0)

#define DBG(fmt, ...) do { \
    fprintf(stderr, "[%s] " fmt "\n", progname, ## __VA_ARGS__ ); \
} while (0)

static struct board_info *find_board(char *id)
{
    struct board_info *ret;
    struct board_info *board;

    ret = NULL;
    for (board = boards; board->id != NULL; board++){
        if (strcasecmp(id, board->id) == 0) {
            ret = board;
            break;
        }
    };

    return ret;
}

static struct board_info *find_board_by_hwid(uint32_t hw_id)
{
    struct board_info *board;

    for (board = boards; board->id != NULL; board++) {
        if (hw_id == board->hw_id)
            return board;
    };

    return NULL;
}

static struct flash_layout *find_layout(char *id)
{
    struct flash_layout *ret;
    struct flash_layout *l;

    ret = NULL;
    for (l = layouts; l->id != NULL; l++){
        if (strcasecmp(id, l->id) == 0) {
            ret = l;
            break;
        }
    };

    return ret;
}

static void usage(int status)
{
    FILE *stream = (status != EXIT_SUCCESS) ? stderr : stdout;
    struct board_info *board;

    fprintf(stream, "Usage: %s [OPTIONS...]\n", progname);
    fprintf(stream,
"\n"
"Options:\n"
"  -B <board>      create image for the board specified with <board>\n"
"  -c              use combined kernel image\n"
"  -E <ep>         overwrite kernel entry point with <ep> (hexval prefixed with 0x)\n"
"  -L <la>         overwrite kernel load address with <la> (hexval prefixed with 0x)\n"
"  -H <hwid>       use hardware id specified with <hwid>\n"
"  -F <id>         use flash layout specified with <id>\n"
"  -k <file>       read kernel image from the file <file>\n"
"  -r <file>       read rootfs image from the file <file>\n"
"  -a <align>      align the rootfs start on an <align> bytes boundary\n"
"  -R <offset>     overwrite rootfs offset with <offset> (hexval prefixed with 0x)\n"
"  -o <file>       write output to the file <file>\n"
"  -s              strip padding from the end of the image\n"
"  -j              add jffs2 end-of-filesystem markers\n"
"  -N <vendor>     set image vendor to <vendor>\n"
"  -V <version>    set image version to <version>\n"
"  -v <version>    set firmware version to <version>\n"
"  -i <file>       inspect given firmware file <file>\n"
"  -x              extract kernel and rootfs while inspecting (requires -i)\n"
"  -h              show this screen\n"
    );

    exit(status);
}

static int get_md5(char *data, int size, char *md5)
{
    MD5_CTX ctx;

    MD5_Init(&ctx);
    MD5_Update(&ctx, data, size);
    MD5_Final(md5, &ctx);
}

static int get_file_stat(struct file_info *fdata)
{
    struct stat st;
    int res;

    if (fdata->file_name == NULL)
        return 0;

    res = stat(fdata->file_name, &st);
    if (res){
        ERRS("stat failed on %s", fdata->file_name);
        return res;
    }

    fdata->file_size = st.st_size;
    return 0;
}

static int read_to_buf(struct file_info *fdata, char *buf)
{
    FILE *f;
    int ret = EXIT_FAILURE;

    f = fopen(fdata->file_name, "r");
    if (f == NULL) {
        ERRS("could not open \"%s\" for reading", fdata->file_name);
        goto out;
    }

    errno = 0;
    fread(buf, fdata->file_size, 1, f);
    if (errno != 0) {
        ERRS("unable to read from file \"%s\"", fdata->file_name);
        goto out_close;
    }

    ret = EXIT_SUCCESS;

 out_close:
    fclose(f);
 out:
    return ret;
}

static int check_options(void)
{
    int ret;

    if (inspect_info.file_name) {
        ret = get_file_stat(&inspect_info);
        if (ret)
            return ret;

        return 0;
    } else if (extract) {
        ERR("no firmware for inspection specified");
        return -1;
    }

    if (board_id == NULL && opt_hw_id == NULL) {
        ERR("either board or hardware id must be specified");
        return -1;
    }

    if (board_id) {
        board = find_board(board_id);
        if (board == NULL) {
            ERR("unknown/unsupported board id \"%s\"", board_id);
            return -1;
        }
        if (layout_id == NULL)
            layout_id = board->layout_id;

        hw_id = board->hw_id;
        hw_rev = board->hw_rev;
    } else {
        if (layout_id == NULL) {
            ERR("flash layout is not specified");
            return -1;
        }
        hw_id = strtoul(opt_hw_id, NULL, 0);

        if (opt_hw_rev)
            hw_rev = strtoul(opt_hw_rev, NULL, 0);
        else
            hw_rev = 1;
    }

    layout = find_layout(layout_id);
    if (layout == NULL) {
        ERR("unknown flash layout \"%s\"", layout_id);
        return -1;
    }

    if (!kernel_la)
        kernel_la = layout->kernel_la;
    if (!kernel_ep)
        kernel_ep = layout->kernel_ep;
    if (!rootfs_ofs)
        rootfs_ofs = layout->rootfs_ofs;

    if (kernel_info.file_name == NULL) {
        ERR("no kernel image specified");
        return -1;
    }

    ret = get_file_stat(&kernel_info);
    if (ret)
        return ret;

    kernel_len = kernel_info.file_size;

    if (combined) {
        if (kernel_info.file_size >
            layout->fw_max_len - sizeof(struct fw_header)) {
            ERR("kernel image is too big");
            return -1;
        }
    } else {
        if (rootfs_info.file_name == NULL) {
            ERR("no rootfs image specified");
            return -1;
        }

        ret = get_file_stat(&rootfs_info);
        if (ret)
            return ret;

        if (rootfs_align) {
            kernel_len += sizeof(struct fw_header);
            kernel_len = ALIGN(kernel_len, rootfs_align);
            kernel_len -= sizeof(struct fw_header);

            DBG("kernel length aligned to %u", kernel_len);

            if (kernel_len + rootfs_info.file_size >
                layout->fw_max_len - sizeof(struct fw_header)) {
                ERR("images are too big");
                return -1;
            }
        } else {
            if (kernel_info.file_size >
                rootfs_ofs - sizeof(struct fw_header)) {
                ERR("kernel image is too big");
                return -1;
            }

            if (rootfs_info.file_size >
                (layout->fw_max_len - rootfs_ofs)) {
                ERR("rootfs image is too big");
                return -1;
            }
        }
    }

    if (ofname == NULL) {
        ERR("no output file specified");
        return -1;
    }

    ret = sscanf(fw_ver, "%d.%d.%d", &fw_ver_hi, &fw_ver_mid, &fw_ver_lo);
    if (ret != 3) {
        ERR("invalid firmware version '%s'", fw_ver);
        return -1;
    }

    return 0;
}

static void fill_header(char *buf, int len)
{
    struct fw_header *hdr = (struct fw_header *)buf;

    memset(hdr, 0, sizeof(struct fw_header));

    hdr->version = htonl(HEADER_VERSION_V1);
    strncpy(hdr->vendor_name, vendor, sizeof(hdr->vendor_name));
    strncpy(hdr->fw_version, version, sizeof(hdr->fw_version));
    hdr->hw_id = htonl(hw_id);
    hdr->hw_rev = htonl(hw_rev);

    if (boot_info.file_size == 0)
        memcpy(hdr->md5sum1, md5salt_normal, sizeof(hdr->md5sum1));
    else
        memcpy(hdr->md5sum1, md5salt_boot, sizeof(hdr->md5sum1));

    hdr->kernel_la = htonl(kernel_la);
    hdr->kernel_ep = htonl(kernel_ep);
    hdr->fw_length = htonl(layout->fw_max_len);
    hdr->kernel_ofs = htonl(sizeof(struct fw_header));
    hdr->kernel_len = htonl(kernel_len);
    if (!combined) {
        hdr->rootfs_ofs = htonl(rootfs_ofs);
        hdr->rootfs_len = htonl(rootfs_info.file_size);
    }

    hdr->ver_hi = htons(fw_ver_hi);
    hdr->ver_mid = htons(fw_ver_mid);
    hdr->ver_lo = htons(fw_ver_lo);

    get_md5(buf, len, hdr->md5sum1);
}

static int pad_jffs2(char *buf, int currlen)
{
    int len;
    uint32_t pad_mask;

    len = currlen;
    pad_mask = (64 * 1024);
    while ((len < layout->fw_max_len) && (pad_mask != 0)) {
        uint32_t mask;
        int i;

        for (i = 10; i < 32; i++) {
            mask = 1 << i;
            if (pad_mask & mask)
                break;
        }

        len = ALIGN(len, mask);

        for (i = 10; i < 32; i++) {
            mask = 1 << i;
            if ((len & (mask - 1)) == 0)
                pad_mask &= ~mask;
        }

        for (i = 0; i < sizeof(jffs2_eof_mark); i++)
            buf[len + i] = jffs2_eof_mark[i];

        len += sizeof(jffs2_eof_mark);
    }

    return len;
}

static int write_fw(char *data, int len)
{
    FILE *f;
    int ret = EXIT_FAILURE;

    f = fopen(ofname, "w");
    if (f == NULL) {
        ERRS("could not open \"%s\" for writing", ofname);
        goto out;
    }

    errno = 0;
    fwrite(data, len, 1, f);
    if (errno) {
        ERRS("unable to write output file");
        goto out_flush;
    }

    DBG("firmware file \"%s\" completed", ofname);

    ret = EXIT_SUCCESS;

 out_flush:
    fflush(f);
    fclose(f);
    if (ret != EXIT_SUCCESS) {
        unlink(ofname);
    }
 out:
    return ret;
}

static int build_fw(void)
{
    int buflen;
    char *buf;
    char *p;
    int ret = EXIT_FAILURE;
    int writelen = 0;

    buflen = layout->fw_max_len;

    buf = malloc(buflen);
    if (!buf) {
        ERR("no memory for buffer\n");
        goto out;
    }

    memset(buf, 0xff, buflen);
    p = buf + sizeof(struct fw_header);
    ret = read_to_buf(&kernel_info, p);
    if (ret)
        goto out_free_buf;

    writelen = sizeof(struct fw_header) + kernel_len;

    if (!combined) {
        if (rootfs_align)
            p = buf + writelen;
        else
            p = buf + rootfs_ofs;

        ret = read_to_buf(&rootfs_info, p);
        if (ret)
            goto out_free_buf;

        if (rootfs_align)
            writelen += rootfs_info.file_size;
        else
            writelen = rootfs_ofs + rootfs_info.file_size;

        if (add_jffs2_eof)
            writelen = pad_jffs2(buf, writelen);
    }

    if (!strip_padding)
        writelen = buflen;

    fill_header(buf, writelen);
    ret = write_fw(buf, writelen);
    if (ret)
        goto out_free_buf;

    ret = EXIT_SUCCESS;

 out_free_buf:
    free(buf);
 out:
    return ret;
}

/* Helper functions to inspect_fw() representing different output formats */
static inline void inspect_fw_pstr(char *label, char *str)
{
    printf("%-23s: %s\n", label, str);
}

static inline void inspect_fw_phex(char *label, uint32_t val)
{
    printf("%-23s: 0x%08x\n", label, val);
}

static inline void inspect_fw_phexpost(char *label,
                                       uint32_t val, char *post)
{
    printf("%-23s: 0x%08x (%s)\n", label, val, post);
}

static inline void inspect_fw_phexdef(char *label,
                                      uint32_t val, uint32_t defval)
{
    printf("%-23s: 0x%08x                  ", label, val);

    if (val == defval)
        printf("(== OpenWrt default)\n");
    else
        printf("(OpenWrt default: 0x%08x)\n", defval);
}

static inline void inspect_fw_phexexp(char *label,
                                      uint32_t val, uint32_t expval)
{
    printf("%-23s: 0x%08x ", label, val);

    if (val == expval)
        printf("(ok)\n");
    else
        printf("(expected: 0x%08x)\n", expval);
}

static inline void inspect_fw_phexdec(char *label, uint32_t val)
{
    printf("%-23s: 0x%08x / %8u bytes\n", label, val, val);
}

static inline void inspect_fw_phexdecdef(char *label,
                                         uint32_t val, uint32_t defval)
{
    printf("%-23s: 0x%08x / %8u bytes ", label, val, val);

    if (val == defval)
        printf("(== OpenWrt default)\n");
    else
        printf("(OpenWrt default: 0x%08x)\n", defval);
}

static inline void inspect_fw_pmd5sum(char *label, uint8_t *val, char *text)
{
    int i;

    printf("%-23s:", label);
    for (i=0; i<MD5SUM_LEN; i++)
        printf(" %02x", val[i]);
    printf(" %s\n", text);
}

static int inspect_fw(void)
{
    char *buf;
    struct fw_header *hdr;
    uint8_t md5sum[MD5SUM_LEN];
    struct board_info *board;
    int ret = EXIT_FAILURE;

    buf = malloc(inspect_info.file_size);
    if (!buf) {
        ERR("no memory for buffer!\n");
        goto out;
    }

    ret = read_to_buf(&inspect_info, buf);
    if (ret)
        goto out_free_buf;
    hdr = (struct fw_header *)buf;

    inspect_fw_pstr("File name", inspect_info.file_name);
    inspect_fw_phexdec("File size", inspect_info.file_size);

    if (ntohl(hdr->version) != HEADER_VERSION_V1) {
        ERR("file does not seem to have V1 header!\n");
        goto out_free_buf;
    }

    inspect_fw_phexdec("Version 1 Header size", sizeof(struct fw_header));

    if (ntohl(hdr->unk1) != 0)
        inspect_fw_phexdec("Unknown value 1", hdr->unk1);

    memcpy(md5sum, hdr->md5sum1, sizeof(md5sum));
    if (ntohl(hdr->boot_len) == 0)
        memcpy(hdr->md5sum1, md5salt_normal, sizeof(md5sum));
    else
        memcpy(hdr->md5sum1, md5salt_boot, sizeof(md5sum));
    get_md5(buf, inspect_info.file_size, hdr->md5sum1);

    if (memcmp(md5sum, hdr->md5sum1, sizeof(md5sum))) {
        inspect_fw_pmd5sum("Header MD5Sum1", md5sum, "(*ERROR*)");
        inspect_fw_pmd5sum("          --> expected", hdr->md5sum1, "");
    } else {
        inspect_fw_pmd5sum("Header MD5Sum1", md5sum, "(ok)");
    }
    if (ntohl(hdr->unk2) != 0)
        inspect_fw_phexdec("Unknown value 2", hdr->unk2);
    inspect_fw_pmd5sum("Header MD5Sum2", hdr->md5sum2,
                       "(purpose yet unknown, unchecked here)");
    if (ntohl(hdr->unk3) != 0)
        inspect_fw_phexdec("Unknown value 3", hdr->unk3);

    printf("\n");

    inspect_fw_pstr("Vendor name", hdr->vendor_name);
    inspect_fw_pstr("Firmware version", hdr->fw_version);
    board = find_board_by_hwid(ntohl(hdr->hw_id));
    if (board) {
        layout = find_layout(board->layout_id);
        inspect_fw_phexpost("Hardware ID",
                            ntohl(hdr->hw_id), board->id);
        inspect_fw_phexexp("Hardware Revision",
                           ntohl(hdr->hw_rev), board->hw_rev);
    } else {
        inspect_fw_phexpost("Hardware ID",
                            ntohl(hdr->hw_id), "unknown");
        inspect_fw_phex("Hardware Revision",
                        ntohl(hdr->hw_rev));
    }

    printf("\n");

    inspect_fw_phexdec("Kernel data offset",
                       ntohl(hdr->kernel_ofs));
    inspect_fw_phexdec("Kernel data length",
                       ntohl(hdr->kernel_len));
    if (board) {
        inspect_fw_phexdef("Kernel load address",
                           ntohl(hdr->kernel_la),
                           layout ? layout->kernel_la : 0xffffffff);
        inspect_fw_phexdef("Kernel entry point",
                           ntohl(hdr->kernel_ep),
                           layout ? layout->kernel_ep : 0xffffffff);
        inspect_fw_phexdecdef("Rootfs data offset",
                              ntohl(hdr->rootfs_ofs),
                              layout ? layout->rootfs_ofs : 0xffffffff);
    } else {
        inspect_fw_phex("Kernel load address",
                        ntohl(hdr->kernel_la));
        inspect_fw_phex("Kernel entry point",
                        ntohl(hdr->kernel_ep));
        inspect_fw_phexdec("Rootfs data offset",
                           ntohl(hdr->rootfs_ofs));
    }
    inspect_fw_phexdec("Rootfs data length",
                       ntohl(hdr->rootfs_len));
    inspect_fw_phexdec("Boot loader data offset",
                       ntohl(hdr->boot_ofs));
    inspect_fw_phexdec("Boot loader data length",
                       ntohl(hdr->boot_len));
    inspect_fw_phexdec("Total firmware length",
                       ntohl(hdr->fw_length));

    if (extract) {
        FILE *fp;
        char *filename;

        printf("\n");

        filename = malloc(strlen(inspect_info.file_name) + 8);
        sprintf(filename, "%s-kernel", inspect_info.file_name);
        printf("Extracting kernel to \"%s\"...\n", filename);
        fp = fopen(filename, "w");
        if (fp)    {
            if (!fwrite(buf + ntohl(hdr->kernel_ofs),
                        ntohl(hdr->kernel_len), 1, fp)) {
                ERR("error in fwrite(): %s", strerror(errno));
            }
            fclose(fp);
        } else {
            ERR("error in fopen(): %s", strerror(errno));
        }
        free(filename);

        filename = malloc(strlen(inspect_info.file_name) + 8);
        sprintf(filename, "%s-rootfs", inspect_info.file_name);
        printf("Extracting rootfs to \"%s\"...\n", filename);
        fp = fopen(filename, "w");
        if (fp)    {
            if (!fwrite(buf + ntohl(hdr->rootfs_ofs),
                        ntohl(hdr->rootfs_len), 1, fp)) {
                ERR("error in fwrite(): %s", strerror(errno));
            }
            fclose(fp);
        } else {
            ERR("error in fopen(): %s", strerror(errno));
        }
        free(filename);
    }

 out_free_buf:
    free(buf);
 out:
    return ret;
}

int main(int argc, char *argv[])
{
    int ret = EXIT_FAILURE;
    int err;

    FILE *outfile;

    progname = basename(argv[0]);

    while ( 1 ) {
        int c;

        c = getopt(argc, argv, "a:B:H:E:F:L:V:N:W:ci:k:r:R:o:xhsjv:");
        if (c == -1)
            break;

        switch (c) {
        case 'a':
            sscanf(optarg, "0x%x", &rootfs_align);
            break;
        case 'B':
            board_id = optarg;
            break;
        case 'H':
            opt_hw_id = optarg;
            break;
        case 'E':
            sscanf(optarg, "0x%x", &kernel_ep);
            break;
        case 'F':
            layout_id = optarg;
            break;
        case 'W':
            opt_hw_rev = optarg;
            break;
        case 'L':
            sscanf(optarg, "0x%x", &kernel_la);
            break;
        case 'V':
            version = optarg;
            break;
        case 'v':
            fw_ver = optarg;
            break;
        case 'N':
            vendor = optarg;
            break;
        case 'c':
            combined++;
            break;
        case 'k':
            kernel_info.file_name = optarg;
            break;
        case 'r':
            rootfs_info.file_name = optarg;
            break;
        case 'R':
            sscanf(optarg, "0x%x", &rootfs_ofs);
            break;
        case 'o':
            ofname = optarg;
            break;
        case 's':
            strip_padding = 1;
            break;
        case 'i':
            inspect_info.file_name = optarg;
            break;
        case 'j':
            add_jffs2_eof = 1;
            break;
        case 'x':
            extract = 1;
            break;
        case 'h':
            usage(EXIT_SUCCESS);
            break;
        default:
            usage(EXIT_FAILURE);
            break;
        }
    }

    ret = check_options();
    if (ret)
        goto out;

    if (!inspect_info.file_name)
        ret = build_fw();
    else
        ret = inspect_fw();

 out:
    return ret;
}

tu zreszta

custom-src\target\linux\ar71xx\image\Makefile

tez nie ma definicji dla MR3420_V2

jest tylko

$(eval $(call SingleProfile,TPLINK,$(fs_64kraw),TLMR3420,tl-mr3420-v1,TL-MR3420,ttyS0,115200,0x34200001,1,16M))

#
# Copyright (C) 2008-2011 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/image.mk

JFFS2_BLOCKSIZE = 64k 128k 256k

define imgname
$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(patsubst jffs2-%,jffs2,$(patsubst squashfs-%,squashfs,$(1)))
endef

define rootfs_align
$(patsubst %-256k,0x40000,$(patsubst %-128k,0x20000,$(patsubst %-64k,0x10000,$(patsubst squashfs-%,0x4,$(1)))))
endef

define sysupname
$(call imgname,$(1),$(2))-sysupgrade.bin
endef

define factoryname
$(call imgname,$(1),$(2))-factory.bin
endef

COMMA:=,

define mkcmdline
$(if $(1),board=$(1) )$(if $(2),console=$(2)$(COMMA)$(3))
endef

SINGLE_PROFILES:=

define SingleProfile
  define Image/Build/Profile/$(3)
    $$(call Image/Build/Template/$(2)/$$(1),$(1),$(4),$$(call mkcmdline,$(5),$(6),$(7)),$(8),$(9),$(10),$(11),$(12))
  endef
  SINGLE_PROFILES += $(3)
endef

define MultiProfile
  define Image/Build/Profile/$(1)
    $(foreach p,$(2),
        $$(call Image/Build/Profile/$p,$$(1))
    )
  endef
endef

LOADER_MAKE := $(NO_TRACE_MAKE) -C lzma-loader KDIR=$(KDIR)

KDIR_TMP:=$(KDIR)/tmp
VMLINUX:=$(BIN_DIR)/$(IMG_PREFIX)-vmlinux
UIMAGE:=$(BIN_DIR)/$(IMG_PREFIX)-uImage
fs_squash:=squashfs-only
fs_64k:=64k
fs_64kraw:=64kraw
fs_128k:=128k
fs_256k:=256k
ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
    fs_squash:=initramfs
    fs_64k:=initramfs
    fs_64kraw:=initramfs
    fs_128k:=initramfs
    fs_256k:=initramfs
    VMLINUX:=$(BIN_DIR)/$(IMG_PREFIX)-vmlinux-initramfs
    UIMAGE:=$(BIN_DIR)/$(IMG_PREFIX)-uImage-initramfs
endif

define CompressLzma
  $(STAGING_DIR_HOST)/bin/lzma e $(1) -lc1 -lp2 -pb2 $(3) $(2)
endef

define PatchKernelLzma
    cp $(KDIR)/vmlinux $(KDIR_TMP)/vmlinux-$(1)
    $(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR_TMP)/vmlinux-$(1) "$(strip $(2))"
    $(call CompressLzma,$(KDIR_TMP)/vmlinux-$(1),$(KDIR_TMP)/vmlinux-$(1).bin.lzma,$(3))
endef

define PatchKernelGzip
    cp $(KDIR)/vmlinux $(KDIR_TMP)/vmlinux-$(1)
    $(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR_TMP)/vmlinux-$(1) "$(strip $(2))"
    gzip -9 -c $(KDIR_TMP)/vmlinux-$(1) > $(KDIR_TMP)/vmlinux-$(1).bin.gz
endef

define MkuImage
    mkimage -A mips -O linux -T kernel -a 0x80060000 -C $(1) $(2) \
        -e 0x80060000 -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
        -d $(3) $(4)
endef

define MkuImageLzma
    $(call PatchKernelLzma,$(1),$(2),$(3))
    $(call MkuImage,lzma,,$(KDIR_TMP)/vmlinux-$(1).bin.lzma,$(KDIR_TMP)/vmlinux-$(1).uImage)
endef

define MkuImageLzma/initramfs
    $(call PatchKernelLzma,$(1),$(2))
    $(call MkuImage,lzma,,$(KDIR_TMP)/vmlinux-$(1).bin.lzma,$(call imgname,initramfs,$(1))-uImage.bin)
endef

define MkuImageGzip
    $(call PatchKernelGzip,$(1),$(2))
    $(call MkuImage,gzip,,$(KDIR_TMP)/vmlinux-$(1).bin.gz,$(KDIR_TMP)/vmlinux-$(1).uImage)
endef

define MkuImageGzip/initramfs
    $(call PatchKernelGzip,$(1),$(2))
    $(call MkuImage,gzip,,$(KDIR_TMP)/vmlinux-$(1).bin.gz,$(call imgname,initramfs,$(1))-uImage.bin)
endef

define MkuImageOKLI
    $(call MkuImage,lzma,-M 0x4f4b4c49,$(KDIR)/vmlinux.bin.lzma,$(KDIR_TMP)/vmlinux-$(1).okli)
endef

define CatFiles
    if [ `stat -c%s "$(1)"` -gt $(2) ]; then \
        echo "Warning: $(1) is too big"; \
    else if [ `stat -c%s $(3)` -gt $(4) ]; then \
        echo "Warning: $(3) is too big"; \
    else \
        ( dd if=$(1) bs=$(2) conv=sync; dd if=$(3) ) > $(5); \
    fi; fi
endef

define Sysupgrade/KR
    $(call CatFiles,$(2),$(3),$(KDIR)/root.$(1),$(4),$(call sysupname,$(1),$(5)))
endef

define Sysupgrade/KRuImage
    $(call CatFiles,$(KDIR_TMP)/vmlinux-$(2).uImage,$(3),$(KDIR)/root.$(1),$(4),$(call sysupname,$(1),$(2)))
endef

define Sysupgrade/RKuImage
    $(call CatFiles,$(KDIR)/root.$(1),$(4),$(KDIR_TMP)/vmlinux-$(2).uImage,$(3),$(call sysupname,$(1),$(2)))
endef

define Image/BuildLoader
    -rm -rf $(KDIR)/lzma-loader
    $(LOADER_MAKE) LOADER=loader-$(1).$(2) KERNEL_CMDLINE="$(3)"\
        LZMA_TEXT_START=0x80a00000 LOADADDR=0x80060000 \
        LOADER_DATA="$(KDIR)/vmlinux.bin.lzma" BOARD="$(1)" \
        compile loader.$(2)
endef

define Image/BuildLoaderAlone
    -rm -rf $(KDIR)/lzma-loader
    $(LOADER_MAKE) LOADER=loader-$(1).$(2) KERNEL_CMDLINE="$(3)" \
        LZMA_TEXT_START=0x80a00000 LOADADDR=0x80060000 \
        BOARD="$(1)" FLASH_OFFS=$(4) FLASH_MAX=$(5) \
        compile loader.$(2)
endef

define Build/Clean
    $(LOADER_MAKE) clean
endef


alfa_ap96_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,256k(u-boot-env)ro,13312k(rootfs),2048k(kernel),512k(caldata)ro,15360k@0x80000(firmware)
alfa_mtdlayout_8M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6144k(rootfs),1600k(kernel),64k(nvram),64k(art)ro,7744k@0x50000(firmware)
all0258n_mtdlayout=mtdparts=spi0.0:256k(u-boot),64k(u-boot-env),1024k(kernel),5248k(rootfs),1536k(failsafe),64k(art),6272k@0x50000(firmware)
all0315n_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,256k(u-boot-env),1024k(kernel),12544k(rootfs),2048k(failsafe),256k(art)ro,13568k@0x80000(firmware)
ap96_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(u-boot-env)ro,6144k(rootfs),1728k(kernel),64k(art)ro,7872k@0x40000(firmware)
ap113_mtd_layout=mtdparts=spi0.0:64k(u-boot),3008k(rootfs),896k(uImage),64k(NVRAM),64k(ART),3904k@0x10000(firmware)
ap121_mtdlayout_2M=mtdparts=spi0.0:64k(u-boot)ro,1216k(rootfs),704k(kernel),64k(art)ro,1920k@0x10000(firmware)
ap121_mtdlayout_4M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,2752k(rootfs),896k(kernel),64k(nvram),64k(art)ro,3648k@0x50000(firmware)
ap136_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6336k(rootfs),1408k(kernel),64k(mib0),64k(art)ro,7744k@0x50000(firmware)
cameo7240_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(nvram)ro,960k(kernel),2752k(rootfs),64k(mac)ro,64k(art)ro,3712k@0x40000(firmware)
cameo913x_mtdlayout=mtdparts=spi0.0:128k(u-boot)ro,64k(config)ro,960k(kernel),2880k(rootfs),64k(art)ro,3840k@0x30000(firmware)
cameo933x_mtdlayout=mtdparts=spi0.0:64k(u-boot)ro,64k(art)ro,64k(mac)ro,64k(nvram)ro,192k(language)ro,896k(kernel),2752k(rootfs),3648k@0x70000(firmware)
cap4200ag_mtdlayout=mtdparts=spi0.0:256k(u-boot),64k(u-boot-env),320k(custom)ro,1536k(kernel),12096k(rootfs),2048k(failsafe),64k(art),13632k@0xa0000(firmware)
db120_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6336k(rootfs),1408k(kernel),64k(nvram),64k(art)ro,7744k@0x50000(firmware)
dir825b1_mtdlayout=mtdparts=spi0.0:256k(uboot)ro,64k(config)ro,1024k(kernel),5184k(rootfs),64k(caldata)ro,1600k(unknown)ro,6208k@0x50000(firmware),64k@0x7f0000(caldata_copy)
dir825b1_mtdlayout_fat=mtdparts=spi0.0:256k(uboot)ro,64k(config)ro,1024k(kernel),6784k(rootfs),64k(caldata)ro,7808k@0x50000(firmware),64k@0x660000(caldata_orig),6208k@0x50000(firmware_orig)
ew-dorin_mtdlayout_4M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),1024k(kernel),2688k(rootfs),64k(art),3712k@0x50000(firmware)
dlrtdev_mtdlayout=mtdparts=spi0.0:256k(uboot)ro,64k(config)ro,1024k(kernel),5184k(rootfs),64k(caldata)ro,640k(certs),960k(unknown)ro,6208k@0x50000(firmware),64k@0x7f0000(caldata_copy)
dlrtdev_mtdlayout_fat=mtdparts=spi0.0:256k(uboot)ro,64k(config)ro,1024k(kernel),6544k(rootfs),640k(certs),64k(caldata)ro,7168k@0x50000(firmware),64k@0x660000(caldata_orig),6208k@0x50000(firmware_orig)
pb92_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,2752k(rootfs),896k(kernel),64k(nvram),64k(art)ro,3648k@0x50000(firmware)
planex_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,960k(kernel),6784k(rootfs),128k(art)ro,7744k@0x50000(firmware)
ubntxm_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1024k(kernel),6528k(rootfs),256k(cfg)ro,64k(EEPROM)ro,7552k@0x50000(firmware)
ubdev_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1024k(kernel),6464k(rootfs),64k(certs),256k(cfg)ro,64k(EEPROM)ro,7488k@0x50000(firmware)
whrhpg300n_mtdlayout=mtdparts=spi0.0:248k(u-boot)ro,8k(u-boot-env)ro,960k(kernel),2816k(rootfs),64k(art)ro,3712k@0x40000(firmware)
wndr3700_mtdlayout=mtdparts=spi0.0:320k(u-boot)ro,128k(u-boot-env)ro,1024k(kernel),6656k(rootfs),64k(art)ro,7680k@0x70000(firmware)
wndr3700v2_mtdlayout=mtdparts=spi0.0:320k(u-boot)ro,128k(u-boot-env)ro,1024k(kernel),14848k(rootfs),64k(art)ro,15872k@0x70000(firmware)
zcn1523h_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6208k(rootfs),1472k(kernel),64k(configure)ro,64k(mfg)ro,64k(art)ro,7680k@0x50000(firmware)

define Image/BuildKernel
    cp $(KDIR)/vmlinux.elf $(VMLINUX).elf
    cp $(KDIR)/vmlinux $(VMLINUX).bin
    dd if=$(KDIR)/vmlinux.bin.lzma of=$(VMLINUX).lzma bs=65536 conv=sync
    dd if=$(KDIR)/vmlinux.bin.gz of=$(VMLINUX).gz bs=65536 conv=sync
    $(call MkuImage,gzip,,$(KDIR)/vmlinux.bin.gz,$(UIMAGE)-gzip.bin)
    $(call MkuImage,lzma,,$(KDIR)/vmlinux.bin.lzma,$(UIMAGE)-lzma.bin)
    cp $(KDIR)/loader-generic.elf $(VMLINUX)-lzma.elf
    -mkdir -p $(KDIR_TMP)
    $(call Image/Build/Initramfs)
endef

define Image/Build/WRT400N
    $(call MkuImageLzma,$(2),$(3))
    $(call Sysupgrade/KRuImage,$(1),$(2),1310720,6488064)
    if [ -e "$(call sysupname,$(1),$(2))" ]; then \
        wrt400n $(KDIR_TMP)/vmlinux-$(2).uImage $(KDIR)/root.$(1) $(call factoryname,$(1),$(2)); \
    fi
endef

define Image/Build/DIR825B1
    $(call MkuImageLzma,$(2),$(3) $(dir825b1_mtdlayout))
    $(call Sysupgrade/KRuImage,$(1),$(2),1048576,5308416)
    if [ -e "$(call sysupname,$(1),$(2))" ]; then \
        ( \
            dd if=$(call sysupname,$(1),$(2)); \
            echo -n "$(4)"; \
        ) > $(call imgname,$(1),$(2))-backup-loader.bin; \
        if [ `stat -c%s $(call sysupname,$(1),$(2))` -gt 4194304 ]; then \
            echo "Warning: $(call sysupname,$(1),$(2)) is too big"; \
        else \
            ( \
                dd if=$(call sysupname,$(1),$(2)) bs=4096k conv=sync; \
                echo -n "$(5)"; \
            ) > $(call factoryname,$(1),$(2)); \
        fi; \
    fi
    $(call MkuImageLzma,$(2)-fat,$(3) $(dir825b1_mtdlayout_fat))
    $(call CatFiles,$(KDIR_TMP)/vmlinux-$(2)-fat.uImage,1048576,$(KDIR)/root.$(1),6946816,$(KDIR_TMP)/$(2)-fat.bin)
    if [ -e "$(KDIR_TMP)/$(2)-fat.bin" ]; then \
        echo -n "" > $(KDIR_TMP)/$(2)-fat.dummy; \
        sh $(TOPDIR)/scripts/combined-image.sh \
            "$(KDIR_TMP)/$(2)-fat.bin" \
            "$(KDIR_TMP)/$(2)-fat.dummy" \
            $(call sysupname,$(1),$(2)-fat); \
    fi
endef

define Image/Build/DLRTDEV
    $(call MkuImageLzma,$(2),$(3) $(dlrtdev_mtdlayout))
    $(call Sysupgrade/KRuImage,$(1),$(2),1048576,5308416)
    if [ -e "$(call sysupname,$(1),$(2))" ]; then \
        ( \
            dd if=$(call sysupname,$(1),$(2)); \
            echo -n "$(4)"; \
        ) > $(call imgname,$(1),$(2))-backup-loader.bin; \
        if [ `stat -c%s $(call sysupname,$(1),$(2))` -gt 4194304 ]; then \
            echo "Warning: $(call sysupname,$(1),$(2)) is too big"; \
        else \
            ( \
                dd if=$(call sysupname,$(1),$(2)) bs=4096k conv=sync; \
                echo -n "$(5)"; \
            ) > $(call factoryname,$(1),$(2)); \
        fi; \
    fi
    $(call MkuImageLzma,$(2)-fat,$(3) $(dlrtdev_mtdlayout_fat))
    $(call CatFiles,$(KDIR_TMP)/vmlinux-$(2)-fat.uImage,1048576,$(KDIR)/root.$(1),6946816,$(KDIR_TMP)/$(2)-fat.bin)
    if [ -e "$(KDIR_TMP)/$(2)-fat.bin" ]; then \
        echo -n "" > $(KDIR_TMP)/$(2)-fat.dummy; \
        sh $(TOPDIR)/scripts/combined-image.sh \
            "$(KDIR_TMP)/$(2)-fat.bin" \
            "$(KDIR_TMP)/$(2)-fat.dummy" \
            $(call sysupname,$(1),$(2)-fat); \
    fi
endef

define Image/Build/WZRHPG30XNH
    $(call MkuImageLzma,$(2),$(3))
    $(call Sysupgrade/KRuImage,$(1),$(2),1048576,31850496)
    if [ -e "$(call sysupname,$(1),$(2))" ]; then \
        ( \
            echo -n -e "# Airstation Public Fmt1\x00\x00\x00\x00\x00\x00\x00\x00"; \
            dd if=$(call sysupname,$(1),$(2)); \
        ) > $(call imgname,$(1),$(2))-tftp.bin; \
        buffalo-enc -p $(4) -v 1.99 \
            -i $(call sysupname,$(1),$(2)) \
            -o $(KDIR_TMP)/$(2).enc; \
        buffalo-tag -b $(4) -p $(4) -a ath -v 1.99 -m 1.01 -l mlang8 \
            -w 3 -c 0x80041000 -d 0x801e8000 -f 1 -r M_ \
            -i $(KDIR_TMP)/$(2).enc \
            -o $(call factoryname,$(1),$(2)); \
    fi
endef

define Image/Build/WZRHPG30XNH/initramfs
    $(call MkuImageLzma/initramfs,$(2),$(3) $(4))
endef

define Image/Build/WHRHPG300N
    $(call MkuImageLzma,$(2),$(3) $(4))
    $(call Sysupgrade/KRuImage,$(1),$(2),983040,2883584)
    if [ -e "$(call sysupname,$(1),$(2))" ]; then \
        ( \
            echo -n -e "# Airstation Public Fmt1\x00\x00\x00\x00\x00\x00\x00\x00"; \
            dd if=$(call sysupname,$(1),$(2)); \
        ) > $(call imgname,$(1),$(2))-tftp.bin; \
        buffalo-enc -p $(5) -v 1.99 \
            -i $(call sysupname,$(1),$(2)) \
            -o $(KDIR_TMP)/$(2).enc; \
        buffalo-tag -b $(5) -p $(5) -a ath -v 1.99 -m 1.01 -l mlang8 \
            -w 3 -c 0x80041000 -d 0x801e8000 -f 1 -r M_ \
            -i $(KDIR_TMP)/$(2).enc \
            -o $(call factoryname,$(1),$(2)); \
    fi
endef

define Image/Build/WHRHPG300N/initramfs
    $(call MkuImageLzma/initramfs,$(2),$(3) $(4))
endef

define Image/Build/Cameo
    $(call MkuImageLzma,$(2),$(3) $(4))
    $(call Sysupgrade/KRuImage,$(1),$(2),$(5),$(6))
    if [ -e "$(call sysupname,$(1),$(2))" ]; then \
        ( \
            dd if=$(KDIR_TMP)/vmlinux-$(2).uImage bs=$(5) conv=sync; \
            dd if=$(KDIR)/root.$(1) bs=$(6) conv=sync; \
            echo -n $(7); \
        ) > $(call factoryname,$(1),$(2)); \
    fi
endef

define Image/Build/CameoHornet
    $(call MkuImageLzma,$(2),$(3) $(4))
    $(call Sysupgrade/KRuImage,$(1),$(2),$(5),$(6))
    if [ -e "$(call sysupname,$(1),$(2))" ]; then \
        mkcameofw -M HORNET -R "DEF" -S $(7) -V "1.99" \
            -K $(5) -I $$$$(($(5)+$(6))) \
            -k $(KDIR_TMP)/vmlinux-$(2).uImage \
            -r $(BIN_DIR)/$(IMG_PREFIX)-root.$(1) \
            -o $(call factoryname,$(1),$(2)); \
    fi
endef

define Image/Build/Cameo913x
    $(call Image/Build/Cameo,$(1),$(2),$(3),$(cameo913x_mtdlayout),983040,2949120,$(4))
endef

define Image/Build/Cameo913x/initramfs
    $(call MkuImageLzma/initramfs,$(2),$(3) $(cameo913x_mtdlayout))
endef

define Image/Build/Cameo7240
    $(call Image/Build/Cameo,$(1),$(2),$(3),$(cameo7240_mtdlayout),983040,2818048,$(4))
endef

define Image/Build/Cameo7240/initramfs
    $(call MkuImageLzma/initramfs,$(2),$(3) $(cameo7240_mtdlayout))
endef

define Image/Build/Cameo933x
    $(call Image/Build/CameoHornet,$(1),$(2),$(3),$(cameo933x_mtdlayout),917504,2818048,$(4))
endef

define Image/Build/Cameo933x/initramfs
    $(call MkuImageLzma/initramfs,$(2),$(3) $(cameo933x_mtdlayout))
endef

define Image/Build/Ath
    $(call Sysupgrade/$(7),$(1),$(2),$(5),$(6))
    if [ -e "$(call sysupname,$(1),$(2))" ]; then \
        dd if=$(KDIR_TMP)/vmlinux-$(2).uImage \
            of=$(call imgname,kernel,$(2)).bin bs=64k conv=sync; \
        dd if=$(KDIR)/root.$(1) \
            of=$(call imgname,$(1),$(2)-rootfs).bin bs=128k conv=sync; \
    fi
endef

define Image/Build/AthGzip
    $(call MkuImageGzip,$(2),$(3) $(4))
    $(call Image/Build/Ath,$(1),$(2),$(3),$(4),$(5),$(6),$(7))
endef

define Image/Build/AthGzip/initramfs
    $(call MkuImageGzip/initramfs,$(2),$(3) $(4))
endef

define Image/Build/AthLzma
    $(call MkuImageLzma,$(2),$(3) $(4))
    $(call Image/Build/Ath,$(1),$(2),$(3),$(4),$(5),$(6),$(7))
endef

define Image/Build/AthLzma/initramfs
    $(call MkuImageLzma/initramfs,$(2),$(3) $(4))
endef

define Image/Build/PB4X
    $(call PatchKernelLzma,$(2),$(3))
    dd if=$(KDIR_TMP)/vmlinux-$(2).bin.lzma \
       of=$(call imgname,kernel,$(2)).bin bs=64k conv=sync
    dd if=$(KDIR)/root.$(1) \
       of=$(call imgname,$(1),$(2)-rootfs).bin bs=128k conv=sync
    -sh $(TOPDIR)/scripts/combined-image.sh \
        "$(call imgname,kernel,$(2)).bin" \
        "$(call imgname,$(1),$(2)-rootfs).bin" \
        $(call sysupname,$(1),$(2))
endef


define Image/Build/MyLoader
    $(call PatchKernelLzma,$(2),$(3))
    -$(STAGING_DIR_HOST)/bin/mkmylofw -B $(2) -s $(4) \
        -p0x030000:0xe0000:al:0x80060000:kernel:$(KDIR_TMP)/vmlinux-$(2).bin.lzma \
        -p0x110000:0:::rootfs:$(KDIR)/root.$(1) \
        $(call imgname,$(1),$(2))-$(5)-factory.img
endef

define Image/Build/UBNTXM
    $(call MkuImageLzma,$(2),$(3) $(ubntxm_mtdlayout))
    $(call Sysupgrade/KRuImage,$(1),$(2),1048576,6684672)
    dd if=$(KDIR_TMP)/vmlinux-$(2).uImage of=$(KDIR_TMP)/vmlinux-$(2).uImage.bin bs=1024k conv=sync
    -$(STAGING_DIR_HOST)/bin/mkfwimage \
        -B $(4) -v $(5).$(6).v6.0.0-OpenWrt-$(REVISION) \
        -k $(KDIR_TMP)/vmlinux-$(2).uImage.bin \
        -r $(BIN_DIR)/$(IMG_PREFIX)-root.$(1) \
        -o $(call factoryname,$(1),$(2))
endef


define Image/Build/UBDEV
    $(call MkuImageLzma,$(2),$(3) $(ubdev_mtdlayout))
    $(call Sysupgrade/KRuImage,$(1),$(2),1048576,6684672)
    dd if=$(KDIR_TMP)/vmlinux-$(2).uImage of=$(KDIR_TMP)/vmlinux-$(2).uImage.bin bs=1024k conv=sync
    -$(STAGING_DIR_HOST)/bin/mkfwimage \
        -B $(4) -v $(5).$(6).v6.0.0-OpenWrt-$(REVISION) \
        -k $(KDIR_TMP)/vmlinux-$(2).uImage.bin \
        -r $(BIN_DIR)/$(IMG_PREFIX)-root.$(1) \
        -o $(call factoryname,$(1),$(2))
endef

define Image/Build/UBNT
    $(call PatchKernelLzma,$(2),$(3))
    dd if=$(KDIR_TMP)/vmlinux-$(2).bin.lzma of=$(KDIR_TMP)/vmlinux-$(2).lzma bs=64k conv=sync
    -$(STAGING_DIR_HOST)/bin/mkfwimage \
        -B $(4) -v $(5).$(6).OpenWrt.$(REVISION) \
        -k $(KDIR_TMP)/vmlinux-$(2).lzma \
        -r $(BIN_DIR)/$(IMG_PREFIX)-root.$(1) \
        -o $(call factoryname,$(1),$(2))
    -sh $(TOPDIR)/scripts/combined-image.sh \
        "$(KDIR_TMP)/vmlinux-$(2).lzma" \
        "$(BIN_DIR)/$(IMG_PREFIX)-root.$(1)" \
  $(call sysupname,$(1),$(2))
endef

define Image/Build/Planex/loader
    $(call Image/BuildLoaderAlone,$(1),gz,$(2) $(planex_mtdlayout),0x52000,0)
endef

define Image/Build/Planex
    [ -e "$(KDIR)/loader-$(2).gz" ]
    $(call MkuImage,gzip,,$(KDIR)/loader-$(2).gz,$(KDIR_TMP)/vmlinux-$(2).uImage)
    $(call MkuImageOKLI,$(2))
    ( \
        dd if=$(KDIR_TMP)/vmlinux-$(2).uImage bs=8k count=1 conv=sync; \
        dd if=$(KDIR_TMP)/vmlinux-$(2).okli; \
    ) > $(KDIR_TMP)/kernel-$(2).bin
    $(call Sysupgrade/KR,$(1),$(KDIR_TMP)/kernel-$(2).bin,983040,6815744,$(2))
    if [ -e "$(call sysupname,$(1),$(2))" ]; then \
        $(STAGING_DIR_HOST)/bin/mkplanexfw \
            -B $(2) \
            -v 2.00.00 \
            -i $(call sysupname,$(1),$(2)) \
            -o $(call factoryname,$(1),$(2)); \
    fi
endef

define Image/Build/ALFA
    $(call MkuImageLzma,$(2),$(3) $(4))
    $(call Sysupgrade/RKuImage,$(1),$(2),$(5),$(6))
    if [ -e "$(call sysupname,$(1),$(2))" ]; then \
        rm -rf $(KDIR)/$(1); \
        mkdir -p $(KDIR)/$(1); \
        cd $(KDIR)/$(1); \
        cp $(KDIR_TMP)/vmlinux-$(2).uImage $(KDIR)/$(1)/$(7); \
        cp $(KDIR)/root.$(1) $(KDIR)/$(1)/$(8); \
        $(TAR) zcf $(call factoryname,$(1),$(2)) -C $(KDIR)/$(1) $(7) $(8); \
        ( \
            echo WRM7222C | dd bs=32 count=1 conv=sync; \
            echo -ne '\xfe'; \
        ) >> $(call factoryname,$(1),$(2)); \
    fi
endef

define Image/Build/ALFA/initramfs
    $(call MkuImageLzma/initramfs,$(2),$(3) $(4))
endef

define Image/Build/TPLINKOLD/loader
    $(call Image/BuildLoaderAlone,$(1),gz,$(2),0x22000,0)
endef

define Image/Build/TPLINKOLD
    [ -e "$(KDIR)/loader-$(2).gz" ]
    $(call MkuImageOKLI,$(2))
    ( \
        dd if=$(KDIR)/loader-$(2).gz bs=7680 count=1 conv=sync; \
        dd if=$(KDIR_TMP)/vmlinux-$(2).okli conv=sync; \
    ) > $(KDIR_TMP)/kernel-$(2).bin
    -$(STAGING_DIR_HOST)/bin/mktplinkfw \
        -H $(4) -W $(5) -F $(6) -N OpenWrt -V $(REVISION)\
        -k $(KDIR_TMP)/kernel-$(2).bin \
        -r $(KDIR)/root.$(1) \
        -o $(call factoryname,$(1),$(2))
    -$(STAGING_DIR_HOST)/bin/mktplinkfw \
        -H $(4) -W $(5) -F $(6) -N OpenWrt -V $(REVISION) -s\
        -k $(KDIR_TMP)/kernel-$(2).bin \
        -r $(KDIR)/root.$(1) \
        -o $(call sysupname,$(1),$(2))
endef

define Image/Build/TPLINKOLD/initramfs
    $(call Image/BuildLoader,$(2),gz,$(3),0x80060000)
    -$(STAGING_DIR_HOST)/bin/mktplinkfw -c \
        -H $(4) -W $(5) -F $(6) -N OpenWrt -V $(REVISION) -s\
        -k $(KDIR)/loader-$(2).gz \
        -o $(call imgname,$(1),$(2))-uImage.bin
endef

define Image/Build/TPLINK/loader
    $(call Image/BuildLoaderAlone,$(1),gz,$(2),0x22000,0)
endef

define Image/Build/TPLINK
    [ -e "$(KDIR)/loader-$(2).gz" ]
    $(call MkuImageOKLI,$(2))
    ( \
        dd if=$(KDIR)/loader-$(2).gz bs=7680 count=1 conv=sync; \
        dd if=$(KDIR_TMP)/vmlinux-$(2).okli conv=sync; \
    ) > $(KDIR_TMP)/kernel-$(2).bin
    -$(STAGING_DIR_HOST)/bin/mktplinkfw \
        -H $(4) -W $(5) -F $(6) -N OpenWrt -V $(REVISION)\
        -k $(KDIR_TMP)/kernel-$(2).bin \
        -r $(KDIR)/root.$(1) \
        -a $(call rootfs_align,$(1)) -j \
        -o $(call factoryname,$(1),$(2))
    -$(STAGING_DIR_HOST)/bin/mktplinkfw \
        -H $(4) -W $(5) -F $(6) -N OpenWrt -V $(REVISION) -s\
        -k $(KDIR_TMP)/kernel-$(2).bin \
        -r $(KDIR)/root.$(1) \
        -a $(call rootfs_align,$(1)) -j \
        -o $(call sysupname,$(1),$(2))
endef

define Image/Build/TPLINK/initramfs
    $(call Image/BuildLoader,$(2),gz,$(3),0x80060000)
    -$(STAGING_DIR_HOST)/bin/mktplinkfw -c \
        -H $(4) -W $(5) -F $(6) -N OpenWrt -V $(REVISION) -s\
        -k $(KDIR)/loader-$(2).gz \
        -o $(call imgname,$(1),$(2))-uImage.bin
endef

define Image/Build/TPLINK-LZMA
    $(call PatchKernelLzma,$(2),$(3))
    -$(STAGING_DIR_HOST)/bin/mktplinkfw \
        -H $(4) -W $(5) -F $(6) -N OpenWrt -V $(REVISION) $(7) \
        -k $(KDIR_TMP)/vmlinux-$(2).bin.lzma \
        -r $(KDIR)/root.$(1) \
        -a $(call rootfs_align,$(1)) -j \
        -o $(call factoryname,$(1),$(2))
    -$(STAGING_DIR_HOST)/bin/mktplinkfw \
        -H $(4) -W $(5) -F $(6) -N OpenWrt -V $(REVISION) $(7) -s \
        -k $(KDIR_TMP)/vmlinux-$(2).bin.lzma \
        -r $(KDIR)/root.$(1) \
        -a $(call rootfs_align,$(1)) -j \
        -o $(call sysupname,$(1),$(2))
endef

define Image/Build/TPLINK-LZMA/initramfs
    $(call PatchKernelLzma,$(2),$(3))
    -$(STAGING_DIR_HOST)/bin/mktplinkfw -c \
        -H $(4) -W $(5) -F $(6) -N OpenWrt -V $(REVISION) $(7) -s \
        -k $(KDIR_TMP)/vmlinux-$(2).bin.lzma \
        -o $(call imgname,$(1),$(2))-uImage.bin
endef

define Image/Build/CyberTAN
    $(call MkuImageGzip,$(2),$(3))
    $(STAGING_DIR_HOST)/bin/trx -o $(KDIR)/image.tmp -f $(KDIR_TMP)/vmlinux-$(2).uImage \
        -x 32 -a 0x10000 -x -32 -f $(KDIR)/root.$(1)
    -$(STAGING_DIR_HOST)/bin/addpattern -B $(2) -v v$(4) \
        -i $(KDIR)/image.tmp \
        -o $(call sysupname,$(1),$(2))
    -$(STAGING_DIR_HOST)/bin/addpattern -B $(2) -v v$(4) -g \
        -i $(KDIR)/image.tmp \
        -o $(call factoryname,$(1),$(2))
    rm $(KDIR)/image.tmp
endef

define Image/Build/Netgear/Build_uImage
    $(call MkuImageLzma,$(1),$(2) $(3),-d20)
    -rm -rf $(KDIR)/$(1)
    mkdir -p $(KDIR)/$(1)/image
    $(STAGING_DIR_HOST)/bin/wndr3700 \
        $(KDIR_TMP)/vmlinux-$(1).uImage \
        $(KDIR)/$(1)/image/uImage \
        $(4)
    $(STAGING_DIR_HOST)/bin/mksquashfs-lzma \
        $(KDIR)/$(1) $(KDIR_TMP)/vmlinux-$(1).uImage.squashfs.tmp \
        -nopad -noappend -root-owned -be
    -rm -rf $(KDIR)/$(1)
    mkimage -A mips -O linux -T filesystem -C none \
        -a 0xbf070000 -e 0xbf070000 \
        -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
        -d $(KDIR_TMP)/vmlinux-$(1).uImage.squashfs.tmp \
        $(KDIR_TMP)/vmlinux-$(1).uImage.squashfs.tmp2
    $(STAGING_DIR_HOST)/bin/wndr3700 \
        $(KDIR_TMP)/vmlinux-$(1).uImage.squashfs.tmp2 \
        $(KDIR_TMP)/vmlinux-$(1).uImage.squashfs \
        $(4)
    -rm -f $(KDIR_TMP)/vmlinux-$(1).uImage.squashfs.tmp*
endef

define Image/Build/Netgear/Estimate_uImage
    $(call Image/Build/Netgear/Build_uImage,$(1)_est,$(2),$(3),$(4))
    ( \
        set -e; \
        kk=`echo '$(3)' | sed -e 's/.*[:,]\([0-9]*\)k(kernel).*/\1/'`; \
        rk=`echo '$(3)' | sed -e 's/.*[:,]\([0-9]*\)k(rootfs).*/\1/'`; \
        let 'tk = kk + rk'; \
        s=`stat -c'%s' '$(KDIR_TMP)/vmlinux-$(1)_est.uImage.squashfs'`; \
        c=`echo '$(3)' | wc -c`; \
        let 'kk = (((s + c) / (64 * 1024) + 1) * 64)'; \
        let 'rk = tk - kk'; \
        echo '$(3)' | sed -e "s/[0-9]*k(kernel)/$$$${kk}k(kernel)/" \
                  -e "s/[0-9]*k(rootfs)/$$$${rk}k(rootfs)/" > \
            '$(KDIR_TMP)/$(1)_mtdparts'; \
        let 'k = kk * 1024'; \
        echo "$$$${k}" > '$(KDIR_TMP)/$(1)_kernel_maxsize'; \
        let 'r = rk * 1024'; \
        echo "$$$${r}" > '$(KDIR_TMP)/$(1)_rootfs_maxsize'; \
    )
    -rm -f $(KDIR_TMP)/vmlinux-$(1)_est \
           $(KDIR_TMP)/vmlinux-$(1)_est.bin.lzma \
           $(KDIR_TMP)/vmlinux-$(1)_est.uImage \
           $(KDIR_TMP)/vmlinux-$(1)_est.uImage.squashfs
endef

define Image/Build/Netgear
    $(call Image/Build/Netgear/Estimate_uImage,$(2),$(3),$(4),$(5))
    $(call Image/Build/Netgear/Build_uImage,$(2),$(3),`cat $(KDIR_TMP)/$(2)_mtdparts`,$(5))
    if [ `stat -c%s '$(KDIR_TMP)/vmlinux-$(2).uImage.squashfs'` -gt \
         `cat '$(KDIR_TMP)/$(2)_kernel_maxsize'` ]; then \
                echo "$(KDIR_TMP)/vmlinux-$(2).uImage.squashfs is too big" >& 2; \
    else if [ `stat -c%s '$(KDIR)/root.$(1)'` -gt \
         `cat '$(KDIR_TMP)/$(2)_rootfs_maxsize'` ]; then \
                echo "$(KDIR)/root.$(1) is too big" >& 2; \
    else \
        ( \
            set -e; \
            dd if=$(KDIR_TMP)/vmlinux-$(2).uImage.squashfs \
            bs=`cat '$(KDIR_TMP)/$(2)_kernel_maxsize'` conv=sync; \
            dd if=$(KDIR)/root.$(1) bs=64k; \
        ) > $(call sysupname,$(1),$(2)); \
        for r in $(7) ; do \
            [ -n "$$$$r" ] && dashr="-$$$$r" || dashr= ; \
            $(STAGING_DIR_HOST)/bin/mkdniimg \
                -B $(6) -v OpenWrt.$(REVISION) -r "$$$$r" $(8) \
                -i $(call sysupname,$(1),$(2)) \
                -o $(call imgname,$(1),$(2))-factory$$$$dashr.img; \
        done; \
    fi; fi
endef

define Image/Build/Netgear/initramfs
    $(call MkuImageLzma,$(2),$(3) $(4))
    $(STAGING_DIR_HOST)/bin/wndr3700 \
        $(KDIR_TMP)/vmlinux-$(2).uImage \
        $(call imgname,$(1),$(2))-uImage.bin \
        $(5)
endef

ifdef CONFIG_PACKAGE_uboot-ar71xx-nbg460n_550n_550nh
  define Image/Build/ZyXEL
    $(call MkuImageLzma,$(2),$(3))
    $(call Sysupgrade/KRuImage,$(1),$(2),917504,2752512)
    if [ -e "$(call sysupname,$(1),$(2))" ]; then \
        if [ ! -f $(BIN_DIR)/$(IMG_PREFIX)-$(2)-u-boot.bin ]; then \
            echo "Warning: $(IMG_PREFIX)-$(2)-u-boot.bin not found"; \
        else \
            $(STAGING_DIR_HOST)/bin/mkzynfw \
                -B $(4) \
                -b $(BIN_DIR)/$(IMG_PREFIX)-$(2)-u-boot.bin \
                -r $(call sysupname,$(1),$(2)):0x10000 \
                -o $(call factoryname,$(1),$(2)); \
    fi; fi
  endef
endif

define Image/Build/OpenMesh
    $(call MkuImageLzma,$(2))
    -sh $(TOPDIR)/scripts/om-fwupgradecfg-gen.sh \
        "$(4)" \
        "$(BUILD_DIR)/fwupgrade.cfg-$(4)" \
        "$(KDIR_TMP)/vmlinux-$(2).uImage" \
        "$(KDIR)/root.$(1)"
    -sh $(TOPDIR)/scripts/combined-ext-image.sh \
        "$(4)" "$(call factoryname,$(1),$(2))" \
        "$(BUILD_DIR)/fwupgrade.cfg-$(4)" "fwupgrade.cfg" \
        "$(KDIR_TMP)/vmlinux-$(2).uImage" "kernel" \
        "$(KDIR)/root.$(1)" "rootfs"
endef

define Image/Build/Zcomax
    $(call MkuImageLzma,$(2),$(3) $(4))
    $(call Sysupgrade/RKuImage,$(1),$(2),1507328,6356992)
    if [ -e "$(call sysupname,$(1),$(2))" ]; then \
        $(STAGING_DIR_HOST)/bin/mkzcfw \
            -B $(2) \
            -k $(KDIR_TMP)/vmlinux-$(2).uImage \
            -r $(BIN_DIR)/$(IMG_PREFIX)-root.$(1) \
            -o $(call imgname,$(1),$(2))-factory.img; \
    fi
endef

define Image/Build/Zcomax/initramfs
    $(call MkuImageLzma/initramfs,$(2),$(3) $(4))
endef

define Image/Build/Template/initramfs/initramfs
    $(call Image/Build/$(1)/initramfs,initramfs,$(2),$(3),$(4),$(5),$(6),$(7),$(8))
endef

define Image/Build/Template/all/squashfs
    $(call Image/Build/$(1),squashfs,$(2),$(3),$(4),$(5),$(6),$(7),$(8))
endef

define Image/Build/Template/all/jffs2-64k
    $(call Image/Build/$(1),jffs2-64k,$(2),$(3),$(4),$(5),$(6),$(7),$(8))
endef

define Image/Build/Template/all/jffs2-128k
    $(call Image/Build/$(1),jffs2-128k,$(2),$(3),$(4),$(5),$(6),$(7),$(8))
endef

define Image/Build/Template/all/jffs2-256k
    $(call Image/Build/$(1),jffs2-256k,$(2),$(3),$(4),$(5),$(6),$(7),$(8))
endef

define Image/Build/Template/squashfs-only/loader
    $(call Image/Build/$(1)/loader,$(2),$(3),$(4),$(5),$(6),$(7),$(8))
endef

define Image/Build/Template/squashfs-only/squashfs
    $(call Image/Build/$(1),squashfs,$(2),$(3),$(4),$(5),$(6),$(7),$(8))
endef

define Image/Build/Template/64k/loader
    $(call Image/Build/$(1)/loader,$(2),$(3),$(4),$(5),$(6),$(7),$(8))
endef

define Image/Build/Template/64k/squashfs
    $(call Image/Build/$(1),squashfs-64k,$(2),$(3),$(4),$(5),$(6),$(7),$(8))
endef

define Image/Build/Template/64k/jffs2-64k
    $(call Image/Build/$(1),jffs2-64k,$(2),$(3),$(4),$(5),$(6),$(7),$(8))
endef

define Image/Build/Template/64kraw/loader
    $(call Image/Build/$(1)/loader,$(2),$(3),$(4),$(5),$(6),$(7),$(8))
endef

define Image/Build/Template/64kraw/squashfs
    $(call Image/Build/$(1),squashfs-raw,$(2),$(3),$(4),$(5),$(6),$(7),$(8))
endef

define Image/Build/Template/64kraw/jffs2-64k
    $(call Image/Build/$(1),jffs2-64k,$(2),$(3),$(4),$(5),$(6),$(7),$(8))
endef

define Image/Build/Template/128k/squashfs
    $(call Image/Build/$(1),squashfs,$(2),$(3),$(4),$(5),$(6),$(7),$(8))
endef

define Image/Build/Template/128k/jffs2-128k
    $(call Image/Build/$(1),jffs2-128k,$(2),$(3),$(4),$(5),$(6),$(7),$(8))
endef

define Image/Build/Template/256k/squashfs
    $(call Image/Build/$(1),squashfs,$(2),$(3),$(4),$(5),$(6),$(7),$(8))
endef

define Image/Build/Template/256k/jffs2-256k
    $(call Image/Build/$(1),jffs2-256k,$(2),$(3),$(4),$(5),$(6),$(7),$(8))
endef

...

$(eval $(call SingleProfile,TPLINKOLD,$(fs_squash),TLWR841NV15,tl-wr841nd-v1.5,TL-WR841N-v1.5,ttyS0,115200,0x08410002,2,4M))

$(eval $(call SingleProfile,TPLINK,$(fs_64kraw),TLMR3220,tl-mr3220-v1,TL-MR3220,ttyS0,115200,0x32200001,1,16M))
$(eval $(call SingleProfile,TPLINK,$(fs_64kraw),TLMR3420,tl-mr3420-v1,TL-MR3420,ttyS0,115200,0x34200001,1,16M))
$(eval $(call SingleProfile,TPLINK,$(fs_64kraw),TLWA701,tl-wa701n-v1,TL-WA901ND,ttyS0,115200,0x07010001,1,4M))
$(eval $(call SingleProfile,TPLINK,$(fs_64kraw),TLWA7510NV1,tl-wa7510n,TL-WA7510N,ttyS0,115200,0x75100001,1,4M))
$(eval $(call SingleProfile,TPLINK,$(fs_64kraw),TLWA901NV1,tl-wa901nd-v1,TL-WA901ND,ttyS0,115200,0x09010001,1,4M))
$(eval $(call SingleProfile,TPLINK,$(fs_64kraw),TLWA901NV2,tl-wa901nd-v2,TL-WA901ND-v2,ttyS0,115200,0x09010002,1,4M))
$(eval $(call SingleProfile,TPLINK,$(fs_64kraw),TLWR740NV1,tl-wr740n-v1,TL-WR741ND,ttyS0,115200,0x07400001,1,4M))
$(eval $(call SingleProfile,TPLINK,$(fs_64kraw),TLWR740NV3,tl-wr740n-v3,TL-WR741ND,ttyS0,115200,0x07400003,1,4M))
$(eval $(call SingleProfile,TPLINK,$(fs_64kraw),TLWR741NV1,tl-wr741nd-v1,TL-WR741ND,ttyS0,115200,0x07410001,1,4M))
$(eval $(call SingleProfile,TPLINK,$(fs_64kraw),TLWR741NV2,tl-wr741nd-v2,TL-WR741ND,ttyS0,115200,0x07410001,1,4M))
$(eval $(call SingleProfile,TPLINK,$(fs_64kraw),TLWR743,tl-wr743nd-v1,TL-WR741ND,ttyS0,115200,0x07430001,1,4M))
$(eval $(call SingleProfile,TPLINK,$(fs_64kraw),TLWR841NV3,tl-wr841nd-v3,TL-WR941ND,ttyS0,115200,0x08410003,3,16M))
$(eval $(call SingleProfile,TPLINK,$(fs_64kraw),TLWR841NV5,tl-wr841nd-v5,TL-WR741ND,ttyS0,115200,0x08410005,1,4M))
$(eval $(call SingleProfile,TPLINK,$(fs_64kraw),TLWR841NV7,tl-wr841nd-v7,TL-WR841N-v7,ttyS0,115200,0x08410007,1,4M))
$(eval $(call SingleProfile,TPLINK,$(fs_64kraw),TLWR842,tl-wr842n-v1,TL-MR3420,ttyS0,115200,0x08420001,1,16M))
$(eval $(call SingleProfile,TPLINK,$(fs_64kraw),TLWR941NV2,tl-wr941nd-v2,TL-WR941ND,ttyS0,115200,0x09410002,2,16M))
$(eval $(call SingleProfile,TPLINK,$(fs_64kraw),TLWR941NV3,tl-wr941nd-v3,TL-WR941ND,ttyS0,115200,0x09410002,2,16M))
$(eval $(call SingleProfile,TPLINK,$(fs_64kraw),TLWR941NV4,tl-wr941nd-v4,TL-WR741ND,ttyS0,115200,0x09410004,1,16M))
$(eval $(call SingleProfile,TPLINK,$(fs_64kraw),TLWR1043,tl-wr1043nd-v1,TL-WR1043ND,ttyS0,115200,0x10430001,1,16M))

$(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLMR11U,tl-mr11u-v1,TL-MR11U,ttyATH0,115200,0x00110101,1,4Mlzma))
$(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLMR3020,tl-mr3020-v1,TL-MR3020,ttyATH0,115200,0x30200001,1,16M))
$(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLMR3040,tl-mr3040-v1,TL-MR3040,ttyATH0,115200,0x30400001,1,16M))
$(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLWR703,tl-wr703n-v1,TL-WR703N,ttyATH0,115200,0x07030101,1,4Mlzma))
$(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLWR740NV4,tl-wr740n-v4,TL-WR741ND-v4,ttyATH0,115200,0x07400004,1,4Mlzma))
$(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLWR741NV4,tl-wr741nd-v4,TL-WR741ND-v4,ttyATH0,115200,0x07410004,1,4Mlzma))
$(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLWR841NV8,tl-wr841n-v8,TL-WR841N-v8,ttyS0,115200,0x08410008,1,4Mlzma))

....

Moze dla TLWR842,tl-wr842n-v1 trzeba cos zmienic ?


jest taki wpis w makefile do budowania obrazow

...TLWR842,tl-wr842n-v1,TL-MR3420...


nie mam pojecia dlaczego sie nie chce zrobic v2

Podr

6

Odp: Problem z obrazem -compilacja wlasna MR3420 v2

Więc nie wiem jak to kompilowałeś bo przeciez 3x20v2 jest w łatkach gargoyle które dodają się jak zaczynasz kompilować obraz....

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

7

Odp: Problem z obrazem -compilacja wlasna MR3420 v2

A ktora to latka, podmieniue recznie tylko nie wiem jeszcze co

8

Odp: Problem z obrazem -compilacja wlasna MR3420 v2

patches-generic/10-mr34220v2_and_mr3420v2_support.patch

Jednoznaczne wiadomo która smile

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

9

Odp: Problem z obrazem -compilacja wlasna MR3420 v2

A jak to odpalic zeby nie dlubac recznie i zeby sie dodalo szybko do moich zrodel - dladczego sie nie dodalo wczesniej nie mam pojecia

10

Odp: Problem z obrazem -compilacja wlasna MR3420 v2

To patch jest, więc po prostu nałóż na źródła.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

11

Odp: Problem z obrazem -compilacja wlasna MR3420 v2

a co to znaczy naloz ? Normalnie patch -p0 -i <patch> z katalogu custom-src ?

12

Odp: Problem z obrazem -compilacja wlasna MR3420 v2

patch -p1 < łatka.patch w custom-src

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

13

Odp: Problem z obrazem -compilacja wlasna MR3420 v2

PS. Jeżeli ta łatka się nie nałożyła to ciekawe co jeszcze Ci się nie nałożyło. A trochę tam tego jest.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

14

Odp: Problem z obrazem -compilacja wlasna MR3420 v2

To moze profilaktycznie wszystkie puscic ? :-)

15

Odp: Problem z obrazem -compilacja wlasna MR3420 v2

Jak chcesz.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

16

Odp: Problem z obrazem -compilacja wlasna MR3420 v2

Bardzo dziwne, bardzo, skompilowalem na tym samym soursie 941 i wgralem i wszystko chodzi, 1043 tez - hmmm, chyba skasowac trzeba wszystko i od nowa ale to 100 lat znowu mi zajmie skompilowanie 6 obrazow 16 M od 0.

17

Odp: Problem z obrazem -compilacja wlasna MR3420 v2

Brakowalo chyba tylko tego 1 patcha, zapuscilem wszystkie z generic-patches i tylko te pliki od image i tplink.. do tego patcha zostaly zmienione, nie wiem jak to sie stalo, narazie sie kompiluje

18

Odp: Problem z obrazem -compilacja wlasna MR3420 v2

Witam,

no i nowy problem, nie kompiluje sie 3040 3420 v2 poszlo - nie wiem czy ma byc 16mlzma czy 16M

16Mlzma))
$(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLMR3040V1,tl-mr3040-v1,TL-MR3040,ttyATH0,115200,0x30400001,1,16M[lzma]))

bylo 4lzma zmienilem na 16Mlzma   wczesniej mialem 16M i sie skompilowalo, znaczy nie robi mi obrazu bo wszystko leci ale nie dochodzi do zrobienia obrazu i nie mam bledu

na tym sie konczy kompilacja

/media/root/proc/gargoyle_x/custom-src/staging_dir/host/bin/padjffs2 /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/root.squashfs 4 8 64 128 256
padding image to 00beb000
padding image to 00bec000
padding image to 00bf0000
padding image to 00c00000
dd if=/media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/root.squashfs of=/media/root/proc/gargoyle_x/custom-src/bin/ar71xx/openwrt-ar71xx-generic-root.squashfs bs=128k conv=sync
96+1 records in
97+0 records out
12713984 bytes (13 MB) copied, 0.118048 s, 108 MB/s
( cd /media/root/proc/gargoyle_x/custom-src/bin/ar71xx ; /usr/bin/find -maxdepth 1 -type f \! -name 'md5sums'  -printf "%P\n" | sort | xargs md5sum --binary > md5sums )
make[6]: Leaving directory `/media/root/proc/gargoyle_x/custom-src/target/linux/ar71xx/image'
make[5]: Leaving directory `/media/root/proc/gargoyle_x/custom-src/target/linux/ar71xx'
make[4]: Leaving directory `/media/root/proc/gargoyle_x/custom-src/target/linux'
make[3]: Leaving directory `/media/root/proc/gargoyle_x/custom-src'
export MAKEFLAGS= ;make -w -r package/index

nie mam mach-tl-mr3040 , jest mach-tl-mr11u

definicje w

mam

}, {
                .id             = "16Mlzma",
                .fw_max_len     = 0xfc0000,
                .kernel_la      = 0x80060000,
                .kernel_ep      = 0x80060000,
                .rootfs_ofs     = 0x100000,
        }, {
                .id             = "16M",
                .fw_max_len     = 0xf80000,
                .kernel_la      = 0x80060000,
                .kernel_ep      = 0x80060000,
                .rootfs_ofs     = 0x140000,
        }, {


ale nigdzie nie ma definicji do mr3040 w mktplinkfw.c



o co chodzi znowu ?

19

Odp: Problem z obrazem -compilacja wlasna MR3420 v2

16Mlzma ma być.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

20

Odp: Problem z obrazem -compilacja wlasna MR3420 v2

to dlaczego sie nie tworzy obraz a cala kompilacja poszla - co jest, w patchach nic sie juz nie zmienia - gdzie moze byc problem ?

21

Odp: Problem z obrazem -compilacja wlasna MR3420 v2

Przejrzyj log wcześniej - pod koniec będzie fizycznie robił obrazy, więc zobacz sobie co tam wypisuje.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

22 (edytowany przez roblad 2013-12-30 21:20:44)

Odp: Problem z obrazem -compilacja wlasna MR3420 v2

To jest juz 2 zapuszczenie, ale robilem wczesniej obraz z 16M i wgralem go na 3040 i router chodzi, jest tam u-boot pope2k'a i dziwne ze chodzi, teraz zrobilem 16Mlzma  i sie obraz nie robi.


cos chyba z tym nie tak:

        }, {
                .id             = "16Mlzma",
                .fw_max_len     = 0xfc0000,
                .kernel_la      = 0x80060000,
                .kernel_ep      = 0x80060000,
                .rootfs_ofs     = 0x100000,
        }, {
                .id             = "16M",
                .fw_max_len     = 0xf80000,
                .kernel_la      = 0x80060000,
                .kernel_ep      = 0x80060000,
                .rootfs_ofs     = 0x140000,
        }, {


a to jest to co mi wypisuje na koncu

Dlaczego jak zrobilem wczesniej 16M to sie zbudowalo i wgralem to do routera i chodzil ?!?!?! - ciekawe co ? jak jest 16Mlzma nie robi sie obraz choc wszystko do niego zeby poskladac sie robi.

Mozna to jakos sprawdzic  ?





IPKG_TMP=/media/root/proc/gargoyle_x/custom-src/tmp/ipkg IPKG_INSTROOT=/media/root/proc/gargoyle_x/custom-src/build_dir/target-mips_r2_uClibc-0.9.33.2/root-ar71xx IPKG_CONF_DIR=/media/root/proc/gargoyle_x/custom-src/staging_dir/target-mips_r2_uClibc-0.9.33.2/etc IPKG_OFFLINE_ROOT=/media/root/proc/gargoyle_x/custom-src/build_dir/target-mips_r2_uClibc-0.9.33.2/root-ar71xx /media/root/proc/gargoyle_x/custom-src/staging_dir/host/bin/opkg --offline-root /media/root/proc/gargoyle_x/custom-src/build_dir/target-mips_r2_uClibc-0.9.33.2/root-ar71xx --force-depends --force-overwrite --force-postinstall --force-maintainer --add-dest root:/ --add-arch all:100 --add-arch ar71xx:200 flag ok base-files
Setting flags for package base-files to ok.
make[4]: Leaving directory `/media/root/proc/gargoyle_x/custom-src/package/base-files'
make[3]: Leaving directory `/media/root/proc/gargoyle_x/custom-src'
make[3]: Entering directory `/media/root/proc/gargoyle_x/custom-src'
make[4]: Entering directory `/media/root/proc/gargoyle_x/custom-src'
make[4]: *** No rule to make target `package/preconfig'.  Stop.
make[4]: Leaving directory `/media/root/proc/gargoyle_x/custom-src'
make[3]: [package/rootfs-prepare] Error 2 (ignored)
rm -f /media/root/proc/gargoyle_x/custom-src/build_dir/target-mips_r2_uClibc-0.9.33.2/root-ar71xx/usr/lib/opkg/info/*.postinst
make[3]: Leaving directory `/media/root/proc/gargoyle_x/custom-src'
make[3]: Entering directory `/media/root/proc/gargoyle_x/custom-src'
make[4]: Entering directory `/media/root/proc/gargoyle_x/custom-src/target/linux'
make[5]: Entering directory `/media/root/proc/gargoyle_x/custom-src/target/linux/ar71xx'
/media/root/proc/gargoyle_x/custom-src/scripts/kconfig.pl  + + /media/root/proc/gargoyle_x/custom-src/target/linux/generic/config-3.3 /media/root/proc/gargoyle_x/custom-src/target/linux/ar71xx/config-3.3 /media/root/proc/gargoyle_x/custom-src/target/linux/ar71xx/generic/config-default > /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/linux-3.3.8/.config.target
awk '/^(#[[:space:]]+)?CONFIG_KERNEL/{sub("CONFIG_KERNEL_","CONFIG_");print}' /media/root/proc/gargoyle_x/custom-src/.config >> /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/linux-3.3.8/.config.target
echo "# CONFIG_KALLSYMS_EXTRA_PASS is not set" >> /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/linux-3.3.8/.config.target
echo "# CONFIG_KALLSYMS_ALL is not set" >> /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/linux-3.3.8/.config.target
echo "# CONFIG_KPROBES is not set" >> /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/linux-3.3.8/.config.target
/media/root/proc/gargoyle_x/custom-src/scripts/metadata.pl kconfig /media/root/proc/gargoyle_x/custom-src/tmp/.packageinfo /media/root/proc/gargoyle_x/custom-src/.config > /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/linux-3.3.8/.config.override
/media/root/proc/gargoyle_x/custom-src/scripts/kconfig.pl 'm+' '+' /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/linux-3.3.8/.config.target /dev/null /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/linux-3.3.8/.config.override > /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/linux-3.3.8/.config
mv /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/linux-3.3.8/.config /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/linux-3.3.8/.config.old
grep -v INITRAMFS /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/linux-3.3.8/.config.old > /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/linux-3.3.8/.config
echo 'CONFIG_INITRAMFS_SOURCE=""' >> /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/linux-3.3.8/.config
rm -rf /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/modules
[ -d /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/linux-3.3.8/user_headers ] || make -C /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/linux-3.3.8 HOSTCFLAGS="-O2 -I/media/root/proc/gargoyle_x/custom-src/staging_dir/host/include -Wall -Wmissing-prototypes -Wstrict-prototypes" CROSS_COMPILE="mips-openwrt-linux-uclibc-" ARCH="mips" KBUILD_HAVE_NLS=no CONFIG_SHELL="/bin/bash" V='' CC="ccache_cc" INSTALL_HDR_PATH=/media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/linux-3.3.8/user_headers headers_install
. /media/root/proc/gargoyle_x/custom-src/include/shell.sh; grep '=[ym]' /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/linux-3.3.8/.config | LC_ALL=C sort | md5s > /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/linux-3.3.8/.vermagic
touch /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/linux-3.3.8/.configured
rm -f /media/root/proc/gargoyle_x/custom-src/build_dir/target-mips_r2_uClibc-0.9.33.2/root-ar71xx/init
make -C /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/linux-3.3.8 HOSTCFLAGS="-O2 -I/media/root/proc/gargoyle_x/custom-src/staging_dir/host/include -Wall -Wmissing-prototypes -Wstrict-prototypes" CROSS_COMPILE="mips-openwrt-linux-uclibc-" ARCH="mips" KBUILD_HAVE_NLS=no CONFIG_SHELL="/bin/bash" V='' CC="ccache_cc" 
make[6]: Entering directory `/media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/linux-3.3.8'
scripts/kconfig/conf --silentoldconfig Kconfig
#
# configuration written to .config
#
make[6]: Leaving directory `/media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/linux-3.3.8'
make[6]: Entering directory `/media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/linux-3.3.8'
  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
  CALL    scripts/checksyscalls.sh
  CHK     include/generated/compile.h
  AS      arch/mips/kernel/r4k_switch.o
  LD      arch/mips/kernel/built-in.o
  LD      arch/mips/built-in.o
  CC      mm/swap.o
  CC      mm/swap_state.o
  CC      mm/swapfile.o
  LD      mm/built-in.o
  CC      drivers/net/phy/swconfig.o
  LD      drivers/net/phy/built-in.o
  LD      drivers/net/built-in.o
  LD      drivers/built-in.o
  LD      vmlinux.o
  MODPOST vmlinux.o
  GEN     .version
  CHK     include/generated/compile.h
  UPD     include/generated/compile.h
  CC      init/version.o
  LD      init/built-in.o
  LD      vmlinux
  SYSMAP  System.map
  Building modules, stage 2.
  MODPOST 247 modules
make[6]: Leaving directory `/media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/linux-3.3.8'
mips-openwrt-linux-uclibc-objcopy -O binary -R .reginfo -R .notes -R .note -R .comment -R .mdebug -R .note.gnu.build-id -S /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/linux-3.3.8/vmlinux /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/vmlinux
mips-openwrt-linux-uclibc-objcopy -R .reginfo -R .notes -R .note -R .comment -R .mdebug -R .note.gnu.build-id -S /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/linux-3.3.8/vmlinux /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/vmlinux.elf
touch /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/linux-3.3.8/.image
make -C image compile install TARGET_BUILD=
make[6]: Entering directory `/media/root/proc/gargoyle_x/custom-src/target/linux/ar71xx/image'
make[6]: `compile' is up to date.
gzip -9 -c /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/vmlinux > /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/vmlinux.bin.gz
/media/root/proc/gargoyle_x/custom-src/staging_dir/host/bin/lzma e /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/vmlinux -lc1 -lp2 -pb2  /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/vmlinux.bin.lzma

LZMA 4.65 : Igor Pavlov : Public domain : 2009-02-03
rm -rf /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/lzma-loader
make V=ss -C lzma-loader KDIR=/media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic LOADER=loader-generic.elf KERNEL_CMDLINE="" LZMA_TEXT_START=0x80a00000 LOADADDR=0x80060000 LOADER_DATA="/media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/vmlinux.bin.lzma" BOARD="generic" compile loader.elf
make[7]: Entering directory `/media/root/proc/gargoyle_x/custom-src/target/linux/ar71xx/image/lzma-loader'
mkdir /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/lzma-loader
cp -fpR ./src/* /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/lzma-loader/
touch /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/lzma-loader/.prepared
make -C /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/lzma-loader CROSS_COMPILE="mips-openwrt-linux-uclibc-" \
                LZMA_TEXT_START=0x80a00000 \
                LOADER_DATA=/media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/vmlinux.bin.lzma \
                FLASH_OFFS= \
                FLASH_MAX= \
                BOARD="generic" \
                clean all
make[8]: Entering directory `/media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/lzma-loader'
rm -f loader *.elf *.bin *.o
mips-openwrt-linux-uclibc-gcc -D__KERNEL__ -Wall -Wstrict-prototypes -Wno-trigraphs -Os -fno-strict-aliasing -fno-common -fomit-frame-pointer -G 0 -mno-abicalls -fno-pic -ffunction-sections -pipe -mlong-calls -fno-common -ffreestanding -fhonour-copts -mabi=32 -march=mips32r2 -Wa,-32 -Wa,-march=mips32r2 -Wa,-mips32r2 -Wa,--trap -D_LZMA_PROB32 -DLZMA_WRAPPER=1 -DLOADADDR=0x80060000 -DCONFIG_BOARD_GENERIC -D__ASSEMBLY__ -c -o head.o head.S
mips-openwrt-linux-uclibc-gcc -D__KERNEL__ -Wall -Wstrict-prototypes -Wno-trigraphs -Os -fno-strict-aliasing -fno-common -fomit-frame-pointer -G 0 -mno-abicalls -fno-pic -ffunction-sections -pipe -mlong-calls -fno-common -ffreestanding -fhonour-copts -mabi=32 -march=mips32r2 -Wa,-32 -Wa,-march=mips32r2 -Wa,-mips32r2 -Wa,--trap -D_LZMA_PROB32 -DLZMA_WRAPPER=1 -DLOADADDR=0x80060000 -DCONFIG_BOARD_GENERIC -c -o loader.o loader.c
mips-openwrt-linux-uclibc-gcc -D__KERNEL__ -Wall -Wstrict-prototypes -Wno-trigraphs -Os -fno-strict-aliasing -fno-common -fomit-frame-pointer -G 0 -mno-abicalls -fno-pic -ffunction-sections -pipe -mlong-calls -fno-common -ffreestanding -fhonour-copts -mabi=32 -march=mips32r2 -Wa,-32 -Wa,-march=mips32r2 -Wa,-mips32r2 -Wa,--trap -D_LZMA_PROB32 -DLZMA_WRAPPER=1 -DLOADADDR=0x80060000 -DCONFIG_BOARD_GENERIC -c -o cache.o cache.c
mips-openwrt-linux-uclibc-gcc -D__KERNEL__ -Wall -Wstrict-prototypes -Wno-trigraphs -Os -fno-strict-aliasing -fno-common -fomit-frame-pointer -G 0 -mno-abicalls -fno-pic -ffunction-sections -pipe -mlong-calls -fno-common -ffreestanding -fhonour-copts -mabi=32 -march=mips32r2 -Wa,-32 -Wa,-march=mips32r2 -Wa,-mips32r2 -Wa,--trap -D_LZMA_PROB32 -DLZMA_WRAPPER=1 -DLOADADDR=0x80060000 -DCONFIG_BOARD_GENERIC -c -o board.o board.c
mips-openwrt-linux-uclibc-gcc -D__KERNEL__ -Wall -Wstrict-prototypes -Wno-trigraphs -Os -fno-strict-aliasing -fno-common -fomit-frame-pointer -G 0 -mno-abicalls -fno-pic -ffunction-sections -pipe -mlong-calls -fno-common -ffreestanding -fhonour-copts -mabi=32 -march=mips32r2 -Wa,-32 -Wa,-march=mips32r2 -Wa,-mips32r2 -Wa,--trap -D_LZMA_PROB32 -DLZMA_WRAPPER=1 -DLOADADDR=0x80060000 -DCONFIG_BOARD_GENERIC -c -o printf.o printf.c
mips-openwrt-linux-uclibc-gcc -D__KERNEL__ -Wall -Wstrict-prototypes -Wno-trigraphs -Os -fno-strict-aliasing -fno-common -fomit-frame-pointer -G 0 -mno-abicalls -fno-pic -ffunction-sections -pipe -mlong-calls -fno-common -ffreestanding -fhonour-copts -mabi=32 -march=mips32r2 -Wa,-32 -Wa,-march=mips32r2 -Wa,-mips32r2 -Wa,--trap -D_LZMA_PROB32 -DLZMA_WRAPPER=1 -DLOADADDR=0x80060000 -DCONFIG_BOARD_GENERIC -c -o LzmaDecode.o LzmaDecode.c
mips-openwrt-linux-uclibc-ld -r -b binary --oformat elf32-tradbigmips -T lzma-data.lds -o data.o /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/vmlinux.bin.lzma
mips-openwrt-linux-uclibc-ld -static --gc-sections -no-warn-mismatch -e startup -T loader.lds -Ttext 0x80a00000 -o loader head.o loader.o cache.o board.o printf.o LzmaDecode.o data.o
mips-openwrt-linux-uclibc-objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S loader loader.bin
mips-openwrt-linux-uclibc-ld -r -b binary --oformat elf32-tradbigmips -o loader2.o loader.bin
mips-openwrt-linux-uclibc-ld -e startup -T loader2.lds -Ttext 0x80060000 -o loader.elf loader2.o
make[8]: Leaving directory `/media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/lzma-loader'
cp -fpR /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/lzma-loader/loader.elf /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/loader-generic.elf
make[7]: Leaving directory `/media/root/proc/gargoyle_x/custom-src/target/linux/ar71xx/image/lzma-loader'
# Use symbolic permissions to avoid clobbering SUID/SGID/sticky bits
/usr/bin/find /media/root/proc/gargoyle_x/custom-src/build_dir/target-mips_r2_uClibc-0.9.33.2/root-ar71xx -type f -not -perm +0100 -not -name 'ssh_host*' -not -name 'shadow' -print0 | xargs -r -0 chmod u+rw,g+r,o+r
/usr/bin/find /media/root/proc/gargoyle_x/custom-src/build_dir/target-mips_r2_uClibc-0.9.33.2/root-ar71xx -type f -perm +0100 -print0 | xargs -r -0 chmod u+rwx,g+rx,o+rx
/usr/bin/find /media/root/proc/gargoyle_x/custom-src/build_dir/target-mips_r2_uClibc-0.9.33.2/root-ar71xx -type d -print0 | xargs -r -0 chmod u+rwx,g+rx,o+rx
install -d -m0755 /media/root/proc/gargoyle_x/custom-src/build_dir/target-mips_r2_uClibc-0.9.33.2/root-ar71xx/tmp
chmod 1777 /media/root/proc/gargoyle_x/custom-src/build_dir/target-mips_r2_uClibc-0.9.33.2/root-ar71xx/tmp
cp /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/vmlinux.elf /media/root/proc/gargoyle_x/custom-src/bin/ar71xx/openwrt-ar71xx-generic-vmlinux.elf
cp /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/vmlinux /media/root/proc/gargoyle_x/custom-src/bin/ar71xx/openwrt-ar71xx-generic-vmlinux.bin
dd if=/media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/vmlinux.bin.lzma of=/media/root/proc/gargoyle_x/custom-src/bin/ar71xx/openwrt-ar71xx-generic-vmlinux.lzma bs=65536 conv=sync
14+1 records in
15+0 records out
983040 bytes (983 kB) copied, 0.00357818 s, 275 MB/s
dd if=/media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/vmlinux.bin.gz of=/media/root/proc/gargoyle_x/custom-src/bin/ar71xx/openwrt-ar71xx-generic-vmlinux.gz bs=65536 conv=sync
19+1 records in
20+0 records out
1310720 bytes (1.3 MB) copied, 0.0046024 s, 285 MB/s
mkimage -A mips -O linux -T kernel -a 0x80060000 -C gzip  -e 0x80060000 -n 'MIPS OpenWrt Linux-3.3.8' -d /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/vmlinux.bin.gz /media/root/proc/gargoyle_x/custom-src/bin/ar71xx/openwrt-ar71xx-generic-uImage-gzip.bin
Image Name:   MIPS OpenWrt Linux-3.3.8
Created:      Mon Dec 30 20:03:24 2013
Image Type:   MIPS Linux Kernel Image (gzip compressed)
Data Size:    1305754 Bytes = 1275.15 kB = 1.25 MB
Load Address: 80060000
Entry Point:  80060000
mkimage -A mips -O linux -T kernel -a 0x80060000 -C lzma  -e 0x80060000 -n 'MIPS OpenWrt Linux-3.3.8' -d /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/vmlinux.bin.lzma /media/root/proc/gargoyle_x/custom-src/bin/ar71xx/openwrt-ar71xx-generic-uImage-lzma.bin
Image Name:   MIPS OpenWrt Linux-3.3.8
Created:      Mon Dec 30 20:03:25 2013
Image Type:   MIPS Linux Kernel Image (lzma compressed)
Data Size:    945550 Bytes = 923.39 kB = 0.90 MB
Load Address: 80060000
Entry Point:  80060000
cp /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/loader-generic.elf /media/root/proc/gargoyle_x/custom-src/bin/ar71xx/openwrt-ar71xx-generic-vmlinux-lzma.elf
mkdir -p /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/tmp
# Preserve permissions (-p) when building as non-root user
/bin/tar -czpf /media/root/proc/gargoyle_x/custom-src/bin/ar71xx/openwrt-ar71xx-generic-rootfs.tar.gz --numeric-owner --owner=0 --group=0 -C /media/root/proc/gargoyle_x/custom-src/build_dir/target-mips_r2_uClibc-0.9.33.2/root-ar71xx/ .
/media/root/proc/gargoyle_x/custom-src/staging_dir/host/bin/mksquashfs4 /media/root/proc/gargoyle_x/custom-src/build_dir/target-mips_r2_uClibc-0.9.33.2/root-ar71xx /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/root.squashfs -nopad -noappend -root-owned -comp xz -Xpreset 9 -Xe -Xlc 0 -Xlp 2 -Xpb 2 -b 256k -processors 1
Parallel mksquashfs: Using 1 processor
Creating 4.0 filesystem on /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/root.squashfs, block size 262144.
[============================================================================================================================================================================/] 2924/2924 100%
Exportable Squashfs 4.0 filesystem, xz compressed, data block size 262144
        compressed data, compressed metadata, compressed fragments, no xattrs
        duplicates are removed
Filesystem size 12199.97 Kbytes (11.91 Mbytes)
        28.70% of uncompressed filesystem size (42507.76 Kbytes)
Inode table size 27660 bytes (27.01 Kbytes)
        24.90% of uncompressed inode table size (111089 bytes)
Directory table size 33736 bytes (32.95 Kbytes)
        45.54% of uncompressed directory table size (74080 bytes)
Number of duplicate files found 70
Number of inodes 3381
Number of files 2859
Number of fragments 99
Number of symbolic links  330
Number of device nodes 0
Number of fifo nodes 0
Number of socket nodes 0
Number of directories 192
Number of ids (unique uids + gids) 1
Number of uids 1
        root (0)
Number of gids 1
        root (0)
cp /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/root.squashfs /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/root.squashfs-raw
cp /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/root.squashfs /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/root.squashfs-64k
/media/root/proc/gargoyle_x/custom-src/staging_dir/host/bin/padjffs2 /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/root.squashfs-64k 64
padding image to 00bf0000
cp /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/root.squashfs-64k /media/root/proc/gargoyle_x/custom-src/bin/ar71xx/openwrt-ar71xx-generic-root.squashfs-64k
/media/root/proc/gargoyle_x/custom-src/staging_dir/host/bin/padjffs2 /media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/root.squashfs 4 8 64 128 256
padding image to 00bea000
padding image to 00bf0000
padding image to 00c00000
dd if=/media/root/proc/gargoyle_x/custom-src/build_dir/linux-ar71xx_generic/root.squashfs of=/media/root/proc/gargoyle_x/custom-src/bin/ar71xx/openwrt-ar71xx-generic-root.squashfs bs=128k conv=sync
96+1 records in
97+0 records out
12713984 bytes (13 MB) copied, 0.120691 s, 105 MB/s
( cd /media/root/proc/gargoyle_x/custom-src/bin/ar71xx ; /usr/bin/find -maxdepth 1 -type f \! -name 'md5sums'  -printf "%P\n" | sort | xargs md5sum --binary > md5sums )
make[6]: Leaving directory `/media/root/proc/gargoyle_x/custom-src/target/linux/ar71xx/image'
make[5]: Leaving directory `/media/root/proc/gargoyle_x/custom-src/target/linux/ar71xx'
make[4]: Leaving directory `/media/root/proc/gargoyle_x/custom-src/target/linux'
make[3]: Leaving directory `/media/root/proc/gargoyle_x/custom-src'
export MAKEFLAGS= ;make -w -r package/index
make[3]: Entering directory `/media/root/proc/gargoyle_x/custom-src'

23

Odp: Problem z obrazem -compilacja wlasna MR3420 v2

Spójrz w konf czy faktycznie masz wybrany 3040 i czy w image/Makefile nie masz zakomentowanej linii od niego.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

24

Odp: Problem z obrazem -compilacja wlasna MR3420 v2

$(eval $(call SingleProfile,ZyXEL,$(fs_64k),NBG_460N_550N_550NH,nbg460n_550n_550nh,NBG460N,ttyS0,115200,NBG-460N))

$(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLMR3020V1,tl-mr3020-v1,TL-MR3020,ttyATH0,115200,0x30200001,1,16Mlzma))
$(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLMR3040V1,tl-mr3040-v1,TL-MR3040,ttyATH0,115200,0x30400001,1,16Mlzma))
$(eval $(call SingleProfile,TPLINK,$(fs_64kraw),TLMR3220V1,tl-mr3220-v1,TL-MR3220,ttyS0,115200,0x32200001,1,16M))
$(eval $(call SingleProfile,TPLINK,$(fs_64kraw),TLMR3420V1,tl-mr3420-v1,TL-MR3420,ttyS0,115200,0x34200001,1,16M))
############ MR3220 V.2
$(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLMR3220V2,tl-mr3220-v2,TL-WR741ND-v4,ttyATH0,115200,0x32200002,1,16Mlzma))
$(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLMR3420V2,tl-mr3420-v2,TL-WR841N-v8,ttyS0,115200,0x34200002,1,16Mlzma))
############

i definicje dla obrazow

char md5salt_boot[MD5SUM_LEN] = {
    0x8c, 0xef, 0x33, 0x5b, 0xd5, 0xc5, 0xce, 0xfa,
    0xa7, 0x9c, 0x28, 0xda, 0xb2, 0xe9, 0x0f, 0x42,
};

static struct flash_layout layouts[] = {
    {
        .id        = "4M",
        .fw_max_len    = 0x3c0000,
        .kernel_la    = 0x80060000,
        .kernel_ep    = 0x80060000,
        .rootfs_ofs    = 0x140000,
    }, {
        .id        = "4Mlzma",
        .fw_max_len    = 0x3c0000,
        .kernel_la    = 0x80060000,
        .kernel_ep    = 0x80060000,
        .rootfs_ofs    = 0x100000,
    }, {
        .id        = "8M",
        .fw_max_len    = 0x7c0000,
        .kernel_la    = 0x80060000,
        .kernel_ep    = 0x80060000,
        .rootfs_ofs    = 0x140000,
    }, {
        .id        = "8Mlzma",
        .fw_max_len    = 0x7c0000,
        .kernel_la    = 0x80060000,
        .kernel_ep    = 0x80060000,
        .rootfs_ofs    = 0x100000,
    }, {
        .id             = "16Mlzma",
        .fw_max_len     = 0xfc0000,
        .kernel_la      = 0x80060000,
        .kernel_ep      = 0x80060000,
        .rootfs_ofs     = 0x100000,
    }, {
        .id             = "16M",
        .fw_max_len     = 0xf80000,
        .kernel_la      = 0x80060000,
        .kernel_ep      = 0x80060000,
        .rootfs_ofs     = 0x140000,
    }, {
        /* terminating entry */
    }
};

static struct board_info boards[] = {
    {
        .id        = "TL-MR3020v1",
        .hw_id        = HWID_TL_MR3020_V1,
        .hw_rev        = 1,
        .layout_id    = "16Mlzma",
    }, {
        .id        = "TL-MR3220v1",
        .hw_id        = HWID_TL_MR3220_V1,
        .hw_rev        = 1,
        .layout_id    = "16M",
    }, {
        .id        = "TL-MR3220v2",
        .hw_id        = HWID_TL_MR3220_V2,
        .hw_rev        = 1,
        .layout_id    = "16Mlzma",
    }, {
        .id        = "TL-MR3420v1",
        .hw_id        = HWID_TL_MR3420_V1,
        .hw_rev        = 1,
        .layout_id    = "16M",
    }, {
        .id        = "TL-MR3420v2",
        .hw_id        = HWID_TL_MR3420_V2,
        .hw_rev        = 1,
        .layout_id    = "16Mlzma",
    }, {
        .id        = "TL-WA701Nv1",
        .hw_id        = HWID_TL_WA701N_V1,
        .hw_rev        = 1,
        .layout_id    = "4M",
    }, {
        .id        = "TL-WA7510N",
        .hw_id        = HWID_TL_WA7510N_V1,
        .hw_rev        = 1,
        .layout_id    = "4M",
    }, {
        .id        = "TL-WA901NDv1",
        .hw_id        = HWID_TL_WA901ND_V1,
        .hw_rev        = 1,
        .layout_id    = "4M",
    }, {
        .id             = "TL-WA901NDv2",
        .hw_id          = HWID_TL_WA901ND_V2,
        .hw_rev         = 1,
        .layout_id    = "4M",
    }, {
        .id        = "TL-WR741NDv1",
        .hw_id        = HWID_TL_WR741ND_V1,
        .hw_rev        = 1,
        .layout_id    = "4M",
    }, {
        .id        = "TL-WR741NDv4",
        .hw_id        = HWID_TL_WR741ND_V4,
        .hw_rev        = 1,
        .layout_id    = "4Mlzma",
    }, {
        .id        = "TL-WR740Nv1",
        .hw_id        = HWID_TL_WR740N_V1,
        .hw_rev        = 1,
        .layout_id    = "4M",
    }, {
        .id        = "TL-WR740Nv3",
        .hw_id        = HWID_TL_WR740N_V3,
        .hw_rev        = 1,
        .layout_id    = "4M",
    }, {
        .id        = "TL-WR743NDv1",
        .hw_id        = HWID_TL_WR743ND_V1,
        .hw_rev        = 1,
        .layout_id    = "4M",
    }, {
        .id        = "TL-WR841Nv1.5",
        .hw_id        = HWID_TL_WR841N_V1_5,
        .hw_rev        = 2,
        .layout_id    = "4M",
    }, {
        .id        = "TL-WR841NDv3",
        .hw_id        = HWID_TL_WR841ND_V3,
        .hw_rev        = 3,
        .layout_id    = "4M",
    }, {
        .id        = "TL-WR841NDv5",
        .hw_id        = HWID_TL_WR841ND_V5,
        .hw_rev        = 1,
        .layout_id    = "4M",
    }, {
        .id        = "TL-WR841NDv7",
        .hw_id        = HWID_TL_WR841ND_V7,
        .hw_rev        = 1,
        .layout_id    = "4M",
    }, {
        .id        = "TL-WR941NDv2",
        .hw_id        = HWID_TL_WR941ND_V2,
        .hw_rev        = 2,
        .layout_id    = "16M",
    }, {
        .id        = "TL-WR941NDv4",
        .hw_id        = HWID_TL_WR941ND_V4,
        .hw_rev        = 1,
        .layout_id    = "16M",
    }, {
        .id        = "TL-WR1041Nv2",
        .hw_id        = HWID_TL_WR1041N_V2,
        .hw_rev        = 1,
        .layout_id    = "4Mlzma",
    }, {
        .id        = "TL-WR1043NDv1",
        .hw_id        = HWID_TL_WR1043ND_V1,
        .hw_rev        = 1,
        .layout_id    = "16M",
    }, {
        .id        = "TL-WR2543Nv1",
        .hw_id        = HWID_TL_WR2543N_V1,
        .hw_rev        = 1,
        .layout_id    = "8Mlzma",
    }, {
        .id        = "TL-WR703Nv1",
        .hw_id        = HWID_TL_WR703N_V1,
        .hw_rev        = 1,
        .layout_id    = "4Mlzma",
    }, {
        /* terminating entry */
    }
};

25

Odp: Problem z obrazem -compilacja wlasna MR3420 v2

Nie wiem czy to ma jakies znaczenie ale zamiast tabow mialem spacje na poczatku w tych liniach

        .id             = "16M",
        .fw_max_len     = 0xf80000,
        .kernel_la      = 0x80060000,
        .kernel_ep      = 0x80060000,
        .rootfs_ofs     = 0x140000,