Bringing OpenWRT to TL-WA801ND v2 (Part 2, Building OpenWRT)


After getting some details about the board it was time to create a build environment. In my case this was just about copying one of the VMs I have prepared just for this purpose. The build environment requires a Linux machine whereas it doesn’t really matter which flavour it is. After everything is set on the VM the very first step is to create a user under which the build will be performed. I created a user ‘openwrt‘ for this and switched user to it. As user openwrt the following commands needed to be executed:

git clone git://git.openwrt.org/12.09/openwrt.git
cd openwrt
./scripts/feeds update
make menuconfig
make

I.e. getting the source, changing into the source directory and updating the feeds (the add-on packages). The ‘make menuconfig’ might not be necessary because everything is already set up for the AR71xx platform. If not configure appropriately. More details about the build system can be found on the developer site of OpenWRT.

The first build ran smooth without any errors or warnings in my case.

I’ve gone through several iterations and even failed attempts to create a working image for the TL-WA801ND after that but ended up with a working source. The patches that were needed and which can be applied to the 12.09 tree are as follows:

diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh
index 416322d..af4dd9e 100755
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -127,6 +127,7 @@ get_status_led() {
         ;;
     tl-mr3220 | \
     tl-mr3420 | \
+    tl-wa801nd-v2 | \
     tl-wa901nd | \
     tl-wa901nd-v2 | \
     tl-wr1041n-v2 | \
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/leds b/target/linux/ar71xx/base-files/etc/uci-defaults/leds
index 7be4ce9..fc6ea05 100755
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/leds
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/leds
@@ -122,6 +122,11 @@ tl-wa901nd)
     ucidef_set_led_netdev "lan" "LAN" "tp-link:green:lan" "eth0"
     ;;

+tl-wa801nd-v2)
+    ucidef_set_led_wlan "wlan" "WLAN" "tp-link:green:wlan" "phy0tpt"
+    ucidef_set_led_netdev "lan" "LAN" "tp-link:green:lan"  "eth0"
+    ;;
+
 tl-wa901nd-v2)
     ucidef_set_led_wlan "wlan" "WLAN" "tp-link:green:wlan" "phy0tpt"
     ;;
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/network b/target/linux/ar71xx/base-files/etc/uci-defaults/network
index 7fa219d..6463961 100755
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/network
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/network
@@ -156,6 +156,7 @@ rb-411 |\
 tl-mr11u |\
 tl-mr3020 |\
 tl-mr3040 |\
+tl-wa801nd-v2 |\
 tl-wa901nd |\
 tl-wa901nd-v2 |\
 tl-wr703n |\
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 2bc8194..63464e5 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -93,6 +93,9 @@ tplink_board_detect() {
     "084200"*)
         model="TP-Link TL-WR842N/ND"
         ;;
+    "080100"*)
+        model="TP-Link TL-WA801N/ND"
+        ;;
     "090100"*)
         model="TP-Link TL-WA901N/ND"
         ;;
@@ -351,6 +354,9 @@ ar71xx_board_detect() {
     *TL-WA7510N)
         name="tl-wa7510n"
         ;;
+    *"TL-WA801N/ND v2")
+        name="tl-wa801nd-v2"
+        ;;
     *TL-WA901ND)
         name="tl-wa901nd"
         ;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index 49b1de9..5ac55ed 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -153,6 +153,7 @@ platform_check_image() {
     tl-mr3220 | \
     tl-mr3420 | \
     tl-wa7510n | \
+    tl-wa801nd-v2 | \
     tl-wa901nd | \
     tl-wa901nd-v2 | \
     tl-wdr4300 | \
diff --git a/target/linux/ar71xx/config-3.3 b/target/linux/ar71xx/config-3.3
index 446f202..3e556c1 100644
--- a/target/linux/ar71xx/config-3.3
+++ b/target/linux/ar71xx/config-3.3
@@ -58,6 +58,7 @@ CONFIG_ATH79_MACH_TEW_712BR=y
 CONFIG_ATH79_MACH_TL_MR11U=y
 CONFIG_ATH79_MACH_TL_MR3020=y
 CONFIG_ATH79_MACH_TL_MR3X20=y
+CONFIG_ATH79_MACH_TL_WA801ND_V2=y
 CONFIG_ATH79_MACH_TL_WA901ND=y
 CONFIG_ATH79_MACH_TL_WA901ND_V2=y
 CONFIG_ATH79_MACH_TL_WDR4300=y
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wa801nd-v2.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wa801nd-v2.c
index e69de29..7444b26 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wa801nd-v2.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wa801nd-v2.c
@@ -0,0 +1,115 @@
+/*
+ *  TP-LINK TL-WA801N/ND v2 board support
+ *
+ *  Copyright (C) 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/platform_device.h>
+
+#include <asm/mach-ath79/ath79.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-wmac.h"
+#include "machtypes.h"
+
+#define TL_WA801ND_V2_GPIO_LED_WLAN    13
+#define TL_WA801ND_V2_GPIO_LED_QSS    15
+#define TL_WA801ND_V2_GPIO_LED_LAN    18
+#define TL_WA801ND_V2_GPIO_LED_SYSTEM    14
+
+#define TL_WA801ND_V2_GPIO_BTN_RESET    17
+#define TL_WA801ND_V2_GPIO_SW_RFKILL    16
+
+#define TL_WA801ND_V2_KEYS_POLL_INTERVAL    20    /* msecs */
+#define TL_WA801ND_V2_KEYS_DEBOUNCE_INTERVAL (3 * TL_WA801ND_V2_KEYS_POLL_INTERVAL)
+
+static const char *tl_wa801nd_v2_part_probes[] = {
+    "tp-link",
+    NULL,
+};
+
+static struct flash_platform_data tl_wa801nd_v2_flash_data = {
+    .part_probes    = tl_wa801nd_v2_part_probes,
+};
+
+static struct gpio_led tl_wa801nd_v2_leds_gpio[] __initdata = {
+    {
+        .name        = "tp-link:green:qss",
+        .gpio        = TL_WA801ND_V2_GPIO_LED_QSS,
+        .active_low    = 1,
+    }, {
+        .name        = "tp-link:green:system",
+        .gpio        = TL_WA801ND_V2_GPIO_LED_SYSTEM,
+        .active_low    = 1,
+    }, {
+        .name        = "tp-link:green:lan",
+        .gpio        = TL_WA801ND_V2_GPIO_LED_LAN,
+        .active_low    = 1,
+    }, {
+        .name        = "tp-link:green:wlan",
+        .gpio        = TL_WA801ND_V2_GPIO_LED_WLAN,
+        .active_low    = 1,
+    },
+};
+
+static struct gpio_keys_button tl_wa801nd_v2_gpio_keys[] __initdata = {
+    {
+        .desc        = "Reset button",
+        .type        = EV_KEY,
+        .code        = KEY_RESTART,
+        .debounce_interval = TL_WA801ND_V2_KEYS_DEBOUNCE_INTERVAL,
+        .gpio        = TL_WA801ND_V2_GPIO_BTN_RESET,
+        .active_low    = 1,
+    }, {
+        .desc        = "RFKILL switch",
+        .type        = EV_SW,
+        .code        = KEY_RFKILL,
+        .debounce_interval = TL_WA801ND_V2_KEYS_DEBOUNCE_INTERVAL,
+        .gpio        = TL_WA801ND_V2_GPIO_SW_RFKILL,
+        .active_low    = 0,
+    }
+};
+
+static void __init tl_wa801nd_v2_setup(void)
+{
+    u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
+    u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
+
+    ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wa801nd_v2_leds_gpio),
+                 tl_wa801nd_v2_leds_gpio);
+
+    ath79_register_gpio_keys_polled(1, TL_WA801ND_V2_KEYS_POLL_INTERVAL,
+                    ARRAY_SIZE(tl_wa801nd_v2_gpio_keys),
+                    tl_wa801nd_v2_gpio_keys);
+
+    ath79_register_m25p80(&tl_wa801nd_v2_flash_data);
+
+    ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_PHY_SWAP);
+
+    ath79_register_mdio(1, 0x0);
+
+    ath79_init_mac(ath79_eth0_data.mac_addr, mac, -1);
+    ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0);
+
+    /* GMAC0 is connected to the PHY0 of the internal switch */
+    ath79_switch_data.phy4_mii_en = 1;
+    ath79_switch_data.phy_poll_mask = BIT(0);
+    ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
+    ath79_eth0_data.phy_mask = BIT(0);
+    ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev;
+    ath79_register_eth(0);
+
+    ath79_register_wmac(ee, mac);
+}
+
+MIPS_MACHINE(ATH79_MACH_TL_WA801ND_V2, "TL-WA801ND-v2", "TP-LINK TL-WA801N/ND v2",
+         tl_wa801nd_v2_setup);
diff --git a/target/linux/ar71xx/generic/profiles/tp-link.mk b/target/linux/ar71xx/generic/profiles/tp-link.mk
index 07d7059..4dd5967 100644
--- a/target/linux/ar71xx/generic/profiles/tp-link.mk
+++ b/target/linux/ar71xx/generic/profiles/tp-link.mk
@@ -93,6 +93,17 @@ endef
 $(eval $(call Profile,TLWA7510))

