Sunday, February 14, 2010

My new PlugPC and Mono

Earlier in the week I received my Tonido PlugPC, and I have immediately fallen in love! What a fantastic little device. Within a few hours I'd got it set up to the point of being able to replace the Media Center PC that I was using for all our media streaming, central storage, and email server. It runs a full Linux kernel and so there is little you can't do with it that you can't do with a desktop... and it run off 9Watts instead of 400! Mine's running a little 'hot' as I have a USB hub plugged in to it. Off the hub I have a 16Gb USB drive which I'm booting the Tonido off of, and 3 x 0.5Tb and 1 x 1Tb drives for storage. I won't bore you with all the set-up details for my Tonido as it is not particularly relevant to this blog. My plan is to use a SheevaPlug (the TonidoPlug is really just a SheevaPlug with some web applications running on it) for development, but for some reason there is a 2-3 week delay with my SheevaPlug order, so I'm doing some playing with my TonidoPlug in the meantime. A few of pickies of my setup:

The most signifiant difference between a PlugPC and a desktop is that you have no screen or mouse or keyboard to interact directly with the device. So once you have your PlugPC connected to an ethernet network, the first thing you have to do in find a route in. I chose SSH, and in particular PuTTY. I haven't had much experience with command line work, but it really isn't that hard. Run PuTTY, give it the IP of your PlugPC, select SSH mode (I used Telnet mode to test my email server when I got it installed), ignore the security warning, login as 'root', and you're in.

Given that the SheevaPlug currently only has a 500Mb flash drive, the chances are that you're going to want more drive space for development. I very much doubt we'll have to wait very long before 16+Gb is available onboard. I followed the directions provided here, to boot from a 16Gb USB drive I got on sale from Staples for $29.99. The directions worked to the letter and I had no trouble whatsoever... very straightforward. My Tonido now boots off the USB drive - and certainly much faster than my Windows PC boots off a hard drive... not bad considering my Windows PC is a water-cooled overclocked (3.6GHz) Quadcore, and the Tonido has a single 1.2GHz core!

My next step was to make sure the packages on my Plug were uptodate. To do this I attempted to run:

apt-get upgrade

This bombed out for reasons I can't quite remember, but was someting to do with not being able to write to a particular location. After some Googling the following fixed things:

mkdir -p /var/cache/apt/archives/partial
apt-get autoclean

This seemed to fix 'apt-get' and re-executing 'apt-get upgrade' worked just fine.

At this point I'm keen to start going through the various tests outlined in previous posts (Amazon SimplDB, SerialPort, obviously the WinForms test is pointless on the Plug!), so I need Mono and IronPython installed. First I tried to install Mono with:

apt-get install mono-2.0-devel

The installation seemed to work, but even the simplest 'Hello World' test failed with a 'Segmentation Fault' response. I messed around some more, but kept running into the same error. Eventually I decided to try and compile Mono from source and install it that way. In doing this I found the article here very useful. There are some packages that the Mono configuration process depends on and need to be available before you attempt your Mono compilation. The following 'apt-get' installed what I needed to move forward:

apt-get install bison gcc gettext pkg-config glib-2.0

Next I downloaded the Mono 2.6.1 source to my root folder, and unzipped it:

cd /
wget http://ftp.novell.com/pub/mono/sources/mono/mono-2.6.1.tar.bz2
bzip2 -cd mono-2.6.1.tar.bz2 | tar xvf -

(NB Edit 11/24/2012: Mono source is now at http://download.mono-project.com/sources/mono/ with the latest version today being 2.10.9).  This created a 'mono-2.6.1' folder that I CDed into ('cd mono-2.6.1'). The compilation and install was remarkably smooth, if not time-consuming:

./configure --prefix=/usr (if this step fails it is probably due to a missing package. Install the indicated package and try again)
make (this process took several hours)
make install

After the install process completed I executed 'mono -V' to check the currently installed version and received the following:

Mono JIT compiler version 2.6.1 (tarball Thu Feb 11 17:56:14 MST 2010)
Copyright (C) 2002-2008 Novell, Inc and Contributors. www-mono-project.com
TLS: __thread
GC: Included Boehm (with typed GC and Parallel Mark)
SIGSEGV: normal
Notifications: epoll
Architecture: armel, soft-float
Disabled: none

So far, so good. I then installed IronPython 2.6 as detailed in my previous posting, and performed the same Amazon SimpleDB access that I had previously (including the 'mozroots' command). So a far more challenging test than a simple 'Hello World' - the test ran as expected and so I am now hoping that I can claim that Mono 2.6.1 and IronPython 2.6 are installed and running OK on my PlugPC... how cool is that!

1 comment:

  1. I was looking for some article on how to run mono on Tonido and this provided with me all I need, thanks a lot! May I know is there anything I need to take care of when I am compiling VB.Net project or I can simply copy the entire project to Linux and just hit compile in mono?

    Thanks!

    ReplyDelete