Before reading this, please have a look at Flash Layout.
A sysupgrade will replace the entire OpenWrt installation: the Linux kernel, the SquashFS partition and the JFFS2 partition. You cannot save installed OPKG packages: you will have to install them again after sysupgrade. That way everything will match, e.g. the flashed Linux Kernel and installed Kernel modules. You can manually save some of your configuration files, but be aware that on rare occasions you will need to modify an old configuration file to work with the updated program.
It is important to download the firmware image file to the
/tmp directory is stored in RAM (using tmpfs), not in the flash storage.
It is unlikely that there is sufficient free space in flash memory but it is possible to arrange sufficient free space in RAM.
You may need to Free up RAM beforehand.
freeIn case you do not have enough free main memory, consult Free up RAM.
/etc/sysupgrade.confwith the configuration files you want to keep
cd /tmp wget http://downloads.openwrt.org/snapshots/trunk/PLATFORM/xxx-sysupgrade.bin wget http://downloads.openwrt.org/snapshots/trunk/PLATFORM/md5sumsAA stable
cd /tmp wget http://downloads.openwrt.org/attitude_adjustment/12.09/PLATFORM/xxx-sysupgrade.bin wget http://downloads.openwrt.org/attitude_adjustment/12.09/PLATFORM/md5sums
md5sum -c md5sums 2> /dev/null | grep OK
sysupgrade -v /tmp/openwrt-ar71xx-generic-wzr-hp-ag300h-squashfs-sysupgrade.bin
root@openwrt:/tmp$ sysupgrade -v openwrt-ar71xx-generic-tl-wr1043nd-v1-squashfs-sysupgrade.bin Saving config files... root/statistics etc/sysupgrade.conf etc/sysctl.conf etc/rc.local etc/profile etc/passwd etc/firewall.user etc/dropbear/dropbear_rsa_host_key etc/dropbear/dropbear_dss_host_key etc/config/wireless etc/config/system etc/config/network etc/config/firewall etc/config/dropbear etc/config/dhcp Switching to ramdisk... Performing system upgrade... Unlocking firmware ... Writing from <stdin> to firmware ... Appending jffs2 data from /tmp/sysupgrade.tgz to firmware...TRX header not found Error fixing up TRX header Writing from <stdin> to firmware ... Upgrade completed Rebooting system...
dmesg uname -a iptables -V ...
|For unknown reasons such a cold reset has often been reported to be necessary after a sysupgrade. This is very very bad in case you performed this remotely!|
opkg update opkg install tc iptables-mod-ipopt wol ...
sysupgradeis not supported for your embedded device, you should use
mtd -r write /tmp/openwrt-ar71xx-generic-wzr-hp-ag300h-squashfs-sysupgrade.bin firmware
Netcat could be employed if you cannot free enough RAM. See netcat. Netcat needs to be installed first.
|This method is NOT recommended!|
nc -q0 192.168.1.1 1234 < openwrt-ar71xx-tl-wr1043nd-v1-squashfs-sysupgrade.bin
nc -l -p 1234 | mtd write - firmware
This method is fine for self built firmwares.
You should check how much RAM you have currently available.(In case you do not have enough left, consult Free up RAM.)
cat [specified firmware].bin | pv -b | nc -l -p 3333
nc 192.168.1.111 3333 > /tmp/[specified firmware].bin
The port 3333 an IP address 192.168.1.111 are just examples. The command 'pv -b' is optional for tracking progress but maybe you have to install pv to your system previously.
sysupgrade -v /tmp/[specified firmware].bin
mtd -r write /tmp/[specified firmware].bin firmware
I have tested under Ubuntu 11.10.
Make sure your router have enough memory.
Make sure you have set the password for your router.(you must set a password for your router to enable the SSH). If not, set by doing this:
linux$ telnet 192.168.1.1 root@OpenWrt:/# passwdSee First Login for more details.
On your Linux PC run:
linux$ scp openwrt-ar71xx-tl-wr1043nd-v1-squashfs-sysupgrade.bin email@example.com:/tmpInput 'yes' to estabilish authenticity, then input the password of your router. Wait
scpcommand finished. Now you can see your firmware in /tmp directory.
root@OpenWrt:/# sysupgrade -v /tmp/[specified firmware].bin
192.168.1.1 is the ip address(may be called GateWay) of your router. Check by run:
linux$ route -nor you can check the the /etc/config/network file, '127.0.0.1' is the loopback ipaddress, the other one is the ip address of your router.
root@OpenWrt:/# cat /etc/config/network | grep 'ipaddr'
First check memory usage with the
cat /proc/meminfo commands; proceed if you have as much free RAM as the image is in size plus an some additional MiB of free memory.
In this example there are precisely 11416 KiB of RAM unused. All the rest 32768 - 11416 = 21352 KiB are used somehow and a portion of it can and will be made available by the kernel, if it be needed, the problem is, we do not know how much exactly that is. Make sure enough is available. Free space in /tmp also counts towards free memory. Therefore with:
One has actually 752+6636 KiB of free memory available.
rm -r /tmp/opkg-lists/
echo 3 > /proc/sys/vm/drop_caches
rm /etc/modules.d/*80211* rm /etc/modules.d/*ath9k* rm /etc/modules.d/b43* reboot
The wireless drivers, usually take up quite some amount of RAM and are not required (unless you are connected via wireless of course ), so an easy way to free up some RAM is to delete the symlinks in
etc/modules.d so these are not loaded into memory at the next reboot.