Newbie
skysky
Posts: 3
Registered: ‎10-18-2009
Posts: 3
Registered: 10-18-2009

upgrade using mtd

Hi

I have a new openwrt .bin file.

I can reflash my RouterStation using TFTP successfully.
But I need to reflash it when it's not near me.

I know that it's possible using mtd command. I tested it in different ways.
but I couldn't do it.

Anyone knows about it?

Plz help
New Member
mperez
Posts: 11
Registered: ‎06-02-2009
Posts: 11
Registered: 06-02-2009

Re: upgrade using mtd

I have done remote upgrades using mtd, with these commands:

mtd -e kernel write openwrt-ar71xx-vmlinux.lzma kernel
mtd -r -e rootfs write openwrt-ar71xx-root.squashfs rootfs

as it is commented in lists.openwrt.org/pipermail/openwrt-users/2009-May/000758.html

but only works for me in previous trunk revisions (17547 for example). In the current revision (18208) if you upgrade the routerstation in this way, after the upgrade it is not possible to access it (not using eth0, neither using wifi).

If the upgrade is done using tftp, all works perfect.
New Member
jmhayes
Posts: 11
Registered: ‎09-24-2008
Posts: 11
Registered: 09-24-2008

Re: upgrade using mtd

I have done remote upgrades using mtd, with these commands:

mtd -e kernel write openwrt-ar71xx-vmlinux.lzma kernel
mtd -r -e rootfs write openwrt-ar71xx-root.squashfs rootfs

as it is commented in lists.openwrt.org/pipermail/openwrt-users/2009-May/000758.html

but only works for me in previous trunk revisions (17547 for example). In the current revision (18208) if you upgrade the routerstation in this way, after the upgrade it is not possible to access it (not using eth0, neither using wifi).

If the upgrade is done using tftp, all works perfect.


I tried this today with 18405 and it doesn't work; on the serial console you can see it loads up and then dies because "Cannot mount root" ... it looks like the command line doesn't get set correctly? Anyone else trying to use mtd to flash RS/PRO?
New Member
doddel
Posts: 34
Registered: ‎10-24-2009
Posts: 34
Registered: 10-24-2009

Re: upgrade using mtd

Am trying to achieve this as well and looked with an hex editor into the images. The lzma compressed kernel that is embedded in the file openwrt-ar71xx-ubnt-rs-squashfs.bin (start at $144) and that works using tftp flash upgrade is different than openwrt-ar71xx-vmlinux.lzma.
The squashfs embedded file and separate file appear identical.
So, unless you want to change the lzma contents (it is probably something to do with the kernel start commands) , extract the lzma image from the .bin file. Its actual length is listed at $13C, the reserved space at $140. In my case 0x144 up to and including 0xE143 (start $144 dec 324 , length $E0000 dec 917504). On a linux machine you can extract it using dd:
dd if=openwrt-ar71xx-ubnt-rs-squashfs.bin of=kernel.lzma ibs=1 skip=324 count=917504
move kernel.lzma to the RS in //tmp
mtd -e kernel -F kernel:0xE0000:0x80060000 write //tmp/kernel.lzma kernel
works here !
New Member
doddel
Posts: 34
Registered: ‎10-24-2009
Posts: 34
Registered: 10-24-2009

Re: upgrade using mtd

Can add that as of end November 2009 support for remote system upgrade of the RS(Pro) was added to OpenWrt Trunk. Thank you 'juhosg' !
It offers the choice to preserve configuration files or to just upgrade and replace everything.
Newbie
wilco
Posts: 4
Registered: ‎12-02-2009
Posts: 4
Registered: 12-02-2009

Re: upgrade using mtd

Can add that as of end November 2009 support for remote system upgrade of the RS(Pro) was added to OpenWrt Trunk. Thank you 'juhosg' !
It offers the choice to preserve configuration files or to just upgrade and replace everything.


How is this accomplished, exactly? I have a RouterStation which I want to upgrade, but I don't want to always have to rely on a TFTP server being available to do it.
New Member
doddel
Posts: 34
Registered: ‎10-24-2009
Posts: 34
Registered: 10-24-2009

