How to flash¶
If you are aware of OpenWRT or DD-WRT: initial flashing of a ZRouter firmware will be done the same way.
A lot of our work / knowledge is based on the information on their websites. So it's always a good idea to visit https://openwrt.org/ and http://www.dd-wrt.com if our pages suffer information about board details, bootloader tips, flashing tutorials and so on. We thank OpenWRT and DD-WRT for sharing this information and we hope they will benefit from our work as we do.
Flashing depends on board type and it's bootloader. In most cases you have to read board specific instructions which you will hopefully find in zrouter board definitions, in this wiki or on OpenWRT / DD-WRT.
- before you open your device be sure you can successfully build a ZRouter firmware for it
- create a serial connection between your workstation and your device (mostly you have to open it and you need a special converter in hardware)
- start an TFTP service in your LAN or on your workstation, the operating system doesn't matter
- connect the ethernet port of your device (if it's a router it's mostly the WAN port) with your switch or workstation, so it can link to the TFTP server
Establish the serial connection with a terminal program. You need board specific parameters like speed, stop bit and negation.
On FreeBSD, in most cases
# /usr/bin/cu -s <speed> -l <serial-port> e.g. # /usr/bin/cu -s 115200 -l /dev/cuaU0
If you don't know the <speed> (you'll see nothing or garbage when speed is wrong), try 115200, 57600, 38400, 19200 and 9600 until you see something useful after powering up the device. The <serial-port> depends on your converter hardware: use /dev/cuaU0 if it's connected via USB and /dev/cuad0 for old serial "COM" port. Of course, for every available port on your system the trailing number grows. To exit cu type "~." (tilde, dot) or "~ ." (tilde, blank, dot). It's a bit confusing, but cu is always with you in FreeBSD base system. Never forget the man pages of tools you are using before giving up.
Enter and configure bootloader¶
What you see in the terminal when powering up the device is the bootloader how it's booting the kernel of the currently installed firmware. The bootloader is a small program in the flash memory of your device, able to start other programs and to boot firmware images.
Before the kernel boots, the bootloader usually gives the possibility to enter it's command-line by hitting a key or key sequence. As you can guess it depends on the bootloader what keys to hit.
If you can see a command-line prompt and the kernel doesn't load, you did it. Within this command-line you can configure some options, e.g. the IP and the TFTP server IP if you flash by this service. Always try "help" or "?" when you get access to such command-line interfaces and "help <command>" to get further usage instructions for a command listed by "help".
Set IP and TFTP Server IP
> setenv ipaddr 192.168.3.10 > setenv serverip 192.168.3.1
Flashing firmware from TFTP¶
Put the ZRouter firmware to the directory served by the TFTP service.
You can test the download on a workstation:
# /usr/bin/tftp tftp> get servername:firmware.bin Received 8126415 bytes during 1.8 seconds in 15918 blocks tftp> quit
Now you do the same on the device with bootloaders capabilities.
1. Erase area in flash
> erase <address> +<size>
2. Fetch firmware (will use server defined with "setenv serverip <address>")
> tftpboot <target-address-RAM> firmware.bin
3. Copy firmware from memory to flash
> cp.b <target-address-RAM> <target-address-flash> <size>
4. Boot flashed firmware
> bootm <target-address-flash>