I tried to recycle an old TP-LINK TL-MR3020 by installing and
configuring OpenWrt on it. This turned out to be a bit challenging
because it has only 4M disk space and 32M RAM. Even the OpenWrt site
does not recommend it anymore
(https://openwrt.org/toh/tp-link/tl-mr3020). To extend the disk space
I used a USB disk, but this is challenging too, because the standard
OpenWrt image for TP-LINK TL-MR3020 does not contain the drivers for
reading it, so a custom image has to be built, which contains these
drivers.

We will see the file ~'mr3020nv1_en_3_17_2_up_boot(150921).bin'~.
According to the instructions on
https://openwrt.org/toh/tp-link/tl-mr3020, since it contains the word
boot, we need to cut off some part of it, before flashing it:

Now connect the router to the computer with a cable and turn it on
while keeping pressed the WPS/RESET button. Looking at the logs
(tail /var/log/syslog -f), you will see a message like this:

Serving mr3020v1_tp_recovery.bin to 192.168.0.86:3686

This means that the router is looking by default for the file
mr3020v1_tp_recovery.bin. So, we should rename tplink.bin to this:

mv /srv/tftp/{tplink.bin,mr3020v1_tp_recovery.bin}

Then try it again and the router will start flashing the new image to
its storage and will reboot. If everything goes well you should be
able to ping to 192.168.0.254, which is the default IP of the
flashed image. You can also open http://192.168.0.254 without
password and access the greenish interface of the router. (If it asks
for a password, then try username 'admin' and password 'admin'.)

Then, following instructions similar to these, open "System Tools" and
"Firmware", then "Choose File" and select
'lede-17.01.5-ar71xx-generic-tl-mr3020-v1-squashfs-factory.bin', and
finally click on "Upgrade".

When upgrade and restart is finished, the router can be accessed on
=192.168.1.1= without password:

3 Use a USB stick for storage

You will notice that the native storage is very limited and you cannot
harness the full power of OpenWrt with so little storage. Plugging a
USB stick to the router doesn't work because the necessary drivers
are missing. If we follow the instructions on this page we have to
build a new image upgrade that contains these drivers and install it.
If we had more disk space (for example 8MiB) we could have installed
the needed drivers from the internet, like this:

If the command fails, most probably you need to install some
additional development packages. The error message should give a hint
about what needs to be installed.

If the image build was successful, you will find on
bin/targets/ar71xx/generic/ the images lede-*-factory.bin and
lede-*-sysupgrade.bin. Let's copy the sysupgrade image to the router
and upgrade the system:

On a linux system, we can partition the USB stick (for example using
fdisk) to have a swap partition of 512MiB, and the rest of it an
ext4 partition. We can plug this USB on the router and continue the
configuration like this:

If everything went well, the router should now be connected to the
internet. Not only that, but it should also act as a gateway for our
computer (connected through the cable).

5 Fix the web interface

Somehow we broke the LUCI web interface when we installed the upgrade
image (in order to install the USB drivers). Now that we have plenty
of storage space and have internet connection, we can fix it easily
(following these instructions:
https://openwrt.org/docs/guide-user/luci/luci.essentials):

7 Setup an OpenVPN client

Basically you need to copy the client profile to
/etc/openvpn/client.conf and fix its permissions, like chmod 600
/etc/openvpn/client.conf. Then install the package openvpn-openssl
and make a small change on the firewall:

8 Create an AP (Access Point)

Right now the router can be used as a gateway only for a computer that
is connected to it by a network cable. It would be nice if it could be
used as a gateway for a phone or tablet as well, connecting to it by
wi-fi.

We can do this by creating a new wireless interface, connecting it to
the LAN network, and configuring it as an AP: