before any flashing i tried to backup the current flash contents. managed to get full 128KB u-boot section once, but any other tries just gave broken files ranging from 70 to 120KB. backing up firmware or art partition did not work at all.
i suspected the busybox was problematic or more likely the executed command sequence because bugblue's original file without last two commands (better not to give reboot parameter due to instabilities and no idea what the hell should echo blaaat do) did not work too. md5sum also did not work so i couldn't check if the images uploaded to device were intact.
so i split commands in two files:
file aa containing:
cd /tmp
tftp -gl img1 192.168.1.2
tftp -gl img2 192.168.1.2
tftp -gl busybox 192.168.1.2
chmod 755 busybox
ls -l > ls
tftp -pl ls 192.168.1.2
should send both image parts and busybox to device, set permissions on busybox, list the tmp directory contents, write them to file ls and send that file back to server. you have to check that file so that it matches img filesizes 1048576 and 7077888 before executing second command sequence that will write these files to flash.
file bb containing:
cd /tmp
./busybox dd if=img1 of=/dev/mtdblock1 conv=fsync
./busybox dd if=img2 of=/dev/mtdblock2 conv=fsync
should write files to kernel and rootfs partitions. you can add ./busybox reboot -f at the end but i found it is safer to just wait for few minutes and power cycle the device.
busybox was downloaded from keyboardgnome's reflash topic: https://forum.openwrt.org/viewtopic.php?id=63123
1. reset device to factory settings
2. set password using curl
curl -o - -b 'tLargeScreenP=1; subType=pcSub; Authorization=Basic%20YWRtaW46YWRtaW40Mg%3D%3D; ChgPwdSubTag=true' 'http://192.168.1.1/'
password is admin42 after this
3. add parental control rule
curl -o - -b 'tLargeScreenP=1; subType=pcSub; Authorization=Basic%20YWRtaW46YWRtaW40Mg%3D%3D; ChgPwdSubTag=' --referer 'http://192.168.1.1/userRpm/ParentCtrlRpm.htm' 'http://192.168.1.1/userRpm/ParentCtrlRpm.htm?ctrl_enable=1&parent_mac_addr=00-00-00-00-00-02&Page=1'
4. execute first sequence of commands
curl -o - -b 'tLargeScreenP=1; subType=pcSub; Authorization=Basic%20YWRtaW46YWRtaW40Mg%3D%3D; ChgPwdSubTag=' --referer 'http://192.168.1.1/userRpm/ParentCtrlRpm.htm?Modify=0&Page=1' 'http://192.168.1.1/userRpm/ParentCtrlRpm.htm?child_mac=00-00-00-00-00-01&lan_lists=888&url_comment=test&url_0=;cd%20/tmp;&url_1=;tftp%20-gl%20aa%20192.168.1.2;&url_2=;sh%20aa;&url_3=&url_4=&url_5=&url_6=&url_7=&scheds_lists=255&enable=1&Changed=1&SelIndex=0&Page=1&rule_mode=0&Save=%B1%A3+%B4%E6'
5. check the ls file got from device for img filesizes
6. go to web interface parental control (the one in the middle that has •, others have +) and delete the entry by clicking on the link at right
7. execute second sequence of commands
curl -o - -b 'tLargeScreenP=1; subType=pcSub; Authorization=Basic%20YWRtaW46YWRtaW40Mg%3D%3D; ChgPwdSubTag=' --referer 'http://192.168.1.1/userRpm/ParentCtrlRpm.htm?Modify=0&Page=1' 'http://192.168.1.1/userRpm/ParentCtrlRpm.htm?child_mac=00-00-00-00-00-01&lan_lists=888&url_comment=test&url_0=;cd%20/tmp;&url_1=;tftp%20-gl%20bb%20192.168.1.2;&url_2=;sh%20bb;&url_3=&url_4=&url_5=&url_6=&url_7=&scheds_lists=255&enable=1&Changed=1&SelIndex=0&Page=1&rule_mode=0&Save=%B1%A3+%B4%E6'
8. wait few minutes (2 at least or 3? i did not count..) until files are written then power cycle device.
the device should now boot with your preferred openwrt configuration.
patch i made to build image for TL-MR22U. if using BTN_SW1 and BTN_SW2 check these gpios are correct. because i didn't care much about this.
diff -urpN a/openwrt/target/linux/ar71xx/base-files/etc/board.d/02_network b/openwrt/target/linux/ar71xx/base-files/etc/board.d/02_network
--- a/openwrt/target/linux/ar71xx/base-files/etc/board.d/02_network 2016-09-21 18:53:58.848183000 +0200
+++ b/openwrt/target/linux/ar71xx/base-files/etc/board.d/02_network 2016-09-21 20:13:59.723654245 +0200
@@ -355,6 +355,7 @@ tl-mr10u |\
tl-mr11u |\
tl-mr12u |\
tl-mr13u |\
+tl-mr22u |\
tl-mr3020 |\
tl-mr3040 |\
tl-mr3040-v2 |\
diff -urpN a/openwrt/target/linux/ar71xx/base-files/etc/diag.sh b/openwrt/target/linux/ar71xx/base-files/etc/diag.sh
--- a/openwrt/target/linux/ar71xx/base-files/etc/diag.sh 2016-09-21 18:53:58.848183000 +0200
+++ b/openwrt/target/linux/ar71xx/base-files/etc/diag.sh 2016-09-21 20:14:38.135842026 +0200
@@ -338,6 +338,7 @@ get_status_led() {
tl-mr10u | \
tl-mr12u | \
tl-mr13u | \
+ tl-mr22u | \
tl-wdr4300 | \
tl-wr703n | \
tl-wr710n | \
diff -urpN a/openwrt/target/linux/ar71xx/base-files/lib/ar71xx.sh b/openwrt/target/linux/ar71xx/base-files/lib/ar71xx.sh
--- a/openwrt/target/linux/ar71xx/base-files/lib/ar71xx.sh 2016-09-21 18:53:58.848183000 +0200
+++ b/openwrt/target/linux/ar71xx/base-files/lib/ar71xx.sh 2016-09-21 20:15:55.936222378 +0200
@@ -233,6 +233,9 @@ tplink_board_detect() {
"001301"*)
model="TP-Link TL-MR13U"
;;
+ "002201"*)
+ model="TP-Link TL-MR22U"
+ ;;
"302000"*)
model="TP-Link TL-MR3020"
;;
@@ -962,6 +965,9 @@ ar71xx_board_detect() {
*"TL-MR13U v1")
name="tl-mr13u"
;;
+ *"TL-MR22U v1")
+ name="tl-mr22u"
+ ;;
*"Tube2H")
name="tube2h"
;;
diff -urpN a/openwrt/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/openwrt/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
--- a/openwrt/target/linux/ar71xx/base-files/lib/upgrade/platform.sh 2016-09-21 18:53:58.852183000 +0200
+++ b/openwrt/target/linux/ar71xx/base-files/lib/upgrade/platform.sh 2016-09-26 22:23:05.160309794 +0200
@@ -356,6 +356,7 @@ platform_check_image() {
tl-mr11u | \
tl-mr12u | \
tl-mr13u | \
+ tl-mr22u | \
tl-mr3020 | \
tl-mr3040 | \
tl-mr3040-v2 | \
@@ -408,6 +409,12 @@ platform_check_image() {
;;
esac
+ case "$board" in
+ tl-mr22u)
+ magic_ver="0200"
+ ;;
+ esac
+
[ "$magic" != "$magic_ver" ] && {
echo "Invalid image type."
return 1
diff -urpN a/openwrt/target/linux/ar71xx/config-4.1 b/openwrt/target/linux/ar71xx/config-4.1
--- a/openwrt/target/linux/ar71xx/config-4.1 2016-09-21 18:53:58.852183000 +0200
+++ b/openwrt/target/linux/ar71xx/config-4.1 2016-09-21 20:17:18.496625993 +0200
@@ -136,6 +136,7 @@ CONFIG_ATH79_MACH_TEW_732BR=y
CONFIG_ATH79_MACH_TEW_823DRU=y
CONFIG_ATH79_MACH_TL_MR11U=y
CONFIG_ATH79_MACH_TL_MR13U=y
+CONFIG_ATH79_MACH_TL_MR22U=y
CONFIG_ATH79_MACH_TL_MR3020=y
CONFIG_ATH79_MACH_TL_MR3X20=y
CONFIG_ATH79_MACH_TL_WA701ND_V2=y
diff -urpN a/openwrt/target/linux/ar71xx/config-4.4 b/openwrt/target/linux/ar71xx/config-4.4
--- a/openwrt/target/linux/ar71xx/config-4.4 2016-09-21 18:53:58.852183000 +0200
+++ b/openwrt/target/linux/ar71xx/config-4.4 2016-09-21 20:17:19.336630096 +0200
@@ -140,6 +140,7 @@ CONFIG_ATH79_MACH_TEW_732BR=y
CONFIG_ATH79_MACH_TEW_823DRU=y
CONFIG_ATH79_MACH_TL_MR11U=y
CONFIG_ATH79_MACH_TL_MR13U=y
+CONFIG_ATH79_MACH_TL_MR22U=y
CONFIG_ATH79_MACH_TL_MR3020=y
CONFIG_ATH79_MACH_TL_MR3X20=y
CONFIG_ATH79_MACH_TL_WA701ND_V2=y
diff -urpN a/openwrt/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt b/openwrt/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
--- a/openwrt/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt 2016-09-21 18:53:58.852183000 +0200
+++ b/openwrt/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt 2016-09-21 20:23:11.318350851 +0200
@@ -1128,6 +1128,16 @@ config ATH79_MACH_TL_MR13U
select ATH79_DEV_USB
select ATH79_DEV_WMAC
+config ATH79_MACH_TL_MR22U
+ bool "TP-LINK TL-MR22U support"
+ select SOC_QCA953X
+ select ATH79_DEV_ETH
+ select ATH79_DEV_GPIO_BUTTONS
+ select ATH79_DEV_LEDS_GPIO
+ select ATH79_DEV_M25P80
+ select ATH79_DEV_USB
+ select ATH79_DEV_WMAC
+
config ATH79_MACH_TL_MR3020
bool "TP-LINK TL-MR3020 support"
select SOC_AR933X
diff -urpN a/openwrt/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-mr22u.c b/openwrt/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-mr22u.c
--- a/openwrt/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-mr22u.c 1970-01-01 01:00:00.000000000 +0100
+++ b/openwrt/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-mr22u.c 2016-09-26 21:58:49.869195240 +0200
@@ -0,0 +1,109 @@
+/*
+ * TP-LINK TL-MR22U board support
+ *
+ * Copyright (C) 2011 dongyuqi <729650915@qq.com>
+ * Copyright (C) 2011-2012 Gabor Juhos <juhosg@openwrt.org>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ */
+
+#include <linux/gpio.h>
+#include <linux/platform_device.h>
+#include <linux/ar8216_platform.h>
+#include <asm/mach-ath79/ar71xx_regs.h>
+
+#include "common.h"
+#include "dev-eth.h"
+#include "dev-gpio-buttons.h"
+#include "dev-leds-gpio.h"
+#include "dev-m25p80.h"
+#include "dev-usb.h"
+#include "dev-wmac.h"
+#include "machtypes.h"
+
+#define TL_MR22U_GPIO_USB_POWER 11
+#define TL_MR22U_GPIO_BTN_RESET 12
+#define TL_MR22U_GPIO_LED_SYSTEM 13
+#define TL_MR22U_GPIO_BTN_SW1 14
+#define TL_MR22U_GPIO_BTN_SW2 16
+#define TL_MR22U_KEYS_POLL_INTERVAL 20 /* msecs */
+#define TL_MR22U_KEYS_DEBOUNCE_INTERVAL (3 * TL_MR22U_KEYS_POLL_INTERVAL)
+
+static const char *tl_mr22u_part_probes[] = {
+ "tp-link",
+ NULL,
+};
+
+static struct flash_platform_data tl_mr22u_flash_data = {
+ .part_probes = tl_mr22u_part_probes,
+};
+
+static struct gpio_led tl_mr22u_leds_gpio[] __initdata = {
+ {
+ .name = "tp-link:blue:system",
+ .gpio = TL_MR22U_GPIO_LED_SYSTEM,
+ .active_low = 1,
+ },
+};
+
+static struct gpio_keys_button tl_mr22u_gpio_keys[] __initdata = {
+ {
+ .desc = "reset",
+ .type = EV_KEY,
+ .code = KEY_RESTART,
+ .debounce_interval = TL_MR22U_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = TL_MR22U_GPIO_BTN_RESET,
+ .active_low = 1,
+ },
+ {
+ .desc = "sw1",
+ .type = EV_KEY,
+ .code = BTN_0,
+ .debounce_interval = TL_MR22U_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = TL_MR22U_GPIO_BTN_SW1,
+ .active_low = 0,
+ },
+ {
+ .desc = "sw2",
+ .type = EV_KEY,
+ .code = BTN_1,
+ .debounce_interval = TL_MR22U_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = TL_MR22U_GPIO_BTN_SW2,
+ .active_low = 0,
+ },
+};
+
+static void __init tl_mr22u_setup(void)
+{
+ u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
+ u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
+
+ /* disable PHY_SWAP and PHY_ADDR_SWAP bits */
+ ath79_setup_ar933x_phy4_switch(false, false);
+
+ ath79_register_m25p80(&tl_mr22u_flash_data);
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_mr22u_leds_gpio),
+ tl_mr22u_leds_gpio);
+ ath79_register_gpio_keys_polled(-1, TL_MR22U_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(tl_mr22u_gpio_keys),
+ tl_mr22u_gpio_keys);
+
+ gpio_request_one(TL_MR22U_GPIO_USB_POWER,
+ GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
+ "USB power");
+ ath79_register_usb();
+
+ ath79_register_mdio(0, 0x0);
+ ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
+ ath79_eth0_data.duplex = DUPLEX_FULL;
+ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
+ ath79_eth0_data.speed = SPEED_100;
+ ath79_eth0_data.phy_mask = BIT(4);
+ ath79_register_eth(0);
+ ath79_register_wmac(ee, mac);
+}
+
+MIPS_MACHINE(ATH79_MACH_TL_MR22U, "TL-MR22U", "TP-LINK TL-MR22U v1",
+ tl_mr22u_setup);
diff -urpN a/openwrt/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h b/openwrt/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
--- a/openwrt/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h 2016-09-21 18:53:58.868184000 +0200
+++ b/openwrt/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h 2016-09-21 20:18:42.741037841 +0200
@@ -164,6 +164,7 @@ enum ath79_mach_type {
ATH79_MACH_TL_MR10U, /* TP-LINK TL-MR10U */
ATH79_MACH_TL_MR11U, /* TP-LINK TL-MR11U */
ATH79_MACH_TL_MR13U, /* TP-LINK TL-MR13U */
+ ATH79_MACH_TL_MR22U, /* TP-LINK TL-MR22U */
ATH79_MACH_TL_MR3020, /* TP-LINK TL-MR3020 */
ATH79_MACH_TL_MR3040, /* TP-LINK TL-MR3040 */
ATH79_MACH_TL_MR3040_V2, /* TP-LINK TL-MR3040 v2 */
diff -urpN a/openwrt/target/linux/ar71xx/files/arch/mips/ath79/Makefile b/openwrt/target/linux/ar71xx/files/arch/mips/ath79/Makefile
--- a/openwrt/target/linux/ar71xx/files/arch/mips/ath79/Makefile 2016-09-21 18:53:58.852183000 +0200
+++ b/openwrt/target/linux/ar71xx/files/arch/mips/ath79/Makefile 2016-09-21 20:23:46.206521409 +0200
@@ -144,6 +144,7 @@ obj-$(CONFIG_ATH79_MACH_TEW_732BR) += ma
obj-$(CONFIG_ATH79_MACH_TEW_823DRU) += mach-tew-823dru.o
obj-$(CONFIG_ATH79_MACH_TL_MR11U) += mach-tl-mr11u.o
obj-$(CONFIG_ATH79_MACH_TL_MR13U) += mach-tl-mr13u.o
+obj-$(CONFIG_ATH79_MACH_TL_MR22U) += mach-tl-mr22u.o
obj-$(CONFIG_ATH79_MACH_TL_MR3020) += mach-tl-mr3020.o
obj-$(CONFIG_ATH79_MACH_TL_MR3X20) += mach-tl-mr3x20.o
obj-$(CONFIG_ATH79_MACH_TL_WAX50RE) += mach-tl-wax50re.o
diff -urpN a/openwrt/target/linux/ar71xx/generic/profiles/tp-link.mk b/openwrt/target/linux/ar71xx/generic/profiles/tp-link.mk
--- a/openwrt/target/linux/ar71xx/generic/profiles/tp-link.mk 2016-09-21 18:53:58.876184000 +0200
+++ b/openwrt/target/linux/ar71xx/generic/profiles/tp-link.mk 2016-09-21 20:21:14.901781715 +0200
@@ -70,6 +70,17 @@ endef
$(eval $(call Profile,TLMR13U))
+define Profile/TLMR22U
+ NAME:=TP-LINK TL-MR22U
+ PACKAGES:=kmod-usb-core kmod-usb2 kmod-ledtrig-usbdev
+endef
+
+define Profile/TLMR22U/Description
+ Package set optimized for the TP-LINK TL-MR22U.
+endef
+$(eval $(call Profile,TLMR22U))
+
+
define Profile/TLMR3020
NAME:=TP-LINK TL-MR3020
PACKAGES:=kmod-usb-core kmod-usb2 kmod-ledtrig-usbdev
diff -urpN a/openwrt/target/linux/ar71xx/image/Makefile b/openwrt/target/linux/ar71xx/image/Makefile
--- a/openwrt/target/linux/ar71xx/image/Makefile 2016-09-21 20:41:15.691652000 +0200
+++ b/openwrt/target/linux/ar71xx/image/Makefile 2016-09-21 20:42:26.115996368 +0200
@@ -628,6 +628,16 @@ define Device/tl-mr13u-v1
endef
TARGET_DEVICES += tl-mr10u-v1 tl-mr11u-v1 tl-mr11u-v2 tl-mr12u-v1 tl-mr13u-v1
+define Device/tl-mr22u-v1
+ $(Device/tplink-8mlzma)
+ BOARDNAME := TL-MR22U
+ DEVICE_PROFILE := TLMR22U
+ TPLINK_HWID := 0x00220101
+ CONSOLE := ttyATH0,115200
+ TPLINK_HEADER_VERSION := 2
+endef
+TARGET_DEVICES += tl-mr22u-v1
+
define Device/tl-mr3020-v1
$(Device/tplink-4mlzma)
BOARDNAME := TL-MR3020