From 6a4d6f6bb8c8aa851e5ee87df80a2a11eb98a8fc Mon Sep 17 00:00:00 2001 From: James <> Date: Thu, 19 Jan 2017 15:32:28 +0000 Subject: works --- master/jmm.patch | 248 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 248 insertions(+) create mode 100644 master/jmm.patch (limited to 'master/jmm.patch') diff --git a/master/jmm.patch b/master/jmm.patch new file mode 100644 index 0000000..3fefe09 --- /dev/null +++ b/master/jmm.patch @@ -0,0 +1,248 @@ +diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh +index 0fa260b..fbaee22 100755 +--- a/target/linux/ramips/base-files/lib/ramips.sh ++++ b/target/linux/ramips/base-files/lib/ramips.sh +@@ -76,7 +76,8 @@ ramips_board_detect() { + *"BR-6475nD") + name="br-6475nd" + ;; +- *"BR-6478AC-v2") ++ *"BR-6478AC-v2"|\ ++ *"BR-6478ACV2") + name="br-6478ac-v2" + ;; + *"Broadway") +diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh +index e3bea00..ba1d9fd 100755 +--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh ++++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh +@@ -176,7 +176,8 @@ platform_check_image() { + } + return 0 + ;; +- br-6475nd) ++ br-6475nd|\ ++ br-6478ac-v2) + [ "$magic" != "43535953" ] && { + echo "Invalid image type." + return 1 +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/mt7620.mk b/target/linux/ramips/image/mt7620.mk +index 9454865..a0edfd8 100644 +--- a/target/linux/ramips/image/mt7620.mk ++++ b/target/linux/ramips/image/mt7620.mk +@@ -2,11 +2,16 @@ + # MT7620A Profiles + # + + define Build/tplink-header + $(STAGING_DIR_HOST)/bin/mktplinkfw2 -a 0x4 -V "ver. 2.0" -B $(1) \ + -o $@.new -k $@ && mv $@.new $@ + endef + ++ ++define Build/edimax-header ++ $(STAGING_DIR_HOST)/bin/mkedimaximg -i $@ -o $@.new -s CSYS $(1) && mv $@.new $@ ++endef ++ + define Build/pad-kernel-ex2700 + cp $@ $@.tmp && dd if=/dev/zero bs=64 count=1 >> $@.tmp \ + && dd if=$@.tmp of=$@.new bs=64k conv=sync && truncate -s -64 $@.new \ +@@ -417,19 +428,9 @@ TARGET_DEVICES += tiny-ac + define Device/br-6478ac-v2 + DTS := BR-6478AC-V2 + DEVICE_TITLE := Edimax BR-6478AC-V2 +- BLOCKSIZE := 4k +- IMAGES += factory.bin ++ BLOCKSIZE := 65536 + 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) ++ IMAGE/sysupgrade.bin := append-kernel | pad-offset $$$$(BLOCKSIZE) 20 | append-rootfs | pad-rootfs -x 20 | check-size $$$$(IMAGE_SIZE) | edimax-header -m RN68 -f 0x70000 -S 0x1100000 + 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 -- cgit v1.2.3