Adding OpenWrt support for a Trendnet TEW-827DRU-V2

The Trendnet TEW-827DRU-V2 is a downgrade from V1 with a slower CPU and less flash/ram.
MT7621a 880Mhz dual core
16MB SPI Flash/128MB DDR3 ram
2 x MT7615E
1 USB3

Mine was easy to open and appears well made with RF shields, thermal pads and good sized heatsink.
The serial header, near the board edge with the leds, is 8 1 57600. From the led edge GND,TX,RX Key parts of the log:
flash: MX25L12805D

[    2.512000] 0x000000000000-0x000001000000 : "ALL"
[    2.520000] 0x000000000000-0x000000030000 : "Bootloader"
[    2.532000] 0x000000030000-0x000000040000 : "Config"
[    2.544000] 0x000000040000-0x000000050000 : "Factory"
[    2.552000] 0x000000050000-0x000000ef0000 : "firmware"
[    2.564000] 0x000000050000-0x000000380000 : "kernel"
[    2.576000] 0x000000380000-0x000000ef0000 : "rootfs"
[    2.584000] 0x000000ef0000-0x000000ff0000 : "rootfs_data"
[    2.596000] 0x000000ff0000-0x000001000000 : "art_block"

The closest OpenWrt supported devices was the IpTime A8004t and here is my preliminary edit of the IpTime *dts

// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;

#include "mt7621.dtsi"

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>

/ {
	compatible = "trendnet,tew-827dru-v2", "mediatek,mt7621-soc";
	model = "TRENDNET TEW-827DRU v2";

	aliases {
		led-boot = &led_cpu;
		led-failsafe = &led_cpu;
		led-running = &led_cpu;
		led-upgrade = &led_cpu;
	};

	leds {
		compatible = "gpio-leds";


		wlan2g {
			label = "tew-827dru-v2:blue:wlan2g";
			gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
			linux,default-trigger = "phy0radio";
		};

		wlan5g {
			label = "tew-827dru-v2:blue:wlan5g";
			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
			linux,default-trigger = "phy1radio";
		};
	};

	keys {
		compatible = "gpio-keys";

		reset {
			label = "reset";
			gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_RESTART>;
		};

		wps {
			label = "wps";
			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_WPS_BUTTON>;
		};
	};
};

&spi0 {
	status = "okay";

	flash@0 {
		compatible = "jedec,spi-nor";
		reg = <0>;
		spi-max-frequency = <50000000>;

		partitions {
			compatible = "fixed-partitions";
			#address-cells = <1>;
			#size-cells = <1>;

			uboot: partition@0 {
				label = "u-boot";
				reg = <0x0 0x30000>;
				read-only;
			};

			partition@30000 {
				label = "config";
				reg = <0x30000 0x10000>;
				read-only;
			};

			factory: partition@40000 {
				label = "factory";
				reg = <0x40000 0x10000>;
				read-only;
			};

			partition@50000 {
				compatible = "denx,uimage";
				label = "firmware";
				reg = <0x50000 0xfc0000>;
			};
		};
	};
};

&gmac0 {
	mtd-mac-address = <&uboot 0x1fc20>;
};

&switch0 {
	ports {
		port@0 {
			status = "okay";
			label = "wan";
			mtd-mac-address = <&uboot 0x1fc40>;
		};

		port@1 {
			status = "okay";
			label = "lan4";
		};

		port@2 {
			status = "okay";
			label = "lan3";
		};

		port@3 {
			status = "okay";
			label = "lan2";
		};

		port@4 {
			status = "okay";
			label = "lan1";
		};
	};
};

&pcie {
	status = "okay";
};

&pcie0 {
	wifi@0,0 {
		compatible = "mediatek,mt76";
		reg = <0x0000 0 0 0 0>;
		mediatek,mtd-eeprom = <&factory 0x0000>;
		ieee80211-freq-limit = <2400000 2500000>;
	};
};

