[<<][openwrt][>>][..]
Thu Mar 7 11:00:50 EST 2013

belkin.7301.r35445.patch

Investigating manojpi's patch:
https://docs.google.com/file/d/0B5aCWpK6ZrH7Mk5LM0IyWE5vRHc/edit?usp=sharing&pli=1

More info here:
http://manojpi.blogspot.com/2013/02/update2-openwrt-on-belkin-share-max.html

Affected files:

target/linux/brcm47xx/patches-3.6/050-mtd-add-bcm47xx-part-parser.patch
target/linux/brcm47xx/image/lzma-loader/src/decompress.c
package/broadcom-diag/src/diag.c
target/linux/brcm47xx/image/Makefile
target/linux/brcm47xx/base-files/etc/init.d/netconfig
package/base-files/files/etc/preinit
tools/firmware-utils/src/trx.c

- target/linux/brcm47xx/patches-3.6/050-mtd-add-bcm47xx-part-parser.patch

First file is a patch of a patch, which is why it looks so weird.  I
don't have much experience maintaining a series of patches.  How would
one edit this?  Assuming that manual editing of the patch is not the
best way..

- target/linux/brcm47xx/image/lzma-loader/src/decompress.c

Support different trx magic.

- package/broadcom-diag/src/diag.c

HACK: platform_detect_legacy() replaces "not found" condition with F7D7301

- target/linux/brcm47xx/image/Makefile

HACK: Creates a separate build rule, passing the extra parameter "-t
belkin" to $(STAGING_DIR_HOST)/bin/trx

- target/linux/brcm47xx/base-files/etc/init.d/netconfig

Config of VLAN ports
HACK: ip address changed

- package/base-files/files/etc/preinit

HACK: ip address changed

- tools/firmware-utils/src/trx.c

HACK: add support for "-t" flag which inserts different magic.


                              ----- cut here -----
diff -uN a/target/linux/brcm47xx/patches-3.6/050-mtd-add-bcm47xx-part-parser.patch b/target/linux/brcm47xx/patches-3.6/050-mtd-add-bcm47xx-part-parser.patch
--- a/target/linux/brcm47xx/patches-3.6/050-mtd-add-bcm47xx-part-parser.patch	2013-02-01 21:04:38.750566738 -0600
+++ b/target/linux/brcm47xx/patches-3.6/050-mtd-add-bcm47xx-part-parser.patch	2013-02-02 00:20:59.008790052 -0600
@@ -26,7 +26,7 @@
  obj-$(CONFIG_MTD_CHAR)		+= mtdchar.o
 --- /dev/null
 +++ b/drivers/mtd/bcm47xxpart.c
-@@ -0,0 +1,541 @@
+@@ -0,0 +1,564 @@
 +/*
 + *  Copyright (C) 2006 Felix Fietkau <nbd@openwrt.org>
 + *  Copyright (C) 2005 Waldemar Brodkorb <wbx@openwrt.org>
@@ -87,6 +87,7 @@
 +#define TRX_NO_HEADER	1		/* Do not write TRX header */
 +#define TRX_GZ_FILES	0x2     /* Contains up to TRX_MAX_OFFSET individual gzip files */
 +#define TRX_MAX_OFFSET	3
++#define TRX_MAGIC_F7D3301	0x20100322      /* Belkin 3301*/
 +
 +struct trx_header {
 +	u32 magic;		/* "HDR0" */
@@ -113,6 +114,7 @@
 +#define ROUTER_NETGEAR_WNR3500L		4
 +#define ROUTER_SIMPLETECH_SIMPLESHARE	5
 +#define ROUTER_NETGEAR_WNDR3400		6
++#define ROUTER_BELKIN_F7D3301 		7
 +
 +static int
 +find_cfe_size(struct mtd_info *mtd)
@@ -151,6 +153,10 @@
 +		/* found a TRX header */
 +		if (le32_to_cpu(trx->magic) == TRX_MAGIC)
 +			goto found;
++		if (le32_to_cpu(trx->magic) == TRX_MAGIC_F7D3301) {
++			pr_notice("Found Belkin_F7D3301 header:cfe\n");
++			goto found;
++		}
 +	}
 +
 +	pr_notice("%s: Couldn't find bootloader size\n", mtd->name);
