Version 3 of Tcl on the Slug

Updated 2005-09-01 18:37:24 by tp

TP The Slug is the affectionate name for the Linksys NSLU2 [L1 ]:

http://www.linuxdevices.com/files/misc/linksys_nslu2-thm.jpg http://www.linuxdevices.com/files/misc/linksys_nslu2_board-sm.jpg

Out of the box, the NSLU2 is a network attached storage appliance utilizing USB 2.0 disk storage (2 ports), connecting via 10/100 mb ethernet. It's primary function is to offer a simple SMB network storage device for Windows or Samba users. The device runs a version of Linux, and all administration is done via a web interface. An ARM 5 (Intel IXP420) running at 133 Mhz powers the box, with 8mb flash and 32mb ram. Any USB 2.0 mass storage device can be plugged in, e.g., a flash thumb keychain drive or a disk drive mounted in a USB enclosure.

What's cool is that the slug is entirely hackable, made possible by the NSLU2-Linux group [L2 ]. By reflashing the firmware with Unslung [L3 ] or OpenSlug [L4 ], the box is capable of serving as an ordinary Linux server. The primary difference between the Unslung and OpenSlug firmware is that the Unslung firmware retains the stock functionality and web administration interface, OpenSlug removes that capability.

After reflashing with either firmware, telnet and/or ssh access can be enabled. Once logged into the Slug, a package tool ipkg can be used to install additional software onto a connected USB drive. A large number of software packages are available for easy installation [L5 ] Many of the packages have been cross-compiled on a host Linux box, but native development is also possible [L6 ]. Be sure to read all of the installation procedures before you reflash with Unslung (or OpenSlug).

There is an existing Tcl package, but I had problems running it with the current release of the Unslung firmware (5.5beta). After installation, ipkg install tcl , running the tclsh8.4 binary results in:

 # tclsh8.4
 application-specific initialization failed: can't upvar from variable to itself

However, Tcl can be built using the native development toolchain [L7 ] just as on any other machine by downloading Tcl (8.4.11) from SourceForge, unpacking, and:

 cd tcl8.4.11/unix
 ./configure --prefix=/opt
 make
 make install

As I have more time, I'll try to submit the appropriate Tcl package fixes back to the NSLU2-Linux project. I am also planning to port additional Tcl software to the Slug. Note that /opt is the conventional directory tree to install packages and other software.

One of the first things you can do with your Slug is to allow it to run at full speed, 266 mHz. Linksys (for some reason) decided to under-clock the processor. A fairly simple hardware mod, removing one easily acccessed resistor, allows the Slug to run at full speed [L8 ]. I used an X-Acto knife to carefully cut the solder traces around the resistor. WARNING!! you should only attempt this procedure only if you feel comfortable with hardware hacking, and are prepared to have your Slug turn into a brick.

The Slug is fully capable of serving up web pages, SMTP server, or other chores that don't require large ammounts of cpu, memory, or bandwidth. Here are a few compelling reasons to do so:

  • Cheap - the street price of the Slug is $70 US at the time of writing (Sep 1, 2005) [L9 ]. A USB 2.0 IDE drive enclosure can also be found for $30-35, and add an IDE disk drive (80 gb is under $50). Total for a simple server is less than $150 US.
  • Low power - even when over clocked, the combined Slug + USB IDE disk doesn't draw much power.
  • QUIET! - no fans, just the IDE drive spinning away.
  • Cool - for the hackiness, geek cool factor.

The best source of info is the NSLU2-Linux project at http://www.nslu2-linux.org/ A mailing list is also available at http://groups.yahoo.com/group/nslu2-linux/

A few other notes:

  • The low-level boot code in the Slug runs the ARM cpu in big-endian mode, most other ARM Debian packages are built for the ARM running in little-endian mode, and are thus unusable. Another project, DebianSlug [L10 ] runs normal little-endian Debian packages by installing a word-swapped kernel and special loader to kick the ARM into little-endian mode. Since native development is easy and many package already exists, I haven't had any need to try this approach.
  • More ideas for what to run on your Slug [L11 ] and [L12 ]
  • The ARM 5 doesn't have a FPU, so be mindful of running floating point intensive apps.