Olpc-xo-qemu

From OLPC
Jump to: navigation, search

http://dev.laptop.org/~mncharity/olpc_xo_qemu/ makes it easier to create and control QEMU emulated laptops. It can also control real XO's, with the same interface.

Status

Current status: not working. (2008 Q4)
Last image known to work: unknown
Dbarral reports 0.009 working with ship.2

Current issues:

  • Unreleased QEMU 0.9.2 is required by the current OLPC kernel. HEAD works.
  • olpc_xo_qemu-0.009 is disabled by a broken LATEST link on dev.laptop.org.
  • olpc_xo_qemu-0.009 can't find XAuthority files on current images.
  • The current (2008 Nov) version of gnome ssh key handling has a bug (pops up a passphrase request window for passphrase-less keys), which makes xo-qemu's ssh'ing painful.
  • Isn't 1200x900 by default, even though qemu now supports that.

Expectation management

This is/was one person's attempt to make OLPC emulation easily usable.

xo-qemu's purpose is to insulate you from difficulties. However, the difficulties still exist. OLPC institutional support for emulation has always been flakey. And xo-qemu needs to do various things (set up ssh keys, enable XTest, get X cookies) whose details repeatedly change.

So xo-qemu releases are only able to create emulated xo's from OLPC qemu images dating from around the same time. But once created, they should continue to work.

OLPC's qemu images have repeatedly ceased to be usable, often for months. Or to require unreleased SVN qemu.

Also, qemu-based emulation has always had limitations: no USB, no sound, no camera.

So... when it works, it's quite useful. But it often doesn't work, and always has limitations.

xo-qemu -help

xo-qemu is a script for downloading, managing, and running OLPC QEMU
disk images on linux.

The One Laptop Per Child (OLPC)<http://wiki.laptop.org/> project
creates a linux distribution for its laptop.  It is released as
numbered builds (ie, "versions"), in several streams (eg, separate
streams for developers and end users).  These builds are available in
several forms, one of which is a disk image that can be run on the
QEMU virtual machine.  This script makes it easier to obtain, manage,
alter, and run these disk images on linux.  It provides virtual,
slightly broken, emulated OLPC XO laptops.

--help 

        Shows this help.

--new-user 

        Checks that qemu and kqemu are working,
        and suggests how to get started.

--report 

        Summarizes the currently available streams and builds.

        (The report format is likely to change).

--get-build STREAM BUILD DIRECTORY

        Downloads STREAM's BUILD disk image into DIRECTORY.
        The build's devel_ext3/ .img.bz2 disk image is used.
        If there is already a copy of the image in DIRECTORY,
        it is not downloaded again.  
        The filename of the image in DIRECTORY is printed.

        BUILD can be "latest" instead of a number.

        Example:
        $ xo-qemu --get-build joyride latest builds/
        builds/olpc-redhat-stream-joyride-build-1418-20071213_1608-devel_ext3.img.bz2
        $ xo-qemu --get-build joyride 1418  builds/
        builds/olpc-redhat-stream-joyride-build-1418-20071213_1608-devel_ext3.img.bz2

--make-laptop LAPTOP DISK_IMAGE

        Creates a new laptop named LAPTOP, from a build DISK_IMAGE.

        A new directory named LAPTOP is created, and must not already exist.
        The DISK_IMAGE is copied into it.  Each laptop is about 1 GB.

        As part of setting up the laptop, qemu is automatically run,
        some configuration done, and then qemu is automatically shut down.
        No user action is needed.

        The LAPTOP/xo file is used to control it.

        Examples:
        $ xo-qemu --make-laptop laptops/one builds/olpc-redhat-stream-joyride-build-1418-20071213_1608-devel_ext3.img.bz2
        $ xo-qemu --make-laptop laptops/one `xo-qemu --get-build joyride latest builds/ |tail -1`
        And then:
        $ laptops/one on