&pcie1 {
	wifi@0,0 {
		compatible = "mediatek,mt76";
		reg = <0x0000 0 0 0 0>;
		mediatek,mtd-eeprom = <&factory 0x8000>;
		ieee80211-freq-limit = <5000000 6000000>;
	};
};

&state_default {
	gpio {
		groups = "wdt", "jtag", "i2c";
		function = "gpio";
	};
};

I found an art_block in a the mt7621_elecom_wrc-2533gst.dts so I think I need to add this and perhaps some additional partitions. I also will need to add some additional GPIO's once I can interogate it. Any guidance thankfully accepted.

I went ahead and added all the OEM partitions into my *.dts

// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;

#include "mt7621.dtsi"

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>

/ {
	compatible = "trendnet,tew-827dru-v2", "mediatek,mt7621-soc";
	model = "TRENDNET TEW-827DRU v2";

	aliases {
		led-boot = &led_cpu;
		led-failsafe = &led_cpu;
		led-running = &led_cpu;
		led-upgrade = &led_cpu;
	};

	leds {
		compatible = "gpio-leds";


		wlan2g {
			label = "tew-827dru-v2:blue:wlan2g";
			gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
			linux,default-trigger = "phy0radio";
		};

		wlan5g {
			label = "tew-827dru-v2:blue:wlan5g";
			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
			linux,default-trigger = "phy1radio";
		};
	};

	keys {
		compatible = "gpio-keys";

		reset {
			label = "reset";
			gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_RESTART>;
		};

		wps {
			label = "wps";
			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_WPS_BUTTON>;
		};
	};
};

&spi0 {
	status = "okay";

	flash@0 {
		compatible = "jedec,spi-nor";
		reg = <0>;
		spi-max-frequency = <50000000>;

		partitions {
			compatible = "fixed-partitions";
			#address-cells = <1>;
			#size-cells = <1>;

			uboot: partition@0 {
				label = "u-boot";
				reg = <0x0 0x30000>;
				read-only;
			};

			partition@30000 {
				label = "config";
				reg = <0x30000 0x10000>;
				read-only;
			};

			factory: partition@40000 {
				label = "factory";
				reg = <0x40000 0x10000>;
				read-only;
			};

			partition@50000 {
				compatible = "denx,uimage";
				label = "firmware";
				reg = <0x50000 0xff0000>;
			};

			partition@50000 {
				label = "kernel";
				reg = <0x50000 0x380000>;
			}; 

			partition@0xff0000 {
				label = "art_block";
				reg = <0xff0000 0x1000000>;
				read-only;
			};
		};
	};
};

&gmac0 {
	mtd-mac-address = <&uboot 0x1fc20>;
};

&switch0 {
	ports {
		port@0 {
			status = "okay";
			label = "wan";
			mtd-mac-address = <&uboot 0x1fc40>;
		};

		port@1 {
			status = "okay";
			label = "lan4";
		};

		port@2 {
			status = "okay";
			label = "lan3";
		};

		port@3 {
			status = "okay";
			label = "lan2";
		};

		port@4 {
			status = "okay";
			label = "lan1";
		};
	};
};

&pcie {
	status = "okay";
};

&pcie0 {
	wifi@0,0 {
		compatible = "mediatek,mt76";
		reg = <0x0000 0 0 0 0>;
		mediatek,mtd-eeprom = <&factory 0x0000>;
		ieee80211-freq-limit = <2400000 2500000>;
	};
};

&pcie1 {
	wifi@0,0 {
		compatible = "mediatek,mt76";
		reg = <0x0000 0 0 0 0>;
		mediatek,mtd-eeprom = <&factory 0x8000>;
		ieee80211-freq-limit = <5000000 6000000>;
	};
};

&state_default {
	gpio {
		groups = "wdt", "jtag", "i2c";
		function = "gpio";
	};
};

Some prior guidance from @123serge123

BTW, openwrt split "firmware" partition into "rootfs" and "rootfs_data" (skipping "kernel") dynamically at boot with special mtd-parser:

I expanded erasesize of partition@0x50000 to 0xff0000 and deleted the rootfs and rootfs_data

Will try to build/test.

