User Tools

Site Tools


openwrt:reflash_wo_usb

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
openwrt:reflash_wo_usb [2013/11/26 21:39]
matthias styling around python recommendations
openwrt:reflash_wo_usb [2014/05/30 09:28] (current)
matthias
Line 1: Line 1:
-====== Reflashing via Failsafe mode and without USB ====== +[[http://​piratebox.cc/openwrt:reflash_wo_usb]]
-===== using Python & Linux ===== +
- +
-If your device is messed up and you are not able to change the network-configuration useful, you may can reflash the router with using you local network and a temporary webserver. +
- +
-In the following HowTo, I assume, that you are using an MR3020 , but this method works for all routers- only exchange the image(-link). I assume you have Linux-Computer with a working python installation.  +
- +
-1. Connect your laptop to the internet. +
-  +
-2. open a Terminal and run  +
- +
-  cd /tmp +
-  wget http://stable.openwrt.piratebox.de/​ar71xx_AA/openwrt-ar71xx-generic-tl-mr3020-v1-squashfs-factory.bin +
- +
-3. After you had downloaded the image, run the following command to launch a small basic webserver +
- +
-**Python 2.7** +
- +
-   ​python -m SimpleHTTPServer 8000 +
- +
-When this fails- you maybe have **Python 3.x**  +
- +
-   ​python3 -m http.server +
- +
-4. Then connect to your MR3020 and boot it into failsafe mode  +
-5. Set your computer to static IP 192.168.1.2  +
-6. Open  +
- +
-   ​telnet ​ 192.168.1.1 +
- +
-7. run the following command to download the image onto your MR3020  +
- +
-   cd /tmp +
-   wget http://​192.168.1.2:​8000/​openwrt-ar71xx-generic-tl-mr3020-v1-squashfs-factory.bin +
- +
-8. If this worked, flash the image (the exact MTD-command may differ on other hardware) and initiate an immediate reboot if everything was fine (-r)  +
- +
-   mtd -r write openwrt-ar71xx-generic-tl-mr3020-v1-squashfs-factory.bin firmware +
- +
- +
- +
-Then you have a fresh install. Sometimes something went wrong on the router. Sometimes, I call it: "a bit is switched wrong",​ the flash does not work on the first time.. especially if you have a corrupt system. You can recognize that, when your OpenWRT doesn'​t store your changes- then simply reflash like above.  +
- +
-Hope this helps.  +
- +
- +
- +
- +
-===== Reflash in Failsafe-Mode using netcat ===== +
-Your box gets messed up? Sometimes it is only possible to recover it during failsafe mode. But how can you get the image to your box? +
- +
-I read about something called netcat. The detailed [[http://​techtinkering.com/​2013/​03/​25/​using-netcat-to-create-ad-hoc-links-between-applications-and-machines/?​utm_source=feedburner&​utm_medium=feed&​utm_campaign=Feed%3A+TechTinkering+%28TechTinkering%29|HowTo]] does not fit well, because the most images lack the server support. After some test, I found out, that you can turn it around. +
- +
-This method works if your computer is linux. If you don't have linux as OS, try a live version of it.. i.e. [[http://​grml.org|grml]]. +
- +
-To transfer a file to your router (The following assumes, that you already have access via failsafe-mode):​ +
- +
-**On the computer** check what you IP is (ifconfig). Then we are starting a Server and pipe the image file into it. After it is done, it will generate a hash-value. +
- +
-  # cat openwrt....bin | nc -l 3333 && md5sum openwrt....bin +
-   +
-(sometimes (on my gentoo-box it was) the command is) +
- +
-  # cat openwrt....bin | nc -l -p 3333  -X   &&​ md5sum openwrt....bin  +
-   +
- +
-**On the router** we connect to the Server: (on the Router can the filename be shorter, different) +
- +
-  # cd /tmp +
-  # nc 192.168.1.x 3333 > openwrt....bin +
-  # md5sum openwrt....bin +
-   +
-Compare the hash value of both outputs, if they are equal proceed with flashing.+
openwrt/reflash_wo_usb.txt · Last modified: 2014/05/30 09:28 by matthias