Copy eeprom from router, program using CH341A

Hi All,

I'm not sure if I've selected the wrong sub-forum for this, but here goes. A while ago (2015) I successfully installed built and installed Chaos Calmer on my DIR-601 Rev b1. (See my success in the forum archive here...https://forum.archive.openwrt.org/viewtopic.php?id=33231&p=5)

Just for a bit of fun, I'd love to keep this old device going. I'm an EE with sufficiently good enough soldering skills that I can change out the flash and ram to something bigger. Changing out the RAM should be trivial, but the flash is a different story.

I have a flash programmer (CH341A) that I can use to program the new flash, but I need to get all the contents from my existing flash first. What is the best way to do this? I've done a USB mod to my router, so what I think can be done is that I can use something like dd copy the contents of the flash to a file on my USB drive, and then use this file to flash my new device. I should add that I'm about 400km away from the router at the moment, but I can login to it remotely...so I would like to pull out the contents from the flash, program the new flash ready, and then install it again when I'm near the unit.

Does that sound reasonable? Is there a similar howto somewhere on how to do this? I realize that even if I create an exact clone of my existing flash, my uboot won't support the full size, but I have a plan for this also (https://github.com/pepe2k/u-boot_mod)

Thanks in advance for any assistance!
Ivan

Do this for each MTD partition number:
cat /dev/mtdX > /tmp/mtdX.bin
then scp the resulting files to your PC. You can reassemble them into an image of the complete chip.

16 MB is the largest new chip to use. Chips larger than 16M use a different addressing scheme and will not work with the pre-bootloader ROM in the SoC.

You will need to pad out the empty space to push the ART partition to occupy the last 64k of the new chip. Or you can use OpenWrt newly booted on the larger chip to install the ART with kmod-mtd-rw.

It isn't necessary to replace the bootloader as long as the kernel fits in the 4M space that the stock bootloader is aware of.

1 Like

Thanks Mike! I was just reading a similar post you made in 2018, and I was about to message you! This is awesome, thanks. I'm going to try to login to the router later this evening and try it.

I'm assuming that since I'm copying the entire chip, I won't have any issues with the wifi radio calibration data, as this is just stored in a special partition in the flash, is that correct (or correct in most cases?)

Ivan

Your assumption is incorrect, you very much have to bother about the wifi calibration data. As mentioned by mk24, it needs to be in the last 64 KB of flash AND you need to adapt the flash partition accordingly (and keep doing so for all eternity, which means patching the DTS and building an image from source, for each and every future upgrade).

Ok, good to know. I'll be building from source for this router for sure, for all time. I'm not sure what you mean by patching the DTS, is there a howto or any other documentation on this?

Thanks, Ivan

@iblackford, read here - https://buildmedia.readthedocs.org/media/pdf/devicetree-specification/latest/devicetree-specification.pdf
You need to designate the type of new flash memory and the placement of new partitions in the address space, and then make a patch to adapt it to the stock router. In this case, you will have to collect the firmware yourself every time you update.

Hi all,

I'm finally getting back to this after a few other...distractions. :). I've removed and soldered the eeprom to my CH341a, and read the contents. Is it safe to post my eeprom contents here to confirm that it's valid before messing around with it?

Thanks, Ivan

Any takers? anyone interested in taking a quick look at my ROM to see if it's correct before I start playing? :slight_smile: