Preparing an image to tftpserver

New images build from OpenWrt is in bin/ar71xx directory. Move or copy openwrt-ar71xx-generic-carambola2-squashfs-sysupgrade.bin to tftp server's content root (/tftpboot for me).

Network connection

You need to connect the machine with tftp server and Carambola2 in a same network.

  • Connect Carambola2 to the same local network with your tftp server.
  • Or, You can connect Carambola2 and tftp server's ethernet port with a Ethernet cable directly.

From Carambola2's u-boot console, type following commands to set its ip and tftp server's ip and save them.

ar7240> setenv ipaddr 192.168.10.230  
ar7240> setenv serverip 192.168.10.100  
ar7240> saveenv  

direct connection (alternative)

If you are connecting Carambola2 and the server directly, connect an Ethernet cable to your tftp server's port, and give it a static IP:

# ifconfig eth0 192.168.12.11

This is temporary. You can bring the setting back by rebooting your server on Linux.

Carambola2 can use either Ethernet port for making tftp request. Plug the Ethernet cable to either of the port.

Get an image from tftpserver

Boot Carambola2 and get to u-boot command line.

fetch the image from tftp server

First, use tftp from u-boot cmmand line to download the image. 0x80060000 is the load address. It is probably always this value for Calambora2.

ar7240> tftp 80060000 /tftpboot/openwrt-ar71xx-generic-carambola2-squashfs-sysupgrade.bin  

This commands contact a tftp server, fetch the specified file (/tftpboot/openwrt-ar71xx-generic-carambola2-squashfs-sysupgrade.bin) and place it in the specified memory location.

ar7240> tftp 80060000 /tftpboot/openwrt-ar71xx-generic-carambola2-squashfs-sysupgrade.bin  
-Using eth1 device
TFTP from server 192.168.12.11; our IP address is 192.168.12.66  
Filename 'openwrt-ar71xx-generic-carambola2-squashfs-sysupgrade.bin'.  
Load address: 0x80060000  
Loading: #################################################################  
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #############
done  
Bytes transferred = 4390916 (430004 hex)generic-carambola2-squashfs-sysupgrade.bin

The number of bytes copied from tftpserver should be the same as the image size. The image size in hex(0x430004) that shown in the output is needed for following steps.

Erase flash memory

Next, erase flash memory. Make absolutely sure that you're erasing from 0x9f050000. If you erase earlier part of flash memory, you'd probably corrupt u-boot and that means you brick Carambola2.

ar7240> erase 9f050000 +430004  

This command erase memory range from 9f050000 for 430004(hex) bytes. This area is happened to be flash memory.

Write the image to flash memory

You have the image you got from tftp server on Carambola2's memory and cleaned up the flash memory area you are going to use. Now, it's ready to write there:

ar7240> cp.b 80060000 9f050000 430004  

It's like memcpy(). Write the content from 0x800600000 to 0x9f050000 for 0x430004 bytes.

You can now reboot Carambola2.

ar7240> boot  

Possible Errors

If you specify a wrong range in erase command, you may see following error:

ar7240> erase 9f05000 +340004  
Error: end address (0x0a245003) not in flash!  
Bad address format  

I typed one less character for starting address. I could brick the board. Phew!