PirateBox on the TL-WR703N v1.7


The PirateBox forums previously said it couldn't be done. The PirateBox hardware page used to say that PirateBox won't run on the TP-Link TL-WR703N v1.7. I wasn't going to let that stop me. With time, TP-Link has made it progressively harder to install custom firmware on the TL-WR703N router, but it's not impossible. This blog documents the process I took to get PirateBox running on my TL-WR703N v1.7.

Update (2019-10-15)
If you have the right tools, and the PirateBox firmware, you can flash the firmware directly to the flash chip on the router motherboard and then skip steps 1-5 in the section titled The process.

Overview

In a previous post, I covered the process for dumping firmware off of this little gem, and flashing firmware via the serial console. The portion where I talk about flashing custom firmware is what's applicable here. Basically, the custom firmware we want to flash is the firmware that PirateBox makes available. Once we flash that via the serial console, then we can generally follow the OpenWrt DIY instructions on the PirateBox site, skipping the bits about upgrading from OpenWrt to the custom PirateBox build of OpenWrt.

PirateBox

According to the PirateBox website, "PirateBox is a DIY anonymous offline file-sharing and communications system built with free software and inexpensive off-the-shelf hardware." If that -- or the name which is a play on The Pirate Bay -- sounds sketchy to you, let me explain a perfectly good use case. As of writing, I work at a school in a country with less than reliable international Internet access. Of course our course management system (CMS) is hosted internationally, and to make matters worse, that system goes down for maintenance while we are still in session at least a couple times a year. How are instructors supposed to be able to distribute electronic materials to classes when this kind of thing happens? How are they supposed to collect electronic submissions? This becomes a bit of a problem. As this just recently happened, I decided to look at PirateBox to see if it could serve as an affordable alternative when our CMS is offline or not functioning correctly for weeks at a time.

What you'll need

This process is a little time consuming and will involve cracking the TL-WR703N case open and connecting to the serial interface on the router board. As such, you're going to need some special tools.
  • See my post on opening up this router and getting a serial connection going. You'll need the list of stuff there as well as...
  • A USB Stick: to connect to your PirateBox for setup and regular use. This must be formatted with a FAT file system, and for those of you wondering, no, exFAT will not work. The exFAT utils are not installed in the PirateBox OpenWrt firmware.
  • A Computer Running the Following Software
    • PuTTY: or similar software for talking to serial ports
    • TFTP Server: For hosting the PirateBox firmware that we want to flash to the router

The process

I'm running Ubuntu Linux, so I'm going to provide instructions specific that system, but if you can get PuTTY and a TFTP server up and running, you should probably be able to generally follow along. Commands listed in black boxes indicate terminal commands.
  1. If you don't have one installed already, follow the instructions in this AskUbuntu answer to set up a TFTP server in Ubuntu.
  2. If you don't have PuTTY already, make sure your package list is up-to-date and get PuTTY installed:
    sudo apt-get update
    sudo apt-get install putty
    
  3. Copy the PirateBox firmware (direct download link) for the TL-WR703N to the /tftpboot folder, renaming it as piratebox.bin.
    cp /path/to/downloaded/piratebox/firmware/*-tl-wr703n-v1-*.bin /tftpboot/piratebox.bin
    
  4. Follow my instructions for opening this bad boy up and connecting to the serial console all the way up to the end where you reach the hornet> prompt. We're now ready to flash the custom firmware. Yes, this is a lengthy process.
  5. In the PuTTY window, issue the following highlighted commands:
    hornet>  tftpboot 0x81000000 piratebox.bin
    dup 1 speed 1000
    Using eth1 device
    TFTP from server 192.168.1.100; our IP address is 192.168.1.111
    Filename 'custom-firmware.bin'.
    Load address: 0x81000000
    Loading: #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             ######################################################
    done
    Bytes transferred = 3932160 (3c0000 hex)
    
    hornet> erase 0x9f020000 +0x3c0000
    
    First 0x2 last 0x3d sector size 0x10000                                       61
    Erased 60 sectors
    
    hornet> cp.b 0x81000000 0x9f020000 0x3c0000
    Copy to Flash... write addr: 9f020000
    done
    
    hornet> bootm 9f020000
    At this point the PirateBox firmware is installed. Now we just follow the applicable DIY instructions for OpenWrt on the PirateBox site.
  6. The light should be blinking on the router. Pull the power on the router.
  7. Get the install_piratebox.zip file (direct download link) off the PirateBox site, and unzip the contents to your USB stick.
  8. Disconnect the USB stick from your computer and plug it into the router.
  9. Connect your router to the computer running the TFTP server using an Ethernet cable.
  10. Connect the router to power again and let it go. It's going to boot and reboot a number of times (mine rebooted automatically 5 times). This whole process will probably take 10-30 minutes. The speed of the USB drive will have an impact here. It took me 10 minutes using an SSD drive. When everything is finished, the indicator light on the router will remain on (more than 30 seconds) and will not blink anymore.
  11. At this point, the PirateBox - Share Freely wireless access point should be visible to your wireless devices. If it is then we just need to finish setting up PirateBox.
  12. Assuming you haven't disconnected the serial connection, you can finish setting everything up there. If you already disconnected the serial interface, open the PirateBox DIY instructions, navigate to the section titled Post-Installation and complete the steps there.
  13. In the PuTTY window (serial console), press [Enter] once and you should see the OpenWrt welcome screen followed by a root prompt. Run the following commands to finish setting up PirateBox:
    # this command has different options; check out each.
    # definitely be sure to change the password at least
    box_init_setup.sh
    
    # only run this if you want to enable the forum component
    /opt/piratebox/bin/board-autoconf.sh
    
    # only run these lines if you want to enable the DLNA (uPnP) server
    # you should have enabled minidlna in the first command here
    cp /opt/piratebox/src/openwrt.example.minidlna /mnt/ext/etc/config/minidlna
    # next line only if you want to configure minidlna settings
    vi /etc/config/minidlna
    /etc/init.d/minidlna start
    /etc/init.d/minidlna enable
    

At this point, PirateBox is set up and running. There's a lot more you can customize from here, but I leave that to you. Again, I did this on a TL-WR703N v1.7 router purchased mid-December 2017. At the time, they said it couldn't be done. I took that as a challenge! It can be done, and cheaper than they said! The TL-WR703N costs 99 CNY in China with delivery. As of writing, that's just over $15 USD. Check out the screenshots below.





EDIT 2018-01-11
After running a bunch of tests, I have one word of caution. While this little device works, it can't handle a heavy load. Any time I try to use the miniDLNA server with more than a few videos loaded, the system runs out of RAM, kills processes (you can see it all real-time if you're connected to the serial console) and sometimes even crashes, resulting in a reboot. I did not seem to have any issue with the chat or forum features. File upload seemed to be temperamental as well.

Comments

Popular posts from this blog

Encrypted Ubuntu Installation with "Manual" Partitioning

Router Firmware -- Dumping and Flashing

Flashing TL-WR703N firmware directly to the flash chip