The TRENDnet TEW-827DRU is an ipq806x wireless router.

ipq8064 SoC with 2x ARMv7-ish Krait 300 CPUs at 1.4Ghz
512MB RAM, 256MB SLC NAND flash (64MB default UBI img size)
1x qca8337-al3c 1000BASE-T ethernet switch, 1-WAN, 4-LAN
2x qca9980 802.11 radios
2x USB3 type A

Product page: 
https://www.trendnet.com/products/wifi/AC2600-MU-MIMO-AC-routers/TEW-827DRU

Development thread: https://forum.openwrt.org/viewtopic.php?id=65956

The tew827dru factory image format supports installation from both the OEM web 
interface and a u-boot "recovery loader" HTTP page, which is accessible by 
booting the device with the reset button held down for four seconds. This 
factory image must be packaged in a FIT file with specific content and a Cameo 
signature/hwid appended to the file. The FIT image itself contains a u-boot 
hush shell script which installs a UBI image containing the kernel, 
sqaushfs-rootfs, and ubifs-overlay. Supporting this factory image required the 
addition of a new ITS formatter tool (its-maker.sh), a u-boot shell script 
(tew827dru-flash.scr), and a tiny "Fail Safe" bootconfig binary blob 
(tew827dru-bootconfig.bin).

Signed-off-by: Jesse Molina <jm...@jmomo.net>
---
 include/image-commands.mk                          |  16 +
 .../linux/ipq806x/base-files/etc/board.d/01_leds   |   6 +
 .../ipq806x/base-files/etc/board.d/02_network      |   4 +
 target/linux/ipq806x/base-files/etc/diag.sh        |   3 +
 .../etc/hotplug.d/firmware/11-ath10k-caldata       |   8 +
 .../etc/hotplug.d/ieee80211/10_fix_wifi_mac        |   3 +
 target/linux/ipq806x/base-files/lib/ipq806x.sh     |   3 +
 .../base-files/lib/preinit/06_set_iface_mac        |  23 ++
 .../ipq806x/base-files/lib/upgrade/platform.sh     |   6 +-
 .../arch/arm/boot/dts/qcom-ipq8064-tew827dru.dts   | 354 +++++++++++++++++++++
 target/linux/ipq806x/image/Makefile                |  48 ++-
 .../linux/ipq806x/image/tew827dru-bootconfig.bin   | Bin 0 -> 84 bytes
 target/linux/ipq806x/image/tew827dru-flash.scr     |  57 ++++
 .../linux/ipq806x/patches-4.4/800-devicetree.patch |   3 +-
 14 files changed, 530 insertions(+), 4 deletions(-)
 create mode 100644 target/linux/ipq806x/base-files/lib/preinit/06_set_iface_mac
 create mode 100644 
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-tew827dru.dts
 create mode 100644 target/linux/ipq806x/image/tew827dru-bootconfig.bin
 create mode 100644 target/linux/ipq806x/image/tew827dru-flash.scr

diff --git a/include/image-commands.mk b/include/image-commands.mk
index 9db150c..2f3e082 100644
--- a/include/image-commands.mk
+++ b/include/image-commands.mk
@@ -168,3 +168,19 @@ define Build/sysupgrade-tar
                --rootfs $(call param_get_default,rootfs,$(1),$(IMAGE_ROOTFS)) \
                $@
 endef
+
+define Build/cameo-sig
+       { \
+               cameo_sig=$(word 1, $(1)) ;\
+               align=$(if $(2),$(2),64) ;\
+               oldsize=$$(stat -c %s $@) ;\
+               sigsize=$$(echo -n $$cameo_sig | wc -c) ;\
+               padsize=$$(( ( ( ( $$oldsize + $$sigsize ) / $$align ) + 1 ) - 
( ( $$oldsize + $$sigsize ) / $$align ) )) ;\
+               newsize=$$(( $$oldsize + $$padsize )) ;\
+               echo "Appending Cameo signature: \"$$cameo_sig\", 
oldsize=$$oldsize align=$$align sigsize=$$sigsize padsize=$$padsize 
newsize=$$newsize" ;\
+               dd if=$@ of=$@.new bs=$$newsize count=1 conv=sync ;\
+               echo -n "$$cameo_sig" >> $@.new ; \
+       }
+       @mv $@.new $@
+endef
+
diff --git a/target/linux/ipq806x/base-files/etc/board.d/01_leds 
b/target/linux/ipq806x/base-files/etc/board.d/01_leds
index 0b75b11..269dfa8 100755
--- a/target/linux/ipq806x/base-files/etc/board.d/01_leds
+++ b/target/linux/ipq806x/base-files/etc/board.d/01_leds
@@ -33,6 +33,12 @@ ea8500)
        ucidef_set_led_wlan "wifi" "WIFI" "ea8500:green:wifi" "phy0radio"
        ucidef_set_led_default "wps" "WPS" "ea8500:green:wps" "0"
        ;;
