Emulating the XO: Difference between revisions

From OLPC
Jump to navigation Jump to search
(→‎Quick Start for Developers: fix path name (~olpc/.sugar/default/config))
No edit summary
 
(134 intermediate revisions by 43 users not shown)
Line 1: Line 1:
{{translations}}
{{translations}}
{{emulation-nav}}
{{ Latest Releases | livecd = inline | devel = inline | extra }}


In the past, OLPC produced alternative software images which could be run in emulators such as QEMU and VMware. This meant that development and testing could happen to a limited extent without requiring an XO laptop.
[[Image:AP1_39.jpg|thumb|laptop-in-laptop]]


'''In 2013, please see Tom Gilliard's many [http://wiki.sugarlabs.org/go/Sugar_Creation_Kit virtual machine images ready-to-go].'''
== Quick Start - [[LiveCd|LiveCD]] ==


Note, XOs are readily available to genuine volunteer contributors through the [[Contributors program]].
For many, the [[LiveCd|LiveCD]] is the easiest way to try [[Sugar]]. It's easy to do, but your work is lost when you reboot.


[http://sugarlabs.org Sugar], the unique user interface of the XO laptops, is also distributed as a generic software project and can be developed and tested on "regular" computers as well as XOs. See [http://wiki.sugarlabs.org/go/Downloads Sugar Labs Downloads] for the full range of options, such as [http://wiki.sugarlabs.org/go/Sugar_on_a_Stick Sugar on a Stick].
As of July 2007, ''the Live CD hasn't been updated in more than 3 months''. The software has advanced greatly during that time,
so it's not clear the Live CD is of much use until it gets updated.


For emulation of extremely old builds, you may be able to come across "ext3 images" on some corners of http://download.laptop.org and http://xs-dev.laptop.org/~cscott/olpc/streams/ which can be loaded into emulators. You are unlikely to find support for them!
== Quick Start - [[Emulating the XO/Quick Start|Emulation]] ==

'''[[Emulating the XO/Quick Start|Emulation]]''' is the other way to try [[Sugar]]. It can be harder to set up,, but work is preserved.
:Sound in [[TamTam]] may not be working at the moment. [[User:MitchellNCharity|MitchellNCharity]] 13:16, 5 June 2007 (EDT)

== Quick Start for Developers ==
Developing on emulation is one alternative for developing [[Activities]]. (To work on [[Sugar]] itself, see [[Setting Up a Sugar Development Environment on *IX OSes]].)

Get [http://olpc.download.redhat.com/olpc/streams/development/LATEST/devel_ext3/olpc-redhat-stream-development-devel_ext3.img.bz2 the latest image]
from [http://olpc.download.redhat.com/olpc/streams/development/LATEST/devel_ext3/ here]. ''(add link to tinderbox)''
Install QEMU and kernel acceleration as described in [[Emulating the XO/Quick Start]]. See the [[/Help_and_tips]] "Development" section.

[http://olpc.download.redhat.com/olpc/streams/development/build505-20070712_0335/devel_ext3/ 505] is the most recent build known to work. Builds after 541 run, but collaboration is broken (you can't see other laptops).<br/>
Many builds between 541 and 505, including 531, 529, and 525, didn't boot. However, some of the later 50x may work.

:Actually build [http://olpc.download.redhat.com/olpc/streams/development/build542/devel_ext3/ 542], the Trial 2 build, introduced a "feature": the configuration is no longer hardcoded to use the server olpc.collabora.co.uk, and has no server prepopulated. You can set the server yourself by editing ''~olpc/.sugar/default/config'' and setting ''server = olpc.collabora.co.uk'' and restarting. This should mean that 542 is the preferred image for developing with, since 505 and other 50x are quite old. --[[User:Morgs|morgs]] 03:54, 21 August 2007 (EDT)

== Overview ==

One way to run oplc software is using an emulator on your pc. See [[Getting started programming]] for other options.

Note '''[[:Category:Emulation]]''' and '''[[Emulating the XO/Help and tips|Help and tips]]'''.

For play, you can use [[LiveCd]] or [[Emulating the XO/Quick Start|Quick Start]].

For development, you can use [[LiveCd]], or qemu (as in quick start, but with a different image), or perhaps one of the [[Developer Images]] other than the LiveCd. An alternate approach is to attempt [[:Category:Installing_Sugar|installing sugar]]. See [[Getting started programming]] for a comparison.

A common development approach is to use [[QEMU]] with kqemu acceleration. See [[Emulating the XO/Quick Start|Quick Start]] for the basics.
Though for development, we will use a different .img, one with a few extra utility programs. See [[OS images]], including '''[[OS_images#Latest_Stable_Build |latest stable build]]'''.

Instead of qemu, you can run [[Emulating the XO/UsingVMware|VMware]], and there are additional options on a [[Emulating the XO/Mac|Mac]].

Please report your experiences in [[User Feedback on Images]]. There is a [[Virtualization Common Room]].

There are [[Emulating the XO/Limitations of XO disk images|limitations with XO disk images]].

The LATEST-STABLE-BUILD versus LATEST build distinction is mostly of interest to people running on actual XO's. In emulation, developers should usually use LATEST. And when STABLE is old, non-developers probably should too.

== Comparison of alternatives ==

An OLPC laptop is custom hardware, running a stripped-down Red Hat linux, running [[Sugar]]. But what if you don't have a real olpc laptop? There are a several options, which can each be used in a couple of ways.

=== recommendations ===
{| border=1 cellspacing=0
|- style="background:lightgray; "
! platform !! purpose !! recommendation
|-
| Windows || development || emulated xo disk image; or emulated Ubuntu with sugar-jhbuild; (or develoepr CD or LiveCD)?. (''need your reports'')
|-
| Mac || development || emulated xo disk image; or emulated Ubuntu with sugar-jhbuild; (or developer CD or LiveCD)?. (''need your reports'')
|-
| Mac with Parallels || development || install Ubuntu 32-bit, and [[Sugar on Ubuntu Linux]]. See [[/Mac]].
|-
| Ubuntu 32-bit || development || [[Sugar with sugar-jhbuild]] and [[Sugar on Ubuntu Linux]]
|-
| 32-bit linux || development || [[Sugar with sugar-jhbuild]]
|-
| 64-bit linux || development || xo disk images under qemu; or [[LiveCd]] once it gets updated (currently it's April)
|}

:I don't really believe the development option of Windows/Mac developer/live CD. I've not yet heard of it actually being used. They are months out of date (April). But [[User:Mcfletch|Mcfletch]] said (in May) it's an option, so I added it. [[User:MitchellNCharity|MitchellNCharity]] 09:19, 23 June 2007 (EDT)
[[User:Mcfletch|Mcfletch]] It's probably no longer an option, Red Hat seems to have stopped releasing them. Even the developer's CDs are getting too old to be usable.

=== background ===
{| border=1 cellspacing=0
|- style="background:lightgray; "
! option
! updated !! sound? !! camera? !! library? !! etoys? !! R/W? !! development software? !! net? !! comments
|-
| [[:Category:Installing Sugar|Installing Sugar]]
| continuous || yes || yes? || yes? || yes
| yes || your own || yes
| On some platforms, it takes time and space (hours and ~3GB), but "just works". On others, it is quite difficult to install.
|-
| [[:Category:Installing Sugar|Installing Sugar]], on a virtual 32-bit Ubuntu, running in an emulator (qemu, parallels, or vmware)
|-
| [[LiveCd]]
| April || yes(boot) yes?(qemu) || yes?(boot) no(qemu) || no || yes
| no || toolchain, Gnome || yes?
| Alternative Quick Start. Can both be booted from, and used in qemu. Problems: A.

|-
| colspan=10 style="background:lightgray; " | [[OS images|XO disk images]]:

|-
| colspan=10 | LATEST-STABLE-BUILD <span style="font-size:80%; "><tt>http://olpc.download.redhat.com/olpc/streams/development/LATEST-STABLE-BUILD/</tt></span>

|-
| ...development-ext3.img
| ~monthly || yes/B || no || yes || yes
| yes || no || after config
| Quick Start for getting a look at Sugar.

|-
| ...development-devel_ext3.img
| ~monthly || yes/B || no || no || yes
| yes || a little || after config

|-
| colspan=10 | LATEST <span style="font-size:80%; "><tt>http://olpc.download.redhat.com/olpc/streams/development/LATEST/</tt></span>

|-
| ...development-ext3.img
| ~daily || yes/B || no || yes || yes
| yes || no || after config

|-
| [http://olpc.download.redhat.com/olpc/streams/development/LATEST/devel_ext3/olpc-redhat-stream-development-devel_ext3.img.bz2 ...development-devel_ext3.img]
| ~daily || yes/B || no || no || yes
| yes || a little || after config
| Good for new developers (requires some command-line comfort).

|-
| colspan=10 style="background:lightgray; " | OTHER

|-
| [[Developer Images#Big Fedora Core 6 Build|FC6+Sugar]]
| April || yes? || ? || ? || no

| yes || Full Fedora Softare Dev. || yes
| 6GB (April version: no etoys)

|}
Key:
:library: A library of sample content is included (english version). Ie, pretty text to web browse without having to get network.
:R/W (writable): With an .img, you can save things between sessions. With a .iso, your environment is the same each time you start.
:development software: are development tools included?
:Net (network): does the network "just work" or "manual" steps are required?

Problems:
:A: LiveCd (April) on fc6 x86_64, kernel panics under kqemu. A squashfs problem.
:B: Tam Tam is silent (though EToys makes noise). Cause unknown.

Notes:
*re "does sugar-jhbuild support camera/mic?": "yes, if the camera uses v4l2 and 640x480, I'd suspect so." Can someone confirm this? (#olpc, now) [[User:MitchellNCharity|MitchellNCharity]] 00:16, 2 June 2007 (EDT)

Doables:
*Remove LiveCd's "?" above.
*Find out what's going on with Tam Tam sound. It would be nice for the xo disk images to all be sound-yes.
*Add a microphone column? Reconsolidate sound/camera/mic into a H/W column?

== Example step-by-step instructions ==

Here, in one place, are assembled all the steps to get you to a working
emulated XO. Assuming you are running on linux, and have already
installed qemu and kqemu.

The following will ''not'' work on your virtual xo: sound, camera. The first because no one has gotten around to figuring out why it isn't working[http://dev.laptop.org/ticket/1978]. The second because qemu doesn't yet support them.

Go to
http://olpc.download.redhat.com/olpc/streams/development/LATEST/devel_ext3/
and obtain the numbered -devel_ext3.img.bz2 and its md5. For this example I used build 485.

md5sum -c olpc-redhat-stream-development-build-485-20070703_0249-devel_ext3.img.bz2.md5
bzcat olpc-redhat-stream-development-build-485-20070703_0249-devel_ext3.img.bz2 > xo-485a.img

The resulting file is 1 GB.

export PORT=2221
qemu-system-x86_64 -soundhw es1370 -serial `tty` -kernel-kqemu -redir tcp:$PORT::22 -hda xo-485a.img
Unless you have a x86_64 cpu, use <tt>qemu</tt> instead of <tt>qemu-system-x86_64</tt>.

The screen will very briefly be black, and then show the blue "GNU
GRUB" screen. If it stays black, that's a qemu bug. Kill qemu and try again.

The boot messages will scroll by, and you should eventually see the normal XO first-time login. We'll save that for later.

In the window where you started qemu, you should now see a login: prompt.

# Enter <tt>root</tt>
# Then:
/etc/rc5.d/S98NetworkManager stop
mv /etc/rc3.d/S98NetworkManager /etc/rc3.d/DISABLED-S98NetworkManager
mv /etc/rc5.d/S98NetworkManager /etc/rc5.d/DISABLED-S98NetworkManager
echo ifup eth0 >> /etc/rc.local
ifup eth0
killall X

Killing X should restart sugar.

If you want to enter a name with diacritics, you need to wait for X to restart, and then do:
su olpc -c"DISPLAY=:0 xmodmap -e 'keycode 77 = Multi_key'"
This sets up Num_lock as Multi_key. Unfortunately, the next time X is
restarted, you will lose it. A better solution is needed.

At this point you could just proceed to use your new XO. However, the screen resolution is wrong (1024x768). So for development, or to get a more accurate feel for how things really look, some extra steps are required.

Once you reach the main sugar screen, you should check the Neighborhood view (F1). If you can't see other people, either the we are having problems with the presence server, you are behind an unusually picky firewall, or networking on qemu is broken again in the build number you are using. (Remember that ping doesn't work inside of qemu).

While this next step is not strictly required, it will enable you to use ssh and scp, which can be handy to move stuff back and forth between your host and xo.

Still as root on the xo,

1. Change the root password.
passwd
Don't worry if it says something like "BAD PASSWORD: ", and complains about the password you picked. It will still work.

2. Change the olpc password.
passwd olpc

Now you can use ssh and scp.


The current released version of QEMU doesn't support 1200x900, so we use a Xephyr remote X server. Each time you boot the xo, if you want 1200x900, you'll need to do these next steps again, except for the ones marked "(First time only)".

1. Still as root on the xo:
init 3
sleep 5
ifup eth0
su olpc
grep export /usr/bin/sugar > ~/env
source ~/env

If the <tt>ifup eth0</tt> fails with an "already running" message, that's ok. Perhaps it is no longer needed.

2. Back on the host, prepare Xephyr (First time only)
mcookie > xephyr-cookie
export COOKIE=`cat xephyr-cookie`
rm -f xephyr-xauth; echo "add :1 . $COOKIE" | xauth -f xephyr-xauth
echo $COOKIE

3. On the xo, still as "su olpc", record the cookie: (First time only)
echo "add 10.0.2.2:1 . " PUT-THE-COOKIE-HERE | xauth

4. Back on the host, start a Xephyr:
Xephyr :1 -auth xephyr-xauth -reset -screen 1200x900x16 -dpi 200
You will probably want to do this in its own window, as it periodically dies and needs to be restarted.

5. On the xo, still as "su olpc", start sugar:
DISPLAY=10.0.2.2:1 sugar

Actually, I usually ssh in from the host, and run sugar that way:

a. On the host,
ssh -o NoHostAuthenticationForLocalhost=yes -p 2222 olpc@localhost
b. in the resulting shell,
source ~/env
export DISPLAY=10.0.2.2:1
sugar
You may also want to run
xmodmap -e 'keycode 77 = Multi_key'
to be able to enter diacritics with the Num_lock key.
But I find doing it first thing tends to kill Xephyr. :(

You should now see the XO first-login screen in correct resolution.
You can use Num_lock to enter diacritics. Congratulations. Sorry it
was so much bother.


To run multiple xo's (to play with collaboration, for instance), you
can repeat the above steps. Create a xo-485b.img, and use a different
PORT number (like 2222). If you are using Xephyr, start a second
Xephyr, which will be 10.0.2.2:'''2''', use that instead of ...:1 in
the instructions. You should now be able to see yourself, and
collaborate in Write.

The following will save you having to periodically type your xo password, but is optional, and can just as easily be done later.

Back on the host,

1. Create an ssh key if you don't already have one. See [[/Help_and_tips#SSH into qemu, using a key]].

2. Copy it to the xo,
scp -o NoHostAuthenticationForLocalhost=yes -P $PORT ~/.ssh/id_rsa.pub root@localhost:~/

3. On the xo, as root, spread the key around:
mkdir ~root/.ssh
mkdir ~olpc/.ssh
cat ~root/id_rsa.pub >> ~root/.ssh/authorized_keys
cat ~root/id_rsa.pub >> ~olpc/.ssh/authorized_keys

You can now ssh and scp without retyping your password.
=Links=
*[http://www.ibm.com/developerworks/linux/library/l-sugar-olpc/index.html Tutorial] Written by IBM on how to get this working.


[[Category:OS]]
[[Category:OS]]

Latest revision as of 16:26, 30 July 2013

  english | español日本語한국어portuguêsрусский HowTo [ID# 290021]  +/-  
modify 

In the past, OLPC produced alternative software images which could be run in emulators such as QEMU and VMware. This meant that development and testing could happen to a limited extent without requiring an XO laptop.

In 2013, please see Tom Gilliard's many virtual machine images ready-to-go.

Note, XOs are readily available to genuine volunteer contributors through the Contributors program.

Sugar, the unique user interface of the XO laptops, is also distributed as a generic software project and can be developed and tested on "regular" computers as well as XOs. See Sugar Labs Downloads for the full range of options, such as Sugar on a Stick.

For emulation of extremely old builds, you may be able to come across "ext3 images" on some corners of http://download.laptop.org and http://xs-dev.laptop.org/~cscott/olpc/streams/ which can be loaded into emulators. You are unlikely to find support for them!