+define Profile/TLWA801
+    NAME:=TP-LINK TL-WA801N/ND
+    PACKAGES:=
+endef
+
+define Profile/TLWA801/Description
+    Package set optimized for the TP-LINK TL-WA801N/ND.
+endef
+$(eval $(call Profile,TLWA801))
+
+
 define Profile/TLWA901
     NAME:=TP-LINK TL-WA901N/ND
     PACKAGES:=
diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile
index 9ebe486..c2d4a44 100644
--- a/target/linux/ar71xx/image/Makefile
+++ b/target/linux/ar71xx/image/Makefile
@@ -878,6 +878,7 @@ $(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLMR3040,tl-mr3040-v1,TL-MR
 $(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLWR703,tl-wr703n-v1,TL-WR703N,ttyATH0,115200,0x07030101,1,4Mlzma))
 $(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLWR740NV4,tl-wr740n-v4,TL-WR741ND-v4,ttyATH0,115200,0x07400004,1,4Mlzma))
 $(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLWR741NV4,tl-wr741nd-v4,TL-WR741ND-v4,ttyATH0,115200,0x07410004,1,4Mlzma))
+$(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLWA801NV2,tl-wa801nd-v2,TL-WA801ND-v2,ttyS0,115200,0x08010002,1,4Mlzma))
 $(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLWR841NV8,tl-wr841n-v8,TL-WR841N-v8,ttyS0,115200,0x08410008,1,4Mlzma))
 $(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLWR1041,tl-wr1041n-v2,TL-WR1041N-v2,ttyS0,115200,0x10410002,1,4Mlzma))
 $(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLWR2543,tl-wr2543-v1,TL-WR2543N,ttyS0,115200,0x25430001,1,8Mlzma,-v 3.13.99))
diff --git a/target/linux/ar71xx/patches-3.3/660-MIPS-ath79-TL-WA801ND-v2-support.patch b/target/linux/ar71xx/patches-3.3/660-MIPS-ath79-TL-WA801ND-v2-support.patch
index e69de29..37c7771 100644
--- a/target/linux/ar71xx/patches-3.3/660-MIPS-ath79-TL-WA801ND-v2-support.patch
+++ b/target/linux/ar71xx/patches-3.3/660-MIPS-ath79-TL-WA801ND-v2-support.patch
@@ -0,0 +1,38 @@
+--- a/arch/mips/ath79/machtypes.h
++++ b/arch/mips/ath79/machtypes.h
+@@ -77,6 +77,7 @@
+     ATH79_MACH_TL_MR3220,        /* TP-LINK TL-MR3220 */
+     ATH79_MACH_TL_MR3420,        /* TP-LINK TL-MR3420 */
+     ATH79_MACH_TL_WA7510N_V1,    /* TP-LINK TL-WA7510N v1*/
++    ATH79_MACH_TL_WA801ND_V2,    /* TP-LINK TL-WA801ND v2 */
+     ATH79_MACH_TL_WA901ND,        /* TP-LINK TL-WA901ND */
+     ATH79_MACH_TL_WA901ND_V2,    /* TP-LINK TL-WA901ND v2 */
+     ATH79_MACH_TL_WDR4300,        /* TP-LINK TL-WDR4300 */
+--- a/arch/mips/ath79/Kconfig
++++ b/arch/mips/ath79/Kconfig
+@@ -461,6 +461,15 @@
+     select ATH79_DEV_M25P80
+     select ATH79_DEV_USB
+ 
++config ATH79_MACH_TL_WA801ND_V2
++    bool "TP-LINK TL-WA801ND v2 support"
++    select SOC_AR934X
++    select ATH79_DEV_ETH
++    select ATH79_DEV_GPIO_BUTTONS
++    select ATH79_DEV_LEDS_GPIO
++    select ATH79_DEV_M25P80
++    select ATH79_DEV_WMAC
++
+ config ATH79_MACH_TL_WA901ND
+     bool "TP-LINK TL-WA901ND/TL-WA7510N support"
+     select SOC_AR724X
+--- a/arch/mips/ath79/Makefile
++++ b/arch/mips/ath79/Makefile
+@@ -77,6 +77,7 @@
+ obj-$(CONFIG_ATH79_MACH_TL_MR11U)    += mach-tl-mr11u.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_WA801ND_V2)    += mach-tl-wa801nd-v2.o
+ obj-$(CONFIG_ATH79_MACH_TL_WA901ND)    += mach-tl-wa901nd.o
+ obj-$(CONFIG_ATH79_MACH_TL_WA901ND_V2)    += mach-tl-wa901nd-v2.o
+ obj-$(CONFIG_ATH79_MACH_TL_WDR4300)     += mach-tl-wdr4300.o
diff --git a/tools/firmware-utils/src/mktplinkfw.c b/tools/firmware-utils/src/mktplinkfw.c
index 2be6335..58a9c39 100644
--- a/tools/firmware-utils/src/mktplinkfw.c
+++ b/tools/firmware-utils/src/mktplinkfw.c
@@ -35,6 +35,7 @@
 #define HWID_TL_MR3420_V1    0x34200001
 #define HWID_TL_WA701N_V1    0x07010001
 #define HWID_TL_WA7510N_V1    0x75100001
+#define HWID_TL_WA801ND_V2    0x08010002
 #define HWID_TL_WA901ND_V1    0x09010001
 #define HWID_TL_WA901ND_V2    0x09010002
 #define HWID_TL_WR703N_V1    0x07030101
@@ -204,6 +205,11 @@ static struct board_info boards[] = {
         .hw_rev        = 1,
         .layout_id    = "4M",
     }, {
+        .id             = "TL-WA801NDv2",
+        .hw_id          = HWID_TL_WA801ND_V2,
+        .hw_rev         = 1,
+        .layout_id    = "4Mlzma",
+    }, {
         .id        = "TL-WA901NDv1",
         .hw_id        = HWID_TL_WA901ND_V1,
         .hw_rev        = 1,

(Note: If you want to compile OpenWRT yourself and create a patch file from the above you have to keep in mind that copy-paste of the above will convert all tabs into spaces. This lets the patch process fail for some files and requires manual corrections in order to succeed. To ease this I uploaded the complete patch here.)

After building the image you can find the result under the ‘bin/ar71xx’ directory which will contain the images for all supported devices using that architecture. In order to install the image onto the device you could simply update the firmware via the web interface. The stock firmware will recognize it as valid and allow installation. But for completeness I would like to explain how it can be installed via the bootloader as well. This could be very helpful especially if you’re experimenting with OpenWRT and something went wrong which bricks your device.

The bootloader is able to receive data via TFTP which in turn requires that you have a TFTP server installed. So either you install that directly on your development machine or any other machine you have at hand. You place the firmware image in the data directory of the TFTP server and start it.

Once you power on the TL-WA801ND you will see a message “Autobooting in 1 seconds” in the console. I.e. you have to be quick to abort autobooting by entering ‘tpl‘ into the console. If you succeed the boot process is interrupted and you will be at the bootloader prompt.

You then need to adjust the boot environment by setting an IP address according to your LAN setup, the IP address of your TFTP server and the name of the image you’re about to install.

U-Boot 1.1.4 (May 24 2012 - 19:13:20)

U-boot AP123

DRAM:  32 MB
id read 0x100000ff
Flash:  4 MB
Using default environment

In:    serial
Out:   serial
Err:   serial
Net:   ag934x_enet_initialize...
wasp reset mask:c03300
WASP ----> S27 PHY
GMAC: cfg1 0x5 cfg2 0x7114
eth0: ba:be:fa:ce:08:41
s27 reg init 
athrs27_phy_setup ATHR_PHY_CONTROL 4: 0x1000
athrs27_phy_setup ATHR_PHY_SPEC_STAUS 4: 0x10
eth0 up
WASP ----> S27 PHY
GMAC: cfg1 0xf cfg2 0x7214
eth1: ba:be:fa:ce:08:41
s27 reg init lan 
ATHRS27: resetting s27
ATHRS27: s27 reset done
athrs27_phy_setup ATHR_PHY_CONTROL 0: 0x1000
athrs27_phy_setup ATHR_PHY_SPEC_STAUS 0: 0x10
athrs27_phy_setup ATHR_PHY_CONTROL 1: 0x1000
athrs27_phy_setup ATHR_PHY_SPEC_STAUS 1: 0x10
athrs27_phy_setup ATHR_PHY_CONTROL 2: 0x1000
athrs27_phy_setup ATHR_PHY_SPEC_STAUS 2: 0x10
athrs27_phy_setup ATHR_PHY_CONTROL 3: 0x1000
athrs27_phy_setup ATHR_PHY_SPEC_STAUS 3: 0x10
eth1 up
eth0, eth1
Autobooting in 1 seconds
wasp> 

wasp> setenv serverip 192.168.0.2

wasp> setenv ipaddr 192.168.0.111

wasp> setenv bootfile openwrt-ar71xx-generic-tl-wa801nd-v2-squashfs-factory.bin

In my case the boot environment looked like this afterwards:

wasp> printenv

bootargs=console=ttyS0,115200 root=31:02 rootfstype=squashfs init=/sbin/init mtdparts=ath-nor0:128k(u-boot),1024k(kernel),2816k(rootfs),64k(config),64k(art)
bootcmd=bootm 0x9f020000
bootdelay=1
baudrate=115200
ethaddr=0xba:0xbe:0xfa:0xce:0x08:0x41
dir=
bc=ap123
lu=tftp 0x81000000 ${dir}u-boot.bin&&erase 0x9f000000 +$filesize;cp.b $fileaddr 0x9f000000 $filesize
lf=tftp 0x81000000 ${dir}${bc}-squashfs&&erase 0x9f120000 +$filesize;cp.b $fileaddr 0x9f120000 $filesize
stdin=serial
stdout=serial
stderr=serial
ipaddr=192.168.0.111
serverip=192.168.0.2
bootfile=openwrt-ar71xx-generic-tl-wa801nd-v2-squashfs-factory.bin
ethact=eth1

Environment size: 630/65532 bytes

Issuing the command ‘tftpboot‘ will start the download of the image.

wasp> tftpboot

enet1 port0 up
dup 1 speed 1000
Using eth1 device
TFTP from server 192.168.0.2; our IP address is 192.168.0.111
Filename 'openwrt-ar71xx-generic-tl-wa801nd-v2-squashfs-factory.bin'.
Load address: 0x81000000
Loading: *#################################################################
 #################################################################
 #################################################################
 #################################################################
 #################################################################
 #################################################################
 #################################################################
 #################################################################
 #################################################################
 #################################################################
 #################################################################
 ######################################################
done
Bytes transferred = 3932160 (3c0000 hex)
wasp> erase 0x9f020000 +0x3c0000

First 0x2 last 0x3d sector size 0x10000
   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18  19  20  21  22  23  24  25  26  27  28  29  30  31  32  33  34  35  36  37  38  39  40  41  42  43  44  45  46  47  48  49  50  51  52  53  54  55  56  57  58  59  60  61
Erased 60 sectors
wasp> cp.b 0x81000000 0x9f020000 0x3c0000

Copy to Flash... write addr: 9f020000
done

If the download was successfully done you will get the amount of transferred bytes (0x3c0000 in the above example) which is then used for the next commands which first erases 0x3c0000 bytes in the flash starting at 0x9f020000 and then copying that amount of data from the RAM starting at 0x81000000 into the flash starting at 0x9f020000. After that was successfully done the bootloader is instructed to start what we flashed by the ‘bootm‘ command:

wasp> bootm 0x9f020000

## Booting image at 9f020000 ...
   Uncompressing Kernel Image ... OK

Starting kernel ...

[    0.000000] Linux version 3.3.8 (openwrt@localhost.home.org) (gcc version 4.6.3 20120201 (prerelease) (Linaro GCC 4.6-2012.02) ) #1 Fri May 24 10:50:15 CEST 2013
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU revision is: 0001974c (MIPS 74Kc)
[    0.000000] SoC: Atheros AR9341 rev 1
[    0.000000] Clocks: CPU:535.000MHz, DDR:400.000MHz, AHB:200.000MHz, Ref:25.000MHz
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 02000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Zone PFN ranges:
[    0.000000]   Normal   0x00000000 -> 0x00002000
[    0.000000] Movable zone start PFN for each node
[    0.000000] Early memory PFN ranges
[    0.000000]     0: 0x00000000 -> 0x00002000
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 8128
[    0.000000] Kernel command line:  board=TL-WA801ND-v2 console=ttyS0,115200 rootfstype=squashfs,jffs2 noinitrd
[    0.000000] PID hash table entries: 128 (order: -3, 512 bytes)
[    0.000000] Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
[    0.000000] Writing ErrCtl register=00000000
[    0.000000] Readback ErrCtl register=00000000
[    0.000000] Memory: 29136k/32768k available (2092k kernel code, 3632k reserved, 405k data, 212k init, 0k highmem)
[    0.000000] SLUB: Genslabs=9, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS:51
[    0.000000] Calibrating delay loop... 266.64 BogoMIPS (lpj=1333248)
[    0.080000] pid_max: default: 32768 minimum: 301
[    0.080000] Mount-cache hash table entries: 512
[    0.090000] NET: Registered protocol family 16
[    0.090000] gpiochip_add: registered GPIOs 0 to 22 on device: ath79
[    0.100000] MIPS: machine is TP-LINK TL-WA801N/ND v2
[    0.510000] bio: create slab  at 0
[    0.520000] Switching to clocksource MIPS
[    0.530000] NET: Registered protocol family 2
[    0.530000] IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.530000] TCP established hash table entries: 1024 (order: 1, 8192 bytes)
[    0.540000] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.540000] TCP: Hash tables configured (established 1024 bind 1024)
[    0.550000] TCP reno registered
[    0.550000] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.560000] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.560000] NET: Registered protocol family 1
[    0.580000] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.590000] JFFS2 version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.600000] msgmni has been set to 56
[    0.600000] io scheduler noop registered
[    0.610000] io scheduler deadline registered (default)
[    0.610000] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
[    0.640000] serial8250.0: ttyS0 at MMIO 0x18020000 (irq = 11) is a 16550A
[    0.650000] console [ttyS0] enabled, bootconsole disabled
[    0.650000] console [ttyS0] enabled, bootconsole disabled
[    0.660000] m25p80 spi0.0: found en25q32b, expected m25p80
[    0.670000] m25p80 spi0.0: en25q32b (4096 Kbytes)
[    0.670000] 5 tp-link partitions found on MTD device spi0.0
[    0.680000] Creating 5 MTD partitions on "spi0.0":
[    0.680000] 0x000000000000-0x000000020000 : "u-boot"
[    0.690000] 0x000000020000-0x0000000ff314 : "kernel"
[    0.700000] mtd: partition "kernel" must either start or end on erase block boundary or be smaller than an erase block -- forcing read-only
[    0.710000] 0x0000000ff314-0x0000003f0000 : "rootfs"
[    0.720000] mtd: partition "rootfs" must either start or end on erase block boundary or be smaller than an erase block -- forcing read-only
[    0.730000] mtd: partition "rootfs" set to be root filesystem
[    0.740000] mtd: partition "rootfs_data" created automatically, ofs=280000, len=170000 
[    0.740000] 0x000000280000-0x0000003f0000 : "rootfs_data"
[    0.750000] 0x0000003f0000-0x000000400000 : "art"
[    0.760000] 0x000000020000-0x0000003f0000 : "firmware"
[    0.780000] ag71xx_mdio: probed
[    0.790000] eth0: Atheros AG71xx at 0xb9000000, irq 4
[    1.340000] ag71xx ag71xx.0: eth0: connected to PHY at ag71xx-mdio.1:00 [uid=004dd042, driver=Generic PHY]
[    1.360000] eth1: Atheros AG71xx at 0xba000000, irq 5
[    1.910000] eth1: Found an AR934X built-in switch
[    2.950000] TCP cubic registered
[    2.950000] NET: Registered protocol family 17
[    2.950000] 8021q: 802.1Q VLAN Support v1.8
[    2.960000] VFS: Mounted root (squashfs filesystem) readonly on device 31:2.
[    2.970000] Freeing unused kernel memory: 212k freed
- preinit -
Press the [f] key and hit [enter] to enter failsafe mode
[    7.420000] eth0: link up (100Mbps/Full duplex)
- regular preinit -
jffs2 not ready yet; using ramdisk
- init -
[    7.930000] eth0: link down
[    8.620000] Compat-drivers backport release: compat-drivers-2013-01-21-1
[    8.620000] Backport based on wireless-testing.git master-2013-02-22
[    8.630000] compat.git: wireless-testing.git
[    8.660000] cfg80211: Calling CRDA to update world regulatory domain
[    8.670000] cfg80211: World regulatory domain updated:
[    8.670000] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
[    8.680000] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[    8.690000] cfg80211:   (2457000 KHz - 2482000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
[    8.700000] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
[    8.700000] cfg80211:   (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[    8.710000] cfg80211:   (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[    8.990000] usbcore: registered new interface driver usbfs
[    9.000000] usbcore: registered new interface driver hub
[    9.010000] usbcore: registered new device driver usb
[    9.520000] ieee80211 phy0: Atheros AR9340 Rev:0 mem=0xb8100000, irq=47
[    9.520000] cfg80211: Calling CRDA for country: US
[    9.530000] cfg80211: Regulatory domain changed to country: US
[    9.530000] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
[    9.540000] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2700 mBm)
[    9.550000] cfg80211:   (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 1700 mBm)
[    9.560000] cfg80211:   (5250000 KHz - 5330000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[    9.570000] cfg80211:   (5490000 KHz - 5600000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[    9.570000] cfg80211:   (5650000 KHz - 5710000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[    9.580000] cfg80211:   (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 3000 mBm)
[    9.640000] PPP generic driver version 2.4.2
[    9.840000] ip_tables: (C) 2000-2006 Netfilter Core Team
[   10.020000] NET: Registered protocol family 24
[   10.030000] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[   10.060000] nf_conntrack version 0.5.0 (458 buckets, 1832 max)
[   10.250000] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver

Please press Enter to activate this console. [   13.590000] device eth0 entered promiscuous mode
[   15.520000] eth0: link up (100Mbps/Full duplex)
[   15.520000] br-lan: port 1(eth0) entered forwarding state
[   15.530000] br-lan: port 1(eth0) entered forwarding state
[   17.530000] br-lan: port 1(eth0) entered forwarding state
[   23.220000] jffs2_scan_eraseblock(): End of filesystem marker found at 0x0
[   23.240000] jffs2_build_filesystem(): unlocking the mtd device... done.
[   23.240000] jffs2_build_filesystem(): erasing all blocks after the end marker... done.
[   30.100000] JFFS2 notice: (1079) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.

BusyBox v1.19.4 (2013-05-23 16:29:05 CEST) built-in shell (ash)
Enter 'help' for a list of built-in commands.

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 ATTITUDE ADJUSTMENT (Attitude Adjustment, r36500)
 -----------------------------------------------------
  * 1/4 oz Vodka      Pour all ingredients into mixing
  * 1/4 oz Gin        tin with ice, strain into glass.
  * 1/4 oz Amaretto
  * 1/4 oz Triple sec
  * 1/4 oz Peach schnapps
  * 1/4 oz Sour mix
  * 1 splash Cranberry juice
 -----------------------------------------------------
root@OpenWrt:/#

Here we go! The TL-WA801ND is now running OpenWRT.

[Update: 10.6.2013]

The above patch was missing a file. This is corrected now.

[Update: 5.7.2013]

A compiled binary can be downloaded here.

[Update: 16.7.2013]

A new compiled binary can be downloaded here. It comes with some more preloaded applications:

  • luci
  • luci-ssl
  • luci-app-qos (Quality of Service)
  • luci-app-wol (Wake-on-LAN)
  • snmpd

[Update: 25.8.2013]

I added a note about the patch above.

199 comments

  1. hello is there a way to use canal 13 ? because it s limited to 11, doesn’t mater wish country i select (i use the client mode)
    i have the same probleme with the wa701nd
    i olso notice the wifi is very poor compared to the 701nd

    1. I experienced the same. There’re two issues as far as I can see: luci is not offering channel 13 and setting the channel via uci is possible but has no effect. I observed similar behavior on other TP-Link devices although I’m not sure if this is specific to the used chips or by design.

      1. The EEPROM in the TP-Link boxes declares regdomain as US no matter where they’re sold. You will have to set ATH_USER_REGD if you want to override this in software.

        Ensure you know the regulations in your country, setting a wrong country/channel/power limit may get you into legal trouble…

      2. Agree. But if you’re allowed to set it to another regulatory domain you’ll see in the log of the access point that it sets to that domain. Nevertheless it does not set any channel above 11.

  2. Maybe I wasn’t clear enough…

    You have to *recompile* OpenWRT with CONFIG_ATH_USER_REGD set to y

    The OpenWRT binaries that you can download from openwrt.org will *not* allow you to select channels 11/12 from the web ui or even via shell in /etc/config/wireless.

    1. Thanks for the hint. I just uploaded a new image of r43321 which is having that set. This version is respecting the regulatory domain and channel 13 can be set.

  3. You are welcome.

    BTW, nicoo and I did a similar port, for the TL-WA7210N, which goes for ~50EUR.

    https://github.com/ffgraz/openwrt/tree/tl-wa7210n-support

    What’s missing is identification of all the GPIOs (LEDs are easy…) and once that’s done, sending a pull request to the OpenWRT devs. If you have any hints regarding the purpose of the GPIOs on the 801ND, I suggest you create an entry in the OpenWRT wiki. Our WIP wiki page is here:

    https://github.com/ffgraz/openwrt-wiki

    cheers

    Alex

  4. Good morning ….

    For those people who has a crippled uboot without tftp transfert working i have build a spezial Python Script to upload the new kernel image automated via bootloader console.

    That means unbricking the device with diabled tftp Client in bootloader without desoldering and external flashing IS POSSIBLE.

    I hope some poeple enjoy this way to unbrick the dead device.

    Here is the code:

    #!/usr/bin/python

    #
    # Some Inports
    #
    import sys # Import for sys.stdout.write
    import string # Import for string handling
    import serial # Import for Serial communication

    #
    # Init Vars
    #
    imagefile = “openwrt.bin”; # define new imagefile
    debugmode = “true”; # set Debugmode to true or false if needed
    stopboot = “tpl”; # word for stopping bootloader on TP-Link
    offset = 0x81000000; # Start Adress in RAM
    offsetflash = 0x9f020000; # start Adress of kernel image in flash
    imagelenght = 0x3c0000; # lenth of openwrt image

    #
    # function for missing printf
    #
    def printf(format, *args):
    sys.stdout.write(format % args)

    #
    # Reading bin file, converting to hex, ordering to 4 Byte Blocks
    #
    str = open(imagefile,”rb”).read(); # Define Filename in
    binarray=[0 for i in range((len(str)/4)+1)]; # Calculating the width of Binarray
    hexStr=””; # Init Var
    count=0; # Init 4 Byte Block Counter
    for x in range(0, len(str), 4): # Loop on str var with step 4
    hexstr=””; # Init 4 Byte Block Content
    hexStr=hex(ord(str[x]))[2:]; # converting bin to hex
    if len(hexStr) < 2: # checking on 1 collum only
    hexstr=hexstr + "0" + (hexStr).strip(); # insert pre 0 if needed + first byte of block
    else:
    hexstr=hexstr + (hexStr).strip(); # first byte of block
    if x+4 <= len(str): # are there some bytes missing?
    for y in range(1, 4): # yes, fill in the missing bytes of block
    hexStr=hex(ord(str[x+y]))[2:]; # converting missing bytes to hex
    if len(hexStr) 0: # are the some bytes missing after last block?
    for z in range(0, missing): # loop on missing bytes after last block
    if debugmode==”true”: print “Adress:”, hex(x+z); # debug output
    hexStr=hex(ord(str[x+z]))[2:]; # convert bin to hex
    if len(hexStr) < 2: # checking on 1 collum only
    hexstr=hexstr + "0" + (hexStr).strip(); # insert pre 0 if needed
    else:
    hexstr=hexstr + (hexStr).strip(); # insert one missing byte

    # After working on last missing Bytes, fill up the last empty Bytes of Block with FF
    for w in range(missing, 4): # fill in all missing bytes of block without content
    hexstr=hexstr + "FF"; # filling up with FF
    if debugmode=="true": print "Fill up next empty Byte of Block with FF";
    if debugmode=="true": print "Offset:", hex(offset+x), "Arraycount:", count, "Byteblock:", hex(x), "Block:", hexstr; # Debug
    binarray[count]=hexstr; # copy converted content to Array
    count +=1; # array block counter +1

    #
    # Serial Console emulation with little output parser
    #
    port = serial.Serial("/dev/ttyUSB0", 115200, timeout = None); # define Serial
    port.flushOutput(); # clear output buffer
    port.flushInput(); # clear input buffer

    # Read line on serial up to CR is incommung
    def serialrdln(pruefung): # funktion on parsing input
    while True:
    line = port.readline().strip(); # reading one line on serial up to CR
    log(line, "in"); # Log output
    if (pruefung) != "": # check if input is empty
    if line == (pruefung): # check if input = parsing line
    return line # return with arg

    # Reading Serial byte by byte and find a defined word
    def serialrd(word): # function on parsing word
    wordlen = len(word); # lenght of parsing word
    charcount = 0; # character conter = 0
    while charcount “, data;
    if typ == “out”:
    print ” “); # parsing console prompt
    log (“State1: Sending mm with offset”, “log”); # log sending mm command with right offset Adress in RAM
    serialwriteecho(“mm ” + (hex(offset)) + “\r\n”); # sending mm command with right offset Adress in RAM and CR with echo
    line = serialrd_input(22); # reading answer from device with offset adress and content
    printf (line); # printing output from device to console
    state = 2; # change to state 2

    if state == 2: # automating the content input to device
    for t in range (0, count): # loop for count of blocks
    serialwriteecho(binarray[t] + “\r\n”); # sending content to port with CR
    line = serialrd_input(22); # reading answer from device with offset adress and content
    printf (line); # printing output from device to console
    state = 3; # change to state 3

    if state == 3: # image is send to ram, stopping mm console with quit
    serialwriteecho(“quit\r\n”); # sending q with CR to port with echo return from device
    data = serialrd(“wasp> “); # parsing console prompt
    state = 4; # change to state 4

    if state == 4: # console input, erasing FLASH
    serialwriteecho(“erase ” + (hex(offsetflash)) + ” +” + (hex(imagelenght)) + “\r\n”); # send erase Flash
    data = serialrd(“wasp> “); # parsing console prompt after earasing
    state = 5; # change to state 5

    if state == 5: # erasing FLASH is done, copy RAM to FLASH
    serialwriteecho(“cp.b ” + (hex(offset)) + ” ” + (hex(offsetflash)) + ” ” + (hex(imagelenght)) + “\r\n”); # send copy to FLASH
    data = serialrd(“wasp> “); # parsing console prompt after flashing
    state = 6; # change to state 6

    if state == 6: # flashing is done, boot from flash
    serialwrite(“bootm ” + (hex(offsetflash)) + “\r\n”); # send boot from flash to device
    port.close(); # close port to device

    break

  5. Has anyone a public storage to upload the code with right tabs and spaces …. After Pasting the code all tabs and spaces where deleted… so the code is unususal.

    THANK YOU

    1. Hi Chri,
      i hope I can help you, but I need some more informations before.

      1.
      Is your device still booting after powering or do you have a reboot loop? Without any connection you can see it at the 4 green led´s at the top of the device.

      Boot loop in bootloader cycle = flashing all green led´s at the same time every 1-3 seconds.

      Booting = different led blinking after powering without flashing of all led´s in a loop.

      The better way is to connect the UART (RS232) of your device to the UART of your PC (Remember the different Voltage of the Ports. You need a Levelshifter to connect both. Without it your device UART Port will be dead for every time.

      2. After connecting your device to PC take a Log of the Bootloader Output and have a look witch bootloader version is installed.

      3. If you have a bootloader with a working TFTP Client you can use the steps posted in the top of this thread.

      4. If you have a bootloader without working TFTP Client you can use my Python Script for unbricking your device.

      4a. On that: Connect your device to the uart of your PC. Look at your PC and write down the Device name of your uart (RS232) …like ttys0 or ttyusb0…

      4b. Copy my script from dropbox in any path of your PC. Copy the new openwrt image to the same directory as the script and rename it to “openwrt.bin”.

      4c. Open the script with a editor end replace the “ttyUSB0” with the name of your UART Port of your PC you written down and save thescript.

      4d. Switch off your Device.

      4e. Open a shell console and change to the path of the script. Start the script with “python tpflash.py” Command (better with Super User rights lige sudo su).

      4f. Switch on your device and wait …… On that take some coffee because the script needs up to 02:10:00 houres to transfert the image to RAM of your device.

      4g. …….. The rest comes up automaticaly …..

      Good Luck

      Regards
      Christian

      1. hello,

        sorry but i follow your instructions ; start your script, then switch on the device and it stops here :

        Offset: 0x813bfff4L Arraycount: 983037 Byteblock: 0x3bfff4 Block: ffffffff
        Offset: 0x813bfff8L Arraycount: 983038 Byteblock: 0x3bfff8 Block: ffffffff
        Offset: 0x813bfffcL Arraycount: 983039 Byteblock: 0x3bfffc Block: ffffffff
        There are 0 bytes left after last Block Offset

        — Stopping Bootloader for getting a Console…

        Serial link with device is still UP so no communication problem. For instance , if i hit Enter key, device finish his boot with the wrong Openwrt image :
        BusyBox v1.19.4 (2013-05-23 16:29:05 CEST) built-in shell (ash)
        Enter ‘help’ for a list of built-in commands.

        _______ ________ __
        | |.—–.—–.—–.| | | |.—-.| |_
        | – || _ | -__| || | | || _|| _|
        |_______|| __|_____|__|__||________||__| |____|
        |__| W I R E L E S S F R E E D O M
        —————————————————–
        ATTITUDE ADJUSTMENT (Attitude Adjustment, r36500)
        —————————————————–
        * 1/4 oz Vodka Pour all ingredients into mixing
        * 1/4 oz Gin tin with ice, strain into glass.
        * 1/4 oz Amaretto
        * 1/4 oz Triple sec
        * 1/4 oz Peach schnapps
        * 1/4 oz Sour mix
        * 1 splash Cranberry juice
        —————————————————–
        root@OpenWrt:/#

        and on my computer , i’ve got this after hitting Enter key :
        Offset: 0x813bfffcL Arraycount: 983039 Byteblock: 0x3bfffc Block: ffffffff
        There are 0 bytes left after last Block Offset

        — Stopping Bootloader for getting a Console…
        Traceback (most recent call last):
        File “./tpflash_n.py”, line 140, in
        data = serialrd(“Autobooting in 1 seconds”); # waiting up the right moment to send STOP to bootloader
        File “./tpflash_n.py”, line 94, in serialrd
        bytestr = port.read(); # read one character
        File “/usr/lib/python2.7/dist-packages/serial/serialposix.py”, line 456, in read
        raise SerialException(‘device reports readiness to read but returned no data (device disconnected?)’)
        serial.serialutil.SerialException: device reports readiness to read but returned no data (device disconnected?)

        Could you help me, Christian ?
        thanks

      2. sorry Christian for my last post…
        I’m an idiot ! It was a good version of openwrt, i’ve just made a mess with network config file…
        It is 12 09 modified version which i’m sure it works.
        Could U give me a link with new version of openwrt which is good for TL-WA801ND v2 ?

        thank and sorry again… do not accept my last post…
        regards
        Cris

      3. It works great with your precompiled image !!!
        Thanks !
        Is your images working with sysupgrade process (via web interface) for device already “openwrt” but with a previous version ? How can we do in a such case without a serial connection ?

    2. Yeah sysupgrade works great too !!! Amazing !!
      Last request (i promess…) : is your image working for 701ND or 901ND ?
      thanks
      cris

  6. regards Christian

    I am using your scripts but stop at this step

    There are 0 bytes left after last Block Offset

    — Stopping Bootloader for getting to Console …

    the device is so

    1.
    Is still booting your device after powering or do you have to reboot loop? Without any connection you can see it at the 4 green LED’s at the top of the device.

    1. Good morning Satan,

      it seems you have a connection problem to your device. The script is at Line “data = serialrd(“Autobooting in 1 seconds”); # waiting up the right moment to send STOP to bootloader” now. That means that the script is waiting for “Autobooting in 1 seconds” output from the device….but in your case there are no characters incomming.

      At this point you have to see all the booting output from your device like:

      U-Boot 1.1.4 (May 24 2012 – 19:13:20)

      U-boot AP123

      DRAM: 32 MB
      id read 0x100000ff
      Flash: 4 MB
      Using default environment

      In: serial
      Out: serial
      Err: serial
      Net: ag934x_enet_initialize…
      wasp reset mask:c03300
      WASP —-> S27 PHY
      GMAC: cfg1 0x5 cfg2 0x7114
      eth0: ba:be:fa:ce:08:41
      s27 reg init
      athrs27_phy_setup ATHR_PHY_CONTROL 4: 0x1000
      athrs27_phy_setup ATHR_PHY_SPEC_STAUS 4: 0x10
      eth0 up
      WASP —-> S27 PHY
      GMAC: cfg1 0xf cfg2 0x7214
      eth1: ba:be:fa:ce:08:41
      s27 reg init lan
      ATHRS27: resetting s27
      ATHRS27: s27 reset done
      athrs27_phy_setup ATHR_PHY_CONTROL 0: 0x1000
      athrs27_phy_setup ATHR_PHY_SPEC_STAUS 0: 0x10
      athrs27_phy_setup ATHR_PHY_CONTROL 1: 0x1000
      athrs27_phy_setup ATHR_PHY_SPEC_STAUS 1: 0x10
      athrs27_phy_setup ATHR_PHY_CONTROL 2: 0x1000
      athrs27_phy_setup ATHR_PHY_SPEC_STAUS 2: 0x10
      athrs27_phy_setup ATHR_PHY_CONTROL 3: 0x1000
      athrs27_phy_setup ATHR_PHY_SPEC_STAUS 3: 0x10
      eth1 up
      eth0, eth1
      Autobooting in 1 seconds

      When there are no incomming characters, please check your UART Connection to PC. There must something be wrong with the wirering.

      Best way is to check the connection before without my script. Therefore please open putty with a serial connection on your port with 115200 speed and reset your device. After that you have to see an output like the text above.

      If there is nothing your connection to device is buggy!!!

      Regards
      Christian

      1. regards Christian

        Were improperly connected cable (solved)

        run the scripts and the last thing Current transition

        813c0000: ffffffff? quit

        — Found String: wasp>
        erase 0x9f020000L + 0x3c0000

        — Found String: wasp>
        0x81000000L cp.b 0x9f020000L 0x3c0000

        — Found String: wasp>

        S27 PHY
        file: ag934x.c,line: 179==: set LAN&WAN SWAP. –debug by HouXB
        GMAC: cfg1 0xf cfg2 0x7114
        eth0: ba:be:fa:ce:08:41
        s27 reg init
        athrs27_phy_setup ATHR_PHY_CONTROL 4: 0x1000
        athrs27_phy_setup ATHR_PHY_SPEC_STAUS 4: 0x10
        eth0 up
        WASP —-> S27 PHY
        file: ag934x.c,line: 179==: set LAN&WAN SWAP. –debug by HouXB
        GMAC: cfg1 0xf cfg2 0x7214
        eth1: ba:be:fa:ce:08:41
        s27 reg init lan
        ATHRS27: resetting s27
        ATHRS27: s27 reset done
        athrs27_phy_setup ATHR_PHY_CONTROL 0: 0x1000
        athrs27_phy_setup ATHR_PHY_SPEC_STAUS 0: 0x50
        athrs27_phy_setup ATHR_PHY_CONTROL 1: 0x1000
        athrs27_phy_setup ATHR_PHY_SPEC_STAUS 1: 0x10
        athrs27_phy_setup ATHR_PHY_CONTROL 2: 0x1000
        athrs27_phy_setup ATHR_PHY_SPEC_STAUS 2: 0x10
        athrs27_phy_setup ATHR_PHY_CONTROL 3: 0x1000
        athrs27_phy_setup ATHR_PHY_SPEC_STAUS 3: 0x10
        eth1 up
        eth0, eth1
        Autobooting in 1 seconds
        ## Booting image at 9f020000 …
        Uncompressing Kernel Image … ERROR: LzmaDecode.c, 543

        Decoding error = 1
        LZMA ERROR 1 – must RESET board to recover

        Thanks for you Help

      2. regards Christian

        Please verify scripts when reading the file openwrt.bin is taking a more character “L” in the String part

        Offset: 0x81000000L Arraycount: 0 Byteblock: 0x0 Block: 01000000

        The size of the * .bin is 0x81000000

        I think the right thing to be without the “L”

        Offset: 0x81000000 Arraycount: 0 Byteblock: 0x0 Block: 01000000

        when this ending run this command

        erase 0x9f020000L + 0x3c0000
        0x81000000L cp.b 0x9f020000L 0x3c0000
        bootm 0x9f020000L

        right when I think should be without the “L”

        erase 0x9f020000 + 0x3c0000
        cp.b 0x81000000 0x9f020000 0x3c0000
        bootm 0x9f020000

  7. regards Christian
    run the python scripts and the last thing Current transition

    813c0000: ffffffff ? quit

    — Found String: wasp>
    erase 0x9f020000L +0x3c0000

    — Found String: wasp>
    cp.b 0x81000000L 0x9f020000L 0x3c0000

    — Found String: wasp>

    <– bootm 0x9f020000L

    1. Hi Satan,

      You are right… Sorry for that. It seems there is a little bug in the script. I will fix it next Monday after my holiday.

      In that time you can input the erase and flashing commands by hand. So i thing transfering the image to ram is working fine.

      As a quick hack you can start the script, transfering the bin to ram. After that ignore the errors on automatic commands and type the erase, flash and reboot command by hand on a console without resetting the device.

      I will fix it soon as possible…

      Regards Christian

      1. Hello Christian

        Thanks for your time and help

        I did as indicated by the manual command, but when I run bootm 9f020000

        starts loading but stops at this step

        [1.080000] VFS: Can not open root device “(null)” or unknown-block (0,0)
        [1.090000] Please append a correct “root =” boot option; here are the available partitions:
        [1.100000] Kernel panic – not syncing: VFS: Unable to mount root fs on unknown-block (0,0)

  8. Hi Satan,

    i have tested my script with 2 devices 5 times. At all times flashing the two devices are done without any error. That means the is now bug in my script. It works fine. But i think it may be poosible that we have some differences in our linux systems. Let me explain my thoughts.

    In one of your post you had a log line like this:

    Offset: 0x81000000L Arraycount: 0 Byteblock: 0x0 Block: 01000000

    This line was printed in my script at line 47 an 68. On my system the output is fine (without the L at the end of the offset adress. Why is it so? Different perl version? it is a standart print syntax in the perl script in the following line:

    print “Offset:”, hex(offset+x), “Arraycount:”, count, “Byteblock:”, hex(x), “Block:”, hexstr;

    In an other post you send a log like this:

    — Found String: wasp>
    erase 0x9f020000L +0x3c0000

    The first line is a log print in line 155. The second line is the answer from the device (it echos the character send to it on the uart). As we see there is some more the L after the string. I think that means the L was send to the device before and it was echoed back. But why is that so? In my perl version and system it works fine without that L.

    So it is possible, that there are some more extra L’s where send in updating the RAM with the hex data.

    So next step is to check your perl and system version. The have to be something buggy with the print command in your version.

    My Perl version is:
    This is perl 5, version 18, subversion 2 (v5.18.2) built for x86_64-linux-gnu-thread-multi
    (with 41 registered patches, see perl -V for more detail).

    My Linux is:
    DISTRIB_ID=Ubuntu
    DISTRIB_RELEASE=14.04
    DISTRIB_CODENAME=trusty
    DISTRIB_DESCRIPTION=”Ubuntu 14.04.1 LTS”
    NAME=”Ubuntu”
    VERSION=”14.04.1 LTS, Trusty Tahr”
    ID=ubuntu
    ID_LIKE=debian
    PRETTY_NAME=”Ubuntu 14.04.1 LTS”
    VERSION_ID=”14.04″
    HOME_URL=”http://www.ubuntu.com/”
    SUPPORT_URL=”http://help.ubuntu.com/”
    BUG_REPORT_URL=”http://bugs.launchpad.net/ubuntu/”

    Gegards

    1. Hello Christian

      I installed *unix 64 bit and it worked fine the scripts

      I have tried several * .bin but do not load well, still not working

      openwrt-ar71xx-generic-tl-WA801ND-v2-squashfs-factory 12.09.bin
      openwrt-ar71xx-generic-tl-WA801ND-v2-squashfs-factory 14.07 (r43601) .bin

      Please tell me which * .bin is running the scripts

      Thanks for the help

      1. Hello Christian

        already solved, I could run the scripts and functions well, since I have the device running

        Many Thanks …..

  9. Note: If you get the message “Please choose a file to upgrade!” when attempting an upgrade from the stock firmware via the admin center/web GUI, just rename the binary file to something short and simple (e.g. openwrt.bin).

    The web GUI does not like long file names or file names with special characters.

  10. Hi Satan,

    It makes me happy hearing you solved all the Problems with the script an your device. In the next 14 Day i will develop a new version of the script in c and compile it to a standart linux object file with some new debugging and monitoring functions. I hope working with that is then some more easyer.

    I wish you and your family some lovely chrismas days and a wonderful new 2015.

    Christian

  11. Hi – Could you upload the latest version of the patch you are using to the DropBox folder. I am trying to patch against 14.07 (Barrier Breaker) but the 12.09 patch isn’t working (understandably!).

    I’m worried if I try to update the patch myself I might miss something, so thought it would be better to see what you’re using.

    Thanks for all your hard work! :)

    1. This is no more required for 14.07. The patch was integrated into the source tree. Version 14.07 supports the device. Just select it in the configuration menu.

  12. Can you share the full .config file you used to build Barrier Breaker image please?
    I want to build from source and it is my first time, I’d like not to mess up having to use serial console afterwards.

  13. Hi

    I just bought an 801ND V2.1 and flashed it with

    openwrt-ar71xx-generic-tl-wa801nd-v2-squashfs-factory

    from the openwrt website.

    It starts up, the four LEDs flash, then the wheel light flashes, and then it stops on, i.e. the power LED and the wheel LED. It doesn’t go any further.

    Can anyone tell me what I’m doing wrong and how to fix this or at least get it back to stock firmware?

    Thanks

    Rob

    1. Hi Rob, why do you think it’s not normal?
      On OpenWRT you sometimes might need additional configuration to associate those LEDs with network activity. The version uploaded here already has those tweaks.
      Try connecting to the AP, it probably works fine.

  14. Hi
    Newbie here and just got hold of an 801ND V2.1 and flashed it with
    openwrt-ar71xx-generic-tl-wa801nd-v2-squashfs-factory
    from the openwrt website.

    It works really well, I need to set it as Bridge with AP, can someone guide me on the configuration please.

    Thanks

  15. This is awesome, I flashed my rooter with your last build r44952, it works flawlessly.

    By the way, I had a “Please choose a file to upgrade!” alert when trying to flash the *.bin, becuse the filename was too long (I renamed it “openwrt.bin”).

  16. any idea how to hard reset?

    i changed the LAN interface (stupidly) to PPPOE and now i cant access the openwrt menu at all :(
    it also cant be pinged.

    when i tried openwrt generic Fail-safe mode, it do give the “quick blink” on gear LED but i cant telnet to 192.168.1.1

    thank you.

  17. TasksOfOhm – Really sorry to bother you good sir. I was having wifi related issues on the latter revision uploaded to your dropbox for my WA801ND v2; drop outs/instability. So I attempted to try what I thought would be a more recently ‘compiled’ image over at: https://downloads.openwrt.org/snapshots/trunk/ar71xx/generic/ “openwrt-ar71xx-generic-tl-wa801nd-v2-squashfs-sysupgrade.bin”

    Not really sure where I stand at the moment, but I am unable to reach ACP at 192.168.1.1. Oddly I can ping, and do receive a response from 192.168.1.1.

    Power LED {Solid lit}, Config LED {Solid lit}, Ethernet LED {Flashing on normal activity – In/Out Packets}

    What do I need in order to revive said device? Can this be done via software, or do I need a UART cable, or other? If additional equipment required, i.e. cables and the like, could you kindly point me in the right direction to what is needed.

    Best Regards,

    stickman89

    1. Hmmm I can still telnet the router, and I believe I can still access it via TFTP… Does this make my life easier? Or do I still need a UART and/or desolder flash chip and reflash that way? If not, what commands can I issue.

      1. No worries… Fixed it myself. Updated root password via telnet. Issued a ‘SCP’ file transfer of the firmware (openwrt.bin) to the /tmp/ directory. Finally, re-installed firmware via sysupgrade -v /tmp/openwrt.bin. Voila.

  18. Muchas gracias por la version. funciona de maravillas, solo una pequeña pregunta, como podria agregar vlans y batman para construir un red en mesh con 2 vlans en bridge, en LuCi no esta la solapa NETWORK — SWITCH, por opkg es imposible no hay suficiente espacio. Saludos

    Thank you very much for the version. works wonders, only one small question, how could add vlans and batman to build a mesh network bridge 2 vlans on in the NETWORK LuCi not flap – SWITCH, by opkg it is impossible not enough space. regards

  19. I have a problem it does boot with your precompiled image but it forces on an ip that is not in the same subnet as my router zo i cant use your script nor connect to the web interface of openwrt now what can i do to fix it in dont have an 3.3v step shifter for a rs232 cable

  20. Thank you very much for porting this software to the TP-Links. I got a bunch of these cheap things and needed a way to expand their functionality and this is the perfect way.

  21. Hi, just wondering, is it possible to convert this AP into a router? a friend a mine bought it thinking it was a router (besides it was less expensive and he thought that it may be a special sale).

    Now he´s stuck with a cable modem and unable to share internet with more than one device. I was wondering that, if it was possible to change the firmware so that the ethernet port would be the wan, and wifi would act like a lan port.

    1. Should be possible.
      You may want to look into NAT and masquerading IPs that come from the wlan interface.

  22. Hi,
    i just updated my Accesspoint with openwrt-ar71xx-generic-tl-wa801nd-v2-squashfs-factory 14.07 unlocked u-boot (r46516) (1).bin

    DHCP after the flash still works. When i type 192.168.1.1 in my webbrowser to reach the webgui i get “Not found The requested URL /cgi-bin/dispatcher.cgi?cmd=0 was not found on this server.

    1. Works fine – openwrt-ar71xx-generic-tl-wa801nd-v2-squashfs-factory 14.07 unlocked u-boot (r48549)

  23. Hello. I flash correctly openwrt with your bin. But I want flash original bin from tp-link and LUCI says “the upload image file does not contain a supported format. Make sure that you choose the genérico image format for your platform”. How I can flash it? The bin is the correct for my tp-wa801 v2. Thanks

      1. ohh, thank you, i don’t see it before. But I try fix it with other method and brick the router with a bootloop. Now i’m use your script for fix it. Thank you very much

  24. Works like a charm! KUDOS!
    I came from a dd-wrt firmware to this one. Had to take the tftp route to get it to flash. It came natural as a “soft” bricked the device trying to flash it (from dd-wrt) with “mtd -r write firmware.bin linux”. Got an error the linux was not supported and locked (or something like that). Then blinkedy, blinkedy, blinkedy :-) brick!
    Made a tftp-server ready and pushed the reset button for a second or so. It came in, grabbed your firmware, and booted up nicely into OpenWrt.
    Thanks again for making this available.
    I’ve made a simple script to push out configuration to multiple units. Windows-CMD which uses blink and sends uci-commands. Installing >10 pcs of this hardware with your firmware next week and needed a way to configure and be able to make changes to them all at once.

  25. What kind of wireless speeds do you guys see with wa801nd/openwrt? It seems that I’m stuck at 20 mbit per second (downstream). Tried different channels, clients, tuning options and so on and so forth, but nothing seems to change the cap.

    Here are my wireless settings:

    wireless.radio0=wifi-device
    wireless.radio0.type=’mac80211′
    wireless.radio0.path=’platform/ar934x_wmac’
    wireless.radio0.country=’DE’
    wireless.radio0.noscan=’1′
    wireless.radio0.hwmode=’11g’
    wireless.radio0.htmode=’HT20′
    wireless.radio0.channel=’4′
    wireless.radio0.bursting=’1′
    wireless.radio0.ff=’1′
    wireless.radio0.compression=’1′
    wireless.radio0.txpower=’19’
    wireless.@wifi-iface[0]=wifi-iface
    wireless.@wifi-iface[0].device=’radio0′
    wireless.@wifi-iface[0].mode=’ap’

    On another note: great work bringing openwrt to this device! Thank you very much!

  26. Hi, can i just upgrade my wa801nd-v2.1 with your latest image (factory 14.07 unlocked u-boot r48549) through stock firmware interface? Or is the tftp flash still mandatory?

  27. Like Lior above, I can not get this to work as a repeater. Is there a doc on configuing as a repeater? Thank you.

  28. Could you please compile an updated (Chaos Calmer/15.05.1) image including your modifications (preloaded luci, luci-ssl, luci-app-qos, luci-app-wol, snmpd)? Or at least tell how you built it (as detailed as this blog post? https://www.andrewklau.com/generating-my-own-openwrt-custom-firmware/)?
    I upgraded from your r44952 14.07 binary image to bleeding edge r49971 Designated Driver and there is not enough space to install luci (opkg install luci) unfortunately, but I can confirm that OpenWRT still works on it.

  29. Thanks a lot man. I bought wa801nd to use it as client to wired router which use internet from iPhone 5. It refuses to work stable because both router and iPhone have quite stupid software. After applying 12.09 bin on router everything works perfect. I am surprised manufacturer did not put any effort to even use your solution. Thanks again man

  30. Hi, I have a TL-WA801ND V2 with 150422 here, it is used as a public AP, with DHCP server off.
    After a few days of uptime, eventually the internet connnection breaks, but the Wi-Fi still works and SSID is visible. After rebooting the WA801ND the internet works again.
    Is OpenWRT known to be more stable than the stock firmware? Which build is known stable wtih everything working, and is there any recovery method without soldering anything?

      1. Thanks for the swift reply!
        Yeah thats already the impression I got… the stock FW is buggy and unstable compared to openWRT.

        Like I said, it is a public AP, I dont own the device lol… but the internet keeps breaking, I thought I could help out by updating to openWRT, but I need to know 100% that it won’t brick.

        tl;dr: So my question is, can I just take the latest build (with unlocked u-boot, what does that mean exactly?) flash it through stock FW web interface, and expect everything to work? So luci is enabled and working by default?
        Also, the network is configured here such that 192.168.1.1 is the IP of the gateway/modem, so after flashing there will be a conflict. Can I set the IP of the TP-link to another IP using the luci interface?

        Thanks again!

  31. Hi there,

    I probably made a mistake :) I have a WA801ND 2.1 and the stock firmware did not allow me to create a guest SSID with no access to my LAN/WAN devices, I was looking to provide only Internet access to guests

    Browsing the net, I found that openwrt would allow this but V2 801ND V2 were not supported because of the lack of ram on this earlier model.

    I was happy to find this blog relating to a build of OperWrt for this specific V2 model. I found that software binaries were available for download on Dropbox and I downloaded “openwrt-ar71xx-generic-tl-wa801nd-v2-squashfs-fact…oot (r48549).bin” because it was the most recent one…

    I renamed it and flashed my 801 V2.1 with it. The front end said it got flashed successfully. However, when the unit restarted it got stuck(?) with the first two leds (power and system) ON / Green, all the others off. The manual says that the system led is on when initializing… But after 30 minutes, I am led to believe that my unit is bricked as it isn’t blinking.

    1 was the bin file I downloaded the wrong one for my 801ND-V2.1 ??
    2 can I access it although it seems bricked ? via Ethernet ?? another way ?
    3 is my unit good for the bin now ?

    I am a mac user, I can run w10 under parallel desktop if needed. I am not too bad with a soldering iron but I don’t want to spend ages to resurrect this unit. If it can be done in one or two evenings, this is fine :)

    Charles

Leave a reply to Christian Cancel reply