How to replace flash chip?

I've got a TL-MR-3040, which is nice, but it has a tiny 4 MB flash. I'd also like to upgrade a "Alfa Hornet UB" (from 8 to 16 MB).

I have a W25Q128FV (that was on a Carambola 2).

Can you outline the steps to replace the flash chip ?

I have a SOIC clip and I've used "flashrom". I know I have to save and restore the "ART" partition.

Do I need to build a new "uboot" or just change the "mtdparts" environment variable ?

Thanks

Most TP-Link builds contain tplinkparts.c in the kernel, which detects the flash size at boot and automatically partitions. This means you don't need to rebuild for a larger chip. The partitioning passed on the kernel command line from the bootloader is not used in any case. I think that very few OpenWrt builds look at it at all.

Use the OpenWrt running on your router now to extract a copy of the bootloader and the ART. Prepare the new flash chip as follows:

  • copy of bootloader (128 kB)
  • "sysupgrade" OpenWrt image
  • empty space (can be anything, it will be erased upon first boot)
  • ART (64k). The ART must be in the last 64k block of the chip no matter what chip size.

Then solder this chip into your router and boot. Note that the first boot of a 16 MB chip can take up to 5 minutes to format the JFFS space. During this time the power LED will be flashing slowly and the network will be down.

The stock uboot can still read and write the flash chip, but only the first 4 MB. This is usually not a problem. Also check out the very handy kmod-mtd-rw which lets you write your ART or bootloader at runtime.

2 Likes

I have done this before for ar71xx, and the procedure is exactly as @mk24 described. If you are bothered that the stock uboot can't "see" the whole flash, and you generally want a better featured bootloader, check pepe2k's builds, I think your devices are already supported.
Good luck.