David's Random Projects and Documents
Feel free to use and link to any docs you find here. Please give credit and link back to this page on any publicly avaliable copies.

Installing Mono from source on the Intel Edison

Prerequisites:

Transferring and Extracting mono source files

Mono can either be transferred through scp from a linux machine or windows box running cygwin or transferred through the USB mass storage partition of your Edison's flash memory. For instructions on transferring files using USB mass storage see transferring files through USB.

Move the mono tar or tar.bz2 file to an empty temporary directory for compilation.

Due to a bug in the tar command in the current version of the Edison Yocto image a flat copy or zipped version of mono source should be created on a separate machine and transferred to the temporary folder instead of extracting the tar ball downloaded from mono-project.com directly. If a zipped file is used to reduce transfer time the command unzip mono-version.zip -d directory can be used to extract the source files.

Compiling and Installing Mono

Steps taken from mono-project.com: How to make a smaller Mono install

Configuring, Compiling, and installing mono from source will take many hours(4). Make sure you have a reliable power connection and can leave your Edison module sitting for most of a day before beginning this process.

Step 1: Configure the build environment (~5 min)

cd into the directory containing your mono source. An ls should look something like this:

AUTHORSconfig.submkinstalldirs
COPYING.LIBconfiguremono
ChangeLogconfigure.acmono-core.spec
LICENSEdatamono-core.spec.in
Makefile.amdepcompmono-uninstalled.pc.in
Makefile.indocsmsvc
NEWSeglibpo
README.mdexternalruntime
acinclude.m4ikvm-nativesamples
aclocal.m4install-shscripts
autogen.shlibgcsupport
build-mingw32.shltmain.shtest-driver
compilem4tools
config.guessmanwinconfig.h
config.h.inmcs
config.rpathmissing

Configure for minimal build

chmod a+x ./configure
mkdir /mono
./configure --enable-minimal=aot,profiler --prefix="/mono"

Step 2: Compile Mono from source (~3 hours)

chmod a+x scripts/*
chmod a+x ./*sh
chmod a+x ./*/*sh
chmod a+x ./*/*/*sh
chmod a+x ./*/*/*/*sh
chmod a+x ./*/*/*/*/*sh
chmod a+x ./*/*/*/*/*/*sh
make CFLAGS=-Os

Step 3: Install Mono (~12 minutes)

Create a mono/lib folder in your home directory and link to in in the /mono folder

mkdir ~/.local
mkdir ~/.local/mono
mkdir ~/.local/mono/lib
ln -s ~/.local/mono/lib /mono/lib

This will allow the mono libraries to install without consuming all of you root directory space.

Install mono from the compilation directory.

make install

Create mono and mcs(compiler) links in you /usr/bin folder

ln -s /mono/bin/mono /usr/bin/mono
ln -s /mono/bin/mcs /usr/bin/mcs

Step 4: Clean up source files

It is now safe to remove the Mono source files from your Edison module freeing ~1GB of space. All you need to do is remove the directory you extracted the mono source code into and your done. This can be done using the rm command. Be careful with this command as it is easy to delete things you didn't mean to silently and anything removed is removed permanently.

cd ../
rm -rf ./mono-source

Note: "mono-source" is the directory you created when extracting mono's source code.

Finished!

Mono should now be installed on your Edison board. You can compile 32-bit .net console applications in either mono develop, Visual Studio, or your Edison using mcs and run them using the mono app.exe command.