Skip to content

Instantly share code, notes, and snippets.

@korzhyk
Last active June 20, 2018 20:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save korzhyk/27f39040bdfe528cc3ce to your computer and use it in GitHub Desktop.
Save korzhyk/27f39040bdfe528cc3ce to your computer and use it in GitHub Desktop.
Unbrick TL-WR1043ND

###1. Connect RS232 serial (USB)

###2. Install OSX drivers NoZAP Drivers

###3. Configure tftp server Ubuntu:

# apt-get install dnsmasq
# /etc/init.d/dnsmasq stop          # Debian automatically starts it as a daemon, so I stop it
# dnsmasq --enable-tftp --tftp-root=/srv/tftp/

OSX (default folder is /private/tftpboot):

sudo launchctl load -F /System/Library/LaunchDaemons/tftp.plist
sudo launchctl start com.apple.tftpd

After complete this HOWTO you can disable tftp daemon sudo launchctl unload /System/Library/LaunchDaemons/tftp.plist

###4. Download firmware DD-WRT or OpenWRT And put in to TFTP folder as fw.bin. And set privileges for tftp server for read. And get calculate firmware size in hex format.

andrii@Andrii-Mac-Pro:/private/tftpboot$ ll
total 47248
-rwxrwxrwx@ 1 andrii  wheel  8060956 20 чер 18:17 dd.bin
-rwxrwxrwx@ 1 andrii  wheel  8060928 20 чер 18:17 fw.bin
-rwxrwxrwx@ 1 andrii  wheel  8060956 15 чер 18:21 tl.bin

Filesize of fw.bin is 8060928 bytes. Use calc or Decimal to Hexadecimal Converter.

###5. Connect to the router screen /dev/tty.NoZAP-PL2303-0000201D 115200 8N1

###6. Skip boot After line Autobooting in 1 seconds quickly type tpl and hit Enter. For prevent router boot and use boot shell.

###7. Configure ipaddr and serverid

ar7100> setenv ipaddr 192.168.1.1
ar7100> setenv serverip 192.168.1.2

You must set ip of your tftp server to 192.168.1.2 for communicate with router.

###8. Unbricking. ####8.1. Eraseold firmware

ar7100> printenv
bootargs=console=ttyS0,115200 root=31:02 rootfstype=jffs2 init=/sbin/init mtdparts=ar9100-nor0:128k(u-boot),1024k(kernel),4096k(rootfs),64k(art)
bootcmd=bootm 0xbf020000
bootdelay=1
baudrate=115200
ethaddr=00:11:22:33:44:55
stdin=serial
stdout=serial
stderr=serial
ethact=eth0
ipaddr=192.168.1.1
serverip=192.168.1.2
ar7100> erase 0xbf020000 +7b0000

First 0x2 last 0x7d sector size 0x10000                                                                            125
Erased 124 sectors

Where 0xbf020000 memory address of start firware sector and 7b0000 is firmware size in hex format.

####8.2. Download new firmware

ar7100> tftpboot 0x81000000 code.bin
Using eth0 device
TFTP from server 192.168.1.2; our IP address is 192.168.1.1
Filename 'code.bin'.
Load address: 0x81000000
Loading: #################################################################
[..lineslineslines..]
done
Bytes transferred = 8060928 (7b0000 hex)

####8.3. Flash firmware

ar7100> cp.b 0x81000000 0xbf020000 0x7b0000
Copy to Flash... write addr: bf020000
done

####8.4. And try to boot

ar7100> bootm 0xbf020000
## Booting image at bf020000 ...
Uncompressing Kernel Image ... OK
...

In most cases after successful uncompressing kernel image router starting normally. Enjoy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment