<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.koansoftware.com/index.php?action=history&amp;feed=atom&amp;title=Embedded_Linux_.NET_applications_with_Yocto</id>
	<title>Embedded Linux .NET applications with Yocto - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.koansoftware.com/index.php?action=history&amp;feed=atom&amp;title=Embedded_Linux_.NET_applications_with_Yocto"/>
	<link rel="alternate" type="text/html" href="https://wiki.koansoftware.com/index.php?title=Embedded_Linux_.NET_applications_with_Yocto&amp;action=history"/>
	<updated>2026-04-17T17:57:54Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.15</generator>
	<entry>
		<id>https://wiki.koansoftware.com/index.php?title=Embedded_Linux_.NET_applications_with_Yocto&amp;diff=255&amp;oldid=prev</id>
		<title>Koan: Created page with &quot;== Embedded Linux .NET applications with Yocto and OpenEmbedded ==  This walk-through has the aim of taking you from a clean system through to including Mono in a build image...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.koansoftware.com/index.php?title=Embedded_Linux_.NET_applications_with_Yocto&amp;diff=255&amp;oldid=prev"/>
		<updated>2020-06-05T09:50:23Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;== Embedded Linux .NET applications with Yocto and OpenEmbedded ==  This walk-through has the aim of taking you from a clean system through to including Mono in a build image...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Embedded Linux .NET applications with Yocto and OpenEmbedded ==&lt;br /&gt;
&lt;br /&gt;
This walk-through has the aim of taking you from a clean system through to including Mono in a build image using the meta-mono layer, then building and packaging an example .NET project for inclusion in that image.&lt;br /&gt;
&lt;br /&gt;
You may already have Yocto installed and just be looking to work with Mono for the first time, in which case you can jump forward to the section you find most relevant, &amp;lt;br/&amp;gt;&lt;br /&gt;
such as [[#Build an example project on the host for testing (optional)|building an example package on the host to test]] or [[#Adding the meta-mono layer to the Yocto build system|adding the meta-mono layer to the Yocto build system]].&lt;br /&gt;
&lt;br /&gt;
The following assumptions are made. You are:&lt;br /&gt;
&lt;br /&gt;
* familiar with basic Linux admin tasks&lt;br /&gt;
* aware of the Yocto Project Reference Manual: [http://www.yoctoproject.org/docs/current/ref-manual/ref-manual.html here].&lt;br /&gt;
* using Ubuntu 18.04 as your host build system&lt;br /&gt;
* working with Yocto&lt;br /&gt;
&lt;br /&gt;
More details are available in the Yocto wiki page: [https://wiki.yoctoproject.org/wiki/Building_and_running_embedded_Linux_.NET_applications_from_first_principles Building and running embedded Linux .NET applications from first principles]&lt;br /&gt;
&lt;br /&gt;
== Adding the &amp;lt;code&amp;gt;meta-mono&amp;lt;/code&amp;gt; layer to the Yocto build system ==&lt;br /&gt;
&lt;br /&gt;
A preferred method for adding recipes to the build environment, and the method shown with this guide, is to place them within a new layer. &lt;br /&gt;
&lt;br /&gt;
Layers isolate particular sets of build meta-data based on machine, functionality or similar, and help to keep the environment clean.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;meta-mono&amp;lt;/code&amp;gt; layer contains Mono specific recipes to support execution of .NET applications on target boards. The layer can be found [http://git.yoctoproject.org/cgit/cgit.cgi/meta-mono here].&lt;br /&gt;
&lt;br /&gt;
To use a new layer such as this you first clone the layer from its git repository and then add the layer to your &amp;lt;code&amp;gt;bitbake&amp;lt;/code&amp;gt; configuration by editing &amp;lt;code&amp;gt;conf/bblayers.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  $ cd ~/yocto/poky-daisy-11.0.0&lt;br /&gt;
  $ git clone git://git.yoctoproject.org/meta-mono&lt;br /&gt;
  $ cd ~/yocto/poky-daisy-11.0.0/build_qemux86&lt;br /&gt;
  $ nano conf/bblayers.conf&lt;br /&gt;
&lt;br /&gt;
Your &amp;lt;code&amp;gt;bblayers.conf&amp;lt;/code&amp;gt; should look similar to this&lt;br /&gt;
&lt;br /&gt;
  # LAYER_CONF_VERSION is increased each time build/conf/bblayers.conf&lt;br /&gt;
  # changes incompatibly&lt;br /&gt;
  LCONF_VERSION = &amp;quot;6&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  BBPATH = &amp;quot;${TOPDIR}&amp;quot;&lt;br /&gt;
  BBFILES ?= &amp;quot;&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  BBLAYERS ?= &amp;quot; \&lt;br /&gt;
    /home/user/yocto/poky-daisy-11.0.0/meta \&lt;br /&gt;
    /home/user/yocto/poky-daisy-11.0.0/meta-yocto \&lt;br /&gt;
    /home/user/yocto/poky-daisy-11.0.0/meta-yocto-bsp \&lt;br /&gt;
    &amp;quot;&lt;br /&gt;
  BBLAYERS_NON_REMOVABLE ?= &amp;quot; \&lt;br /&gt;
    /home/user/yocto/poky-daisy-11.0.0/meta \&lt;br /&gt;
    /home/user/yocto/poky-daisy-11.0.0/meta-yocto \&lt;br /&gt;
    &amp;quot;&lt;br /&gt;
&lt;br /&gt;
Make the new layer visible to &amp;lt;code&amp;gt;bitbake&amp;lt;/code&amp;gt; by adding a line to &amp;lt;code&amp;gt;BBLAYERS&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  BBLAYERS ?= &amp;quot; \&lt;br /&gt;
    /home/user/yocto/poky-daisy-11.0.0/meta \&lt;br /&gt;
    /home/user/yocto/poky-daisy-11.0.0/meta-yocto \&lt;br /&gt;
    /home/user/yocto/poky-daisy-11.0.0/meta-yocto-bsp \&lt;br /&gt;
    /home/user/yocto/poky-daisy-11.0.0/meta-mono \&lt;br /&gt;
    &amp;quot;&lt;br /&gt;
&lt;br /&gt;
Now &amp;lt;code&amp;gt;bitbake&amp;lt;/code&amp;gt; can see the recipes in the new layer.&lt;br /&gt;
&lt;br /&gt;
You will also see when &amp;lt;code&amp;gt;bitbake&amp;lt;/code&amp;gt; runs and shows the Build Configuration that the repository branch and hash of your layer is shown which is useful to know, particularly when comparing notes with others as to why a build fails, e.g.&lt;br /&gt;
&lt;br /&gt;
  Build Configuration:&lt;br /&gt;
  BB_VERSION        = &amp;quot;1.22.0&amp;quot;&lt;br /&gt;
  BUILD_SYS         = &amp;quot;i686-linux&amp;quot;&lt;br /&gt;
  NATIVELSBSTRING   = &amp;quot;Ubuntu-12.04&amp;quot;&lt;br /&gt;
  TARGET_SYS        = &amp;quot;i586-poky-linux&amp;quot;&lt;br /&gt;
  MACHINE           = &amp;quot;qemux86&amp;quot;&lt;br /&gt;
  DISTRO            = &amp;quot;poky&amp;quot;&lt;br /&gt;
  DISTRO_VERSION    = &amp;quot;1.6&amp;quot;&lt;br /&gt;
  TUNE_FEATURES     = &amp;quot;m32 i586&amp;quot;&lt;br /&gt;
  TARGET_FPU        = &amp;quot;&amp;quot;&lt;br /&gt;
  meta&lt;br /&gt;
  meta-yocto&lt;br /&gt;
  meta-yocto-bsp    = &amp;quot;&amp;lt;unknown&amp;gt;:&amp;lt;unknown&amp;gt;&amp;quot;&lt;br /&gt;
  meta-mono         = &amp;quot;master:88c6d5f1961d58b3ec203ff19594f954c3e49cd9&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Build an image including Mono/.NET support ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;meta-mono&amp;lt;/code&amp;gt; layer includes a recipe to build an image &amp;lt;code&amp;gt;core-image-mono&amp;lt;/code&amp;gt; based on the Yocto standard image &amp;lt;code&amp;gt;core-image-sato&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To build this image&lt;br /&gt;
&lt;br /&gt;
  $ bitbake core-image-mono&lt;br /&gt;
&lt;br /&gt;
This may take a while, even if you have already built &amp;lt;code&amp;gt;core-image-minimal&amp;lt;/code&amp;gt; as additional GUI support packages need to be built.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;core-image-mono&amp;lt;/code&amp;gt; recipe can be found [http://git.yoctoproject.org/cgit/cgit.cgi/meta-mono/tree/recipes-mono/images/core-image-mono.bb here] and pulls in an include file from [http://git.yoctoproject.org/cgit/cgit.cgi/meta-mono/tree/recipes-mono/images/core-image-mono.inc here].&lt;br /&gt;
&lt;br /&gt;
You can see in the include file that extra packages are added to the standard &amp;lt;code&amp;gt;core-image-sato&amp;lt;/code&amp;gt; image.&lt;br /&gt;
&lt;br /&gt;
  IMAGE_INSTALL += &amp;quot;mono mono-helloworld&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
This is how you would add Mono support to your image within a recipe, or within a .bbappend file. In fact it should only be necessary to add the &amp;lt;code&amp;gt;mono&amp;lt;/code&amp;gt; package as it is not necessary to have the examples unless you wish to for testing purposes.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;mono-helloworld&amp;lt;/code&amp;gt; recipe included here shows how to build the example project using &amp;lt;code&amp;gt;autotools&amp;lt;/code&amp;gt;. For details see the recipe itself [http://git.yoctoproject.org/cgit/cgit.cgi/meta-mono/tree/recipes-mono/mono-helloworld/mono-helloworld_1.1.bb here], and more importantly the include file it pulls in [http://git.yoctoproject.org/cgit/cgit.cgi/meta-mono/tree/recipes-mono/mono-helloworld/mono-helloworld.inc here].&lt;br /&gt;
&lt;br /&gt;
You could choose to replace &amp;lt;code&amp;gt;mono-helloworld&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;mono-helloworld-xbuild&amp;lt;/code&amp;gt; which as the name suggests shows how to build the eaxmple project with &amp;lt;code&amp;gt;xbuild&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Testing the .NET executable on an emulated target==&lt;br /&gt;
&lt;br /&gt;
Having built &amp;lt;code&amp;gt;core-image-mono&amp;lt;/code&amp;gt; you can then run it up under &amp;lt;code&amp;gt;qemu&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run up the image, simply use&lt;br /&gt;
 $ runqemu qemux86&lt;br /&gt;
&lt;br /&gt;
This will boot the emulator, load up the image, you&amp;#039;ll see a kernel loading and then a basic user interface.&lt;br /&gt;
&lt;br /&gt;
If you find that your keymap is incorrect you might wish to set this explicitly, for example&lt;br /&gt;
&lt;br /&gt;
 $ runqemu qemux86 qemuparams=&amp;#039;-k en-gb&amp;#039;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 $ runqemu qemux86 qemuparams=&amp;#039;-k en-us&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Open up a terminal window using the appropriate icon, Log into the emulator as &amp;#039;root&amp;#039;, no password and run the examples.&lt;br /&gt;
&lt;br /&gt;
You can run the first with&lt;br /&gt;
&lt;br /&gt;
  $ mono helloworld.exe&lt;br /&gt;
&lt;br /&gt;
Or alternatively the recipe installs a script to wrap use of Mono, so you can use the form&lt;br /&gt;
&lt;br /&gt;
  $ helloworld&lt;br /&gt;
&lt;br /&gt;
This will output &lt;br /&gt;
&lt;br /&gt;
HelloWorld&lt;br /&gt;
&lt;br /&gt;
[https://wiki.yoctoproject.org/wiki/File:Monoemulatedhelloworld.png]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can run the second with&lt;br /&gt;
&lt;br /&gt;
  $ mono /usr/lib/helloworldform.exe&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
  $ helloworldform&lt;br /&gt;
&lt;br /&gt;
Depending on your host environment (e.g. using SSH) you may need to explicitly set the &amp;lt;code&amp;gt;DISPLAY&amp;lt;/code&amp;gt; variable for this to work, with&lt;br /&gt;
&lt;br /&gt;
  $ export DISPLAY=:0&lt;br /&gt;
  $ mono /usr/lib/helloworld/helloworldform.exe&lt;br /&gt;
&lt;br /&gt;
This will show a test Windows Forms form titled &amp;#039;Hello World&amp;#039;&lt;br /&gt;
&lt;br /&gt;
[https://wiki.yoctoproject.org/wiki/File:Monoemulatedhelloworldform.png]&lt;br /&gt;
&lt;br /&gt;
Lastly you can run a test GTK# application with&lt;br /&gt;
&lt;br /&gt;
You can run the second with&lt;br /&gt;
&lt;br /&gt;
  $ mono /usr/lib/helloworldgtk.exe&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
  $ helloworldgtk&lt;/div&gt;</summary>
		<author><name>Koan</name></author>
	</entry>
</feed>