Flash memory Upgrade ...what could go wrong

Sure, here's a more polished version of your forum post:


Hello everyone!

Last year, I sought help in this topic regarding my TP-Link TD-W9980.

Despite the mishap I described in that thread, the router has been running smoothly since then. However, the onboard flash storage is extremely limited (only 8MB), which doesn't leave much room for installing additional packages. At one point, I even ran into an issue where the device couldn't save a configuration file because the storage was full!

I'm considering upgrading the flash chip by replacing it with a 16MB version of the same part number. While I’m confident in my soldering skills, I'm unsure about the software side of things, which is where I'd appreciate some guidance.

Has anyone tried something similar? What challenges might I face with OpenWrt when upgrading the flash storage? From what I've read in other forum threads and blog posts (I know this post is for another model, i wonder how possible is to perfom the same to the 9980 i have) , mentioned needing to recompile firmware and modify bootloaders after such upgrades. Does this mean I’d need to compile custom firmware for each new OpenWrt version moving forward?

Any insights or advice would be greatly appreciated!

Thanks in advance!


ps I have SPI flash programmers , SoIC8 clips and all that stuff.

You need to edit dts, and most notably relocate (copy data) system partition at the end of flash to new end of flash...

2 Likes

Hello Brada4!

So, if I understand correctly, the process would start by dumping the existing flash IC, then using a hex editor (or dd for those command line aficionados) to rearrange the partitions.

However, I’m a bit confused at this point. When looking at the partition table, the last partition is labeled as "radio." Is this the system partition you were referring to?

Also, regarding the dts file (I’m assuming you’re referring to the Device Tree Source file), would the changes involve specifying the new boot address and instructing the system on how to handle the larger flash size?

Thanks again for the help!

All 3-4 partitions after the firmware/rootfs area. Wiki says config, romfile, rom, radio

It would mean adjusting the location and size of each affected partition in the DTS. Your device has no own DTS, right? But is hijacking the td-w8980 DTS, right?

Then it is likely about these lines, which you need to adjust according to how you copied the contents. Curiously, the DTS is different than the mtd contents shown in the wiki article, so you may need to first look with a hex editor or so, what data and how much data is actually at the end of the chip...

i guess.

so the upgrade prosses would be as follows:

  1. teardown router , de-solder the eeprom , dump its contents.
  2. Make a new larger .hex file copy the contents of the dump acordingly (system partition , aka config, romfile, rom, radio as per what wiki says)
  3. clone the openwrt repo similar to what this post shows
  4. Go on the dts file and edit the start/end addresses
  5. compile , bake it on the new eeprom
  6. enjoy your new upgraded router

riiight?

I got my hands on a New (new old stock since the IC is Obsolete) W25Q128FVSIG

now to find my eeprom dumper/reader and lets get modding
Will post updates.

ps
@hnyman Could you confim what i wrote here is correct or am i wrong on smt ?
Thanks in advance

In principle yes, but the devil is in the details...

The crucial part is that the "config partitions" are on places whre everybody expects them to be. (boardconfig, ddrsettings, radio according to DTS. No idea where rom,romfile come from to wiki)

You can adjust DTS, but that is just for Linux itself. But does the u-boot bootloader expect to find MAC adresses & DDR memory settings at a certain place? That has nothing to do with DTS.

Life was simpler in the early times, when components were less sophisticated.

1 Like

Don't try to unsolder the old chip without backing up all its contents first. This can be done from within the release OpenWrt that is running now.
cat /dev/mtdX > /tmp/mtdX.bin
with each partition then scp the bin files to a safe place (and perhaps rename them).

ye , no , this aint happening with the current state of the CPE.
It cannot even save setings or logs .
its a miracle that it routes trafic around

Now that i re-think this , i could propably mount a usb flash on its ports and perform the dd there

The /tmp filesystem in OpenWrt is a RAM disk. Files placed there are outside of the flash space. Of course they do not persist through a power cut or reboot.

root@OpenWrt:~# cat /dev/mtd
mtd0       mtd1       mtd2       mtd3       mtd4       mtd5       mtd6       mtdblock0  mtdblock2  mtdblock4  mtdblock6
mtd0ro     mtd1ro     mtd2ro     mtd3ro     mtd4ro     mtd5ro     mtd6ro     mtdblock1  mtdblock3  mtdblock5

so i copy every one of them from within the os ?

Im guessing is safer to do it from here in case the original eeprom gets damaged somehow ?

Use the ones that have just a number not "ro" or "block" in the name. And do each partition file separately, you can cat them together in the proper order later. At least one of the partitions will be an overlap of some of the others so you're going to have some of the flash data twice.

Yes exactly the old flash may be damaged in removal.

1 Like

I tried to copy the files ,

i createed the images with

cat /dev/mtd0 > /tmp/mtd0.bin
cat /dev/mtd1 > /tmp/mtd1.bin
cat /dev/mtd2 > /tmp/mtd2.bin

i tried to copy them with SCP

scp root@<router-ip>:/tmp/mtd0.bin ./mtd0.bin
scp root@<router-ip>:/tmp/mtd1.bin ./mtd1.bin
scp root@<router-ip>:/tmp/mtd2.bin ./mtd2.bin

but it failed , with the error ash: /usr/libexec/sftp-server: not found

My last try was to copy them from the router using a usb flash drive , it wouldnt mount and i read online it needs extra openwrt packages, and ... i dont have any space left :frowning:

Scratch Dis .

i was able to do it the other way around , not from my host to the router , but from the router to the host

You should have used the scp "-O" option to use the old transfer logic.
Or alternatively have installed the openssh-sftp-server

1 Like

He's Dead, Jim :nerd_face:

After doing the cat /dev ... and after a power cut , when it boots up it does not bring up dsl and the error im getting is the following

Your JFFS2-partition seems full and overlayfs is mounted read-only.
Please try to remove files from /overlay/upper/... and reboot!

Any ideas how to bring it back brefore i go ahead to play with its eeprom ?

I'm guessing you copied files to flash instead of /tmp, so now the flash is full. This also means the files you retrieved are truncated and corrupt.

The most certain way to recover from overfilling the overlay is to run firstboot to erase everything back to default settings.

1 Like

Documented the procedure at TDW-9980 16MB flash upgrade , good luck.

1 Like