TP-Link C2600 flash memory upgrade

Hi,

I am trying to replace the MX25U25635F flash chip with a MX25U51245G one. I have not yet made any soldering, because firstly I would like to create a "semi" working image before I try to replace the flash memory.

My initial thought is to dump the complete content of the current 32 MByte flash, and write it back twice to the new 64 MByte one. In this stage, I think the router can be booted as before. Then, download and modify the partition table in the device tree, then build a sysupgrade type image, and flash it back, then the whole chip will be used now and I will have plenty of free space to install anything else. I made the attached patch, which is almost working.

I figured out that the final image was constructed with a binary called 'tplink-safeloader', which I found in the firmware-utils package (https://github.com/openwrt/firmware-utils) and this was built during the build process.

My problem is I had to patch the tplink-safeloader.c as well to add the modified "C2600M64" device type, because if I did not modify the identifier to this, I can only create images that are not larger than the original one.

This is my current process:

  1. clone this: https://github.com/openwrt/openwrt && switch to tags/v25.12.0-rc4
  2. apply my c2600_64m.diff patch
  3. copy the .config from the "openwrt-imagebuilder-25.12.0-rc4-ipq806x-generic.Linux-x86_64.tar.zst"
  4. make && wait cca 40 minutes
  5. find the created imagebuilder in the bin directory

The first part is done.

  1. clone this: https://github.com/openwrt/firmware-utils
  2. apply my firmware-utils-c2600_64m.diff patch
  3. build the patched "tplink-safeloader" with 'gcc tplink-safeloader.c -lssl -lcrypto -o .tplink-safeloader.bin'
  4. replace the original '.tplink-safeloader.bin' in the /staging_dir/host/bin with the new one

And finally, images can be built from now (but I did not test it yet!).

My question is, is there any better way to integrate the patching of the 'firmware-utils' into the main build process? I mean, to generate the right version of the imagebuilder without touching anything by hand?

You have to rebuild kernel which has offsets of wifi config/ mac address blocks compiled in, imagebuilder will not rebuild kernel

why are you even doing this, C2600 got two USB3 ports, simply use extroot.

or leave the default layout intact, use the extra space after the last mtd as extroot.

Yepp, I can rebuild the universe (look at the first five steps), and I can create a "new" imagebuilder, which contains all the required patches and modifications (and the created image looks fine for my eyes).

My only problem is the last four steps, which require some manual touching, and because of this, it looks ugly, something that hurts my eyes. I am looking for a better solution, something that looks beautiful.

Why not? I used preconfigured/built images in the past ~20 years, which I made, and it contained all the required packages and configuration files (so, the storage on the USB contains only data, not software or configuration), and I want to do this in the future as well, but 25.12 will get some extra weight, and soldering back a bigger flash seems the most fun and interesting way to continue this thing.

My second thought was to keep the original flash and destroy the partition layout completely. With this, maybe I can build it from ground up from zero, starting with a fresh U-boot. But removing/replacing the flash seems easier :smiley:

Partition layout is compiled in as described in dts. very few devices use partitions like a pc eg raspberry sd cards.

Yes, I know it. I already modified it (see the first patch, which adds a new target which was based on the original c2600 target).

It is not guaranteed that the PCB takes >16 MB flash chips, nor that the OEM u-boot can talk to them. Either of which should be a more immediate concern to you (so be careful when removing the original flash, you might have to put it back). You have entered dragon's territory, it's only up to you what will happen, no one else can give advice without trying it on the very same hardware (and using an exactly identical flash chip).

News flash, it doesn't show only by looking at your forum nick.