+tew827dru)
+       ucidef_set_led_usbdev "usb2" "USB2" "tew827dru:blue:usb" "2-1"
+       # The ledtrig_usbdev kernel module can only map 1 LED-GPIO to 1 USB 
port.
+       # Thus, this only works for one of the two ports, for now.
+       # ucidef_set_led_usbdev "usb4" "USB4" "tew827dru:blue:usb" "4-1"
+       ;;
 *)
        ;;
 esac
diff --git a/target/linux/ipq806x/base-files/etc/board.d/02_network 
b/target/linux/ipq806x/base-files/etc/board.d/02_network
index b720455..e419f9b 100755
--- a/target/linux/ipq806x/base-files/etc/board.d/02_network
+++ b/target/linux/ipq806x/base-files/etc/board.d/02_network
@@ -22,6 +22,10 @@ r7800)
        ucidef_add_switch "switch0" \
                "1:lan" "2:lan" "3:lan" "4:lan" "6@eth1" "5:wan" "0@eth0"
        ;;
+tew827dru)
+       ucidef_add_switch "switch0" \
+               "1:lan" "2:lan" "3:lan" "4:lan" "6t@eth1" "5:wan" "0t@eth0"
+       ;;
 db149)
        ucidef_set_interface_lan "eth1 eth2 eth3"
        ucidef_add_switch "switch0" \
diff --git a/target/linux/ipq806x/base-files/etc/diag.sh 
b/target/linux/ipq806x/base-files/etc/diag.sh
index 0bf5934..11705ee 100755
--- a/target/linux/ipq806x/base-files/etc/diag.sh
+++ b/target/linux/ipq806x/base-files/etc/diag.sh
@@ -11,6 +11,9 @@ get_status_led() {
        ea8500)
                status_led="ea8500:white:power"
                ;;
+       tew827dru)
+               status_led="tew827dru:blue:power"
+               ;;
        esac
 }
 
diff --git 
a/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata 
b/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index c7977e6..a218183 100644
--- a/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -60,6 +60,10 @@ case "$FIRMWARE" in
          r7800)
                ath10kcal_extract "art" 4096 12064
                ;;
+       tew827dru)
+               hw_mac_addr=$(mtd_get_mac_ascii devinfo hw_mac_addr)
+               ath10kcal_extract "ART" 4096 12064
+               ;;
        esac
        ;;
 "ath10k/cal-pci-0001:01:00.0.bin")
@@ -76,6 +80,10 @@ case "$FIRMWARE" in
         r7800)
                ath10kcal_extract "art" 20480 12064
                ;;
+       tew827dru)
+               hw_mac_addr=$(mtd_get_mac_ascii devinfo hw_mac_addr)
+               ath10kcal_extract "ART" 20480 12064
+               ;;
        esac
        ;;
 *)
diff --git 
a/target/linux/ipq806x/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac 
b/target/linux/ipq806x/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
index 1ae4352..a3326ab 100644
--- a/target/linux/ipq806x/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
+++ b/target/linux/ipq806x/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
@@ -18,6 +18,9 @@ case "$board" in
        ea8500)
                echo $(macaddr_add $(mtd_get_mac_ascii devinfo hw_mac_addr) 
$(($PHYNBR + 1)) ) > /sys${DEVPATH}/macaddress
                ;;
+       tew827dru)
+               echo $(macaddr_add $(mtd_get_mac_ascii APPSBLENV wan_mac) 
$(($PHYNBR + 1)) ) > /sys${DEVPATH}/macaddress
+               ;;
        *)
                ;;
 esac
