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.
build the patched "tplink-safeloader" with 'gcc tplink-safeloader.c -lssl -lcrypto -o .tplink-safeloader.bin'
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?
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
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).