<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.sugarlabs.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mk8</id>
	<title>Sugar Labs - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.sugarlabs.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mk8"/>
	<link rel="alternate" type="text/html" href="https://wiki.sugarlabs.org/go/Special:Contributions/Mk8"/>
	<updated>2026-04-08T16:55:16Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://wiki.sugarlabs.org/index.php?title=Dextrose/Building&amp;diff=58545</id>
		<title>Dextrose/Building</title>
		<link rel="alternate" type="text/html" href="https://wiki.sugarlabs.org/index.php?title=Dextrose/Building&amp;diff=58545"/>
		<updated>2010-10-27T10:28:07Z</updated>

		<summary type="html">&lt;p&gt;Mk8: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Build system ==&lt;br /&gt;
&lt;br /&gt;
Dextrose uses [http://wiki.laptop.org/go/OS_Builder olpc-os-builder], a tool create by OLPC to build official and customized system images. The Dextrose git repository contains, olpc-os-builder, local customizations specific to Dextrose, and fixes and enhancements waiting to be pushed upstream.&lt;br /&gt;
&lt;br /&gt;
== Build host requirements ==&lt;br /&gt;
&lt;br /&gt;
The Dextrose build system runs on &#039;&#039;&#039;Fedora 11 i386&#039;&#039;&#039; through &#039;&#039;&#039;Fedora 13 x86_64&#039;&#039;&#039; (&#039;&#039;&#039;Fedora 14 beta&#039;&#039;&#039; can be used also). The host system runs &#039;&#039;&#039;shouldn&#039;t&#039;&#039;&#039; matter, because the build runs in a chroot environment. olpc-os-builder does not yet run on Ubuntu due to a missing dependency.&lt;br /&gt;
&lt;br /&gt;
The initial build requires about &#039;&#039;&#039;700MB&#039;&#039;&#039; of rpm packages and Sugar activity bundles. The packages and bundles are cached for futures builds.&lt;br /&gt;
&lt;br /&gt;
== Initial setup ==&lt;br /&gt;
&lt;br /&gt;
* Install dependencies (you need to be root to do this)&lt;br /&gt;
&lt;br /&gt;
  yum upgrade&lt;br /&gt;
  yum install libtomcrypt-devel bitfrost make gcc mtd-utils python-imgcreate zip unzip zlib-devel&lt;br /&gt;
&lt;br /&gt;
* Checkout Dextrose build system&lt;br /&gt;
&lt;br /&gt;
  git clone git://git.sugarlabs.org/dextrose/mainline.git dextrose&lt;br /&gt;
&lt;br /&gt;
* Compile build helper programs&lt;br /&gt;
&lt;br /&gt;
  cd dextrose&lt;br /&gt;
  make&lt;br /&gt;
&lt;br /&gt;
* Generate initial sequence number for the builds (42 is just for an example)&lt;br /&gt;
&lt;br /&gt;
  echo 42 &amp;gt;buildnr-dx&lt;br /&gt;
&lt;br /&gt;
== Creating a build ==&lt;br /&gt;
&lt;br /&gt;
* Run the Build (again you need to be root to able to do this)&lt;br /&gt;
&lt;br /&gt;
  time ./osbuilder.py examples/dextrose2-xo1.ini&lt;br /&gt;
&lt;br /&gt;
obviusly you can use sudo if your user is configured to do this, and the you can use this&lt;br /&gt;
&lt;br /&gt;
  time ./osbuilder.py examples/dextrose2-xo1.ini&lt;br /&gt;
&lt;br /&gt;
The initial build may take several hours depending on available bandwith.  Subsequent builds will take about 15-20 minutes&lt;br /&gt;
&lt;br /&gt;
Upon completion the new image is available at &amp;lt;tt&amp;gt;build/output&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Because several build tools, olpc-os-builder, imgcreate and yum, are nested, error output could be misleading or obscure. Before digging into code, you please ask on IRC in case someone has already seen the same problem.&lt;br /&gt;
&lt;br /&gt;
== Publishing the images ==&lt;br /&gt;
&lt;br /&gt;
Please do not publish signed builds unless they implement the [http://wiki.laptop.org/go/Antitheft_HowTo OLPC anti-theft system].&lt;br /&gt;
&lt;br /&gt;
== Customizing your build ==&lt;br /&gt;
&lt;br /&gt;
olpc-os-builder is documented at&lt;br /&gt;
[http://git.sugarlabs.org/projects/dextrose/repos/mainline/trees/master/doc/README README]&lt;br /&gt;
in the olpc-os-builder tree. The modules are documented in &amp;lt;tt&amp;gt;README&amp;lt;/tt&amp;gt; files in the&lt;br /&gt;
[http://git.sugarlabs.org/projects/dextrose/repos/mainline/trees/master/modules modules] directory.&lt;br /&gt;
&lt;br /&gt;
=== Upstream Code ===&lt;br /&gt;
&lt;br /&gt;
Dextrose is based on upstream olpc code located at dev.laptop.org.&lt;br /&gt;
&lt;br /&gt;
 git remote add olpc git://dev.laptop.org/projects/olpc-os-builder&lt;br /&gt;
 git fetch olpc&lt;br /&gt;
 git log olpc/master&lt;br /&gt;
&lt;br /&gt;
=== Customizing the core RPMs ===&lt;br /&gt;
&lt;br /&gt;
* Go to the &amp;lt;tt&amp;gt;rpms/PACKAGENAME&amp;lt;/tt&amp;gt; in the dextrose tree&lt;br /&gt;
&lt;br /&gt;
* Edit the spec file. Typically this involves adding a new patch, which is done by adding a &amp;lt;tt&amp;gt;PatchNN:&amp;lt;/tt&amp;gt; tag and a corresponding &amp;lt;tt&amp;gt;%patchNN&amp;lt;/tt&amp;gt; rule in &amp;lt;tt&amp;gt;%setup&amp;lt;/tt&amp;gt;. Some of the intricacies of RPM spec files are unveiled in the [http://fedoraproject.org/wiki/Packaging/Guidelines Fedora Packaging Guidelines].&lt;br /&gt;
&lt;br /&gt;
* Increase the release number after each change.&lt;br /&gt;
&lt;br /&gt;
=== building the Custom RPM ===&lt;br /&gt;
&lt;br /&gt;
If you have a Fedora 11 i386 system, just type:&lt;br /&gt;
&lt;br /&gt;
  make i586&lt;br /&gt;
&lt;br /&gt;
Otherwise, you need to build in a [http://fedoraproject.org/wiki/Projects/Mock mock] chroot:&lt;br /&gt;
&lt;br /&gt;
  make srpm&lt;br /&gt;
  sudo mock -r fedora-11-i386 --resultdir=. --rebuild mypackage.src.rpm&lt;br /&gt;
&lt;br /&gt;
=== Uploading the Custom RPM ===&lt;br /&gt;
&lt;br /&gt;
* Upload rpm to a yum repository and add it to the ini file used by the OLPC OS builder.&lt;br /&gt;
&lt;br /&gt;
* To automate this step, we have a rule &amp;lt;tt&amp;gt;make uploadrpm&amp;lt;/tt&amp;gt; which points at the Dextrose repository. Edit &amp;lt;tt&amp;gt;rpms/common/Makefile.common&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;rpms/common/uploadrpm&amp;lt;/tt&amp;gt; to retarget this rule to your repository.&lt;br /&gt;
&lt;br /&gt;
=== Building custom kernels ===&lt;br /&gt;
&lt;br /&gt;
 $ git clone http://dev.laptop.org/git/olpc-2.6/&lt;br /&gt;
 $ cd olpc-2.6&lt;br /&gt;
 $ setarch i386 make ARCH=i386 xo_1-kernel-rpm&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
&lt;br /&gt;
* [http://wiki.sugarlabs.org/go/Development_Team/Jhbuild Sugar-jhbuild] - The Sugar Labs build system.&lt;br /&gt;
&lt;br /&gt;
* [http://www.rpm.org/wiki/Docs Rpm] - The Redhat package manager.&lt;br /&gt;
&lt;br /&gt;
* [http://fedoraproject.org/wiki/Packaging/Guidelines Fedora packaging] - Fedora packaging workflow and conventions.&lt;br /&gt;
&lt;br /&gt;
* [http://createrepo.baseurl.org/] - The yum package repositories builder.&lt;br /&gt;
&lt;br /&gt;
* [http://activities.sugarlabs.org] - The Sugar Labs activities library.&lt;br /&gt;
&lt;br /&gt;
* General understanding of the Linux system plumbing infrastructure: [http://www.kernel.org/ kernel],&lt;br /&gt;
[http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html udev], [http://www.freedesktop.org/wiki/Software/dbus dbus], [http://www.freedesktop.org/wiki/Software/DeviceKit DeviceKit], [http://www.freedesktop.org/wiki/NetworkManager NetworkManager],&lt;br /&gt;
[http://www.x.org/wiki/ Xorg]...&lt;br /&gt;
&lt;br /&gt;
* Flashing laptops and debugging any problems&lt;br /&gt;
&lt;br /&gt;
* Interaction with the Sugar and OLPC community to solve issues and minimize our divergence from the official builds.&lt;/div&gt;</summary>
		<author><name>Mk8</name></author>
	</entry>
	<entry>
		<id>https://wiki.sugarlabs.org/index.php?title=Mono&amp;diff=12847</id>
		<title>Mono</title>
		<link rel="alternate" type="text/html" href="https://wiki.sugarlabs.org/index.php?title=Mono&amp;diff=12847"/>
		<updated>2008-12-08T10:26:13Z</updated>

		<summary type="html">&lt;p&gt;Mk8: New page: {{Developers}} {{Stub}}  Sugar activities are usually written in Python using the  Python Activity API. This page documents how it is possible to use Mono to write a Suga...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Developers}}&lt;br /&gt;
{{Stub}}&lt;br /&gt;
&lt;br /&gt;
Sugar activities are usually written in Python using the  [[API_Reference|Python Activity API]]. This page documents how it is possible to use Mono to write a Sugar activity. With Mono, you can use any underlying language like C# or Boo.&lt;br /&gt;
&lt;br /&gt;
=Overview=&lt;br /&gt;
&lt;br /&gt;
=XO Bundle and Mono Bundle=&lt;br /&gt;
To write an OLPC Mono activity, you need to prepare a .xo [[Bundle]] including all required libraries. This is necessary because the Mono runtime is not officially supported by the OS images.&lt;br /&gt;
&lt;br /&gt;
If you use Mono, you know that the C# compiler does not traslate the source to machine code, but to an IL (Intermediate Language) that requires a runtime to be executed. Since you don&#039;t have the runtime installed on the XO, you need to create a Mono bundle so the runtime is packed with the executable.&lt;br /&gt;
&lt;br /&gt;
To do this, you need to have the program already in binary format and use the mkbundle2 utility to create the stand-alone application.&lt;br /&gt;
&lt;br /&gt;
 mkbundle2 --config /etc/mono/config --deps --static -o MonkeysMemory.exe monkeysmemory.exe&lt;br /&gt;
&lt;br /&gt;
In this example &amp;quot;monkeysmemory.exe&amp;quot; is the original IL binary file, while &amp;quot;MonkeysMemory.exe&amp;quot; is the binary file that can be run without runtime installed.&lt;br /&gt;
&lt;br /&gt;
Normally, --static flag means that LGPL code is linked statically with your application.&lt;br /&gt;
A special exception is made for OLPC users where the LGPL restrictions does not apply when you create activities.&lt;br /&gt;
&lt;br /&gt;
In your bundle you need to put some glue shared libraries that are used by the Mono runtime like this:&lt;br /&gt;
&lt;br /&gt;
* libgdksharpglue-2.so&lt;br /&gt;
* libgladesharpglue-2.so&lt;br /&gt;
* libglibsharpglue-2.so&lt;br /&gt;
* libgtksharpglue-2.so&lt;br /&gt;
* libMonoPosixHelper.so&lt;br /&gt;
* libpangosharpglue-2.so&lt;br /&gt;
* uiX11Util.so&lt;br /&gt;
&lt;br /&gt;
All these files (except uiX11Util.so) are taken from mono environment. The last one (uiX11Util.so) is&lt;br /&gt;
OLPC specific and allows to setup some X11 atoms needed by the Sugar interface.&lt;br /&gt;
These files are placed in the bin directory of the activity.&lt;br /&gt;
&lt;br /&gt;
=How to run a Mono activity=&lt;br /&gt;
I suppose that you are able to install an activity on the OLPC, but how to create a standard activity bundle?&lt;br /&gt;
You can find all documentation you need about the contents of a XO Bundle file [[Bundle]] but here give a look inside the activity luncher script.&lt;br /&gt;
&lt;br /&gt;
This example of activity launcher is taken from the e-toys launcher with some little adjustment and is placed in bin directory.&lt;br /&gt;
The name of this script is specify in the &#039;&#039;activity-info&#039;&#039; file:&lt;br /&gt;
&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 # Author: Torello Querci&lt;br /&gt;
 # Original Author: Bert Freudenberg&lt;br /&gt;
 # Purpose: Run binary application. In this case Monkey&#039;s Memory&lt;br /&gt;
 #&lt;br /&gt;
 # This version of etoys-activity is called only under new Sugar&lt;br /&gt;
 # (Joyride/Update.1). There is another one in the bundle&#039;s root&lt;br /&gt;
 # directory called under old Sugar which was pre-installed on the&lt;br /&gt;
 # first mass-produced machines (Trial-3/Ship.1).&lt;br /&gt;
 echo &amp;quot;$0&amp;quot; &amp;quot;$@&amp;quot;&lt;br /&gt;
 echo&lt;br /&gt;
 &lt;br /&gt;
 # arguments are unordered, have to loop&lt;br /&gt;
 args=&amp;quot;&amp;quot;&lt;br /&gt;
 while [ -n &amp;quot;$2&amp;quot; ] ; do&lt;br /&gt;
     case &amp;quot;$1&amp;quot; in&lt;br /&gt;
         -b | --bundle-id)   bundle_id=&amp;quot;$2&amp;quot;   ; args=&amp;quot;$args BUNDLE_ID $2&amp;quot; ;;&lt;br /&gt;
         -a | --activity-id) activity_id=&amp;quot;$2&amp;quot; ; args=&amp;quot;$args ACTIVITY_ID $2&amp;quot;;;&lt;br /&gt;
         -o | --object-id)   object_id=&amp;quot;$2&amp;quot;   ; args=&amp;quot;$args OBJECT_ID $2&amp;quot;;;&lt;br /&gt;
         -u | --uri)         uri=&amp;quot;$2&amp;quot;         ; args=&amp;quot;$args URI $2&amp;quot;;;&lt;br /&gt;
         *) echo unknown argument $1 $2 ;;&lt;br /&gt;
     esac&lt;br /&gt;
     shift;shift&lt;br /&gt;
 done&lt;br /&gt;
 &lt;br /&gt;
 # really need bundle id and activity id&lt;br /&gt;
 if [ -z &amp;quot;$bundle_id&amp;quot; -o -z &amp;quot;$activity_id&amp;quot; ] ; then&lt;br /&gt;
   echo ERROR: bundle-id and activity-id arguments required&lt;br /&gt;
   echo Aborting&lt;br /&gt;
   exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
 # some debug output&lt;br /&gt;
 echo launching $bundle_id instance $activity_id&lt;br /&gt;
 [ -n &amp;quot;$object_id&amp;quot;   ] &amp;amp;&amp;amp; echo with journal obj $object_id&lt;br /&gt;
 [ -n &amp;quot;$uri&amp;quot;         ] &amp;amp;&amp;amp; echo loading uri $uri&lt;br /&gt;
 echo&lt;br /&gt;
 &lt;br /&gt;
 export SUGAR_BUNDLE_PATH=`dirname $0`&lt;br /&gt;
 export PATH=$SUGAR_BUNDLE_PATH:$PATH&lt;br /&gt;
 &lt;br /&gt;
 cd $SUGAR_BUNDLE_PATH/..&lt;br /&gt;
 export LD_LIBRARY_PATH=$SUGAR_BUNDLE_PATH:$LD_LIBRARY_PATH&lt;br /&gt;
 &lt;br /&gt;
 # Try to setup the SHARED_DIR&lt;br /&gt;
 export MONO_SHARED_DIR=$TMPDIR&lt;br /&gt;
 &lt;br /&gt;
 # now run the application&lt;br /&gt;
 exec MonkeysMemory.exe \&lt;br /&gt;
     -sugarBundleId $bundle_id \&lt;br /&gt;
     -sugarActivityId $activity_id \&lt;br /&gt;
     $args &amp;lt; /dev/null &amp;gt; /dev/null&lt;br /&gt;
&lt;br /&gt;
If you look inside the code script you can find some specific instruction:&lt;br /&gt;
* the home directory is changed from the internal bin directory to the parent one. This is not mandatory but is useful for me;&lt;br /&gt;
* it is setup the LD_LIBRARY_PATH environment variable. This is needed because the application need to find the specific shared object;&lt;br /&gt;
* it is setup the MONO_SHARED_DIR non-system environment variable. This is needed because Mono normally use a special shared internal repository to track the state of mutex across multiple process and this repository is written on /tmp. Since the normal /tmp directory is not writeble from the application in the OLPC security schema, is necessary to change the default path used to store this repository.&lt;br /&gt;
&lt;br /&gt;
Obviously MonkeysMemory.exe is a sample activity name and is not necessary that the application have the .exe suffix because is e normal linux application.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note: the script is changed from previous version because Rainbow isolation subsystem now not create for the process the the stdin and stdout handles. This is not compatibile with some version of mono runtime.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Interfacing with the native subsystem =&lt;br /&gt;
&lt;br /&gt;
== Creating a new application ==&lt;br /&gt;
&lt;br /&gt;
To create a sugarized application with Mono you can use the Sugar.Window class in place of the common Gtk.Window.&lt;br /&gt;
This class inherits from Gtk.Window and adds all the code necessary to integrate with Sugar&#039;s activity interface.&lt;br /&gt;
The constructor of this class expects two parameters that were passed by the startup script.  Therefore, your Main function needs to parse its command-line arguments to isolate:&lt;br /&gt;
* activityId&lt;br /&gt;
* bundleId&lt;br /&gt;
The Sugar.Window class adds a new event, &#039;&#039;&#039;SetActiveEvent&#039;&#039;&#039;, generated when Sugar switches between zoom levels.&lt;br /&gt;
&lt;br /&gt;
== Sugarizing an existing application ==&lt;br /&gt;
&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
= Example Activity written in Mono =&lt;br /&gt;
&lt;br /&gt;
You can find [http://mk8.codewiz.org/olpc/MonkeysMemory-13.xo a sample activity] written using Mono. [[MonkeysMemory | Here]] you can find the specific page about this activity.&lt;br /&gt;
&lt;br /&gt;
= Assembly dependency =&lt;br /&gt;
To write or migrate your application to OLPC activity you need to use a specific assembly that manager the DBus event and the X property needed to Sugar environment. This assembly use the NDesk.DBus one to manage the DBus message. You can find the NDesk.DBus assembly in your distribution or from the source [http://www.ndesk.org/DBusSharp here].&lt;br /&gt;
&lt;br /&gt;
The source code of sugar assembly can be found [http://mk8.codewiz.org/wiki/sugar-0.1.tgz here].&lt;/div&gt;</summary>
		<author><name>Mk8</name></author>
	</entry>
</feed>