diff --git a/target/linux/ipq806x/base-files/lib/ipq806x.sh 
b/target/linux/ipq806x/base-files/lib/ipq806x.sh
index 0b11b72..ffd08ea 100644
--- a/target/linux/ipq806x/base-files/lib/ipq806x.sh
+++ b/target/linux/ipq806x/base-files/lib/ipq806x.sh
@@ -38,6 +38,9 @@ ipq806x_board_detect() {
        *"R7800")
                name="r7800"
                ;;
+       "TRENDnet TEW-827DRU")
+               name="tew827dru"
+               ;;
        esac
 
        [ -z "$name" ] && name="unknown"
diff --git a/target/linux/ipq806x/base-files/lib/preinit/06_set_iface_mac 
b/target/linux/ipq806x/base-files/lib/preinit/06_set_iface_mac
new file mode 100644
index 0000000..b4ed225
--- /dev/null
+++ b/target/linux/ipq806x/base-files/lib/preinit/06_set_iface_mac
@@ -0,0 +1,23 @@
+#!/bin/sh
+#
+# Copyright (c) 2014 The Linux Foundation. All rights reserved.
+#
+
+set_ether_mac() {
+       . /lib/functions/uci-defaults.sh
+       . /lib/ipq806x.sh
+       . /lib/functions/system.sh
+
+       board=$(ipq806x_board_name)
+
+       case "$board" in
+       tew827dru)
+               # Set the correct ethernet MAC addresses per OEM intent.
+               ifconfig eth0 hw ether $(mtd_get_mac_ascii APPSBLENV wan_mac) 
2>/dev/null
+               ifconfig eth1 hw ether $(mtd_get_mac_ascii APPSBLENV lan_mac) 
2>/dev/null
+               ;;
+       esac
+
+}
+
+boot_hook_add preinit_main set_ether_mac
diff --git a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh 
b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
index 7726abb..69bda42 100644
--- a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
@@ -11,7 +11,8 @@ platform_check_image() {
        ea8500 |\
        r7500 |\
        r7500v2 |\
-       r7800)
+       r7800 |\
+       tew827dru)
                nand_do_platform_check $board $1
                return $?;
                ;;
@@ -36,7 +37,8 @@ platform_pre_upgrade() {
        d7800 |\
        r7500 |\
        r7500v2 |\
-       r7800)
+       r7800 |\
+       tew827dru)
                nand_do_upgrade "$1"
                ;;
        ea8500)
