Ruby/Rails on Gumstix

For the past couple of weeks, I’ve been playing around with Ruby on a
Gumstix computer. This is a small machine – it fits in the palm of an
adult hand – with an ARM (Intel XScale variant) processor, 16 MB of
flash disk and 64 MB of RAM. The basic component boards are, as the name
implies, about the size of a stick of gum. There are two models, one
which takes an MMC card and the other which takes a Compact Flash (CF)
card. The operating system is Linux (2.6.18 at present). See

http://gumstix.com

for the hardware, cross-development toolchain and other software
details.

I have enough of this working that I’m looking for testers and ideas for
applications. The basic software distribution includes Ruby, although I
had to tweak the Ruby makefile a bit. SQLite 3 already runs on the
platform as well, as does lighttpd, so one obvious one is a Rails port.
I have most of the pieces of the Rails port working – the hardest part
is getting all the paths and environment variables correct for both the
cross-development toolchain and the target system. Because of speed and
space issues, anything that involves a C compile step, such as
sqlite3-ruby, needs to be cross-compiled and cross-linked on the host
development system.

Right now, the pieces that are mostly working are on RubyForge at

http://rubyforge.org/viewvc/RailsOnAStick/?root=vgrails

You’ll need a Linux host, Ruby 1.8.5 and Rake for this. As far as I know
any Linux with Ruby 1.8.5 will work, although I only use Gentoo so there
are probably a few things I take for granted that will need to be added
to the project for other hosts. So … what would you do with one of
these? A robot that speaks Ruby? Hmmm … how about a robot duck that
types? A “massively parallel” map-reduce engine (non-floating point –
the hardware doesn’t have a floating point unit)? A network monitoring
device?


M. Edward (Ed) Borasky, FBG, AB, PTA, PGS, MS, MNLP, NST, ACMC(P)
http://borasky-research.blogspot.com/

If God had meant for carrots to be eaten cooked, He would have given
rabbits fire.

On 11/25/06, M. Edward (Ed) Borasky [email protected] wrote:

for the hardware, cross-development toolchain and other software details.
I love those little things. I don’t have any yet, but I’m planning to
get some for a toy robotics project with a target date for late summer
/ early fall next year.

the hardware doesn’t have a floating point unit)? A network monitoring
device?

OK, well, if I had an unlimited budget, I’d buy a couple thousand of
them and line the inside of my car with them, set them up on a private
WiFi network with Hadoop – an open-source Java implementation of
map/reduce and the Google filesystem – and see if I could set up
massively parallel computation within my car so my car could plot the
behavior of neighboring cars, drive itself, understand speech
commands, and talk. In other words, in an ideal world, I’d use this
technology to build my own Knight Rider.

However, to be a little more realistic, and to speak about Ruby rather
than Java, there was a recent project using those things which added
them to tiny remote-control helicopters and set up a WiFi network to
explore flocking in flying robots, and they had a simple Web
application for their user interface. That would be a perfect use of
Rails in this context, and of course you could write the flocking code
in Ruby as well.

http://perso.orange.fr/pascal.brisset/chromicro/doc/chromicro.html

My own project for next year is going to basically involve creating
“Simon,” the 80s toy, with four animal skulls, four Gumstix boxes, and
a set of LEDs. I haven’t figured out the input devices yet. This is
for Burning Man so it’s going to be a bit garish and otherworldly, but
the basic idea is, Simon was a little toy which threw aribitrary
sequences of flashing lights at you and you had to put them back into
the machine in the correct order. The sequences grew quicker and more
complex as you levelled up in the game, and this implementation will
be played in a small ring, where you have to actually physically run
from light to light to replay Simon’s sequences, and of course the
sequences will be delivered by LEDs located in the eyes of painted
animal skulls. It’s going to be quite terrifying. It’ll entertain the
children at Burning Man during the day and send the festival’s
acidheads into therapy for the rest of their lives during the night.

Obviously there will be Gumstix boxes attached to the back of each
skull, along with a WiFi network and some simple code to coordinate
the flashing of the lights and so on and so forth. The lack of a
proper input device is the remaining hurdle, but I’m pretty sure I can
figure it out.

Obviously, if Rails is available on Gumstix, I’ll use it in two ways
for this project: in the way the robot helicopters people used their
Web interface, i.e., as the admin or control interface, and
additionally I’d probably use the “restful” stuff in edge Rails to
coordinate the “Simon”-style sequences of flashing lights.

