Monday, January 14, 2008

OLPC Laptop in Ubuntu 7.10

This tutorial covers information on how to emulate XO on a typical Linux environment. I will be using Ubuntu Gutsy (7.10) and qemu for emulation.

First we need to get qemu.

sudo apt-get install qemu
sudo apt-get install kqemu-source
Then we need to prepare the module for using accelerated layer qemu (kqemu)
sudo module-assistant prepare
sudo module assistant auto-install kqemu
We make the udev rules so it automatically loads the module. Create the file /etc/udev/rules.d/60-kqemu.rules and write:
KERNEL=="kqemu", NAME="%k", GROUP="kqemu", MODE="0660"
appending a new line.

Add a new group and a new user:
sudo addgroup --system kqemu
sudo adduser $USER kqemu
    Login and logout for changes to take effect and then reload the udev daemon:
    sudo /etc/init.d/udev reload.
    Load the kqemu module itself:
    sudo update-modules
    sudo modprobe kqemu
    Now, get the XO image from the olpc site:

    and unpack it:
    bunzip2 olpc-redhat-stream-development-devel_ext3.img.bz2
    Now make your ram partition bigger
    sudo umount /dev/shm
    sudo mount -t tmpfs -o size=528m none /dev/shm
    And run it:
    qemu -m 512 -hda olpc-redhat-stream-development-devel_ext3.img

    1 comment:

    Anonymous said...

    For Ubuntu 7.04 and up (tested on Hardy 8.04), I have created a script that handles everything automaticaly (even downloading the image). Here it is

    ## olpc vm script for ubuntu (>= 7.04) by Yannis Tsopokis
    ## go here for more info:
    ## (soon there will be an olpc section there)
    [ -f olpc-redhat-stream-ship.2-build-659-20080229_1949-devel_ext3.img ] || wget $link && bunzip2 olpc-redhat-stream-ship.2-build-659-20080229_1949-devel_ext3.img.bz2
    dpkg --get-selections qemu 2>/dev/null | grep install || sudo apt-get install qemu
    dpkg --get-selections kqemu-common 2>/dev/null | grep install || sudo apt-get install kqemu-common
    dpkg --get-selections module-assistant 2>/dev/null | grep install || sudo apt-get install module-assistant
    sudo module-assistant auto-install kqemu
    sudo su -c "echo 'options kqemu major=0' > /etc/modprobe.d/kqemu"
    sudo su -c 'echo KERNEL==\"kqemu\", NAME=\"%k\", MODE=\"0666\" > /etc/udev/rules.d/60-kqemu.rules'
    sudo /sbin/modprobe kqemu major=0
    qemu -kernel-kqemu -m 256 -soundhw es1370 -serial `tty` -net user -net nic,model=rtl8139 -hda olpc-redhat-stream-ship.2-build-659-20080229_1949-devel_ext3.img

    create a file named and put the above inside it. then run "source" and it will do everything for you. it is tested with 32-bit systems and even handles kqemu kernel modules.