Edit: Still have this wrong getting. Hexadecimal math is not a strong point

Just for clarification:
reg = <a b>;
means
reg = <start_offset length>;
not
reg = <start_offset end_offset>;

The OEM dmesg partitions are <start_offset end_offset> but the *.dts needs <start_offset length>;

The initial partitions up to partition@0x50000 I think are good.

// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;

#include "mt7621.dtsi"

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>

/ {
	compatible = "trendnet,tew-827dru-v2", "mediatek,mt7621-soc";
	model = "TRENDNET TEW-827DRU v2";

	aliases {
		led-boot = &led_cpu;
		led-failsafe = &led_cpu;
		led-running = &led_cpu;
		led-upgrade = &led_cpu;
	};

	leds {
		compatible = "gpio-leds";


		wlan2g {
			label = "tew-827dru-v2:blue:wlan2g";
			gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
			linux,default-trigger = "phy0radio";
		};

		wlan5g {
			label = "tew-827dru-v2:blue:wlan5g";
			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
			linux,default-trigger = "phy1radio";
		};
	};

	keys {
		compatible = "gpio-keys";

		reset {
			label = "reset";
			gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_RESTART>;
		};

		wps {
			label = "wps";
			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_WPS_BUTTON>;
		};
	};
};

&spi0 {
	status = "okay";

	flash@0 {
		compatible = "jedec,spi-nor";
		reg = <0>;
		spi-max-frequency = <50000000>;

		partitions {
			compatible = "fixed-partitions";
			#address-cells = <1>;
			#size-cells = <1>;

			uboot: partition@0 {
				label = "u-boot";
				reg = <0x0 0x30000>;
				read-only;
			};

			partition@30000 {
				label = "config";
				reg = <0x30000 0x10000>;
				read-only;
			};

			factory: partition@40000 {
				label = "factory";
				reg = <0x40000 0x10000>;
				read-only;
			};

			partition@50000 {
				compatible = "denx,uimage";
				label = "firmware";
				reg = <0x50000 0xff0000>;
			};

			partition@0xff0000 {
				label = "art_block";
				reg = <0xff0000 0x002da0>;
				read-only;
			};
		};
	};
};

&gmac0 {
	mtd-mac-address = <&uboot 0x1fc20>;
};

&switch0 {
	ports {
		port@0 {
			status = "okay";
			label = "wan";
			mtd-mac-address = <&uboot 0x1fc40>;
		};

		port@1 {
			status = "okay";
			label = "lan4";
		};

		port@2 {
			status = "okay";
			label = "lan3";
		};

		port@3 {
			status = "okay";
			label = "lan2";
		};

		port@4 {
			status = "okay";
			label = "lan1";
		};
	};
};

&pcie {
	status = "okay";
};

&pcie0 {
	wifi@0,0 {
		compatible = "mediatek,mt76";
		reg = <0x0000 0 0 0 0>;
		mediatek,mtd-eeprom = <&factory 0x0000>;
		ieee80211-freq-limit = <2400000 2500000>;
	};
};

&pcie1 {
	wifi@0,0 {
		compatible = "mediatek,mt76";
		reg = <0x0000 0 0 0 0>;
		mediatek,mtd-eeprom = <&factory 0x8000>;
		ieee80211-freq-limit = <5000000 6000000>;
	};
};

&state_default {
	gpio {
		groups = "wdt", "jtag", "i2c";
		function = "gpio";
	};
};

What I'm confused about is the mtd_parser expansion of partition@0x50000. Does this produce kernel, rootfs and rootfs_data? If I need to add the art_block, is it easiest to calculate the size, subtract it from the end and convert to hexadecimal to get the art_block start? Do I need to make adjustments to partition@0x50000/firmware to leave space for the art_block?

If you are using Ubuntu or similar the calculator has a "programming mode" where you add or substract in Hex.

I am no expert but by the look of it your "firmware" partition stops at rootfs and does not include "rootfs_data".

The size in this case is 0xef0000 - 0x50000 = EA0000
If you are including the rootfs_data it should be FA0000 (please recalculate as well just in case)

