Getting started programming
Developing for the OLPC
Thank you for considering working on the One Laptop Per Child project. This page tries to provide you with the answers you need to get started either by contributing to existing projects or starting your own.
Setting up a Development Environment
The OLPC's software environment is a heavily modified Fedora Core Linux system running a custom GUI shell (Sugar). To develop for the platform you will eventually need access to a platform which runs in a manner substantially similar to the OLPC environment. Luckily there are many available options.
Emulation (Recommended for New Developers)
By far the most time-efficient and effective way to start developing for the OLPC system is to download an operating system image that can be run in one of the popular emulation/virtualisation systems, such as Qemu, VMWare or Parallels. These images allow you to run a virtual OLPC-configured machine on your regular development workstation.
There are two major classes of images available, one group is as close as possible to the OLPC installation. These official images do not provide GUI IDEs or SVG graphics editors. They normally would be used either with command-line tools (e.g. VIM) or with an NFS (or similar) share to a workstation on which you will do your actual coding. As a result, the official images tend to involve either more Unix developer-toolchain familiarity or more setup in your development environment.
The second group of images are the Developer Images, which are intended to be used as virtual desktop machines. The images have far more software than is installed on the OLPC laptops. They resemble a developer's desktop machine which has been upgraded to support the Sugar environment. They tend to have GUI IDEs, full Gnome desktop installations and the like, which make it easy for developers to work entirely within the emulated environment.
Developers working on Developer Images should be sure to test their creations on real OLPC Laptops or official images in order to be sure that they do not have dependencies on software not available on the actual laptops.
Native Linux Installation
There are two major approaches to a native Linux installation of the OLPC Sugar system. In the first, you use the
sugar-jhbuild build-base
command to build a parallel set of the libraries required to run the OLPC software. This approach generally works reasonably well on most modern Linux distributions, though the build system (jhbuild) tends to be very fragile, so you may spend quite some time rebuilding and fixing errors to get a final working system.
In the second approach you update your Linux operating system to such a point that it resembles the OLPC environment. You then need only use the more fragile build system for a tiny fraction of the packages required. You should be aware that such upgrades often will require you to update well beyond the "stable" configurations for your Linux distribution, and as such may make your system unstable. As of 2007-04-08 only Fedora Core 6/7, Gentoo and Ubuntu Feisty Fawn are known to upgrade reasonably well.
Hardware Developer's Program
While there are only a small number of test units being produced, developers can submit proposals to receive one of those units for testing and development. XXX where did that page go?
Joining or Staring a Project
Communications Channels
Requests and Ideas for Projects
Existing Projects
Available Resources
Documentation
Tutorials
Frequently Referenced Documents
These documents are frequently referenced during the development process.
- Sugar Architecture covers Sugar APIs and specifications
- The Developer's Category collects everything in the wiki that's been tagged as pertaining to developers (it's a bit hard to navigate)
- Developers Program focuses on development for the core system, but with information useful for activity developers as well
- Software components is a somewhat old document describing the various pieces of software and libraries involved in the system.
- Sugar PyDoc just provides the raw API documentation, which is severely lacking in documentation strings (Good familiarisation project might be working with Marco to improve that situation)
- Hippo PyDoc again, just raw API documentation, needs lots of documentation effort
- Instructions on using the Sugar user interface
- Human interaction guidelines (HIG) for Sugar activities
- Tutorial to create a new activity
- Sugar Code Snippets
- Understanding sugar code provides an overview of how Sugar interacts with activities, including startup and shutdown, useful to understand the environment in which your activity will run
- Software projects discusses the various sub-projects, good place to go to find out where you may be needed XXX would be nice to have an area for advertising particular needs as well
- Bitfrost the security system which will control activities and their interaction with the system and other users
- Getting involved in OLPC - general guide to where help is needed, though written a while ago, before direct development was particularly easy (thus the emphasis on working on upstream projects AFAICS)
- Activity Bundles describes the packaging structure
Frequently Asked Questions
- What is needed?
- Software ideas describes application classes that are needed
- Software projects describes the currently active projects that may need help
- How do I do networking in Sugar?
- Internal (to other laptops)
- External (to the wider internet)
- Activity Sharing (session establishment)
- Otherwise general Python networking
- Twisted (will this be available on the images?)
- Asyncore
- PyRO (Python remote objects)
- XMLRPC/SOAP
- How do I create a persistent server/service?
- How do I register for start-time loading?
- Is there any dbus event service for loading only on response to messages? That is, not loading until there is an event of a given type, such as a presence event?
- How do I access the special hardware?
- Camera
- Have to script v4l2 via gstreamer to capture a single frame from the camera. See sugar/shell/intro/glive.py for sample code
- Camera-as-video-camera (v4l2?)
- Is a regular v4l2 device available via gstreamer (gst module)
- Directional pad/buttons
- Have their own X key names
- Currently 4-button set mapped to arrow (cursor) keys
- Two separate buttons mapped to ??? (pageup/pagedown)
- Touchpad
- Drawing pad (stylus pad)
- How to switch in/out of stylus mode?
- How to set interpretation parameters?
- Audio-port probe
- How to get access?
- What's going to come out when I get access (keeping in mind I (the developer) likely won't have the actual hardware available)
- Mode-switching code for the screen
- backlight on/off
- backlight brightness
- set all 8 (4 distinct) settings for MODE_MONO_LUMA, MODE_CSWIZZLE, MODE_COL_AA
- query, change, and restrict screen orientation
- drop to a lower resolution for performance or ease of porting, such as 600x450 or 400x300
- Camera
- How do I create my activity GUI?
- How does HippoCanvas work?
- Can I just use Cairo or GTK directly?
- How can a non-Python app fully interact with Sugar?
- At the moment it cannot. This appears to be an arbitrary restriction that can currently be "fixed" by creating a wrapper in Python. Basically Sugar is using custom dbus messages to communicate with a server that must be present for every activity. AFAICS there's no real reason to do that, as all that's communicated is "which bundle did we start", which Sugar knows before it starts the bundle.
- How flexible does the GUI need to be? (e.g. resize and rotate)
- How do I share code between activities?
- What's the best development approach:
- Write outside Sugar, finish and debug, then port?
- Write to Sugar, test and debug within the system?
- How do I package my activity?
- How do I work from an in-process activity (develop registration)?
- setup.py develop
- You can use sugar-activity to start the activity, but you have to manually close it (using the Sugar GUI: show the frame, then move to the activity icon on the top bar, hover for a second, then click close (yes, it's really that awkward))
- How do I produce a binary extension?
- How do I make my package available for users to download dynamically?
- How do I tell users about updates to the packages?
- How do I work from an in-process activity (develop registration)?
- How do I get access to user-generated content (share files between applications)?
- How do I test a Sugar activity?
- Start sugar, start a bash shell, run "sugar-jhbuild shell" to set up the sugar environment variables, then use "sugar-activity YourActivityName" to run the activity with output going to your local shell
- How do I debug a Sugar activity?
- How do I create an asymmetric application? (Publisher for others to consume)
Links
- The Sugar page has useful links for developing on the OLPC's software stack.
- Application Developers
Using your PC for development: the Software Development Kit
This collection of programs is designed to assist 3rd party developers begin work on software for the OLPC
Installation
NOTE: The following information is obsolete - Use [pilgrim] instead
Using Yum
$ su root # cd /etc/yum.repos.d # wget http://people.redhat.com/berrange/olpc/sdk/olpc-sdk.repo # yum install olpc-sdk
Or if RPMs are desired they can be downloaded from link RedHat
Set up
Work in Progress.
Images of the software on the OLPC
At this stage in development we have daily images that are automatically generated. They work most of the time but it's very possible that some times we get an image that won't boot or has some kind of startup problem. At some point in the not too distant future we'll have a list of "known good" images that have gone through some testing.
If you want to download a daily image, please visit the OLPC Software Testing page for details on how to use them.
Development Notes
Using the Classic Linux Environment on the OLPC
It's possible to install a classic Linux environment on the laptop. You might want to use this to do development or testing of the hardware. Note that this is very different than what will be on the laptop in the end.
Future Notes
- We should have a small development environment for you to use soon. While it's possible to use a Fedora Core Rawhide release to do development, you will want to make sure that your code works and compiles in a development environment that only contains the software that will be on the end laptop. This will be your final check before attempting to deploy software.
- We will have more information soon about Sugar and building activities in python. We've only now gotten to the point where the builds are usable and should build out some development documentation soon.
- Eventually some volunteers will flesh out the information on the OLPC Python Environment to help people set up development environments on their favorite OS.