Support for TL-WR840N Ver 6.0

Here are the steps for anyone to compile openwrt for tp-link 840 version 6,6.1,6.2
Get needed files from here:

  1. clone latest openwrt
  2. cd scripts/ and make ./feeds update
  3. install luci if you need to
  4. copy dts files to target/linux/ramips/dts
  5. copy to target/linux/ramips/image/
  6. copy 02_network to ./target/linux/ramips/mt76x8/base-files/etc/board.d/02_network
  7. leds for tp-link version 6.2 you can see in file 6.2-leds. You can do your etc/config/system with 6.2-leds
  8. make menuconfig and choose your arch:
    Target System (MediaTek Ralink MIPS)
    Subtarget (MT76x8 based boards)
    Target Profile (TP-Link TL-WR840N v6.2)
  9. Note that space is not enough for luci if you can not remove kernel and busybox options you do not need like tar/gzip...
    You can remove IPV6 for quick free space.
  10. make V=99 (this to compile)
  11. ready images will be here: bin/targets/ramips/mt76x8/
    You can flash from original software. Note that you will have also tftp images.
    You can flash with them too using address.
  12. I hope someone finally put this into openwrt tree :slight_smile:

If you remove unneeded stuff there is a plenty of space !!! Personally i have web luci with upnp + ipv6 and netfilter extra modules and still have 200K free !
Note that you need latest openwrt because there are changes in dts files which i changed here already.

Note: needs updating ! Also is not entirely true. Because there are lots of unneeded packages you do not need like tar/gz for example etc....
My image openwrt-ramips-mt76x8-tplink_tl-wr840n-v6.2-squashfs-sysupgrade.bin is 3604754 bytes big. This is mtd partitions:

df -h

Filesystem Size Used Available Use% Mounted on
/dev/root 2.3M 2.3M 0 100% /rom
tmpfs 14.1M 88.0K 14.0M 1% /tmp
tmpfs 14.1M 52.0K 14.0M 0% /tmp/root
tmpfs 512.0K 0 512.0K 0% /dev
/dev/mtdblock4 448.0K 228.0K 220.0K 51% /overlay
overlayfs:/overlay 448.0K 228.0K 220.0K 51% /

This router has luci+ipv6+natfilter_extra_modules and still 220K free !
I can even install tcpdump :slight_smile:


I'm trying to compile Ver 6.0
Download of version of yesterday (635f111148) fails with the current message:

mipsel-openwrt-linux-musl-cpp: error: ../dts/mt7628an_mediatek_br-323.dts: No such file or directory
mipsel-openwrt-linux-musl-cpp: warning: '-x assembler-with-cpp' after last input file has no effect
mipsel-openwrt-linux-musl-cpp: fatal error: no input files
compilation terminated.
make[5]: *** [Makefile:195: /Devel/OpenWRT/openwrtwr-840n-v6/build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/image-mt7628an_mediatek_br-323.dtb] Error 1
make[5]: Leaving directory '/Devel/OpenWRT/openwrtwr-840n-v6/target/linux/ramips/image'
type or paste code here

Any hints?
Should I use v19.07.3 instead of newest one?

1 Like

Hi boys, I need WR840N Version 6.20 openwrt image with Luci compiled to flash from standard tplink firmware ui ?

I want to use WR840N V6.20 for switch with vlans :slight_smile:

yess, truee...... agree

by the way, i just try to expand the space using 25q128 (16Mbyte)
by the rough of our eyes, looks work correctly and pretty well...

here my dmesg are

[    0.287284] console [ttyS0] enabled
[    0.294274] bootconsole [early0] disabled
[    0.303557] spi-mt7621 10000b00.spi: sys_freq: 193333333
[    0.323751] m25p80 spi0.0: w25q128 (16384 Kbytes)
[    0.328594] 4 fixed-partitions partitions found on MTD device spi0.0
[    0.335032] Creating 4 MTD partitions on "spi0.0":
[    0.339918] 0x000000000000-0x000000010000 : "boot"
[    0.345628] 0x000000010000-0x000000fb0000 : "firmware"
[    0.353528] 2 tplink-fw partitions found on MTD device firmware
[    0.359604] Creating 2 MTD partitions on "firmware":
[    0.364647] 0x000000000000-0x0000001851b2 : "kernel"
[    0.370570] 0x0000001851b4-0x000000fa0000 : "rootfs"
[    0.376294] mtd: device 3 (rootfs) set to be root filesystem
[    0.383514] 1 squashfs-split partitions found on MTD device rootfs
[    0.389854] 0x000000370000-0x000000fa0000 : "rootfs_data"
[    0.396167] 0x000000fe0000-0x000000ff0000 : "config"
[    0.402082] 0x000000ff0000-0x000001000000 : "factory"
[    0.408708] libphy: Fixed MDIO Bus: probed
[    0.424844] rt3050-esw 10110000.esw: link changed 0x00
[    0.430957] mtk_soc_eth 10100000.ethernet: generated random MAC address 06:53:5a:8d:d2:50
[    0.439948] mtk_soc_eth 10100000.ethernet eth0: mediatek frame engine at 0xb0100000, irq 5
[    0.449946] NET: Registered protocol family 10
[    0.458277] Segment Routing with IPv6
[    0.462091] NET: Registered protocol family 17
[    0.466715] 8021q: 802.1Q VLAN Support v1.8
[    0.480102] VFS: Mounted root (squashfs filesystem) readonly on device 31:3.
[    0.493753] Freeing unused kernel memory: 1200K
[    0.498389] This architecture does not have kernel memory protection.
[    1.527619] init: Console is alive
[    1.531299] init: - watchdog -
[    2.206360] random: fast init done
[    2.530951] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    2.695594] kmodloader: done loading kernel modules from /etc/modules-boot.d/*

and here my littlescrap configuration

define Device/tl-wr840n-v6-16m
  DTS := TL-WR840NV6-16M
  MTK_SOC := mt7628an
  IMAGE_SIZE := $(ralink_default_fw_size_16M)
  DEVICE_TITLE := TP-Link TL-WR840N v6 (16M |
  TPLINK_HWID := 0x08400006
  IMAGES += tftp-recovery.bin factory.bin
  IMAGE/tftp-recovery.bin := pad-extra 64k | $$(IMAGE/factory.bin)
  SUPPORTED_DEVICES += tl-wr840n-v6-16m
TARGET_DEVICES += tl-wr840n-v6-16m
/ {
        compatible = "tplink,tl-wr840n-v6-16m", "mediatek,mt7628an-soc";
        model = "TP-Link TL-WR840N v6 (16M)";

&spi0 {
        status = "okay";

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

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

                        partition@0 {
                                label = "boot";
                                reg = <0x0 0x10000>;

                        partition@10000 {
                                compatible = "tplink,firmware";
                                label = "firmware";
                                reg = <0x10000 0xfa0000>;

                        partition@fe0000 {
                                label = "config";
                                reg = <0xfe0000 0x10000>;

                        factory: partition@ff0000 {
                                label = "factory";
                                reg = <0xff0000 0x10000>;


technically itjust working well, if i just compailing it with no any else .config added
but whenever i put ssh or LuCI embeded on it ..

[    6.723109] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00240014: 0x0400 instead
[    6.732734] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00240018: 0x517d instead
[    6.742359] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0024001c: 0x0898 instead
[    6.751984] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00240020: 0xf644 instead
[    6.761609] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00240024: 0xb018 instead
[    6.771259] jffs2: Further such events for this erase block will not be printed

[    6.822733] jffs2: CLEANMARKER node found at 0x0024ae54, not first node in block (0x00240000)
[    6.900093] jffs2: Cowardly refusing to erase blocks on filesystem with no valid JFFS2 nodes
[    6.908670] jffs2: empty_blocks 188, bad_blocks 0, c->nr_blocks 225
[    6.915107] VFS: Cannot open root device "(null)" or unknown-block(31,3): error -5
[    6.922792] Please append a correct "root=" boot option; here are the available partitions:
[    6.931280] 1f00              64 mtdblock0
[    6.931285]  (driver?)
[    6.937927] 1f01           16000 mtdblock1
[    6.937931]  (driver?)
[    6.944554] 1f02            1556 mtdblock2
[    6.944557]  (driver?)
[    6.951197] 1f03           14443 mtdblock3
[    6.951201]  (driver?)
[    6.957840] 1f04           10688 mtdblock4
[    6.957844]  (driver?)
[    6.964467] 1f05              64 mtdblock5
[    6.964470]  (driver?)
[    6.971115] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,3)
[    6.983281] Rebooting in 1 seconds..
DU Setting Cal Done�۸8890000][2������A][00252���݊

then kernel panik.. just shows'up
so, what iam missing then ?

support added in my LEDE fork for TL-WR840N v6 see [Testing] lede-17.01 security backports for 4/32 devices

We can still build version 6.0,6.1,6.2,14 versus latest openwrt and have enough free space so we can store settings during restarts. I can upload dts/02_network and if someone is interested in making patches. Also i can upload good .config and kernel config files where i cut things we do not need like ca-bundle (over 100K compressed) and similar stuff. Also my build has ipv6 and luci/upnp/extra nat modules included.
This is my final image size:
3735853 Oct 21 11:08 openwrt-ramips-mt76x8-tplink_tl-wr840n-v6.2-squashfs-sysupgrade.bin

please share - looks interesting

Ok here you can see my builds:

Check the readme for personal build.

small fix to 6.2 dts file

&ethernet {
	mtd-mac-address = <&factory 0xf100>;
        mtd-mac-address-increment = <1>;

I uploaded the change.
I will not recompile old binaries (no time) so you will have all interfaces same mac address and WAN mac will be the same as LAN and on the sticker of the router....
Everyone can get the source and fix it.....

where dts for version 14

There is already version 14 in openwrt. You do not need mine :slight_smile:

Link not worked (


If something does not work notify me...


I tried your sysupgrade.bin on my v6.2 but I was unable to do anything with it once I flashed it. Everything looked good, but I couldn't update package list or even change the ip address of the device. I have since reverted back to stock tplink firmware without issues. Too bad because it was actually working, but I need to add sqm at least... otherwise I would of kept it.

If you want to add just compile it by yourself.
There is so little space left on the device so i removed almost all.
If you plan to add php or stuff like that just forget it. There is no space even for tcpdump.....

1 Like

that's why I tried backporting it to my LEDE based tree ([Testing] lede-17.01 security backports for 4/32 devices) but it seems I still need to do some stabilizing work on it


Im using your build and things runs great!, thanks man I hope to see another update on this.
ps: mine is TL-WR840N V6.2

Hello all,

I'm new in the forum and newbie with OpenWrt.
I'd like to know if anyone have the factory.bin ready to upload to router wr840n V6 (BR).
As @gaspare explain, the wr840n V6 (BR) is a MEDIATEK MT7628NN, with 4M of flash and 32M of RAM.


Thanks ! It's working very well on my TL-WR840N v6.2 with your binary.

I tried to compile it myself but the target device strangely doesn't show up on make menuconfig (there are no TL-WR840N targets available at all).

Also, file 02_network access is forbidden.