Ruby/Rails on Gumstix

  • Thread starter M. Edward (Ed) Borasky
  • Start date
M

M. Edward (Ed) Borasky

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?
 
G

Giles Bowkett

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 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.
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?

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.
 
G

Giles Bowkett

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.)
 
D

Dick Davies

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

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 Flying Gridswarm, and the UltraSwarm

(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
- robotics, wearables, drones, things like the 'Pegasus' project :
( http://www.pegasushabproject.org.uk/ )
than for general purpose computing.

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
 
M

M. Edward (Ed) Borasky

Giles said:
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
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!" :)
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

M. Edward (Ed) Borasky

Dick said:
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. :)
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. :)
 
D

Dick Davies

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.
 
G

Giles Bowkett

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!" :)
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.
 
G

Giles Bowkett

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?
 
D

Dick Davies

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.
 
M

M. Edward (Ed) Borasky

Giles said:
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 Shaw 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. :)
 
G

Giles Bowkett

As a matter of fact, I was planning to ask Zed Shaw 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. :)

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.)
 
G

Giles Bowkett

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.
 
J

Joel VanderWerf

M. Edward (Ed) Borasky said:
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?
 
M

M. Edward (Ed) Borasky

Joel said:
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.
 
J

Joel VanderWerf

M. Edward (Ed) Borasky said:
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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top