Re: upgrade using mtd

1. compile an image using the OpenWrt toolchain ; choose AR71xx and RouterStation in 'make menuconfig'
2. a successful compile will produce in trunk/bin among others : openwrt-ar71xx-ubnt-rs-squashfs-sysupgrade.bin
3. upload that to the RS e.g. to //tmp
4. login to the RS and from the console issue the sysupgrade command with the appropriate options and the above filename
Newbie
wilco
Posts: 4
Registered: ‎12-02-2009
Posts: 4
Registered: 12-02-2009

Re: upgrade using mtd

Thanks. Are the images named with *ubnt-rs* in downloads.openwrt.org/snapshots/trunk/ar71xx/ appropriate for upgrading? In other words, were they built so they can work on the RS boards?
New Member
doddel
Posts: 34
Registered: ‎10-24-2009
Posts: 34
Registered: 10-24-2009

Re: upgrade using mtd

yes; you'ĺl now find the Dec 14 ones that are called openwrt-ar71xx-ubnt-rs-squashfs-sysupgrade.bin.
Do note that these are bare-bone images and that you will probably want to add quite a few additional packages to make the systems do what you want.
My goal was to update RouterStation firmware at a remote location connected to me by its 5 GHz wireless interface. So I compiled a customized image with all the needed bells and whistles using the OpenWrt toolchain so that after the update the wireless connection would come back, which it did !
Just to prevent confusion: with the addition of the new <...>-sysupgrade.bin images the <...>.bin images of the past, used in updates per tftp, were renamed to <...>-factory.bin.
So when using the sysupgrade script use <...>-sysupgrade.bin
when using tftp use the <....>-factory.bin
Newbie
bduhbya
Posts: 1
Registered: ‎11-09-2010
Posts: 1
Registered: 11-09-2010

Re: upgrade using mtd

1. compile an image using the OpenWrt toolchain ; choose AR71xx and RouterStation in 'make menuconfig'
2. a successful compile will produce in trunk/bin among others : openwrt-ar71xx-ubnt-rs-squashfs-sysupgrade.bin
3. upload that to the RS e.g. to //tmp
4. login to the RS and from the console issue the sysupgrade command with the appropriate options and the above filename


As you mentioned, when 'make' is tun several binary images are created. Among them, used to be "openwrt-ar71xx-squashfs-sysupgrade.bin". When I first started building openWRT, this image was built every time I ran make. Recently, when I run 'make' this image is no longer provided. I do not know what that turned this off. I have poured over the menuconfig and I absolutely cannot find what option will re-enable this image to be built. Is there a simple solution for this? I really don't want to spend hours trying to convert the other image types and bricking my router a half dozen times in the process. I have already spent WAY too much time trying to get an image with everything I need in it. Thanks in advance for the help.
New Member
doddel
Posts: 34
Registered: ‎10-24-2009
Posts: 34
Registered: 10-24-2009

Re: upgrade using mtd

@bduhbya
Only read today your post and question. My latest cross-compile of OpenWrt Trunk for the RS platform dates from Nov. 11 2010, which is later than your post, and it did produce the sysupgrade. That makes me think something is not correct in your build environment.

A while ago I had also problems, of a different kind which would stop the build process, and it turned out to be caused by changes to the build system which were not introduced well through regular svn updates of trunk. After all Trunk is not a release and sometimes radical changes are introduced that work well from scratch but not with an earlier version present. What I did is erase the subdirectories inside the trunk directory but for the dl and feeds subdirectories so that not all packages have to be reloaded from the net again. I than did a fresh checkout and make menuconfig and make and that cured the problems and restored consistency of the cross-compilation build environment.
Newbie
Hacker-CB
Posts: 8
Registered: ‎06-12-2012
Posts: 8
Registered: 06-12-2012

Re: upgrade using mtd

Hello!

1) Is anybody knows how to convert openwrt firmware from
downloads.openwrt.org/backfire/10.03.1/atheros/openwrt-atheros-ubnt2-***
to ubiquittu firmware format (to flash via www)

2) Maybe anybody have universal script to flash via mtd?