Checkers on the OLPC

First, is there a checkers Activity? Looking at the Activities page on the OLPC wiki suggests no.   However, with the underlying Linux system, it is possible to configure an application for Linux, and then Sugarize the application to fit on the OLPC.

Where to go from here?  Well, the OLPC is not a terribly fast system.  But it is a vast improvement from systems of yesterday, my yesterday.  Earlier in life, our family computer was the well loved Commodore 64.  There was a treasure trove of games for it.

So, if you search for Commodore 64 and checkers, does anything come up?  Yes! So the trick will be to get VICE running on the OLPC using the Sugar interface.

Commodore 64 UI

The question is, are these games still relevant today?  I like to think that a better question is, are games today as relevant as the ones of yesterday?  Think about it – memory, CPU, and graphics were scarce then.  If you look at the quantity of C64 games, you’ll see that competition was fierce, even during the dawn of computing.  Play Loderunner or Jumpman on the C64 platform, and I assure you, you will be not want to stop.  This is where the pioneering innovation took place.

Build Process

The OLPC (-1) is a 32bit i586 machine, with a 400MHz CPU.  Selecting a build platform is important.  Since the G1G1 program was started in 2007, picking a distribution from around that time would be wise. To build VICE, we’ll use virtualization and Fedora 7 to create a compile host.

Fedora 7 Login

To compile VICE, we’ll use these options:

#!/bin/bash

LDFLAGS="-Wl,-rpath=/home/olpc/Activities/VICE.activity/lib"
export LDFLAGS

sh ./configure                                                          
        --prefix=/home/olpc/Activities/VICE.activity                    
        --enable-fullscreen

gmake

I came up with the above options after trying a few times.  The best place for the install is in /home/olpc.  Applications are called activities.  I put the rpath in place due to the fact we will probably need to add libraries.  After installing it (manually at first), I’ll see if the executable invokes:

[olpc@g1g1 ~]$ cd $HOME/Activities/VICE.activity/bin
[olpc@g1g1 bin]$ ldd x64 | grep "not found"
        libesd.so.0 => not found
        libungif.so.4 => not found
        libgif.so.4 => not found

So it looks as though we need to copy these files into our VICE library rpath.  Running the ldd command once more to check:

[olpc@g1g1 bin]$ ldd x64 | grep "not found"
        libaudiofile.so.0 => not found

So the libesd.so.0 file has a dependency too.  After copying the libaudiofile.so.0 library into the rpath, it comes back clean.

[olpc@g1g1 bin]$ ldd x64 | grep "not found"
[olpc@g1g1 bin]$

So now, our basic hierarchy looks like this:

[olpc@g1g1 bin]$ cd $HOME/Activities/VICE.activity
[olpc@g1g1 VICE.activity]$ ls -ald *
drwxrwxr-x 2 olpc olpc  4096 2010-09-08 14:48 bin
drwxrwxr-x 3 olpc olpc  4096 2010-09-08 14:30 lib
drwxrwxr-x 5 olpc olpc  4096 2010-09-05 13:47 share

For ease of development, I put the following Makefile in $HOME/Activities/VICE.activity:

[olpc@xo-14-64-13 VICE.activity]$ cat Makefile
ACTIVITY        :=      $(shell basename $(shell pwd) .activity)

all:
        rm -fv $(HOME)/$(ACTIVITY).xo MANIFEST
        find ./ | sed 's,^./,$(ACTIVITY).activity/,g' > MANIFEST
        cd $(HOME)/Activities && zip -9 -r $(HOME)/$(ACTIVITY).xo $(ACTIVITY).activity

So by typing “make” while in $HOME/Activities/VICE.activity, I can then expect an
XO activity in $HOME (in this case $HOME/VICE.xo). As you can see, it also creates a MANIFEST
file as well.

Henceforth, $HOME/Activities/VICE.activity is will now be referred to $SUGAR_BUNDLE_PATH. This variable is set to whatever the running Activity is. In $SUGAR_BUNDLE_PATH, we will need an activity/ directory containing the following files: activity.info and VICE.svg (an icon).

[olpc@g1g1 VICE.activity]$ export SUGAR_BUNDLE_PATH=$HOME/Activities/VICE.activity
[olpc@g1g1 VICE.activity]$ cat $SUGAR_BUNDLE_PATH/activity/activity.info 
[Activity]
name = VICE
activity_version = 1
host_version = 1
bundle_id = net.foundationlaboratories.olpc.VICE
icon = VICE
exec = bin/activity.sh

Obviously we’ll need a “bin/activity.sh” script as well.

[olpc@g1g1 VICE.activity]$ cat bin/activity.sh
#!/bin/bash
#
# Activity launcher for VICE.
#
# Variables and libsugarize.so are taken from the X-1 Activity.  Thank you 
# Bert Freudenberg for this wonderful activity:
#
#   http://wiki.laptop.org/go/X_Activity
#

PATH=${SUGAR_BUNDLE_PATH}/bin
export PATH

# pass activity options to libsugarize
while [ -n "$2" ] ; do
    case "$1" in
        -b | --bundle-id)     export SUGAR_BUNDLE_ID="$2" ;;
        -a | --activity-id)   export SUGAR_ACTIVITY_ID="$2" ;;
        -o | --object-id)     export SUGAR_OBJECT_ID="$2" ;;
        -u | --uri)           export SUGAR_URI="$2" ;;
        *) echo unknown argument $1 $2 ;;
    esac
    shift;shift
done

# set vars and dirs in case we run in jhbuild 
[ -z "$SUGAR_BUNDLE_PATH" ] 
    && export SUGAR_BUNDLE_PATH=`dirname $0|xargs dirname`
[ -z "$SUGAR_PROFILE" ] 
    && export SUGAR_PROFILE=default

cd "$SUGAR_BUNDLE_PATH"
umask 0002

# sugarize
export NET_WM_NAME="VICE C64 Emulator"
export LD_LIBRARY_PATH="$SUGAR_BUNDLE_PATH/lib"
export LD_PRELOAD="$SUGAR_BUNDLE_PATH/lib/libsugarize.so"

x64 -VICIIdsize $*

Comments are closed.