@@ -313,6 +319,16 @@
 +
 +			goto found;
 +		}
++		if (le32_to_cpu(trx.magic) == TRX_MAGIC_F7D3301) {
++			part->offset = le32_to_cpu(trx.offsets[2]) ? : 
++				le32_to_cpu(trx.offsets[1]);
++			part->size = le32_to_cpu(trx.len); 
++
++			part->size -= part->offset;
++			part->offset += off;
++			pr_notice("Found Belkin_F7D3301 header:root\n");
++			goto found;
++		}
 +	}
 +
 +	pr_warn("%s: Couldn't find root filesystem\n",
@@ -433,6 +449,13 @@
 +		return ROUTER_SIMPLETECH_SIMPLESHARE;
 +	}
 +
++	if (boardtype == 0xa4cf
++	  && boardrev == 0x1102) { 
++		/* Belkin 3301 */
++		return ROUTER_BELKIN_F7D3301;
++	}
++
++
 +	return 0;
 +}
 +
diff -uN a/target/linux/brcm47xx/image/lzma-loader/src/decompress.c b/target/linux/brcm47xx/image/lzma-loader/src/decompress.c
--- a/target/linux/brcm47xx/image/lzma-loader/src/decompress.c	2013-02-01 21:04:38.647231767 -0600
+++ b/target/linux/brcm47xx/image/lzma-loader/src/decompress.c	2013-02-01 21:43:54.505303409 -0600
@@ -78,6 +78,7 @@
 }
 
 #define TRX_MAGIC       0x30524448      /* "HDR0" */
+#define TRX_MAGIC_F7D3301       0x20100322      /* "HDR0" */
 
 struct trx_header {
 	unsigned int magic;		/* "HDR0" */
@@ -139,6 +140,7 @@
 	/* look for trx header, 32-bit data access */
 	for (data = ((unsigned char *) KSEG1ADDR(BCM4710_FLASH));
 		((struct trx_header *)data)->magic != TRX_MAGIC &&
+		((struct trx_header *)data)->magic != TRX_MAGIC_F7D3301 &&
 		((struct trx_header *)data)->magic != EDIMAX_PS_HEADER_MAGIC;
 		 data += 65536);
 
diff -uN a/package/broadcom-diag/src/diag.c b/package/broadcom-diag/src/diag.c
--- a/package/broadcom-diag/src/diag.c	2013-02-01 21:04:41.820615399 -0600
+++ b/package/broadcom-diag/src/diag.c	2013-02-01 22:10:09.846370426 -0600
@@ -115,6 +115,7 @@
 	/* Belkin */
 	BELKIN_UNKNOWN,
 	BELKIN_F7D4301,
+	BELKIN_F7D3301,
 
 	/* Netgear */
 	WGT634U,
@@ -864,6 +865,20 @@
 			{ .name = "led1",	.gpio = 1 << 15, .polarity = REVERSE },
 		},
 	},
+	[BELKIN_F7D3301] = {
+		.name		= "Belkin PlayMax F7D3301",
+		.buttons	= {
+			{ .name = "reset",	.gpio = 1 << 6 },
+			{ .name = "wps",	.gpio = 1 << 8 },
+		},
+		.leds		= {
+			{ .name = "power",	.gpio = 1 << 10, .polarity = REVERSE },
+			{ .name = "warn",	.gpio = 1 << 11, .polarity = REVERSE },
+			{ .name = "wlan",	.gpio = 1 << 13, .polarity = REVERSE },
+			{ .name = "led0",	.gpio = 1 << 14, .polarity = REVERSE },
+			{ .name = "led1",	.gpio = 1 << 15, .polarity = REVERSE },
+		},
+	},
 	/* Netgear */
 	[WGT634U] = {
 		.name		= "Netgear WGT634U",
@@ -1121,6 +1136,7 @@
 	/* no easy model number, attempt to guess */
 	boardnum = getvar("boardnum");
 	boardtype = getvar("boardtype");
+	printk("manoj: boardnum= %s : boardtype : %s\n", boardnum, boardtype);
 
 	if (!strcmp(boardnum, "20070615")) { /* Linksys WRT600N  v1/V1.1 */
 		if (!strcmp(boardtype, "0x478") && !strcmp(getvar("cardbus"), "0") && !strcmp(getvar("switch_type"),"BCM5395"))
@@ -1306,6 +1322,7 @@
 		!strcmp(getvar("status_gpio"), "1")) /* gpio based detection */
 		return &platforms[PS1208MFG];
 
+		return &platforms[BELKIN_F7D3301];
 	/* not found */
 	return NULL;
 }
@@ -1463,6 +1480,7 @@
 		return;
 
 	for(; l->name; l++) {
+		printk(MODULE_NAME ": led:%s\n",l->name);
 		if (l->gpio & gpiomask)
 			continue;
 
diff -uN a/target/linux/brcm47xx/image/Makefile b/target/linux/brcm47xx/image/Makefile
--- a/target/linux/brcm47xx/image/Makefile	2013-02-01 21:04:38.650565153 -0600
+++ b/target/linux/brcm47xx/image/Makefile	2013-02-01 22:37:08.314067909 -0600
@@ -107,6 +107,7 @@
 
 define Image/Build/Initramfs
 	$(STAGING_DIR_HOST)/bin/trx -o $(BIN_DIR)/$(IMG_PREFIX)-initramfs.trx -f $(KDIR)/loader.gz -f $(KDIR)/vmlinux.lzma
+	$(STAGING_DIR_HOST)/bin/trx -t belkin -o $(BIN_DIR)/$(IMG_PREFIX)-f7d3301-initramfs.trx -f $(KDIR)/loader.gz -f $(KDIR)/vmlinux.lzma
 endef
 
 define Image/Build/Chk
@@ -117,6 +118,9 @@
 	$(STAGING_DIR_HOST)/bin/trx -o $(BIN_DIR)/$(IMG_PREFIX)-$(1).trx \
 		-f $(KDIR)/loader.gz -f $(KDIR)/vmlinux.lzma \
 		$(call trxalign/$(1),$(1))
+	$(STAGING_DIR_HOST)/bin/trx -t belkin -o $(BIN_DIR)/$(IMG_PREFIX)-f7d3301-$(1).trx \
+		-f $(KDIR)/loader.gz -f $(KDIR)/vmlinux.lzma \
+		$(call trxalign/$(1),$(1))
 	$(call Image/Build/$(1),$(1))
 	$(call Image/Build/Motorola,$(1),wr850g,1,$(1))
 	$(call Image/Build/USR,$(1),usr5461,$(1))
diff -uN a/target/linux/brcm47xx/base-files/etc/init.d/netconfig b/target/linux/brcm47xx/base-files/etc/init.d/netconfig
--- a/target/linux/brcm47xx/base-files/etc/init.d/netconfig	2013-02-01 21:04:38.663898698 -0600
+++ b/target/linux/brcm47xx/base-files/etc/init.d/netconfig	2013-02-01 22:31:36.294049100 -0600
@@ -131,6 +131,10 @@
 			c["vlan0ports"] = "0 1 2 3 5"
 			c["vlan1ports"] = "4 5"
 		}