I’m not actually sure about that, I was originally planning to do it
all by hand, but I’ve found it’s very interesting to push Rails
further than it’s supposed to go, and it usually holds up pretty well
when you do. Besides, if it’s available, well hell, why not.

Anyway, in terms of my timeframe, I’m not even planning to get my
first box until next year. I’m getting an illuminated fur coat, which
is not going to be cheap, and then there’s the usual December
holidays, with all their associated expenses. However, Gumstix are
pretty cheap, even with the WiFi option.

Wow, I just checked the web site, they look SO different than they
used to. They didn’t used to have the cases on there, it’s a big
change visually. Hmm, also it looks like they use Bluetooth instead of
WiFi. I have absolutely no idea what the difference is there, I have a
feeling it probably doesn’t matter.

Anyway, I am definitely massively interested in this project, but I
probably won’t even get my first box until early next year.

ooh, I think I figured out the input device. it’ll just be some kind
of spooky-looking stick with a Gumstix inside. all you have to do is
wave the stick at the skulls and press a button. (this is assuming
that there’s some way for the skulls to determine which one of them
the stick is closest to when the button is pushed.)

On 26/11/06, Giles B. [email protected] wrote:

However, to be a little more realistic, and to speak about Ruby rather
than Java, there was a recent project using those things which added
them to tiny remote-control helicopters and set up a WiFi network to
explore flocking in flying robots, and they had a simple Web
application for their user interface. That would be a perfect use of
Rails in this context, and of course you could write the flocking code
in Ruby as well.

Pages perso Orange - Domaine obsolète

I thought that was just a bluetooth controlled flyer.
Are you confusing it with the UltraSwarm/GridSmarm stuff
http://cswww.essex.ac.uk/staff/owen/research.htm#The%20Flying%20Gridswarm,%20and%20the%20UltraSwarm

(which at the time it got all the publicity, wasn’t a grid - it was 1
machine
with a flight time of about 45 seconds).

Gumstix are fantastic, but IMO they’re more appropriate for custom apps

For your Simon thing, I’d go for a p100 and some serial cables (killjoy
I know,
but you’ll be less annoyed when it’s stolen or puked on). Maybe some
IRDA
recievers in each skull and a TV remote for the ‘wand’?

A dozen 'stix in a cluster has about the same computing power
of a so-so pentium3, and costs probably 3 times the price a Sun
T2000 (once you sort the networking out).

That said, they’re perfectly able to compile stuff themselves - storage
more than memory is your limiting factor, so just use an NFS share.

Alternatively, I had a lot of success cross-compiling ARM packages with
the stuff from http://scratchbox.org

Giles B. wrote:

However, to be a little more realistic, and to speak about Ruby rather
than Java, there was a recent project using those things which added
them to tiny remote-control helicopters and set up a WiFi network to
explore flocking in flying robots, and they had a simple Web
application for their user interface. That would be a perfect use of
Rails in this context, and of course you could write the flocking code
in Ruby as well.

Pages perso Orange - Domaine obsolète
Yeah, there’s a link to the flocking helos on the Gumstix website. I
like the sound of that: “Hey, Georgia, look at those flocking helos!” :slight_smile:
I don’t know what software they used for the web servers, but it was
probably not Ruby. The gizmos now come with Python and “microperl”, and
the native web server is “boa”.
Wow, I just checked the web site, they look SO different than they
used to. They didn’t used to have the cases on there, it’s a big
change visually. Hmm, also it looks like they use Bluetooth instead of
WiFi. I have absolutely no idea what the difference is there, I have a
feeling it probably doesn’t matter.
They have two models, the Waysmall and the Netstix. The Netstix has a
regular Ethernet port and a compact flash slot. You can put a WiFi or
Bluetooth card in the slot. They Waysmall has an MMC slot; I don’t know
what peripherals are available MMC, but it also has two serial ports, a
USB port, and comes it three models, one of which has Bluetooth built
in.


M. Edward (Ed) Borasky, FBG, AB, PTA, PGS, MS, MNLP, NST, ACMC(P)
http://borasky-research.blogspot.com/

If God had meant for carrots to be eaten cooked, He would have given
rabbits fire.

Dick D. wrote:

That said, they’re perfectly able to compile stuff themselves - storage
more than memory is your limiting factor, so just use an NFS share.
They also have both ccache and distcc, so it’s perfectly feasible to
have a Gumstix compile farm. :slight_smile:

