summaryrefslogtreecommitdiffstats
path: root/do-work/Edimax-v2/embr6478acv2
diff options
context:
space:
mode:
authorJames <>2017-01-18 06:22:14 +0000
committerJames <>2017-01-18 06:22:14 +0000
commit39e964f156a59ac652b9f344d36810beab35d036 (patch)
treeb58a12e6aed70dd859d090f79ac448a4877bd956 /do-work/Edimax-v2/embr6478acv2
downloadmaster-31e0f0ae-pq-39e964f156a59ac652b9f344d36810beab35d036.tar.gz
master-31e0f0ae-pq-39e964f156a59ac652b9f344d36810beab35d036.tar.bz2
master-31e0f0ae-pq-39e964f156a59ac652b9f344d36810beab35d036.zip
first cut
Diffstat (limited to 'do-work/Edimax-v2/embr6478acv2')
-rw-r--r--do-work/Edimax-v2/embr6478acv2309
1 files changed, 309 insertions, 0 deletions
diff --git a/do-work/Edimax-v2/embr6478acv2 b/do-work/Edimax-v2/embr6478acv2
new file mode 100644
index 0000000..4bbe3e9
--- /dev/null
+++ b/do-work/Edimax-v2/embr6478acv2
@@ -0,0 +1,309 @@
+diff --git a/target/linux/ramips/Makefile b/target/linux/ramips/Makefile
+index 51cd8f3..8ede6c4 100644
+--- a/target/linux/ramips/Makefile
++++ b/target/linux/ramips/Makefile
+@@ -10,7 +10,7 @@ ARCH:=mipsel
+ BOARD:=ramips
+ BOARDNAME:=MediaTek Ralink MIPS
+ SUBTARGETS:=rt305x mt7620 mt7621 mt7628 mt7688 rt3883 rt288x
+-FEATURES:=squashfs gpio mips16
++FEATURES:=squashfs gpio mips16 jffs2
+ MAINTAINER:=John Crispin <john@phrozen.org>
+
+ KERNEL_PATCHVER:=4.4
+diff --git a/target/linux/ramips/dts/BR-6478AC-V2.dts b/target/linux/ramips/dts/BR-6478AC-V2.dts
+index ac870cc..ce1054f 100644
+--- a/target/linux/ramips/dts/BR-6478AC-V2.dts
++++ b/target/linux/ramips/dts/BR-6478AC-V2.dts
+@@ -56,15 +56,36 @@
+ };
+ };
+
++
++ gpio_export {
++ compatible = "gpio-export";
++ #size-cells = <0>;
++ usb-power {
++ gpio-export,name="usb-power";
++ gpio-export,output=<0>;
++ gpios = <&gpio2 5 0>; // pin45
++ };
++ };
++
++
++
++/*
+ usbphy: usbphy {
+ compatible = "mediatek,mt7620-usbphy";
+ #phy-cells = <1>;
+ resets = <&rstctrl 22 &rstctrl 25>;
+ reset-names = "host", "device";
+ };
++*/
+
+ };
+
++
++&gpio2 {
++ status = "okay";
++};
++
++
+ &spi0 {
+ status = "okay";
+
+@@ -164,10 +185,11 @@
+ };
+ };
+
+-&gsw {
++/* &gsw {
+ mediatek,port4 = "gmac";
+ mediatek,mt7530 = <1>;
+ };
++*/
+
+ &wmac {
+ ralink,mtd-eeprom = <&factory 0>;
+@@ -176,7 +198,7 @@
+ &pcie {
+ status = "okay";
+
+- pcie0 {
++ pcie-bridge {
+ mt76@0,0 {
+ reg = <0x0000 0 0 0 0>;
+ device_type = "pci";
+diff --git a/target/linux/ramips/image/Makefile b/target/linux/ramips/image/Makefile
+index d165ec5..8a256bd 100644
+--- a/target/linux/ramips/image/Makefile
++++ b/target/linux/ramips/image/Makefile
+@@ -4,6 +4,8 @@
+ # This is free software, licensed under the GNU General Public License v2.
+ # See /LICENSE for more information.
+ #
++JFFS2_BLOCKSIZE=4k
++
+ include $(TOPDIR)/rules.mk
+ include $(INCLUDE_DIR)/image.mk
+
+diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk
+index d508fd9..ce953dd 100644
+--- a/target/linux/ramips/image/mt7620.mk
++++ b/target/linux/ramips/image/mt7620.mk
+@@ -2,6 +2,12 @@
+ # MT7620A Profiles
+ #
+
++
++define Build/edmx-header
++ $(STAGING_DIR_HOST)/bin/mkedmximg < $@ > $@.new && mv $@.new $@
++endef
++
++
+ define Build/tplink-header
+ $(STAGING_DIR_HOST)/bin/mktplinkfw2 -a 0x4 -V "ver. 2.0" -B $(1) \
+ -o $@.new -k $@ && mv $@.new $@
+@@ -416,18 +422,12 @@ define Device/br-6478ac-v2
+ DTS := BR-6478AC-V2
+ DEVICE_TITLE := Edimax BR-6478AC-V2
+ BLOCKSIZE := 4k
+- IMAGES += factory.bin
+ IMAGE_SIZE := 7616k
+- IMAGE/sysupgrade.bin := \
+- append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | append-rootfs | \
+- seama -m "dev=/dev/mtdblock/5" -m "type=firmware" | \
+- pad-rootfs | check-size $$$$(IMAGE_SIZE)
+- IMAGE/factory.bin := \
+- append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | \
+- append-rootfs | pad-rootfs -x 64 | \
+- seama -m "dev=/dev/mtdblock/2" -m "type=firmware" | \
+- seama-seal -m "signature=wapn22_dlink.2013gui_dap1320b" | \
+- check-size $$$$(IMAGE_SIZE)
++ IMAGES += factory.bin rawfs.bin kernel.bin
++ IMAGE/rawfs.bin := append-rootfs
++ IMAGE/kernel.bin := append-kernel | pad-offset $$$$(BLOCKSIZE) 20 | edmx-header
++ IMAGE/sysupgrade.bin := append-kernel | pad-offset $$$$(BLOCKSIZE) 20 | edmx-header | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
++ IMAGE/factory.bin := append-kernel | pad-offset $$$$(BLOCKSIZE) 20 | edmx-header | append-rootfs | pad-rootfs -x 64 | check-size $$$$(IMAGE_SIZE)
+ DEVICE_PACKAGES := kmod-mt76
+ endef
+ TARGET_DEVICES += br-6478ac-v2
+diff --git a/target/linux/ramips/patches-4.4/9999-em-br6478acv2.patch b/target/linux/ramips/patches-4.4/9999-em-br6478acv2.patch
+new file mode 100644
+index 0000000..59c7b5e
+--- /dev/null
++++ b/target/linux/ramips/patches-4.4/9999-em-br6478acv2.patch
+@@ -0,0 +1,108 @@
++--- a/drivers/mtd/mtdsplit/mtdsplit.c 2017-01-18 03:45:15.345921539 +0000
+++++ b/drivers/mtd/mtdsplit/mtdsplit.c 2017-01-18 04:31:27.032704016 +0000
++@@ -95,6 +95,10 @@
++ if (type)
++ *type = MTDSPLIT_PART_TYPE_JFFS2;
++ return 0;
+++ } else if (magic == 0x20031985) {
+++ if (type)
+++ *type = MTDSPLIT_PART_TYPE_JFFS2;
+++ return 0;
++ } else if (be32_to_cpu(magic) == UBI_EC_MAGIC) {
++ if (type)
++ *type = MTDSPLIT_PART_TYPE_UBI;
++--- a/drivers/mtd/mtdsplit/mtdsplit_uimage.c 2017-01-13 11:33:11.517379487 +0000
+++++ b/drivers/mtd/mtdsplit/mtdsplit_uimage.c 2017-01-18 04:22:42.188040972 +0000
++@@ -53,6 +53,14 @@
++ uint8_t ih_name[IH_NMLEN]; /* Image Name */
++ };
++
+++struct csys_header {
+++ uint32_t cs_magic;
+++ uint32_t a;
+++ uint32_t b;
+++ uint32_t board_sig;
+++ uint32_t len;
+++};
+++
++ static int
++ read_uimage_header(struct mtd_info *mtd, size_t offset, u_char *buf,
++ size_t header_len)
++@@ -127,6 +135,7 @@
++ header = (struct uimage_header *)(buf + ret);
++
++ uimage_size = sizeof(*header) + be32_to_cpu(header->ih_size);
+++ uimage_offset= offset + ret;
++ if ((offset + uimage_size) > master->size) {
++ pr_debug("uImage exceeds MTD device \"%s\"\n",
++ master->name);
++@@ -141,9 +150,8 @@
++ goto err_free_buf;
++ }
++
++- uimage_offset = offset;
++
++- if (uimage_offset == 0) {
+++ if (offset == 0) {
++ uimage_part = 0;
++ rf_part = 1;
++
++@@ -181,8 +189,8 @@
++ }
++
++ parts[uimage_part].name = KERNEL_PART_NAME;
++- parts[uimage_part].offset = uimage_offset;
++- parts[uimage_part].size = uimage_size;
+++ parts[uimage_part].offset = offset;
+++ parts[uimage_part].size = uimage_size+uimage_offset;
++
++ if (type == MTDSPLIT_PART_TYPE_UBI)
++ parts[rf_part].name = UBI_PART_NAME;
++@@ -305,32 +313,41 @@
++ * Edimax
++ **************************************************/
++
++-#define FW_EDIMAX_OFFSET 20
++ #define FW_MAGIC_EDIMAX 0x43535953
++
++ static ssize_t uimage_find_edimax(u_char *buf, size_t len)
++ {
++ struct uimage_header *header;
+++ struct csys_header *cheader;
++
++- if (len < FW_EDIMAX_OFFSET + sizeof(*header)) {
+++ if (len < sizeof(*cheader) + sizeof(*header)) {
++ pr_err("Buffer too small for checking Edimax header\n");
++ return -ENOSPC;
++ }
++
++- header = (struct uimage_header *)(buf + FW_EDIMAX_OFFSET);
+++ cheader = (struct csys_header *)buf;
++
++- switch be32_to_cpu(header->ih_magic) {
+++ switch be32_to_cpu(cheader->cs_magic) {
++ case FW_MAGIC_EDIMAX:
++ break;
++ default:
++ return -EINVAL;
++ }
++
+++ header = (struct uimage_header *)(buf + sizeof(*cheader));
+++
+++ switch be32_to_cpu(header->ih_magic) {
+++ case IH_MAGIC:
+++ break;
+++ default:
+++ return -EINVAL;
+++ }
+++
++ if (header->ih_os != IH_OS_LINUX ||
++- header->ih_type != IH_TYPE_FILESYSTEM)
+++ header->ih_type != IH_TYPE_KERNEL)
++ return -EINVAL;
++
++- return FW_EDIMAX_OFFSET;
+++ return sizeof(*cheader);
++ }
++
++ static int
+diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile
+index 803ada4..d55d914 100644
+--- a/tools/firmware-utils/Makefile
++++ b/tools/firmware-utils/Makefile
+@@ -72,6 +72,7 @@ define Host/Compile
+ $(call cc,mkheader_gemtek,-lz)
+ $(call cc,mkrtn56uimg, -lz)
+ $(call cc,dgn3500sum)
++ $(call cc,mkedmximg)
+ $(call cc,edimax_fw_header, -Wall)
+ $(call cc,mkmerakifw sha1, -Wall)
+ $(call cc,mkmerakifw-old, -Wall)
+diff --git a/tools/firmware-utils/src/mkedmximg.c b/tools/firmware-utils/src/mkedmximg.c
+new file mode 100644
+index 0000000..d420cc1
+--- /dev/null
++++ b/tools/firmware-utils/src/mkedmximg.c
+@@ -0,0 +1,47 @@
++#include <stdio.h>
++#include <stdint.h>
++#include <unistd.h>
++
++char buf[8*1024*1024];
++
++
++struct header {
++uint32_t csys;
++uint32_t thing1;
++uint32_t thing2;
++uint32_t board_sig;
++uint32_t len;
++};
++
++
++
++
++int main(int argc,char *argv[])
++{
++size_t len;
++struct header h;
++uint32_t crc;
++
++
++len=read(0,buf,sizeof(buf));
++
++h.csys='SYSC';
++h.thing1=0x01100000;
++h.thing2=0x00070000;
++h.board_sig='86NR';
++h.len=len;
++
++
++write(1,&h,sizeof(h));
++write(1,buf,len);
++//write(1,&crc,sizeof(crc));
++
++return 0;
++}
++
++
++
++
++
++
++