Nicolas314

All my geeky stuff ends up here. Mostly Unix-related

Posts Tagged ‘optware

Running optware on Tomato

leave a comment »

If you have an ARM- or MIPS-based router like the Linksys WRT54g (MIPS) or Netgear’s WNR3500L (MIPS), you probably know you can run alternative firmware like dd-wrt, Tomato, or openwrt. Choosing the right one for your router is both a matter of user requirements (what do you want to do with your router?) and a question of taste (which one do you find easier to handle?). Whatever you choose, you may end up running a firmware version lacking a couple of functionalities and this is where optware shines.

Optware is a Debian-like distribution for ARM-based Linux devices. Packages live under /opt and all share common dynamic libraries stored there. Package management itself is handled by ipkg, a close equivalent to dpkg on Debian. There are pre-compiled binaries available for ARM on various sites, allowing you to install handy network-based functionalities in a couple of commands.

More information about Optware can be found on these sites:

Check out the list of packages offered by this distribution, it is quite impressive. To give you ideas you could run:

  • lighttpd, apache, cherokee or nginx for your own web site served directly from your router!
  • Python, Perl, Lua and other scripting languages
  • cron jobs
  • ftp or samba server, bittorrent clients
  • etc.

The only trouble with the default WNR3500L is that you will quickly run out of space if you only rely on flash memory included on the router. The solution is quite obvious though: dedicate a USB stick to the task and install everything onto it. Here are the steps I took to achieve this under Tomato:

Mount your USB stick on /opt on boot

This part was heavily inspired by Adventures with DD-WRT. On your Tomato admin interface, select Administration and then Scripts in the left menu. Copy/paste the following code inside the Init tab:

#!/bin/sh
sleep 6
umount -f /tmp/mnt/sda1
mount -rw -o noatime,nodev /dev/sda1 /opt

In other words: you are asking the router to wait for six seconds to let the USB stick get mounted (default is /tmp/mnt/sda1) and then you un-mount it and re-mount immediately on /opt where Optware lives.

Reboot your router. Make sure your USB stick has been re-mounted correctly on /opt e.g. by ssh’ing into your router and running df -h /opt

Install Optware

This part was taken from the dd-wrt site. You first download a bootstrapping shell script from an active mirror and then run it to download and setup Optware basics. I got the initial script from pastebin but there are alternative mirrors:


# wget http://pastebin.ca/raw/1031954 -O - | tr -d '\r' > /tmp/optware-install.sh
# sh /tmp/optware-install.sh

Check the Optware/dd-wrt pages for more detailed information. You will see that the script is taking care of setting up shared C libraries for all optware packages to use, and then configure ipkg (the package manager) for immediate usage.

That’s about it. You can now install packages with ipkg like this:


# ipkg install python25
[...]
# python2.5
Python 2.5.5 (r255:77872, May 20 2010, 23:37:05)
[GCC 4.1.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

I cannot thank enough the team behind Optware, this is really a wonderful set of tools! Porting and compiling packages is a tedious task, I would probably not be running a Python-based web server on my router without Optware.

Advertisements

Written by nicolas314

Saturday 13 November 2010 at 12:52 am

Posted in hardware, optware, router

Tagged with , , ,