diff --git 
a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-tew827dru.dts 
b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-tew827dru.dts
new file mode 100644
index 0000000..8f1585f
--- /dev/null
+++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-tew827dru.dts
@@ -0,0 +1,354 @@
+#include "qcom-ipq8064-v1.0.dtsi"
+#include <dt-bindings/input/input.h>
+
+/ {
+       model = "TRENDnet TEW-827DRU";
+       compatible = "trendnet,tew827dru", "qcom,ipq8064";
+
+       memory@0 {
+               reg = <0x42000000 0x1e000000>;
+               device_type = "memory";
+       };
+
+       reserved-memory {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+               rsvd@41200000 {
+                       reg = <0x41200000 0x300000>;
+                       no-map;
+               };
+       };
+
+       aliases {
+               serial0 = &uart4;
+               mdio-gpio0 = &mdio0;
+       };
+
+       chosen {
+               bootargs = "console=ttyMSM0,115200n8 ubi.mtd=11 ubi.block=0,1 
root=/dev/ubiblock0_1 rootfstype=squashfs";
+               linux,stdout-path = "serial0:115200n8";
+
+       };
+
+       soc {
+               pinmux@800000 {
+                       i2c4_pins: i2c4_pinmux {
+                               pins = "gpio12", "gpio13";
+                               function = "gsbi4";
+                               bias-disable;
+                       };
+
+                       spi_pins: spi_pins {
+                               mux {
+                                       pins = "gpio18", "gpio19", "gpio21";
+                                       function = "gsbi5";
+                                       drive-strength = <10>;
+                                       bias-none;
+                               };
+                       };
+                       nand_pins: nand_pins {
+                               mux {
+                                       pins = "gpio34", "gpio35", "gpio36",
+                                              "gpio37", "gpio38", "gpio39",
+                                              "gpio40", "gpio41", "gpio42",
+                                              "gpio43", "gpio44", "gpio45",
+                                              "gpio46", "gpio47";
+                                       function = "nand";
+                                       drive-strength = <10>;
+                                       bias-disable;
+                               };
+                               pullups {
+                                       pins = "gpio39";
+                                       bias-pull-up;
+                               };
+                               hold {
+                                       pins = "gpio40", "gpio41", "gpio42",
+                                              "gpio43", "gpio44", "gpio45",
+                                              "gpio46", "gpio47";
+                                       bias-bus-hold;
+                               };
+                       };
+
+                       mdio0_pins: mdio0_pins {
+                               mux {
+                                       pins = "gpio0", "gpio1";
+                                       function = "gpio";
+                                       drive-strength = <8>;
+                                       bias-disable;
+                               };
+                       };
+
+                       rgmii2_pins: rgmii2_pins {
+                               mux {
+                                       pins = "gpio27", "gpio28", "gpio29", 
"gpio30", "gpio31", "gpio32",
+                                              "gpio51", "gpio52", "gpio59", 
"gpio60", "gpio61", "gpio62" ;
+                                       function = "rgmii2";
+                                       drive-strength = <8>;
+                                       bias-disable;
+                               };
+                       };
+               };
+
+               gsbi@16300000 {
+                       qcom,mode = <GSBI_PROT_I2C_UART>;
+                       status = "ok";
+
+                       uart4: serial@16340000 {
+                               status = "ok";
+                       };
+                       /*
+                        * The i2c device on gsbi4 should not be enabled.
+                        * On ipq806x designs gsbi4 i2c is meant for exclusive
+                        * RPM usage. Turning this on in kernel manifests as
+                        * i2c failure for the RPM.
+                        */
+               };
+
+               phy@100f8800 {          /* USB3 port 1 HS phy */
+                       status = "ok";
+               };
+
+               phy@100f8830 {          /* USB3 port 1 SS phy */
+                       status = "ok";
+               };
+
+               phy@110f8800 {          /* USB3 port 0 HS phy */
+                       status = "ok";
+               };
+
+               phy@110f8830 {          /* USB3 port 0 SS phy */
+                       status = "ok";
+               };
+
+               usb30@0 {
+                       status = "ok";
+               };
+
+               usb30@1 {
+                       status = "ok";
+               };
+
+               pcie0: pci@1b500000 {
+                       status = "ok";
+                       phy-tx0-term-offset = <7>;
+               };
+
+               pcie1: pci@1b700000 {
+                       status = "ok";
+                       phy-tx0-term-offset = <7>;
+               };
+
+               pcie2: pci@1b900000 {
+                       status = "ok";
+                       phy-tx0-term-offset = <7>;
+               };
+
+               nand@1ac00000 {
+                       status = "ok";
+
+                       pinctrl-0 = <&nand_pins>;
+                       pinctrl-names = "default";
+
+                       nand-ecc-strength = <4>;
+                       nand-bus-width = <8>;
+
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+
+                       SBL1@0 {
+                               label = "SBL1";
+                               reg = <0x0000000 0x0040000>;
+                               read-only;
+                       };
+
+                       MIBIB@40000 {
+                               label = "MIBIB";
+                               reg = <0x0040000 0x0140000>;
+                               read-only;
+                       };
+
+                       SBL2@180000 {
+                               label = "SBL2";
+                               reg = <0x0180000 0x0140000>;
+                               read-only;
+                       };
+
+                       SBL3@2c0000 {
+                               label = "SBL3";
+                               reg = <0x02c0000 0x0280000>;
+                               read-only;
+                       };
+
+                       DDRCONFIG@540000 {
+                               label = "DDRCONFIG";
+                               reg = <0x0540000 0x0120000>;
+                               read-only;
+                       };
+
+                       SSD@660000 {
+                               label = "SSD";
+                               reg = <0x0660000 0x0120000>;
+                               read-only;
+                       };
+
+                       TZ@780000 {
+                               label = "TZ";
+                               reg = <0x0780000 0x0280000>;
+                               read-only;
+                       };
+
+                       RPM@a00000 {
+                               label = "RPM";
+                               reg = <0x0a00000 0x0280000>;
+                               read-only;
+                       };
+
+                       APPSBL@53a0000 {
+                               label = "APPSBL";
+                               reg = <0x53a0000 0x500000>;
+                               read-only;
+                       };
+
+                       APPSBLENV@1180000{
+                               label = "APPSBLENV";
+                               reg = <0x1180000 0x80000>;
+                               read-only;
+                       };
+
+                       ART@1180000 {
+                               label = "ART";
+                               reg = <0x1200000 0x140000>;
+                               read-only;
+                       };
+
+                       rootfs@58a0000 {
+                               label = "rootfs";
+                               reg = <0x58a0000 0x4000000>;
+                       };
+
+                       BOOTCONFIG@5340000{
+                               label = "BOOTCONFIG";
+                               reg = <0x5340000 0x60000>;
+                               read-only;
+                       };
+
+                       APPSBL_1@c80000{
+                               label = "APPSBL_1";
+                               reg = <0xc80000 0x500000>;
+                               read-only;
+                       };
+
+                       rootfs_1@1340000 {
+                               label = "rootfs_1";
+                               reg = <0x1340000 0x4000000>;
+                       };
+
+               };
+
+               mdio0: mdio {
+                       compatible = "virtual,mdio-gpio";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       gpios = <&qcom_pinmux 1 0 &qcom_pinmux 0 0>;
+                       pinctrl-0 = <&mdio0_pins>;
+                       pinctrl-names = "default";
+
+                       phy0: ethernet-phy@0 {
+                               device_type = "ethernet-phy";
+                               reg = <0>;
+                               qca,ar8327-initvals = <
+                                       0x00004 0x7600000   /* PAD0_MODE */
+                                       0x00008 0x1000000   /* PAD5_MODE */
+                                       0x0000c 0x80        /* PAD6_MODE */
+                                       0x000e4 0x6a545     /* MAC_POWER_SEL */
+                                       0x000e0 0xc74164de  /* SGMII_CTRL */
+                                       0x0007c 0x4e        /* PORT0_STATUS */
+                                       0x00094 0x4e        /* PORT6_STATUS */
+                                       >;
+                       };
+
+                       phy4: ethernet-phy@4 {
+                               device_type = "ethernet-phy";
+                               reg = <4>;
+                       };
+               };
+
+               // WAN eth0
+               gmac1: ethernet@37200000 {
+                       status = "ok";
+                       phy-mode = "rgmii";
+                       qcom,id = <1>;
+                       qcom,phy_mdio_addr = <4>;
+                       qcom,poll_required = <1>;
+                       qcom,rgmii_delay = <0>;
+                       qcom,emulation = <0>;
+                       pinctrl-0 = <&rgmii2_pins>;
+                       pinctrl-names = "default";
+                       fixed-link {
+                               speed = <1000>;
+                               full-duplex;
+                       };
+               };
+
+               // LAN eth1
+               gmac2: ethernet@37400000 {
+                       status = "ok";
+                       phy-mode = "sgmii";
+                       qcom,id = <2>;
+                       qcom,phy_mdio_addr = <0>;       /* none */
+                       qcom,poll_required = <0>;       /* no polling */
+                       qcom,rgmii_delay = <0>;
+                       qcom,emulation = <0>;
+                       fixed-link {
+                               speed = <1000>;
+                               full-duplex;
+                       };
+               };
+
+       };
+
+       gpio-keys {
+               compatible = "gpio-keys";
+
+               rfkill {
+                       label = "rfkill";
+                       gpios = <&qcom_pinmux 9 1>;
+                       linux,code = <KEY_RFKILL>;
+               };
+
+               reset {
+                       label = "reset";
+                       gpios = <&qcom_pinmux 54 1>;
+                       linux,code = <KEY_RESTART >;
+               };
+
+               wps {
+                       label = "wps";
+                       gpios = <&qcom_pinmux 67 1>;
+                       linux,code = <KEY_WPS_BUTTON>;
+               };
+       };
+
+       gpio-leds {
+               compatible = "gpio-leds";
+
+               usb {
+                       label = "tew827dru:blue:usb";
+                       gpios = <&qcom_pinmux 7 1>;
+                       default-state = "off";
+               };
+
+               power {
+                       label = "tew827dru:blue:power";
+                       gpios = <&qcom_pinmux 53 1>;
+                       default-state = "off";
+                       linux,default-trigger = "heartbeat";
+               };
+       };
+};
+
+&adm_dma {
+       status = "ok";
+};
+
diff --git a/target/linux/ipq806x/image/Makefile 
b/target/linux/ipq806x/image/Makefile
index ff5be05..6ca776a 100644
--- a/target/linux/ipq806x/image/Makefile
+++ b/target/linux/ipq806x/image/Makefile
@@ -90,6 +90,35 @@ define Device/TpSafeImage
 endef
 DEVICE_VARS += TPLINK_BOARD_NAME
 
