DO IT AT YOUR OWN RISK!
What is u-boot?
U-boot is a universal boot loader which starts when you plug in the power cable. It runs itself to check the board and make some initial configuration. After feeling everything’s right, it loads the main OS and start the system. More information can be found at: http://wiki.openwrt.org/doc/techref/bootloader/uboot
Which u-boot to install?
I don’t know what stock u-boot can do, but certainly not much. As a geek, sometimes it's just easy to “soft brick” the router when I dig into configurations and settings: the hardware is good but the OS is out of connection or stop working. For WR703N (and some other TP-Link devices with AR9331 SOC) users, it lucky to have someone like misp to develop a web failsafe u-boot: http://code.google.com/p/wr703n-uboot-with-web-failsafe/ and some like pepe2k to modify and improve that up to a new level: https://forum.openwrt.org/viewtopic.php?id=43237. The latter one is the u-boot I recommend.
This u-boot allow you to flash new firmware, u-boot and art through web browsers (not only firefox) or other ways. More details can be found at the link above. I strongly recommend to read that before doing anything.
How to install the new u-boot
(This u-boot works for all version of WR703N, including v1.6 and v1.7.)
If you are using the firmware other than dd-wrt, you might want to flash it. The stock firmware certainly won’t let you write the u-boot. Openwrt’s official build won’t allow you write the u-boot section for security reason. Of course you can build your own openwrt firmware to change the setting. I don’t know about other distributions. If it works, fine; if not, try dd-wrt. Flash any image you want after upgrade the u-boot.
Things to do:
1. Save current settings
You never know when you'll need it again.
2. Prepare required files
Required:
- dd-wrt for WR703N: search wr703n at http://www.dd-wrt.com/site/support/router-database, download the “WR703N v1.x Firmware - Webflash image for first installation”
- u-boot.bin: download U-Boot images, not source code at: https://forum.openwrt.org/viewtopic.php?id=43237
- shell script:
#! /bin/sh
#high chance need have a change ...
UBOOT_NAME=wr703n_tuboot_test_2012_06_06.bin
MD5SUM_SHOULD_BE="623dc0bba6fab68c22e5fb2f329d7d09"
#need check the md5sum,any one byte in bootloader shoud right ...
CURRENT_MD5SUM_VAL=$( md5sum $UBOOT_NAME |awk '{print $1 }' )
echo "$UBOOT_NAME md5sum : $CURRENT_MD5SUM_VAL"
if [ $MD5SUM_SHOULD_BE = $CURRENT_MD5SUM_VAL ]; then
echo "$UBOOT_NAME md5sum check pass"
else
echo "###############$UBOOT_NAME md5sum check fail###############"
exit
fi
RAW_UBOOT_LEN=`wc -c $UBOOT_NAME | awk '{print $1 }'`
NEED_PAD_LEN=$((0x1fc00-$RAW_UBOOT_LEN))
#Generate a file used as pad ...
dd if=/dev/zero of=pad.bin bs=1 count=$NEED_PAD_LEN
cat $UBOOT_NAME pad.bin >tuboot_0x1fc00.bin
echo "Backup some config first,just like MAC address ..."
dd if=/dev/mtd0 of=./config.bin bs=1 skip=$((0x1fc00))
cat ./tuboot_0x1fc00.bin ./config.bin >uboot_0x20000.bin
Optional:
- stock firmware (in Chinese): http://www.tp-link.com.cn/product_portable_225.html?v=download#tag
- hfs (for windows): http://www.rejetto.com/hfs/?f=dl
3. Flash dd-wrt through the router’s control panel
I think you should know what to do…
4. Use telnet to get into the router, download the new u-boot.bin
The u-boot.bin should be 64k (65536 byte) exactly, choose the file corresponding to the device and make sure!
You can go to dd-wrt web interface to setup the network to download the file or setup a local http server then wget
the file form local.
(In windows, you can use hfs, in linux, just install apache or nginx or any server you want)
Download it to the ram not the rom. It’s faster and won’t wear the rom.
5. Use shell script to make a complete u-boot
The u-boot don’t have the information like mac address right which need to be add before write into the router.
Remember to change the filename and md5 in it.
6. Flash the new u-boot
Use mtd commend to rewrite the u-boot section:
cat /proc/mtd
It might look like (I do this in the openwrt, names is different in dd-wrt but the sections are the same):
dev: size erasesize name
mtd0: 00020000 00010000 "u-boot"
mtd1: 00102c70 00010000 "kernel"
mtd2: 002cd390 00010000 "rootfs"
mtd3: 00110000 00010000 "rootfs_data"
mtd4: 00010000 00010000 "art"
mtd5: 003d0000 00010000 "firmware"
mtd0 is normally the u-boot section.
mtd write uboot_0x20000.bin {section}
{section} is the u-boot section you can see in the first commend. You can replace {section} with device name like mtd0
or name like Redboot
7. Flash the system you want
Download the firmware and flash it into the router:
mtd write any_system_you_like.bin linux
(linux is mtd5’s name in dd-wrt).
All done. Reboot the router and go have fun.
How to use the new u-boot?
There’s three mode in the u-boot but normally I need only the web failsafe function. (Other two function can be found in the u-boot download post)
Push the reset button and plug in the power. You can see the led flashes for like one-third a second, paused a little while and start to blink. The blink is regular and can be distinguished from the first. Count the blink for 3 and release the reset button, and now the web failsafe is turned on.
Set your IP dress to 192.168.1.2 and gateway to 192.168.1.1. Open your browser and open http://192.168.1.1/. You know the rest.
Once again: DO IT AT YOUR OWN RISK!
what happens if i replace mtd0 with a wrong uboot image? can i reset to the old image back or not?
if you flashed a wrong uboot image to mtd0, please do not reboot or your device will unable to boot and you need to unsolder the flash chip and program the right image. while you still booted, flash the right image instead and your device should be fine, ad the uboot image is only used when you boot.