I have a lot of TP-Link TL-WR841N v11 which I bought in bulk for a cheap price. The strange thing about them is the inability to install OpenWrt. The TP-Link web interface throws a wrong image error when trying to flash. Even with TFTP recovery method -- the image file does get transferred on TFTP server log, but then the router immediately reboots without flashing.
I created a thread about this issue long ago, and after 3 years I finally discover the cause of the problem myself. The device is in fact a limited version made by TP-Link for a local ISP namely FPT Telecom.
The SPI flash chip on the board is a GigaDevice 625Q64CSIG which is 64 mebibit (8MiB). And that was the reason it refused to accept 4MiB image files, even those downloaded from TP-Link official website.
Here is a snippet of the output when booting the stock firmware:
5 cmdlinepart partitions found on MTD device ath-nor0
Creating 5 MTD partitions on "ath-nor0":
0x000000000000-0x000000020000 : "u-boot"
0x000000020000-0x000000120000 : "kernel"
0x000000120000-0x0000007e0000 : "rootfs"
0x0000007e0000-0x0000007f0000 : "config"
0x0000007f0000-0x000000800000 : "art"
So, we have 128KiB u-boot
partition, a 1MiB kernel
partition, a 6912KiB rootfs
partition, a 64KiB config
partition, and a 64KiB art
partition. Pay attention to the position of the art
partition: it is located at the end of the flash chip.
By modding a serial connection and flashing OpenWrt image via u-boot
, I was able to force a successful installation of OpenWrt. Here is the kernel boot log:
[ 0.334371] m25p80 spi0.0: gd25q64 (8192 Kbytes)
[ 0.339204] 3 fixed-partitions partitions found on MTD device spi0.0
[ 0.345785] Creating 3 MTD partitions on "spi0.0":
[ 0.350748] 0x000000000000-0x000000020000 : "u-boot"
[ 0.356841] 0x000000020000-0x0000003f0000 : "firmware"
[ 0.363225] 2 tplink-fw partitions found on MTD device firmware
[ 0.369427] Creating 2 MTD partitions on "firmware":
[ 0.374584] 0x000000000000-0x00000015dd78 : "kernel"
[ 0.380546] 0x00000015dd78-0x0000003d0000 : "rootfs"
[ 0.386595] mtd: device 3 (rootfs) set to be root filesystem
[ 0.392501] 1 squashfs-split partitions found on MTD device rootfs
[ 0.398966] 0x000000380000-0x0000003d0000 : "rootfs_data"
[ 0.405399] 0x0000003f0000-0x000000400000 : "art"
OpenWrt assumes that the art
partition is located at offset 0x3f0000 (4,032KiB), but in reality that partition is located at offset 0x7f0000 (8,128KiB). Hence Wi-Fi functionality is out of the question.
I was able to use dd
to move the art
partition to offset 0x3f0000 and Wi-Fi worked. But I am still stuck with a 4MiB usable storage.
Where is the partition offset information stored? And how can I edit it to use all available flash? Specifically, I need to:
- Change the offset of the
art
partition to 0x7f0000 (8,128KiB). - Change the size of the
rootfs
partition to all available space. - If the mtdsplit
rootfs_data
partition is not auto-detected, I need to change its offsets too.
I am using images built from 19.07.10 ImageBuilder, if that matters.