You were never here, you didn't see anything..

OpenWRT Recovery


As part of a test project I am working on I am installing OpenWRT on a TP-Link MR-3020. During the process I quickly learned that the default images would not have what I needed, and sadly installing additional packages via opkg was not an option as once the initial update was performed the file system on the tiny router was full. Into to the creation of a custom image using the OpenWRT Image Generator I launched.

The Image Generator makes it very easy to create custom images for supported routers. I went through and located all the packages I needed to add to and remove from the image. At one point I thought I had exactly what I needed, built the image and flashed it. Upon reboot I got a wonderful nothing.

The OpenWRT wiki on the MR-3020 is awesome enough to include how to get in to recover mode in case of emergency. Problem is the debricking guide was not helpful in recovering the router once in the proper mode, so here I write a little post that helps in that regard.

A recovery from flashing an image that is too large is actually very simple, just flash a proper image. The fun part is making that happen. First you need to have a wget accessible resource containing the image you wish to flash. For me this is my home server. The recovery mode has a default IP of 192.168.1.1, so you of course need to have said resource on the same subnet. I placed the router on my switch and added a second IP address to my server with:

ifconfig eth0:1 192.168.1.5 netmask 255.255.255.0

This will create an aliased interface using the given IP. I used this route as this is to be temporary, so why go editing config files and such as this is fast, simple and works.

Next place the router in to recovery mode. On the MR-3020 this is done by pressing the WPS button when it starts to blink and holding it till it blinks faster. Then telnet in to the router using the 192.168.1.1 IP. You will be presented with the normal login screen and not have to actually log in.

Once in the router chage to the /tmp directory.

cd /tmp

Using wget download the image from your resource. for me this is my test HTTP server.

wget http://192.168.1.5/~andarius/openwrt/openwrt-ar71xx-generic-tl-mr3020-v1-squashfs-sysupgrade.bin

Once the image is downloaded you can simple flash it as if you were performing a normal upgrade.

sysupgrade -v openwrt-ar71xx-generic-tl-mr3020-v1-squashfs-sysupgrade.bin

The router will automatically reboot as normal, and assuming your good image truly is good you should be back in business.

Have any Question or Comment?

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This blog is kept spam free by WP-SpamFree.

Most who fail…

Most who fail have yet to really try!