Generic flashing over the Serial port

Technical references

Actual procedure

mkdir -p /tmp/tftp/
cp openwrt-...-factory.bin /tmp/tftp/firm.bin

sudo ip addr add 192.168.1.234/24 dev eth0
sudo dnsmasq -d --port=0 --enable-tftp --tftp-root=/tmp/tftp/
screen /dev/ttyUSB0 115200

DO NOT USE THESE VALUES. FIND OUT THE RIGHT ONES! NO, NOT KIDDING.

Commands:

setenv serverip 192.168.1.234
tftpboot 0x81000000 firm.bin
erase 0xbf020000 +0x7c0000
cp.b 0x81000000 0xbf020000 0x7c0000
bootm 0xbf020000

To get a rough idea of the process, check an example serial console log during the whole procedure

Kermit

You can use a client using the Kermit (protocol) to transfer the new image. It may take forever and a half (15-20min) to copy. But it's easier and more secure than running a tftpd server. These instructions assume you're using a Linux system, but they will give you all you need to do the same on a Windows box.

Requirements:

DO NOT USE THESE VALUES. FIND OUT THE RIGHT ONES! NO, NOT KIDDING.

erase 0xbf020000 +7c0000 # 7c0000: size of the firmware (be aware that you may have a different size thus bricking your router)
loadb 0x81000000

Fire up C-Kermit and run the following commands (or configure your Kermit client to these parameters):

set line /dev/ttyUSB0 # Just make sure you got the right USB interface
set speed 115200
set carrier-watch off
set handshake none
set flow-control none
robust
set file type bin
set file name lit
set rec pack 1000
set send pack 1000
set window 5
send code.bin # Make sure you include a proper path to the file. That's why I just kept it in /home/$user

After the 15-20min file transfer, the new firmware should be on your router and you can continue in terminal:

DO NOT USE THESE VALUES. FIND OUT THE RIGHT ONES! NO, NOT KIDDING.

cp.b 0x81000000 0xbf020000 0x7c0000
bootm 0xbf020000

Note: This serial transfer method doesn't solve the “chicken or the egg” dilemma (if your Ethernet port is not working on U-Boot) because you cannot use tftpboot to transfer code.bin to u-boot. Fortunately U-Boot supports serial transfer using modem protocol: http://acassis.wordpress.com/2009/10/23/transfering-file-to-u-boot-over-serial/