You should post the whole bootlog here of the factory firmware as it will give more info.

I presently have xcalc (-rpn) which is a TI-30, or HP-10 when run with the -rpn flag. Doesn't have a programming mode. If a programming calculator is recommended, I can install, Debian 10. I've been using an online hexadecimal calculator to check my math.

I would like to understand this a little more, particularly the part where "firmware" is expanded at boot because there is also a "kernel" partition in my dmesg (1700+ lines of code which is not pasting into a pre-formatted box). Right now I'm acting on the assumption that "kernel", "rootfs" and "rootfs_data are generated at boot and to add the art_block, I need to work backwards from the end of the available space.

I think I have this: I made @karw200 adjustment to the size and added the art_block

// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;

#include "mt7621.dtsi"

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>

/ {
	compatible = "trendnet,tew-827dru-v2", "mediatek,mt7621-soc";
	model = "TRENDNET TEW-827DRU v2";

	leds {
		compatible = "gpio-leds";


		wlan2g {
			label = "tew-827dru-v2:blue:wlan2g";
			gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
			linux,default-trigger = "phy0radio";
		};

		wlan5g {
			label = "tew-827dru-v2:blue:wlan5g";
			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
			linux,default-trigger = "phy1radio";
		};
	};

	keys {
		compatible = "gpio-keys";

		reset {
			label = "reset";
			gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_RESTART>;
		};

		wps {
			label = "wps";
			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_WPS_BUTTON>;
		};
	};
};

&spi0 {
	status = "okay";

	flash@0 {
		compatible = "jedec,spi-nor";
		reg = <0>;
		spi-max-frequency = <50000000>;

		partitions {
			compatible = "fixed-partitions";
			#address-cells = <1>;
			#size-cells = <1>;

			uboot: partition@0 {
				label = "u-boot";
				reg = <0x0 0x30000>;
				read-only;
			};

			partition@30000 {
				label = "config";
				reg = <0x30000 0x10000>;
				read-only;
			};

			factory: partition@40000 {
				label = "factory";
				reg = <0x40000 0x10000>;
				read-only;
			};

			partition@50000 {
				compatible = "denx,uimage";
				label = "firmware";
				reg = <0x50000 0xf90000>;
			};

			partition@0xff0000 {
				label = "art_block";
				reg = <0xff0000 0x10000>;
				read-only;
			};
		};
	};
};

&gmac0 {
	mtd-mac-address = <&uboot 0x1fc20>;
};

&switch0 {
	ports {
		port@0 {
			status = "okay";
			label = "wan";
			mtd-mac-address = <&uboot 0x1fc40>;
		};

		port@1 {
			status = "okay";
			label = "lan4";
		};

		port@2 {
			status = "okay";
			label = "lan3";
		};

		port@3 {
			status = "okay";
			label = "lan2";
		};

		port@4 {
			status = "okay";
			label = "lan1";
		};
	};
};

&pcie {
	status = "okay";
};

&pcie0 {
	wifi@0,0 {
		compatible = "mediatek,mt76";
		reg = <0x0000 0 0 0 0>;
		mediatek,mtd-eeprom = <&factory 0x0000>;
		ieee80211-freq-limit = <2400000 2500000>;
	};
};

&pcie1 {
	wifi@0,0 {
		compatible = "mediatek,mt76";
		reg = <0x0000 0 0 0 0>;
		mediatek,mtd-eeprom = <&factory 0x8000>;
		ieee80211-freq-limit = <5000000 6000000>;
	};
};

&state_default {
	gpio {
		groups = "wdt", "jtag", "i2c";
		function = "gpio";
	};
};

With the following image/mt7621.mk entry

define Device/trendnet_tew-827dru-v2
  DEVICE_VENDOR := TRENDnet
  IMAGE_SIZE := 16000k
  DEVICE_MODEL := TEW-827DRU
  DEVICE_VARIANT := V2
  DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3 wpad-basic
endef
TARGET_DEVICES += trendnet_tew-827dru-v2

