Thursday, February 15, 2018

TL-WR703N Flash OpenWrt over U-Boot

Here is the U-Boot commands to flash the OpenWrt firmware over U-Boot.
  1. Obtain IP:
    dhcp
    
  2. Note down the IP of the WR703N (i.e. 192.168.0.59), and the TFTP server (i.e. 192.168.0.134), press CTRL+C, then:
    setenv ipaddr 192.168.0.59
    setenv serverip 192.168.0.134
    
  3. Write the OpenWrt image to RAM address 0x80800000:
    tftpboot 0x80800000 wrt.bin
    
  4. Erase the FLASH from block 0x9F020000, for 0x3C0000 bytes in size, this is the size of the OpenWrt image:
    Note that 0x9F000000 is the start of FLASH, there are 64KiB U-Boot code + 64 KiB Data, so the OpenWrt image starts at 0x9F020000.
    erase 0x9F020000 +0x3C0000
    
  5. Finally, we copy back the downloaded image from RAM back to the flash:
    cp.b 0x80800000 0x9F020000 0x3C0000