LEDE for WR841N v13/WR840N v4

Этот пост на русском языке

Damn. I just wanted to start a blog and left it alone after the introduction post. It’s time to return.

TP-Link continues to migrate onto the new Mediatek chipsets. They’ve released new versions of two popular routers recently: WR841N and WR840N.

Some guy called svobodavac made a patch for wr840n v4 initial support by LEDE. That pull request was declined by LEDE and was temporary closed.

Unfortunately, the mt76 wireless open-source driver is not able to provide a stable wireless connection. With this driver I had continuous disconnects, missing beacons, packet loses, low power signal (this was fixed with new EEPROM location in dts). I don’t know if it works or not properly for all mt76xx devices or just mt7603.

So I decided to build LEDE with a proprietary MTK driver.

All images are LEDE 17.01.

For WR841N v13:

lede-ramips-mt7628-tl-wr841n-v13-squashfs-factory.bin

lede-ramips-mt7628-tl-wr841n-v13-squashfs-sysupgrade.bin

For WR840N v4 (WARNING! This firmware wasn’t tested on WR840N V4! I doubt that you’ll face any issues, because this two devices are similar, but I have warned you):

lede-ramips-mt7628-tl-wr840n-v4-squashfs-factory.bin

lede-ramips-mt7628-tl-wr840n-v4-squashfs-sysupgrade.bin

FAQ:

How to install?
The installation is only possible via TFTP. Nothing special, just like on any other TP-Link. The file name must be tp_recovery.bin.

More info about using TP-Link TFTP recovery can be found here (Windows-only).

How to update from LEDE/OpenWrt?
You can do it via LuCI Backup/Flash Firmware, or via sysupgrade over SSH. Just use the sysupgrade image. The factory image flashing via OpenWrt/LEDE won’t work for now.

If you have installed a firmware WR840N v4 on WR841N v13 or vice-versa, it’s better to update via TFTP (more info in previous spoiler).

Will I ever be able to flash this via stock web-interface?
Probably, yes. There are some discussions about it in the pull request comments. It seems that new TP-Link firmware have a new header. Now all LEDE/OpenWrt firmwares are built with empty header and because of that it can be flashed only via TFTP.
Where is the driver was taken from?
The driver for 4.1.X.X kernel was taken from the Padavan for Asus RT-N56U firmware. Makefile for the kernel package was taken from here. Some dependencies was taken from padavan firmware and from witi-openwrt.
How stable it is?
It seems that it is very stable. I didn’t have disconnects or packet loss.
What was tested and works?
The wireless itself :), UCI control, MultiSSID.
What does not work?
Controlling via LuCI. This is because of iwinfo doesn’t work properly with this driver and can’t provide any information about device. Now you can only set SSID and WEP encryption via LuCI, any other setting can be changed over ssh.

Also, the wireless LED doesn’t work too. You can set it to rai0 interface in LuCI LED Configuration to make it flash when data received or transmitted :).

What probably works?
WDS and client mode. I haven’t tested it yet, but the driver supports it. Generally speaking, this driver must have full support of this device. The problems can be occurred during a UCI to .dat config translation.
How to configure wireless via SSH?
The documentation for all UCI params can be found here. Right after the first boot wireless broadcasts with SSID “MT7628” and without encryption. It is connected to the br-lan bridge by default. So you can found the example configuration in /etc/config/wireless file.
'Wireless is disabled or not associated'!
This is because of iwinfo, which can’t provide any information. So, LuCI is unable to get real wireless status. The wireless itself should work and you should be able to see it on other devices.
There is no wlan0 interface!
The driver creates rai0, rai1, rai2… interfaces instead of wlan0, wlan1, wlan2…
What about package repositories?
I’ve replaced core repo with my own repo, which will be hosted on my server. Core repo contains all kernel modules provided with LEDE. You can’t install kernel modules from the lede-project.org because of hashsum mismatch (this was done by OpenWrt developers). All other repos (base, routing, telephony…) are default, from lede-project.org. You only need to uncomment them in /etc/opkg/distfeeds.conf.
How long you gonna keep this repo?
I’ll try to keep it as long as possible. All new builds will be in separate directories, so that way I’ll not break opkg when new build will be released.
Is source code or patch available?
I’ve created the LEDE feed with this driver. It is available here: https://github.com/worm202/lede-mt7603
Why don't you make a pull request to the LEDE repo?
LEDE will not approve this, because MTK driver is non-free. To make LEDE officially support those devices we need to fix the open-source driver. Moreover, there was a problem with firmware header, this needs to be fixed too.

I’m working on it. If I fix it, I’ll make pull request to LEDE.

Why wr840n v4 wasn't tested?
It’s easy – I don’t have a device. Because of it’s similarity to wr841n v13 it probably work as well.
What is the difference between wr841n v13 and wr840n v4?
As I know, there is a difference in LEDs. WR841N v13 has 4 LAN LEDs, but WR840N v4 only one. Generally, this two devices are similar (or same). LEDE firmwares are compatiable, so WR841N v13 can work with WR840N v4 firmware.
Can this driver work with other Mediatek Wi-Fi chips?
Probably, yes. It has support for multiple chips including, for example, MT7610E (802.11 AC chip, which isn’t available on LEDE/OpenWrt yet). The problem with packages in my repo is that it was modified to build and work on this two devices specifically.
It doesn't work / I didn't understand anything, how to revert back to the stock firmware?
TFTP.

Stock TP-Link firmware without boot: WR840N v4, WR841N v13.

(PLEASE DO NOT USE FIRMWARE FROM TP-LINK OFFICIAL SITE WHEN REVERTING OVER TFTP. YOU’LL BRICK YOUR DEVICE COMPLETELY!)

The filename of firmware should be tp_recovery.bin.

7 thoughts on “LEDE for WR841N v13/WR840N v4”

  1. Hi Raxp

    Can you be so kind to write tutorial how to build fresh openwrt firmware with this driver?
    I tested and works perfectly.

    Regards

    1. Yeah, damn, I totally forgot. I apologize, but I didn’t had much time to clean things up. I decided to just publish this as it is.
      I’ll try to do this as soon as possible

      1. Hi,

        Even if you don’t have time to write a tutorial just yet, can you at least rebuild this version and post the binaries? The opensource version of the driver is still not working right, and I’m having troubles to re-implement what you did here.

Leave a Reply

Your email address will not be published. Required fields are marked *