+define Build/mkfit-TEW827DRU
+       $(TOPDIR)/scripts/its-maker.sh \
+               --device $(DEVICE_NAME) \
+               -O $@.its \
+               --img-name 0 script \
+               --img-descr 0 "u-boot-HTTP firmware update script" \
+               --img-file 0 
$(TOPDIR)/target/linux/ipq806x/image/tew827dru-flash.scr \
+               --img-type 0 script --img-arch 0 $(ARCH) \
+               --img-compression 0 none \
+               --img-hashes 0 crc32 \
+               --img-name 1 ubi-image \
+               --img-descr 1 "UBI rootfs image" \
+               --img-file 1 $@ \
+               --img-type 1 firmware \
+               --img-arch 1 $(ARCH) \
+               --img-compression 1 none \
+               --img-hashes 1 crc32 \
+               --img-name 2 bootconfig \
+               --img-descr 2 "BOOTCONFIG: boot from APPSBL and rootfs" \
+               --img-file 2 
$(TOPDIR)/target/linux/ipq806x/image/tew827dru-bootconfig.bin \
+               --img-type 2 firmware \
+               --img-arch 2 $(ARCH) \
+               --img-compression 2 none \
+               --img-hashes 2 crc32
+       PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.fit
+       @rm $@.its
+       @mv $@.fit $@
+endef
+
 define Device/AP148
        $(call Device/FitImage)
        $(call Device/UbiFit)
