Everyone that have/had the TP-LINK TD-W8970v1 router with installed OpenWrt noticed that there is about 2MB (with installed LuCI) of free space to install additional packages for extending router functions. It is possible to extend the memory with extroot method but there is another method to extend the internal memory: replacing the SPI flash. After replacing the flash there is about 10MB (including LuCI) for additional packages.
Building OpenWrt from sources
The prepared firmware with OpenWrt v19.07.5 is available here. If you will download the firmware, you can skip the build process.
Make sure that all dependencies needed for building OpenWrt, the list is here. If all of dependencies are installed then you can start building the OpenWrt image.
- Clone the OpenWrt repository to your local destination
git clone https://github.com/openwrt/openwrt.git
- Enter the cloned OpenWrt directory and switch to desired branch, e.g.
cd openwrt git checkout v19.07.5
- Get the patch for TD-W8970v1 16M mod and apply it according to the selected version.
git apply /path/to/19.07.patch
- Prepare the sources for building
./scripts/feeds update -a ./scripts/feeds install -a
- Generate config for building:
Select lantiq as target system and TP-LINK TD-W8970-16M as target profile.
- Run make to build the firmware.
SPI flash replacement
This procedure allows you to replace the SPI flash with a bigger one, this mod requires the a different version of u-boot, you also must have a backup of the calibration partition. It also requires good skills in soldering and desoldering SMD components.
You will need:
A full flash backup.
An soic clamp or a socket to program the new flash.
A Winbond W25Q128FV.
Soldering iron, solder and solder wick.
Steps to replace the rom:
Remove the flash chip, use the clamp or the socket to extract data if not done previously
Clean the pads
- Use the clamp or the socket to read the data from old SPI flash.
Use the clamp or the socket to write the modified u-boot on address 0x0. The modified u-boot is available here.
- Solder the new SPI flash.
Connect the serial to USB device to router (use TX, RX and GND pins only). Also conenct the ethernet cable directly to the computer.
Setup static IP address on the computer to 192.168.2.2
- Open the terminal, access the USB serial device. You can use screen command to access the serial:
screen /dev/ttyUSB0 115200 8n1
Start the router and abort the boot by pressing any key. Make sure that atftp server is running on your computer.
- Install the new firmware
setenv ipaddr 192.168.2.1 setenv serverip 192.168.2.2 tftpboot 0x81000000 sysupgrade.bin sf erase 0x20000 0xfa0000 sf write 0x81000000 0x20000 0xfa0000 reset
- Extract radio settings from old SPI flash dump
dd if=oldSPI.bin of=radio.bin bs=1 skip=8192000 #skip 0x7d0000 bytes
- After reset abor the boot by pressing any key
tftpboot 0x81000000 radio.bin setenv ipaddr 192.168.2.1 setenv serverip 192.168.2.2 sf erase 0xfd0000 0x30000 sf write 0x81000000 0xfd0000 0x30000 reset
And that’s all!