+		if (model == "Belkin PlayMax F7D3301") {
+			c["vlan0ports"] = "0 1 2 3 8*"
+			c["vlan1ports"] = "4 8"
+		}
 		if ((nvram["boardtype"] == "0x042f") || (nvram["boardtype"] == "0x0472")) {
 			if (nvram["boardnum"] == "45") {
 				# WL-500gP
@@ -234,7 +238,7 @@
 		p("ifname", "lan_ifname")
 		p("macaddr", "lan_macaddr")
 		print "	option proto	static"
-		print "	option ipaddr	192.168.1.1"
+		print "	option ipaddr	192.168.2.1"
 		print "	option netmask	255.255.255.0"
 		print ""
 		print ""
diff -uN a/package/base-files/files/etc/preinit b/package/base-files/files/etc/preinit
--- a/package/base-files/files/etc/preinit	2013-02-01 21:04:40.773932143 -0600
+++ b/package/base-files/files/etc/preinit	2013-02-01 22:25:54.890508010 -0600
@@ -5,13 +5,13 @@
 export PATH=/bin:/sbin:/usr/bin:/usr/sbin
 
 pi_ifname=
-pi_ip=192.168.1.1
-pi_broadcast=192.168.1.255
+pi_ip=192.168.2.1
+pi_broadcast=192.168.2.255
 pi_netmask=255.255.255.0
 
 fs_failsafe_ifname=
-fs_failsafe_ip=192.168.1.1
-fs_failsafe_broadcast=192.168.1.255
+fs_failsafe_ip=192.168.2.1
+fs_failsafe_broadcast=192.168.2.255
 fs_failsafe_netmask=255.255.255.0
 
 fs_failsafe_wait_timeout=2
diff -uN a/tools/firmware-utils/src/trx.c b/tools/firmware-utils/src/trx.c
--- a/tools/firmware-utils/src/trx.c	2013-02-01 21:04:42.777297229 -0600
+++ b/tools/firmware-utils/src/trx.c	2013-02-01 21:58:35.610598691 -0600
@@ -66,6 +66,7 @@
 /**********************************************************************/
 /* from trxhdr.h */
 
+#define TRX_MAGIC_F7D3301	0x20100322
 #define TRX_MAGIC	0x30524448	/* "HDR0" */
 #define TRX_MAX_LEN	0x720000
 #define TRX_NO_HEADER	1		/* Do not write TRX header */	
@@ -105,6 +106,7 @@
 	struct trx_header *p;
 	char trx_version = 1;
 	unsigned char binheader[32];
+	unsigned long trx_magic_c=TRX_MAGIC;
 
 	fprintf(stderr, "mjn3's trx replacement - v0.81.1\n");
 
@@ -115,13 +117,13 @@
 
 	p = (struct trx_header *) buf;
 
-	p->magic = STORE32_LE(TRX_MAGIC);
+	//p->magic = STORE32_LE(TRX_MAGIC);
 	cur_len = sizeof(struct trx_header) - 4; /* assume v1 header */
 
 	in = NULL;
 	i = 0;
 
-	while ((c = getopt(argc, argv, "-:2o:m:a:x:b:f:A:F:")) != -1) {
+	while ((c = getopt(argc, argv, "-:2o:m:a:x:b:f:A:F:t:")) != -1) {
 		switch (c) {
 			case '2':
 				/* take care that nothing was written to buf so far */
@@ -164,6 +166,9 @@
 				append = 0;
 
 				break;
+			case 't':
+				trx_magic_c = TRX_MAGIC_F7D3301;
+				break;
 			case 'o':
 				ofn = optarg;
 				if (ofn && !(out = fopen(ofn, "w"))) {
@@ -247,6 +252,8 @@
 				usage();
 		}
 	}
+	fprintf(stderr, "INFO: trxMagic=0x%8x\n",trx_magic_c);
+	p->magic = STORE32_LE(trx_magic_c);
 	p->flag_version = STORE32_LE((trx_version << 16));
 
 	if (!in) {
                              ----- cut here -----




[Reply][About]
[<<][openwrt][>>][..]