I'll try to run the initramfs image tomorrow to fill out the led gpio's

Something is still not correct. Your facotry (0x50000+0xf90000) is 0xfe0000 and not 0xff0000.

When you say it is not working what do you mean? Do you actually flash it and it doesn't boot or what is it.

Again best way to go about this to have access to the console first and post the whole bootlog. Then try and get a copy of your whole flash just in case.

You can then start flashing away as long as you know you can get back to factory in case you brick your device (which seems highly likely with the way your partitions are defined in the dts).

Also are you sure that the WAN mac address resides in the uboot partiton and not in the factory one? I am only a noob but seen in many dlink mt7621 devices the mac address is in the factory partiton.

Changed to 0x50000 + 0xfa00000

I used the *dts from the IPtime A8004t that also uses mt7615e drivers

Here are the MAC Snippets from the trendnet tew-827dru v2 serial output

[    3.044000] DriverOwn()::Success to clear FW Own
[    3.052000] mt_pci_chip_cfg(): HWVer=0x8a10, FWVer=0x8a10, pAd->ChipID=0x7615
[    3.064000] mt_pci_chip_cfg(): HIF_SYS_REV=0x76150001
[    3.076000] RtmpChipOpsHook(493): Not support for HIF_MT yet! MACVersion=0x0
....
[    3.856000] GMAC1_MAC_ADRH -- : 0x0000d8eb
[    3.864000] GMAC1_MAC_ADRL -- : 0x9733d8e3
[    3.872000] Ralink APSoC Ethernet Driver Initilization. v3.1  1024 rx/tx descriptors allocated, mtu = 1500!
[    3.892000] GMAC1_MAC_ADRH -- : 0x0000d8eb
[    3.900000] GMAC1_MAC_ADRL -- : 0x9733d8e3
[    3.908000] PROC INIT OK!
.....
[   16.868000] set LAN/WAN LLLLW
[   16.880000] GMAC1_MAC_ADRH -- : 0x0000d8eb
[   16.888000] GMAC1_MAC_ADRL -- : 0x9733d8e3
[   16.896000] GDMA2_MAC_ADRH -- : 0x0000d8eb
[   16.904000] GDMA2_MAC_ADRL -- : 0x9733d8e4
....
[   64.980000] mt7615_init_mac_cr(): TMAC_TRCR0=0x82783c8c
[   64.992000] MtAsicSetMacMaxLen(1290): Not finish Yet!
[   65.000000] <--mt_mac_init()
[   65.008000] CmdRxHdrTransBLUpdateRsp::EventExtCmdResult.u4Status = 0x0
[   65.024000] CmdRxHdrTransBLUpdateRsp::EventExtCmdResult.u4Status = 0x0
[   65.036000] CmdRxHdrTransBLUpdateRsp::EventExtCmdResult.u4Status = 0x0
[   65.048000] MAC Init Done!
....
[   80.576000] EEPROM Init Done!
[   80.584000] mt_mac_init()-->
[   80.588000] mt_mac_pse_init(2716): Don't Support this now!
[   80.600000] mt7615_init_mac_cr()-->
[   80.604000] mt7615_init_mac_cr(): TMAC_TRCR0=0x82783c8c
[   80.616000] MtAsicSetMacMaxLen(1290): Not finish Yet!
[   80.628000] <--mt_mac_init()
[   80.632000] CmdRxHdrTransBLUpdateRsp::EventExtCmdResult.u4Status = 0x0
[   80.644000] CmdRxHdrTransBLUpdateRsp::EventExtCmdResult.u4Status = 0x0
[   80.660000] CmdRxHdrTransBLUpdateRsp::EventExtCmdResult.u4Status = 0x0
[   80.672000] MAC Init Done!
....
[   96.812000] mt_mac_init()-->
[   96.816000] mt_mac_pse_init(2716): Don't Support this now!
[   96.828000] mt7615_init_mac_cr()-->
[   96.836000] mt7615_init_mac_cr(): TMAC_TRCR0=0x82783c8c
[   96.844000] MtAsicSetMacMaxLen(1290): Not finish Yet!
[   96.856000] <--mt_mac_init()
[   96.864000] CmdRxHdrTransBLUpdateRsp::EventExtCmdResult.u4Status = 0x0
[   96.876000] CmdRxHdrTransBLUpdateRsp::EventExtCmdResult.u4Status = 0x0
[   96.892000] CmdRxHdrTransBLUpdateRsp::EventExtCmdResult.u4Status = 0x0
[   96.904000] MAC Init Done!