--xo-api0 LAPTOP ACTION

        Controls the LAPTOP.  This is usually called indirectly
        using LAPTOP/xo ACTION.

        Examples:
        $ laptops/one/xo on
        $ laptops/one/xo off

  on 


  off 


  is-running 


  ssh [olpc|root] [COMMAND-LINE]


  scp [SCP_ARGS] FROM TO

        Copies FROM to TO, where both are either a local path,
        or [olpc|root]:path/on/the/laptop.

  env 

        Prints "LAPTOP=xxx DISPLAY=xxx XAUTHORITY=xxx".
        These environment variables let you run X windows programs
        on the laptop's X server, from the host.

        This is mostly used for automated testing.

        Examples:
        $ bash     # start up a new shell, since we're about to modifiy it
        $ export `laptops/one/xo env`
        $ xterm    # somewhat useless, but illustrates the concept.
        $ import screenshot_of_laptop.png

  do COMMAND [ARGS]

        Sets up the same environment variables as /xo env,
        and then runs COMMAND.
        If and environment variable XO_QEMU_DO_PATH is defined,
        it is used instead of PATH to find COMMAND.

        Examples:
        $ laptops/one/xo do xterm
        $ laptops/one/xo do sh -c 'echo $DISPLAY'

  xephyr on|off

        Switches between using the laptop's normal X server,
        and using an external Xephyr X server.

        The real OLPC laptop hardware has a 1200x900 display,
        Until qemu supports having a 1200x900 display (the release after 0.9.0),
        Xephyr can be used when one is needed.

        Example:
        $ laptops/one/xo on
        $ laptops/one/xo xephyr on

  sugar restart

        Restarts sugar.  This is needed after some configuration changes.

  mount [WHAT WHERE USER] | -u [WHERE]

        mount [WHAT WHERE USER]

        Mounts laptop directory WHAT on host directory WHERE,
        with the host user mapped to laptop USER olpc or root.

        If no arguments are given,
         / is mounted on LAPTOP/root with the user as root, and
         /home/olpc is mounted on LAPTOP/olpc with the user as olpc.

        mount -u WHERE

        Unmounts whatever is mounted on WHERE.
        Equivalent to "fusermount -u WHERE".

        If no WHERE is given, then LAPTOP/root and LAPTOP/olpc are unmounted.

        "/xo off" unmounts everything mounted.

        Example:
        $ laptops/one/xo on
        $ laptops/one/xo mount
        $ ls laptops/one/root
        activities  bin  boot  dev...
        $ ls -a laptops/one/olpc
        .AbiSuite .bash_history ... .sugar ...
        $ laptops/one/xo mount -u

--enlarge-disk-image IMAGE SIZE_MB

        Enlarges the LAPTOP's disk to MB megabytes.
        The laptop's disk is normally 1000 MB, with only 1/3 used.
        But when doing development, and installing lots of things like gcc,
        it sometimes helps to make it bigger.

--make-laptop-remote LAPTOP

        Like make-laptop, but for remote access to a real XO laptop.

        Example steps:

        (1) Create a remote access laptop:
          $ xo-qemu --make-laptop-remote laptops/two

        (2) Move the laptop to a usb drive.
          $ mv laptops/two /media/whatever/two
          $ sync

        (3) On the real XO laptop, run setup_real_xo_for_remote_access, as root.
        [olpc@xo-...]$ sudo /media/something/two/setup_real_xo_for_remote_access
        [olpc@xo-...]$ sync

        (4) Back on the host, move the laptop back from the usb drive.
          $ mv /media/whatever/two laptops/two
          $ sync

        The laptop should now work:
          $ laptops/two/xo ssh whoami

        When the real XO laptop gets a new ip address from dhcp,
        you tell the remote access laptop about it by:
          $ laptops/two/xo ip 192.whatever

  ip ADDRESS

        Set the IP address on a remote access laptop.

        It is an error to request this action on a QEMU laptop.

See also