LibraryBox-Africa

= Here is the process I used to create each of the 7 LibraryBox's sent to Africa: =

Why isn't the install all done from a USB storage stick?
The goal is to have everything on a USB Storage stick so that the LibraryBox can be created without connectivity to any network. It turns out this is not currently possible using the publicly available LibraryBox software. When performing the install, the currently provided install package downloads the following from the Internet:


 * http://stable.openwrt.piratebox.de/ar71xx/packages/Packages.gz
 * http://stable.openwrt.piratebox.de/ar71xx/packages/python_2.7.3-1_ar71xx.ipk
 * http://stable.openwrt.piratebox.de/ar71xx/packages/libffi_3.0.10-1_ar71xx.ipk
 * http://stable.openwrt.piratebox.de/ar71xx/packages/python-mini_2.7.3-1_ar71xx.ipk

I will look at this in the future but time constraints require me to get the LibraryBox's built and deployed prior to resolving this issue.

1. Load the necessary firmware
''If you have already done this using the instructions found 'here', you may skip to the next step! If not, proceed.''

Open a Terminal Window on your MacBook. Issue the following command: netstat -r Look for the "default" entry under the column header labelled "Destination". Save the IP Address under the "Gateway" column header. At my desk this is the beginning of the "netstat -r" output: Destination Gateway Flags Refs Use Netif Expire default 10.17.8.1 UGSc 10 0 en0 10.17.8/25 link#4 UCS 5 0 en0 10.17.8.1 0:8:e3:ff:fd:c4 UHLWIi 9 0 en0 163

The "10.17.8.1" address will be used as the Gateway address entered during configuration. You also need to find an IP Address that is not currently being used on your network. I use the "ifconfig" command to learn what IP address has been assigned to my ethernet connection. On a WIndows machine, you may try the "ipconfig" command. Here is the output from the ifconfig command: en0: flags=8863&lt;UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST&gt; mtu 1500 options=2b&lt;RXCSUM,TXCSUM,VLAN_HWTAGGING,TSO4&gt; ether 40:6c:8f:18:b6:27 inet6 fe80::426c:8fff:fe18:b627%en0 prefixlen 64 scopeid 0x4 inet 10.17.8.34 netmask 0xffffff80 broadcast 10.17.8.127 media: autoselect (1000baseT &lt;full-duplex,flow-control&gt;) status: active The IP address "10.17.8.34" is currently assigned to my laptop. I then start doing a series of "ping 10.17.8.XX" commands where XX is an incremental number beginning with "35". When I find a IP Address that does not respond to ping, I write it down for use during configuration. (I got lucky, in my example the very next IP address, 10.17.8.35, was available.)

Plug an ethernet cable from the TP-Link into your laptop. Make sure you Laptop ethernet port is set to use DHCP and that you have turned off your wireless network.

Point a web browser here: http://192.168.0.254

Choose "System Tools -&gt; Firmware Upgrade"

Browse to the firmware on the USB stick (or where ever you saved it on your laptop): openwrt-ar71xx-generic-tl-mr3020-v1-squashfs-factory.bin This firmware upgrade will take several minutes. When the Browser window says "Completed", it will then change to a "Unable to Connect" page. This is good news! It means the new firmware is loaded.

2. Download the PirateBox software
Now manually set the IPADDR for the ethernet port on your laptop to 192.168.1.2, subnet mask or 255.255.0.0 and do not fill in the router address. Now you are ready to begin the TP-LINK configuration using a Terminal window. telnet 192.168.1.1 ... ... root@OpenWrt:/# passwd Changing password for root New password: &lt;SomeSecretPassword&gt; Retype password: &lt;SomeSecretPassword&gt; Password for root changed by root root@OpenWrt:/# Now configure the TP-LINK network so that after a reboot, it will be able to download the required PirateBox components. You will use the Gateway and IP address discovered earlier. Edit /etc/config/network so it looks like this (using either the "nano" or "vi" editor): config interface 'loopback' option ifname 'lo' option proto 'static' option ipaddr '127.0.0.1' option netmask '255.0.0.0'

config interface 'lan' option ifname 'eth0' option type 'bridge' option proto 'static' option ipaddr '10.17.8.35' option gateway '10.17.8.1' option netmask '255.255.0.0' list dns '8.8.8.8' list dns '4.4.4.4'

Power-down the TP-LINK. Plug the LibraryBox USB storage stick into the TP-LINK. Change the ethernet configuration your on laptop to use DHCP and connect your laptop via ethernet to the local network. Connect the TP-LINK via ethernet to the local network as well. Power up the TP-LINK.

Once TP-LINK is up, from a terminal window on your MacBook you should be able to "ssh root@10.17.8.35" (or whatever IP address you discovered and used earlier!). You will use the "&lt;SomeSecretPassword&gt;" password you defined earlier. Once you are connected, issue the following command: ping google.com This is to ensure you have Internet connectivity. If this doesn't work successfully, you need to start over! When it does work, CTL-C to stop it and then issue the following commands: insmod uhci insmod usb-ohci This insures you can access the USB storage stick plugged into the TP-LINK.

You are now ready to install PirateBox and LibraryBox from the USB storage stick. Enter the following commands: mount /dev/sda1 /mnt cd /mnt/ opkg install piratebox_0.3-2_all.ipk cd /mnt/usb/librarybox/ ./librarybox.sh ./nochat.sh To change the logo that appears on the LibraryBox web page to instead use the logo placed on the USB stick, use the following command: cp /mnt/usb/librarybox/oer.png /opt/piratebox/src/piratebox-logo-small.png Here is some cleanup commands to make things look pretty on the web site: cp /mnt/usb/Pirate/Shared rm *.png rm *.ico

Power-down the TP-LINK, unplug ethernet cable from the TP-Link, then power-up the TP-LINK. Look for and connect to the wireless network named "LibraryBox - Free Content". Once connected to this network, you should be able to point a web browser at "http://192.168.1.1" to access the content on this LibraryBox.

Notes about content on the USB stick
If you want to get rid of all the funny Mac metadata files on the USB drive, enter these commands from a terminal window on the Mac before you remove the USB storage drive: find /Volumes/PATRIOT -iname "._*" -delete find /Volumes/PATRIOT -iname "._Vid*" -delete find /Volumes/PATRIOT -iname "._vid*" -delete