mono

The following instructions describe the process of getting a poorman's Mono running on 770/n800 devices (Scirocco and Bora SDK releases have been tested). The process is temporary (ugly) in nature as it requires using externally-compiled tarball binaries. The proper way of doing things would be to provide nicely-decoupled mono packages - like it's done in Mono for Debian.

The method described below is presented for testing purposes only. The idea is to get people quickly started experimenting with mono. Even though the resulting setup is 100% working, it should be used only for development.

Prerequisites: * Working scratchbox Apophis * Bora or Scirocco SDK releases installed * Some understanding of scratchbox environment * Root access to the scratchbox machine

All the tarballs mentioned here can be found at http://files.mdk.am/other/ .

Installing mono devkit

First unpack the mono_devkit.tar.gz in the scratchbox directory. You need to do this as root.

tar xzf mono_devkit.tar.gz -C /scratchbox 

Thanks to this the mono virtual machine will run always on the host. We need to expose some of the system shared libraries to mono. This can be accomplished easily by copying them from /usr/lib to /scratchbox/host_shared/lib/. As root:

cp /usr/lib/libglib-2.0* /scratchbox/host_shared/lib/
cp /usr/lib/libgthread-2.0* /scratchbox/host_shared/lib/
cp /usr/lib/libgmodule-2.0* /scratchbox/host_shared/lib/

Setting up the 386 scratchbox target

Login to scratchbox and create a new 386 target using sb-menu as described in the standard SDK instructions. During the devkit selection pick mono devkit additionally to other devkits. Proceed as normal.

Select the newly created target and when inside scratchbox unpack mono_classlib.tar.gz and mono_i386_gtk_sharp.tar.gz into the root directory.

fakeroot tar xzf mono_classlib.tar.gz -C /
fakeroot tar xzf mono_i386_gtk_sharp.tar.gz -C /

Now you have a fully working mono environment where you can compile and run mono programs.

Setting up the arm scratchbox target

Arm target should be created analogically. The only difference applies to the final steps - when in scratchbox, unpack mono_arm_gtk_sharp.tar.gz instead of mono_i386_gtk_sharp.tar.gz. The classlib file stays the same.

In this environment you can compile mono programs. Mono-only programs can be run too, but other (ie. software that uses gtk-sharp) will fail as the 386-running mono vm will try to pinvoke into arm code.

Setting up mono on the device

Get mono_arm_runtime.tar.gz, mono_classlib.tar.gz (already used) and mono_arm_gtk_sharp.tar.gz (already used) and put the tarballs on the mmc card.

Log into your nokia 770/n800 using terminal or ssh access. As root, unpack all the files into root dir:

tar xzf /media/mmc1/mono_arm_runtime.tar.gz -C /
tar xzf /media/mmc1/mono_arm_gtk_sharp.tar.gz -C /
tar xzf /media/mmc1/mono_classlib.tar.gz -C /

Now you can run mono/gtk-sharp programs on your nokia device.

Final notes

  • Creating the arm scratchbox target is an optional step and you'll need it only for compiling mono libraries with unmanaged code. Everything else (standard mono programs using gtk-sharp) can be compiled in 386 target and moved directly to the device.

  • This setup should not be used for detailed performance evaluation as it has been compiled with minimal optimizations (including softfloats) to work on both devices (770 and n800). Additionally, the mono programs can't right now benefit from the maemo-launcher used for standard C programs (that significantly reduces the startup time).

  • You might notice that mono occupies a lot of flash space on your device. This is because the bundle includes everything provided by the mono classlib, including the debugging information. Most applications require just a small subset of the whole library. Proper debian packaging should limit the average flash usage to acceptable minimum.

  • Notice that currently gtk 2.6 is used on the devices. Gtk-sharp has been bootstrapped with 2.6 target and functionality exposed by later API's is not available.

* We currently don't have working hildon mono bindings which limits the GUI usage.

CategoryHowToDevelopment