The easy way:
1- Backup u-boot+art, flash uboot to new flash rom.
2- Solder new flash rom to board & install firmware by tftp.
3- Flash ART by using kmod-mtd-rw.
You will also need to reconfigure the partition table embedded into the firmware image. In practice, you need to modify your device's build recipe to define 16 mb flash instead of 4 (and to move art location info to reflect the new place...). And then compile a new image and flash that
I've made backups of mtd0 and mtd4 partitions.
Then I look at mtd0: I found MAC at position 0x1FC00 and PIN at position 0x1FE00, but there is no MODEL at position 0x1FD00, I see FF's there. But my router works OK with this flash. Is it okay?
Basically you need a backup of the u-boot (mtd0) and art (mtd4) then you will need an u-boot from https://github.com/pepe2k/u-boot_mod .
You need to make an empty 16MB file then starting from 0x0000000 address to put your original u-boot and right over it (from 0x0000000) the Pepe2k uboot.
The Pepe's u-boot contans a web server in order to upload firmware and art.
After flashing the 16MB combined u-boot flash file to SPI chip, solder it to your router, solder the serial connection as well.
Connect serial TTL USB cable to the router to watch the boot up.
Set your ip address to static: 192.168.1.4
Boot up the router (the u-boot web server should start automatically) and upload your art partition: http://192.168.1.1/art.html
Build your generic firmware with 16MB size and upload it at: http://192.168.1.1
My router is old enough, and probably it's uboot wil not recognize 16 MB chip. I've bought one 16 MB SPI FLASH W25Q128FVSG, when I'l get it I'l try burn it with factory uboot.
Just in case I've build u-boot from official TP-Link sources (link), which should work with up to 16 MB flash chips (according to /GPL_Code/ap81fus/boot/u-boot/include/configs/ap81.h, line 207).
Now I am preparing image for flashing to new chip via CH431A SPI programmer (in WinHex):
Firstly I created new empty 16777216 bytes file.
Then I write to begining of this new file previously optained bootloader (mtd0 from working router, size 131072 bytes).
Then I add to the end of this new file ART (mtd4 from working router, size 65536 bytes).
Now I can write this image to new chip, solder in router and flash firmware via tftp?
Also, I edited a bit source code of OpenWrt (added new version of TL-WR941ND V3 with 16 MB chip) and built new firmware. I obtained openwrt-......-factory.bin, openwrt-......-sysupgrade.bin and so on. How I can add this file to new 16 MB image? It will be easier to write image with firmware already - tftpd procedure will be ommited and I will obtain working (i hope ) router already after soldering new flash chip.
I've already edited this file, compile firmware.
My question is how to insert this firmware to new 16 MB spi flash by SPI programmer?
I've inserted bootloader and ART, but I don't know how to insert firmware.
Place the firmware in the flash chip image at the 128k boundary right after the bootloader (offset 0x20000). Use the sysupgrade bin file. A release build will automatically find the larger flash chip and create the proper larger overlay filesystem. It is not necessary to compile your own unless you want other changes.
Thanks, it's exactly as I thought.
It's better to build firmware with all needed software at once, because, as I read, wherein software will take up less space due to a compression.
Great, I will try write flash at Monday and post here my results.
Finaly I've done flash upgrade procedure. Stock bootloader correctly work with 16 MB Winbond 25q128fv flash chip.
For building big firmwares I've edited this files:
\source\target\linux\ar71xx\image\tiny-tp-link.mk:
I've added this:
Then I've craete new image using WinHex - firstly I've created empty 16777216 bytes file, then I've filled it by FFs, then insert into it previously obtained bootloader (cat /dev/mtd0 from router running with original 4 MB flash), and to the end - I've insert previously obtained ART to the last 64 kbytes of new 16 MB image.
Then I write this image to new 16 MB chip by SPI programmer CH431A, replace old 4 MB chip by this new burned 16 MB chip. Turn on router and voolya - It's working!