@@ -201,6 +230,23 @@ define Device/R7800
        DEVICE_PACKAGES := ath10k-firmware-qca9984
 endef
 
-TARGET_DEVICES += AP148 AP148-legacy C2600 D7800 DB149 EA8500 R7500 R7500v2 
R7800
+define Device/TEW827DRU
+       DEVICE_DTS := qcom-ipq8064-tew827dru
+       BLOCKSIZE := 128KiB
+       PAGESIZE := 2048
+       FILESYSTEMS := squashfs
+       KERNEL_SUFFIX := -uImage
+       KERNEL = kernel-bin | append-dtb | uImage none | pad-to 2k
+       KERNEL_NAME := zImage
+       KERNEL_IN_UBI := 1
+       IMAGES := factory.bin sysupgrade.tar
+       IMAGE/factory.bin := append-ubi | mkfit-TEW827DRU | cameo-sig 
AP148AR9880-RT-150127-00
+       IMAGE/sysupgrade.tar := sysupgrade-tar
+       BOARD_NAME := tew827dru
+       DEVICE_TITLE := TRENDnet TEW-827DRU
+       DEVICE_PACKAGES := ath10k-firmware-qca99x0
+endef
+
+TARGET_DEVICES += AP148 AP148-legacy C2600 D7800 DB149 EA8500 R7500 R7500v2 
R7800 TEW827DRU
 
 $(eval $(call BuildImage))
diff --git a/target/linux/ipq806x/image/tew827dru-bootconfig.bin 
b/target/linux/ipq806x/image/tew827dru-bootconfig.bin
new file mode 100644
index 
0000000000000000000000000000000000000000..16816a91a70ad71120c49a1ab7f13681cb023a65
GIT binary patch
literal 84
zcmZ3maPd+GAYcY!11raXfM6#d5FZQ}AyiR*eo0y}R18Ex#j{h3@=|k<#Gy<86T}JG

literal 0
HcmV?d00001

