diff options
author | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2018-09-16 19:26:25 +0200 |
---|---|---|
committer | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2018-09-16 19:26:25 +0200 |
commit | 4dc1eee385f1b5115976db8d6b60ca0a08ed05ce (patch) | |
tree | 8c2562a28e69949dee07563a8bedc6029d7acc9a /package/system/mtd | |
parent | be049529e6a883601fd47303a05165a6a0b9a4a5 (diff) | |
download | mtk-20170518-4dc1eee385f1b5115976db8d6b60ca0a08ed05ce.zip mtk-20170518-4dc1eee385f1b5115976db8d6b60ca0a08ed05ce.tar.gz mtk-20170518-4dc1eee385f1b5115976db8d6b60ca0a08ed05ce.tar.bz2 |
package/system: probably from OpenWRT
Diffstat (limited to 'package/system/mtd')
-rw-r--r-- | package/system/mtd/src/mtd.c | 19 | ||||
-rw-r--r-- | package/system/mtd/src/trx.c | 4 |
2 files changed, 22 insertions, 1 deletions
diff --git a/package/system/mtd/src/mtd.c b/package/system/mtd/src/mtd.c index 6dd6eea..260e17f 100644 --- a/package/system/mtd/src/mtd.c +++ b/package/system/mtd/src/mtd.c @@ -678,8 +678,27 @@ int main (int argc, char **argv) no_erase = 1; break; case 'j': + { + FILE * fp = NULL; + char * buf = NULL; + long len = 2048; // assume 2048 + size_t l = 0; + if ((fp = fopen("/proc/cpuinfo", "r"))) { + buf = (char *)malloc(len); + if (!buf) break; + memset(buf, 0, len); + l = fread(buf, 1, len, fp); + buf[len-1] = 0; + if (strstr(buf, "7623")) { + fprintf(stderr, "<%s>, yes 7623\n", __FUNCTION__); + break; + } + } + + fprintf(stderr, "<%s>, no 7623\n", __FUNCTION__); jffs2file = optarg; break; + } case 's': errno = 0; jffs2_skip_bytes = strtoul(optarg, 0, 0); diff --git a/package/system/mtd/src/trx.c b/package/system/mtd/src/trx.c index 65c2440..089d1ac 100644 --- a/package/system/mtd/src/trx.c +++ b/package/system/mtd/src/trx.c @@ -101,13 +101,14 @@ err: return -1; } +#ifndef target_ar71xx int trx_check(int imagefd, const char *mtd, char *buf, int *len) { const struct trx_header *trx = (const struct trx_header *) buf; int fd; - if (strcmp(mtd, "linux") != 0) + if (strcmp(mtd, "firmware") != 0) return 1; *len = read(imagefd, buf, 32); @@ -141,6 +142,7 @@ trx_check(int imagefd, const char *mtd, char *buf, int *len) close(fd); return 1; } +#endif int mtd_fixtrx(const char *mtd, size_t offset) |