Alternatively, I had a lot of success cross-compiling ARM packages with
the stuff from http://scratchbox.org
There are quite a few “open development toolchains” for the ARM. The
Gumstix people use a heavily hacked and customized version of the
uclibc/busybox/buildroot collection. I’ve only been doing this a couple
of weeks, so I’ve only found maybe half a dozen bugs, most of which
Gumstix inherited from the upstream source. But yes, in the long run, a
better cross-development toolchain is a must. Since I have Gentoo, I’ll
most likely go with the Gentoo Embedded toolchain rather than trying to
deal with yet another open source community. :slight_smile:


M. Edward (Ed) Borasky, FBG, AB, PTA, PGS, MS, MNLP, NST, ACMC(P)
http://borasky-research.blogspot.com/

If God had meant for carrots to be eaten cooked, He would have given
rabbits fire.

On 26/11/06, M. Edward (Ed) Borasky [email protected] wrote:

They have two models, the Waysmall and the Netstix. The Netstix has a
regular Ethernet port and a compact flash slot. You can put a WiFi or
Bluetooth card in the slot. They Waysmall has an MMC slot; I don’t know
what peripherals are available MMC, but it also has two serial ports, a
USB port, and comes it three models, one of which has Bluetooth built in.

The MMC slot is just for storage (you can’t plug NICs into it) - use
CFstix for that.
If you want to do Wifi, either use a CF card or ask them about wifistix
(there’s been a dedicated wifi board coming Real Soon Now for about
a year).

I think bluetooth is preferred as it makes more sense for short range
purposes and it draws an order of magnitude less power.

For your Simon thing, I’d go for a p100 and some serial cables (killjoy I know,
but you’ll be less annoyed when it’s stolen or puked on). Maybe some IRDA
recievers in each skull and a TV remote for the ‘wand’?

No, there’s an element of theatricality required, and serial cables
would totally ruin that. Plus there’s not much chance of anybody
stealing an entire art installation. To do this right I’d probably
want the skulls mounted a good seven feet high or something. Anyone
who can puke on my computer or the skull it’s housed in from a
distance of at least seven feet definitely qualifies as an edge case.
It’s not as if people go around Burning Man looking for art pieces
which might contain Gumstix and then dissassembling them. I mean the
ticket to the event costs more than a Gumstix box, the technology is
relatively unknown to begin with, and you’d have to be a bit of a
maniac to scale seven-foot poles just to steal spare parts. And not
only a maniac, but in incredible shape.

In fairness, I should have probably mentioned the seven-foot poles.
The IRDA thing might be a good idea. All it really has to do is be
something which the computer in a given skull can definitively
identify as being closer to it than to any other skull. It would be
very cool if you had to be very close to the skull for the wand to
work, and if the wand could trigger the skull just by proximity, i.e.,
no button, like magic. (Obviously if the wand had a very limited
range, then the fact that a skull sensed proximity at all would
automatically mean it was the most proximate skull.)

A dozen 'stix in a cluster has about the same computing power
of a so-so pentium3, and costs probably 3 times the price a Sun
T2000 (once you sort the networking out).

well, that is a very real consideration. however keep in mind all I’m
really trying to do on the software side is emulate a game that ran on
extremely cheap hardware during the 80s. I mean it sold for like five
bucks, and that was twenty years ago. Gumstix might be slow but they
can probably handle “Simon.”

if the Gumstix are too slow to run Rails, I’m more likely to abandon
Rails than Gumstix. just code it by hand in Perl or something if I
have to.

but that is a real consideration.

Ed – do they run really slowly? have you coded any apps in Rails on
them, to see how they handle it?

Yeah, there’s a link to the flocking helos on the Gumstix website. I
like the sound of that: “Hey, Georgia, look at those flocking helos!” :slight_smile:
I don’t know what software they used for the web servers, but it was
probably not Ruby. The gizmos now come with Python and “microperl”, and
the native web server is “boa”.

yeah, I think the project even predates the Rails hype – just a
possible use.

On 28/11/06, Giles B. [email protected] wrote:

A dozen 'stix in a cluster has about the same computing power
of a so-so pentium3, and costs probably 3 times the price a Sun
T2000 (once you sort the networking out).

well, that is a very real consideration. however keep in mind all I’m
really trying to do on the software side is emulate a game that ran on
extremely cheap hardware during the 80s. I mean it sold for like five
bucks, and that was twenty years ago. Gumstix might be slow but they
can probably handle “Simon.”

Oh, absolutely - I was raising an eyebrow at the cluster idea, not
trying
to say you need any horsepower for this job.

