This document describes the steps needed to run Genode on the GTA01 platform using the OKL4 kernel version 2.1.1. To optimize the work flow during development, these steps could be automated using make or any scripting tool of your choice. This document describes the building blocks to do so.

Download and unpack OKL4 2.1.1-patch.9

OKL4 download location
http://wiki.ok-labs.com/downloads/release-2.1.1-patch.9/

After unpacking the archive, you will get a directory called okl4_2.1.1-patch.9/.

You will need to adapt the file platform/s3c2410/tools/machines.py to define the physical memory starting at 0x33000000. The actual memory starts at 0x30000000 but we want to load the boot image to a higher address to prevent conflicting physical addresses of the OKL4 kernel and the boot image loaded by Qemu. By changing the physical memory start to the higher value, the kernel will start at this address, leaving the lower addresses for the boot loader and the boot image.

Download the ARM tool chain

Tool chain-download location
http://www.ertos.nicta.com.au/downloads/tools/arm-linux-3.4.4.tar.gz

The tool chain should be installed to the /opt/nicta directory and the PATH variable of your shell must be updated to find the tools. For example, bash users can do:

export PATH=$PATH:/opt/nicta/tools/gcc-3.4.4-glibc-2.3.5/arm-linux/bin

Note that the setting of the PATH variable is only needed to build the OKL4 kernel. For building Genode, the tool chain is expected to reside under /opt/nicta/ by default.

Build the OKL4 kernel for ARM

Go to the okl4_2.1.1-patch.9/ directory and issue the following command to build the kernel and the l4test program for the GTA01 platform:

./tools/build.py project=l4test machine=gta01

The kernel binary will be created at build/pistachio/bin/kernel.

Compile Genode for GTA01

You can use the create_builddir tool, located at Genode's tool/builddir/ directory:

<genode-dir>/tool/builddir/create_builddir okl4_gta01 \
    GENODE_DIR=<genode-dir> \
    BUILD_DIR=<build-dir> \
    L4_DIR=<okl4-dir>

The <genode-dir> is the top-level Genode directory, <build-dir> is the build directory to be created, and <okl4-dir> is the path to your okl4_2.1.1-patch.9/ directory.

After having created the build directory, you can build Genode:

cd <build-dir>
make

In addition to the normal Genode components, a gta01 platform driver will be built. It is called gta01_drv and contains a simple frame-buffer and input driver. So you can use this driver as a replacement for vesa_drv and ps2_drv. Note that this driver is just a proof of concept to run Genode on Qemu-neo1973. You might use the file os/config/gta01 as a template for your GTA01-specific Genode config file.

Create a bootable image

For creating a bootable image from the OKL4 kernel, the Genode components, and the Genode config file, you can use elfweaver provided with the OKL4 distribution. First, it is a good idea to strip the binaries using arm-linux-strip. In the base-okl4/tool/ directory, you can find a template for an elfweaver config file called weaver_gta01.xml. After setting the kernel in the weaver_gta01.xml configuration file to <okl4-dir>/build/pistachio/bin/kernel, you can invoke elfweaver with the following arguments:

cd <build-dir>/bin
<okl4-dir>/tools/pyelf/elfweaver merge \
   --output=weaver.elf \
   <genode-dir>/base-okl4/tool/weaver_gta01.xml

In a second step, we need to convert weaver.elf to a boot image loadable by Qemu:

<okl4-dir>/tools/pyelf/elfweaver modify \
   -o image.boot weaver.elf \
   --physical_entry --physical

The resulting image.boot will be loaded as kernel into Qemu.

Using the Qemu-neo1973 emulator

Please revisit the following website for more detailed information about the Qemu-neo1973 project:

http://wiki.openmoko.org/wiki/Openmoko_under_QEMU

Check out and build the SVN version of Qemu-neo1973:

svn co https://svn.openmoko.org/trunk/src/host/qemu-neo1973
cd qemu-neo1973
./configure --target-list='arm-softmmu'
make

You will need a NAND flash with a boot loader, namely u-boot. The tools for generating such a boot flash are contained in the openmoko/ subdirectory of Qemu. However, you will need to tweak the configuration a bit by editing the openmoko/env file. The following declarations are known to work:

kernel_wildcard="uImage-2.6.22.5-moko11+svnr3238-r9-neo1973.bin"
rootfs_wildcard="openmoko-image-fic-gta01.jffs2"
uboot_wildcard="u-boot-gta01*.bin"
download_dir="http://downloads.openmoko.org/distro/obsolete-images/Om2007.11//images/neo1973/"

After setting up the tools configuration, you can download all the needed ingredients via:

./openmoko/download.sh

Configuring the boot flash

There is the flash configuration tool ./openmoko/flash.sh, which can be used to customize the downloaded boot loader. However, we should edit it a bit to make starting our boot image easier. It is a good idea to replace the setenv&nbsp;bootcmd with the following line:

setenv bootcmd 'setenv bootargs \${bootargs_base} \${mtdparts}; bootelf 30100000'

Note the bootelf&nbsp;30100000 command, which will start the execution of our loaded image. Now, you can generate the customized NAND flash image:

./openmoko/flash.sh

The resulting file is called ./openmoko/openmoko-flash.base. With the boot loader ready and configured, we can finally start our image.boot via qemu:

arm-softmmu/qemu-system-arm -M gta01 -m 130 \
    -mtdblock openmoko/openmoko-flash.base \
    -serial stdio -kernel <build-dir>/bin/image.boot

At the boot menu, just press space to select the Boot entry or issue the boot command at the serial prompt.