Is there a way to interrogate the MAC location. I have a Trendnet update that I can search through.

I did some research on the MAC addresses and found this:

I'm having trouble testing my initial build. Via UART, u-boot zips by any opportunity to choose boot options. I suspect bootdelay is set to 0 as described for the xiaomi 4a:
Xiaomi Mi Router 4A Gigabit Edition (R4AG/R4A Gigabit) -- fully supported and flashable with OpenWRTInvasion,

My ch341a programmer is not detecting the flash chip and I suspect it is bad (there was a spark and the connect led became abnormally hot). I've ordered a new one, but for now, I can't change the u-boot environment commands.

I also can't connect via ssh or telnet. Trendnet's GPL'd source download does not contain telnet or openssh.

The device has a http recovery loader (hold reset during power on x 5 seconds) at 192.168.10.1 as described for another Trendnet device:

Unfortunately, attempting to load my build via the http recovery loader fails - unable to get specific error messages. My other Trendnet device has a cameo signature appended and I pasted the code from an OEM update image onto my image and renamed it factory. It also failed.

Specific to this device, I see a couple of pathways: Hacking u-boot as was done with the Xiaomi, Look into the OpenWrt Invasion program and modifying the sysupgrade.bin image into a factory.bin.

The later looks to be the safest path - I'll split off a thread as it could apply to other devices.

I may have found another upgrade path although I've not seen it described. The GPL'd source came with these files:
GPL_TEW-827DRU_v2/qsdk_gpl/bin/ramips

drwxr-xr-x 2 jsh jsh     4096 Aug 28  2017 manifest
-rw-r--r-- 1 jsh jsh      324 Aug 28  2017 md5sums
-rw-r--r-- 1 jsh jsh 12451840 Aug 28  2017 openwrt-ramips-mt7621-root.squashfs
-rw-r--r-- 1 jsh jsh 14549016 Aug 28  2017 openwrt-ramips-mt7621-uImage.bin
-rwxr-xr-x 1 jsh jsh  5974464 Aug 28  2017 openwrt-ramips-mt7621-vmlinux.bin
-rwxr-xr-x 1 jsh jsh  5979520 Aug 28  2017 openwrt-ramips-mt7621-vmlinux.elf
drwxr-xr-x 2 jsh jsh    20480 Aug 28  2017 packages
-rw-r--r-- 1 jsh jsh  2015231 Aug 28  2017 vmlinux.bin.lzma

I'm wondering if I install openwrt-ramips-mt7621-uImage.bin, should I then be able to upgrade to my build?

This also raises an image question that I will post in a separate thread.

This would most likely brick your device, eventually for good.

No.

1 Like

The OEM system rescue GUI will not flash my build. I have the TTY/USB0 output but u-Boot appears to be locked out; no bootdelay or response to key inputs/

The image I reference in the prior post came with the Trendnet GPL'd source download and the README indicates that is the image I would attempt to flash after building. Note that this image came in the zip download and was not built:

Environment: Ubuntu 14.04 LTS 32bit

.......
clip
.......


4. Install Extra Software Package

$ su test
$ sudo apt-get install build-essential cmake libncurses5-dev zlib1g-dev gawk ccache gettext libssl-dev xsltproc zip ocaml-findlib sharutils automake libtool pkg-config subversion git-core intltool gcc-multilib


5. Setup Toolchain Environment

5.1 Extract the FOSS target

     Copy the FOSS target and extract it

$ cp TEW827DRU_FW200b09_GPL_FOSS.tar.gz /home/test/
$ cd /home/test
$ tar zxvf TEW827DRU_FW200b09_GPL_FOSS.tar.gz

     You will see 4 files TEW827DRU_FW200b09_GPL.tar.gz, uci-for-x86-linux.tgz, toolchain.tar.gz, and README in /home/test


5.2 Install Uci Package

     Extract uci-for-x86-linux.tgz package which is from step 5.1 and compile it, then install

$ tar zxvf uci-for-x86-linux.tgz
$ cd uci-for-x86-linux
$ git checkout 51f2ea3271762cebf1e3b54a6e87297f2cab0194
$ sudo cmake -D BUILD_LUA:BOOL=OFF .
$ sudo make
$ sudo cp uci /bin/
$ sudo cp libuci.so /lib/

     After finishing the steps above, please use the type uci command to check whether it works or not.

$ uci
Usage: uci [<options>] <command> [<arguments>]

Commands:
        batch
        export     [<config>]
        import     [<config>]
        changes    [<config>]
        commit     [<config>]
        add        <config> <section-type>
        add_list   <config>.<section>.<option>=<string>
        del_list   <config>.<section>.<option>=<string>
        show       [<config>[.<section>[.<option>]]]
        get        <config>.<section>[.<option>]
        set        <config>.<section>[.<option>]=<value>
        delete     <config>[.<section>[[.<option>][=<id>]]]
        rename     <config>.<section>[.<option>]=<name>
        revert     <config>[.<section>[.<option>]]
        reorder    <config>.<section>=<position>

Options:
        -c <path>  set the search path for config files (default: /etc/config)
        -d <str>   set the delimiter for list values in uci show
        -f <file>  use <file> as input instead of stdin
        -m         when importing, merge data into an existing package
        -n         name unnamed sections on export (default)
        -N         don't name unnamed sections
        -p <path>  add a search path for config change files
        -P <path>  add a search path for config change files and use as default
        -q         quiet mode (don't print error messages)
        -s         force strict mode (stop on parser errors, default)
        -S         disable strict mode
        -X         do not use extended syntax on 'show'


5.3 Install Toolchain

	Extract toolchain.tar.gz in /opt, then you can find /opt/buildroot-gcc463

$ cd /home/test
$ sudo cp toolchain.tar.gz /opt/
$ cd /opt
$ sudo tar zxf toolchain.tar.gz


6. Build SDK

$ cd /home/test
$ tar zxf TEW827DRU_FW200b09_GPL.tar.gz
$ cd qsdk_gpl
$ make V=s 2>&1 | tee makelog.log


7. Complete

    After compiling, please check firmware that is ready or not.

$ ls -l bin/ramips
total 40056
drwxr-xr-x 2 alexlin alexlin     4096  Aug 18 14:57 manifest
-rw-r--r-- 1 alexlin alexlin      324  Aug 18 20:26 md5sums
-rw-r--r-- 1 alexlin alexlin 12451840  Aug 18 20:26 openwrt-ramips-mt7621-root.squashfs
-rw-r--r-- 1 alexlin alexlin 14549016  Aug 18 20:26 openwrt-ramips-mt7621-uImage.bin
-rwxr-xr-x 1 alexlin alexlin  5974464  Aug 18 20:25 openwrt-ramips-mt7621-vmlinux.bin
-rwxr-xr-x 1 alexlin alexlin  5979520  Aug 18 20:25 openwrt-ramips-mt7621-vmlinux.elf
drwxr-xr-x 2 alexlin alexlin    20480  Aug 18 20:21 packages
-rw-r--r-- 1 alexlin alexlin  2014539  Aug 18 20:26 vmlinux.bin.lzma


8. Upload Firmware

     Please use openwrt-ramips-mt7621-uImage.bin in bin/ramips folder to upgrade the machine.


Closing this thread. I had bought this unit reconditioned and it stopped powering up. The transformer checked OK with a volt meter and it still was returnable for a refund.

Presently using a Trendnet TEW-810DR as an access point with stubby DNS over TLS but would like to learn more about enhancing security/privacy and getting with more capability.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.