HOWTO:Backup your router

From Embedded Xinu
Jump to navigation Jump to search

When experimenting with kernels, you may find yourself corrupting the router and having to recover from a known good state. It is a good idea to make a copy of the CFE when it is in its original factory configuration for if and when. Here are a few different methods depending on your resources:


If you are running a relatively recent version of dd-wrt, you can download the CFE from the web interface.




To backup the CFE from within the CFE itself you need an active serial console and a live network connection to a TFTP server. On the TFTP server, create a file for the backup image. It must be world writable. If you do not pre-create the file for the TFTP client, the backup may fail. We name and label our routers to keep them straight. Consider naming the backup image after each router's hostname if you have many of them.


user@xinuserver:tftpboot$ touch routername.cfe
user@xinuserver:tftpboot$ chmod a+w routername.cfe

Access the CFE using the usual method.

If necessary, configure the network interface and check the connection to your TFTP server ( in this example):

CFE> ifconfig eth0 -auto
Device eth0:  hwaddr 00-1E-E5-86-02-7A, ipaddr, mask
        gateway, nameserver, domain
*** command status = 0
CFE> ping ( is alive ( 1 packets sent, 1 received
*** command status = 0

Save the CFE region to the file you created on the TFTP server:

CFE> save BC000000 40000
262144 bytes written to
*** command status = 0

Note: You can also save the entire flash image (CFE+Kernel+NVRAM) by passing 400000 as the length instead of 40000. This isn't really necessary, but you might find it referenced elsewhere. If you have to recover via JTAG it will take a LONG time to restore the entire flash image. It is much more efficient to load just the CFE, then upload the kernel via TFTP and use a factory reset to restore NVRAM.


For this method to work, we assume you have a working EJTAG interface to your router. For details, check out our Router Recovery page.

Use the -probeonly option to figure out what options TJTAG needs for your particular setup.

Backup the CFE with TJTAG:

user@host:tjtag$ ./tjtag -backup:cfe /wiggler /noemw /noreset

TJTAG will create a CFE.BIN file with some sort of timestamp identifier appended to the filename. Rename and store somewhere safe.