Mono on the Intel Galileo
- Posted: Sep 12, 2014 at 6:00AM
Since we're on something of a .NET and Galileo theme right now, these posts from Jeremiah Morrill caught my eye. Our community is pretty awesome in how it's not only hacking away at the Galileo, but in how it shares the results... :)
What "portable" .NET conversation is complete without including Mono?
Over the last week, since my Intel Galileo dev board arrived, I’ve been trying to get mono ported over to Microsoft’s “Windows on Devices”. With a bit of recent success, I wanted to share the experience and give you something to download.
tldr;Download link at the bottom of the post
Why Mono on Windows? Doesn’t Microsoft have their own CLR and why not just use a Raspberry Pi- like board?
Right now Microsoft’s Windows on IoT (let’s call it mincore until we are corrected), there is minimal .NET support. The CLR is there, but there’s little to no supporting libs. In short it’s either incomplete, or perhaps just waiting for .NET native support. I don’t want to wait around to see what Microsoft is doing with this OS. I just paid $50 for this device, so I want to do something besides blinking LEDs.
So why not just use an already Linux supported device running mono? For some people, this may be a no-brainer and probably already doing it. For others like me, we have a good chunk of dependencies on Microsoft technologies and/or APIs, which also may include our own C and C++ libraries. So naturally, something I want is a cheap low powered device I can mostly recompile and not muck up a stable codebase in the process. Mono on this mincore Windows just may fit, even if temporary.
What is this mincore-Windows-IoT and what’s involved in porting Mono over to it?
What about p/invoke stuff in the BCLs?
There’s also a good amount of DllImports in the Mono BCLs...
What isn’t working with mono besides stuff that doesn’t already work with mono?
Where’s the code? You gotta hook it up. The power of GPL compels you!
It’s coming, I promise. The problem is I hacked up so many things, just trying to get it to work, I’m working on cleaning it up. I want it to be compatible the rest of the mono build system, only enabled with some preprocessor flags Shouldn’t be much longer than a week.
Where’s the bins, I wanna try it out!
I uploaded the latest port here...
Previously I blogged about running mono on the Intel Galileo board and provided the binaries. I promised the source code and wanted to make good on that. I have uploaded this experiment to github here.
Some Quick Notes on Compiling
At the moment, compiling is sort of a “two pass” deal. I’m sure someone with more gcc experience could make it a single pass, but this method works well.
Once you download the source, more or less follow the instructions here but use the source from my repo: http://www.codeproject.com/Articles/815565/How-to-build-Mono-on-Windows Those instructions will essentially build the mono runtime, compiler and .NET BCLs. The native mono runtime and other native binaries from this output is not compatible with the Intel Galileo, but it does give us valid BCL dlls.
Next open up mono\msvc_minwin\mono.sln. Compile a Release|Win32 or Release_SGEN|Win32. Copy the binary outputs (mono*.exe and mono*.dlll) to your monoinstall\bin folder. Copy your mono installation directory to your device and enjoy.
Quick Notes on the Code Changes