I think some 'stix would be a good way of doing the skull
thing (especially if you want to keep the skulls mobile). They’ve
got a reasonable amount of welly if you’re not doing a lot of floating
point.

Do you know about the NSLU2? It’s still small (size of a packet of
smokes) but its a bit more versatile than a gumstix as it has 2 USB2.0
ports. Debian runs on them these days, so you can probably have any
apps you want.

Giles B. wrote:

if the Gumstix are too slow to run Rails, I’m more likely to abandon
Rails than Gumstix. just code it by hand in Perl or something if I
have to.

but that is a real consideration.

Ed – do they run really slowly? have you coded any apps in Rails on
them, to see how they handle it?
I have not benchmarked them on Rails yet. For non-floating point
applications, they are about equivalent to a 233 MHz K6

http://docwiki.gumstix.org/Benchmarks

As a matter of fact, I was planning to ask Zed S. if he had any
standard Rails/Mongrel benchmarks he’d be willing to contribute to the
community. Obviously it would have to be something that would actually
run in 64 MB of RAM with a SQLite database running off a, say, 512 MB CF
card. :slight_smile:


M. Edward (Ed) Borasky, FBG, AB, PTA, PGS, MS, MNLP, NST, ACMC(P)
http://borasky-research.blogspot.com/

If God had meant for carrots to be eaten cooked, He would have given
rabbits fire.

I think some 'stix would be a good way of doing the skull
thing (especially if you want to keep the skulls mobile). They’ve
got a reasonable amount of welly if you’re not doing a lot of floating point.

Do you know about the NSLU2? It’s still small (size of a packet of
smokes) but its a bit more versatile than a gumstix as it has 2 USB2.0
ports. Debian runs on them these days, so you can probably have any
apps you want.

well…I know that according to Google they’re bigger than an apple
and smaller than a bottle of Pepsi.

http://fredericiana.com/uploads/thumb-nslu2-Size-In-Context.jpg

It does look handy. Actually looking at that vent brings to mind
another issue which might be off for either one of the hardware
options, which is that in the particular environment this is intended
for, corrosive alkaline dust is extremely ubiquitous. I was thinking I
might be able to get around this part with a really wanton misuse of
Saran Wrap, but I hadn’t gone much further than that.

The big question I’ve got to work out is how to make the wand work. I
think beyond that the project is actually pretty straightforward.

M. Edward (Ed) Borasky wrote:

For the past couple of weeks, I’ve been playing around with Ruby on a
Gumstix computer. This is a small machine – it fits in the palm of an

I was using ruby on gumstix for a wireless networking testbed earlier
this year. One problem was with ruby loading dynamic libs, so I had to
build ruby statically liked with socket and so on. (I think python had
the same problem, IIRC.) Have encountered this problem? If so, have you
found a way around it?

As a matter of fact, I was planning to ask Zed S. if he had any
standard Rails/Mongrel benchmarks he’d be willing to contribute to the
community. Obviously it would have to be something that would actually
run in 64 MB of RAM with a SQLite database running off a, say, 512 MB CF
card. :slight_smile:

those are kind of unusual requirements.

(I’m probably not currently in any position to criticize anyone for
having unusual requirements – I’m just saying they may make for
unusual benchmarking.)

Joel VanderWerf wrote:

M. Edward (Ed) Borasky wrote:

For the past couple of weeks, I’ve been playing around with Ruby on a
Gumstix computer. This is a small machine – it fits in the palm of an

I was using ruby on gumstix for a wireless networking testbed earlier
this year. One problem was with ruby loading dynamic libs, so I had to
build ruby statically liked with socket and so on. (I think python had
the same problem, IIRC.) Have encountered this problem? If so, have
you found a way around it?

I’ll have to look at the makefile – it may be static by default.
“socket.c” didn’t even cross-compile on my machine; I have IPV6 and the
cross-development toolchain croaked until I disabled IPV6 in the Ruby
makefile.


M. Edward (Ed) Borasky, FBG, AB, PTA, PGS, MS, MNLP, NST, ACMC(P)
http://borasky-research.blogspot.com/

If God had meant for carrots to be eaten cooked, He would have given
rabbits fire.

M. Edward (Ed) Borasky wrote:

I’ll have to look at the makefile – it may be static by default.
“socket.c” didn’t even cross-compile on my machine; I have IPV6 and the
cross-development toolchain croaked until I disabled IPV6 in the Ruby
makefile.

Check your ext/Setup. Lines beginning with # are not linked statically.

Does “require ‘socket’” (for example) succeed when you are running on
the stixen? What about other extensions?