Copying firmware from old 4 MBytes chip to new 16 MBytes

Some general points, mostly for others who hit this thread at a later date....

Number 1

Copy everything. Then copy every division of everything separately. Make multiple copies of the previous.

Number 2

Adding headers / quick connects to the board/flash can be helpful.

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.

1 Like

Simply changing chip will not be enough.

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

1 Like

Most tplink builds will dynamically partition and thus automatically use a larger flash chip. Rebuilding is not required.

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?

I have done a 16MB upgrade on TL-WR841 v8 according to this guide (German): https://www.youtube.com/watch?v=l6rw1zo4A2c

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

Reboot your router and Openwrt should start.

1 Like

As of mk24 say, today most of tplink no need pepe2k uboot to reconigze larger chip. Just flash uboot to new chip, flash owrt & restore ART mtd.

Your TL-WR841 v8 has SOC AR9341, which is supported by Pepe2k uboot. Mine SOC AR9132 isn't supported by this custom uboot.

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).

If I remember correctly, Owrt 18.06.1 can recognize & handle full 16mb chip.

I 've got my new 16 MB chip.

Now I am preparing image for flashing to new chip via CH431A SPI programmer (in WinHex):

  1. Firstly I created new empty 16777216 bytes file.
  2. Then I write to begining of this new file previously optained bootloader (mtd0 from working router, size 131072 bytes).
  3. Then I add to the end of this new file ART (mtd4 from working router, size 65536 bytes).
  4. 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 :slight_smile:) router already after soldering new flash chip.

Thanks.

You can generate 16MB image by edit target/linux/ar71xx/image/tiny-tp-link.mk, change 4m to 16m in 941nd v3 section.

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.

TFTP upload method.

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.

That is true, but now that you have 16 MB of flash you won't need to care about that so much.

it is a relic of the past - original flash size is 4 MB - very tight =)

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:

define Device/tl-wr941nd-v3-16MB-NOLZMA
  $(Device/tplink-16m)
  DEVICE_TITLE := TP-LINK TL-WR941N/ND v3 16 MB NOLZMA
  BOARDNAME := TL-WR941ND
  DEVICE_PROFILE := TLWR941
  TPLINK_HWID := 0x09410002
  TPLINK_HWREV := 3
endef
TARGET_DEVICES += tl-wr941nd-v3-16MB-NOLZMA

And in this file:
\source\target\linux\ar71xx\image\common-tp-link.mk
I've added this

define Device/tplink-16m
  $(Device/tplink-nolzma)
  TPLINK_FLASHLAYOUT := 16M
  IMAGE_SIZE := 15872k
endef

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!

4 Likes

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.