diff options
author | John Crispin <john@openwrt.org> | 2013-04-09 14:19:33 +0000 |
---|---|---|
committer | John Crispin <john@openwrt.org> | 2013-04-09 14:19:33 +0000 |
commit | 48feea4861bba4673e8e2d7a6cedf483963180fc (patch) | |
tree | 57574091de0b15e695598d69ff0af2be3c0bc5aa /tools/firmware-utils/src | |
parent | e468abcae08b82174ab086261a8767e468b720ed (diff) | |
download | upstream-48feea4861bba4673e8e2d7a6cedf483963180fc.tar.gz upstream-48feea4861bba4673e8e2d7a6cedf483963180fc.tar.bz2 upstream-48feea4861bba4673e8e2d7a6cedf483963180fc.zip |
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>
SVN-Revision: 36289
Diffstat (limited to 'tools/firmware-utils/src')
-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 8b0359f749..ed662d8ecc 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) |