diff options
author | blogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2013-04-09 14:19:33 +0000 |
---|---|---|
committer | blogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2013-04-09 14:19:33 +0000 |
commit | cb06f20d31cc8776aab0de950b89b77f50eef890 (patch) | |
tree | 40279112e9941bcace56f3f7dc6a4fdeb7e5b703 /tools | |
parent | b945e78bc3eb53374715a44c0c4b49826d0a8c71 (diff) |
[ramips] Add Netgear WNCE2001 (OF version)
Add Netgear WNCE2001.
This is a small RT3052 device with 4MB spi flash and 32MB ram.
2 built-in antennas, 1x fastE, no USB, reset & wps switch.
On my model the AP/RT switch is unpopulated, but I verified the gpio
mapping for it.
The stock firmware is running an unprotected tftpd which allows you
to read any file from the filesystem.
Serial port is present on testpads (See image on the wiki page).
There are more testpads below the shield near the SoC, which
may have JTAG.
Slight annoyance: The bootloader is checksumming kernel&rootfs, but
can be tricked by zeroing checksum and length fields in the checksum
partition, see
target/linux/ramips/base-files/lib/preinit/04_disable_wnce2001_flash_checksumming
The manufacturer image is very similar to the DAP one, so I slightly
modified mkdapimg to support generating it.
The resulting
openwrt-ramips-rt305x-wnce2001-squashfs-factory-(worldwide|northamerica).bin
can be used to flash from stock to OpenWRT using the stock firmware
upgrade function, without using the serial port.
http://www.netgear.com/landing/wnce2001.aspx
http://wiki.openwrt.org/toh/netgear/wnce2001
Signed-off-by: Tobias Diedrich <ranma+openwrt@tdiedrich.de>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@36289 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'tools')
-rw-r--r-- | tools/firmware-utils/src/mkdapimg.c | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/tools/firmware-utils/src/mkdapimg.c b/tools/firmware-utils/src/mkdapimg.c index 8b0359f74..ed662d8ec 100644 --- a/tools/firmware-utils/src/mkdapimg.c +++ b/tools/firmware-utils/src/mkdapimg.c @@ -27,6 +27,8 @@ #define MAX_MODEL_NAME_LEN 20 #define MAX_SIG_LEN 30 +#define MAX_REGION_LEN 4 +#define MAX_VERSION_LEN 12 struct img_hdr_struct { uint32_t checksum; @@ -51,7 +53,7 @@ perrexit(int code, char *msg) void usage() { - fprintf(stderr, "usage: %s [-p] [-m model] -s signature -i input -o output\n", progname); + fprintf(stderr, "usage: %s [-p] [-m model] [-r region] [-v version] -s signature -i input -o output\n", progname); exit(1); } @@ -60,8 +62,11 @@ main(int ac, char *av[]) { char model[MAX_MODEL_NAME_LEN+1]; char signature[MAX_SIG_LEN+1]; + char region[MAX_REGION_LEN+1]; + char version[MAX_VERSION_LEN+1]; int patchmode = 0; int fixmode = 0; + int have_regionversion = 0; FILE *ifile, *ofile; int c; @@ -71,11 +76,13 @@ main(int ac, char *av[]) progname = basename(av[0]); memset(model, 0, sizeof(model)); memset(signature, 0, sizeof(signature)); + memset(region, 0, sizeof(region)); + memset(version, 0, sizeof(version)); while ( 1 ) { int c; - c = getopt(ac, av, "pxm:s:i:o:"); + c = getopt(ac, av, "pxm:r:v:s:i:o:"); if (c == -1) break; @@ -94,6 +101,24 @@ main(int ac, char *av[]) } strcpy(model, optarg); break; + case 'r': + if (strlen(optarg) > MAX_REGION_LEN) { + fprintf(stderr, "%s: region exceeds %d chars\n", + progname, MAX_REGION_LEN); + exit(1); + } + have_regionversion = 1; + strcpy(region, optarg); + break; + case 'v': + if (strlen(optarg) > MAX_VERSION_LEN) { + fprintf(stderr, "%s: version exceeds %d chars\n", + progname, MAX_VERSION_LEN); + exit(1); + } + have_regionversion = 1; + strcpy(version, optarg); + break; case 's': if (strlen(optarg) > MAX_SIG_LEN) { fprintf(stderr, "%s: signature exceeds %d chars\n", @@ -150,6 +175,10 @@ main(int ac, char *av[]) imghdr.checksum = htonl(cksum); imghdr.partition = 0 ; // don't care? imghdr.hdr_len = sizeof(imghdr); + if (have_regionversion) { + imghdr.hdr_len += MAX_REGION_LEN; + imghdr.hdr_len += MAX_VERSION_LEN; + } imghdr.flash_byte_cnt = htonl(bcnt); } else { if (ntohl(imghdr.checksum) != cksum) { @@ -176,6 +205,12 @@ main(int ac, char *av[]) if (fwrite(&imghdr, sizeof(imghdr), 1, ofile) < 0) perrexit(2, "fwrite header on output"); + if (have_regionversion) { + if (fwrite(®ion, MAX_REGION_LEN, 1, ofile) < 0) + perrexit(2, "fwrite header on output"); + if (fwrite(&version, MAX_VERSION_LEN, 1, ofile) < 0) + perrexit(2, "fwrite header on output"); + } while ((c = fgetc(ifile)) != EOF) { if (fputc(c, ofile) == EOF) |