Thursday, November 14, 2013

Installing OpenWRT on D-Link DIR-505L H/W Ver. A1

The D-Link DIR-505L is a great and cheap WiFi router that can run OpenWRT. I costs about $40 from Amazon (http://www.amazon.com/D-Link-Systems-SharePort-Companion-DIR-505L/dp/B009LENJ90) and it has a 400 MHz MIPS processor, 64 MB RAM, and 8 MB flash drive. It is probably the cheapest OpenWRT-capable router that you will find with 64 MB of RAM (I came to this conclusion after looking on the web for a few hours). We currently purchased two of these routers from running our code on OpenWRT in our lab (https://github.com/ipop-project). The first stop was the DIR-505 page on OpenWRT (http://wiki.openwrt.org/toh/d-link/dir-505). This page gives the details of the router, but it did not give a clear link to the firmware file for the router. Eventually I figured it out and here it is:

http://downloads.openwrt.org/snapshots/trunk/ar71xx/openwrt-ar71xx-generic-dir-505-a1-squashfs-factory.bin

The next step is to flash firmware with OpenWRT image through the router's web interface. Once you have successfully connect to the wireless router, point your web brower to http://192.168.0.1. The setup wizard will show up, just cancel that. Click on Maintenance (on the horizontal navigation bar), then Click on Firmware (on the vertical navigation bar on the left). You will see the input form where you can upload the firmware. The webpage will tell you not to update your firmware over WiFi. You can ignore that because i have done it multiple times and nothing bad happened. If you upload the file from above, you will get the following message: "The chosen file is not a firmware file". This took me a while to figure out and the main reason for this blog post.

First, you need to open the bin file in vim and set vim in hex mode

vim openwrt-ar71xx-generic-dir-505-a1-squashfs-factory.bin

then once you have vim open, run the hex mode command

:%!xxd

You will notice in the first few lines that it says

0000030: 5235 3035 4131 2d33 0000 0000 0000 4445  R505A1-3......DE

That value is what is causing the firmware update to fail, modify the fourth line of hex code directly to

0000030: 5235 3035 4c41 312d 3300 0000 0000 4445  R505LA1-3.....DE

You only have to update the hex number (not the letters on the right). Once done, revert back to regular mode

:%!xxd -r

then just save and exit

:wq

Now you should be able to update your firmware through the web interface with no trouble. If you have any issues, just leave a comment. Good luck, Internetland.

10 comments:

  1. Hi, Pierre
    I've update your FW successfully.
    but there are only three interface "br-lan, eth1, lo" left, the WIFI disappear.
    And I cannot find the web interface of your FW.
    Could you give me more detail user guidance?
    Thank you very mnuch.

    ReplyDelete
  2. by default OpenWRT disables Wifi, you can turn it on by modifying /etc/config/wireless more info at

    http://wiki.openwrt.org/doc/uci/wireless

    ReplyDelete
  3. Hi, Pierre
    if I wanna get the source code of the DIR-505 of openwrt version, where could I get that?
    Thanks.

    ReplyDelete
  4. https://dev.openwrt.org/browser#trunk/target/linux/ar71xx

    ReplyDelete
  5. Hello, you can try my images with LuCi and more already integrated:
    http://www.superwrt.eu/firmware/d-link-dir-505/

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. You can change the default organize name (SSID) to the one of your decision. You can quit broadcasting the system name. So that nobody else other than the general population who know the SSID, can enter your system. visit here

    ReplyDelete