diff --git a/target/linux/ipq806x/image/tew827dru-flash.scr 
b/target/linux/ipq806x/image/tew827dru-flash.scr
new file mode 100644
index 0000000..3cdc42e
--- /dev/null
+++ b/target/linux/ipq806x/image/tew827dru-flash.scr
@@ -0,0 +1,57 @@
+# TRENDnet TEW-827DRU 1.0R u-boot script.
+# This script is read and executed by the uboot-HTTP recovery loader.
+# The OEM HTTP firmware upgrader does not use this file.
+# WARNING: Be extremely careful editing this script. A mistake could brick 
devices.
+# 
+# "setenv imgaddr 0x42000000" is automatically set for us by the recovery tool.
+# imxtract automatically sets the $fileaddr and $filesize environment 
variables for the extracted image.
+
+echo ""
+echo "------------------------------------------------------------"
+echo ""
+echo "LEDE TEW-827DRU script START."
+
+# imgaddr=0x42000000
+support_hw_version=V1.0R
+support_machid=1260
+rootfs_nand_addr=0x58a0000
+rootfs_nand_size=0x4000000
+rootfs_1_nand_addr=0x1340000
+rootfs_1_nand_size=0x4000000
+BOOTCONFIG_nand_addr=0x5340000
+BOOTCONFIG_nand_size=0x60000
+
+# --------------------------------------------------
+
+# Validate hardware.
+if test "${hw_version}" != "${support_hw_version}" ; then echo "Wrong Hardware 
Version: Quitting." ; exit 1 ; fi
+if test "${machid}" != "${support_machid}" ; then echo "Wrong machine ID: 
Quitting." ; exit 1 ; fi
+
+# Write the UBI image (kernel+rootfs+ubifs)
+echo ""
+echo "Flashing the UBI image..."
+ipq_nand linux || echo "Failed to set ipq_nand: Quitting." && exit 1
+imxtract ${imgaddr} ubi-image || echo "Failed to imxtract the ubi image: 
Quitting." && exit 1
+nand erase ${rootfs_nand_addr} ${rootfs_nand_size} || echo "Failed to nand 
erase: Quitting." && exit 1
+nand write ${fileaddr} ${rootfs_nand_addr} ${filesize} || echo "Failed to nand 
write: Quitting." && exit 1
+echo "Done flashing UBI image."
+
+# Write the bootconfig to set APPSBL/rootfs as active.
+echo ""
+echo "Flashing the BOOTCONFIG image..."
+ipq_nand linux || echo "Failed to set ipq_nand: Quitting." && exit 1
+imxtract ${imgaddr} bootconfig || echo "Failed to imxtract the bootconfig 
image: Quitting." && exit 1
+nand erase ${BOOTCONFIG_nand_addr} ${BOOTCONFIG_nand_size} || echo "Failed to 
nand erase: Quitting." && exit 1
+# We need to write 0x800 instead of filesize for the bootconfig, due to page 
size.
+nand write ${fileaddr} ${BOOTCONFIG_nand_addr} 0x800 || echo "Failed to nand 
write: Quitting." && exit 1
+echo "Done flashing BOOTCONFIG image."
+
+echo ""
+echo "LEDE TEW-827DRU script END."
+echo ""
+echo "------------------------------------------------------------"
+echo ""
+exit 0
+
+# The u-boot HTTP loader will automatically reboot the system after exit.
+
diff --git a/target/linux/ipq806x/patches-4.4/800-devicetree.patch 
b/target/linux/ipq806x/patches-4.4/800-devicetree.patch
index 85f2534..ae174fd 100644
--- a/target/linux/ipq806x/patches-4.4/800-devicetree.patch
+++ b/target/linux/ipq806x/patches-4.4/800-devicetree.patch
@@ -12,7 +12,7 @@ Signed-off-by: Jonas Gorski <j...@openwrt.org>
 
 --- a/arch/arm/boot/dts/Makefile
 +++ b/arch/arm/boot/dts/Makefile
-@@ -506,7 +506,13 @@ dtb-$(CONFIG_ARCH_QCOM) += \
+@@ -506,7 +506,14 @@ dtb-$(CONFIG_ARCH_QCOM) += \
        qcom-apq8084-ifc6540.dtb \
        qcom-apq8084-mtp.dtb \
        qcom-ipq8064-ap148.dtb \
@@ -23,6 +23,7 @@ Signed-off-by: Jonas Gorski <j...@openwrt.org>
 +      qcom-ipq8064-r7500.dtb \
 +      qcom-ipq8064-r7500v2.dtb \
 +      qcom-ipq8065-r7800.dtb \
++      qcom-ipq8064-tew827dru.dtb \
        qcom-msm8660-surf.dtb \
        qcom-msm8960-cdp.dtb \
        qcom-msm8974-sony-xperia-honami.dtb
-- 
2.9.3


_______________________________________________
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev

Reply via email to