OKl4? is a microkernel developed and distributed by Open Kernel Labs. It's focused on embedded devices.
This document provides brief instructions about downloading, building and booting the OKL4 version of Genode for the x86 architecture. For using Genode with OKL4 on the ARM-based GTA01 platform, please refer to Genode/OKL4 on the GTA01 platform.
Prerequisites
You need Python 2.4 to use the OKL4 build system. On Debian/Ubuntu systems simply type:
apt-get install python2.4
Moreover, you need to download and install the tool-chain used by Genode. Have a look at this page:
- http://genode.org/download/tool-chain
- Genode tool-chain
Downloading and building OKL4
Download and unpack the OKL4 sources and tool-chain to an appropriated directory:
mkdir okl4 cd okl4 wget http://wiki.ok-labs.com/downloads/release-2.1.1-fix.7/okl4_2.1.1-fix.7.tar.gz wget http://www.ertos.nicta.com.au/downloads/i686-gcc-3.3.4-glibc-2.3.3-2006-06-02.tar.gz tar xzf okl4_2.1.1-fix.7.tar.gz tar xzf i686-gcc-3.3.4-glibc-2.3.3-2006-06-02.tar.gz
Building the kernel
Adapt your binary path to include the OKL4 tool-chain binary directory.
export PATH=$PATH:`pwd`/opt/nicta/gcc-3.3.4-glibc-2.3.3/i686-unknown-linux-gnu/bin
Compile the kernel by invoking the python script that can be found in the tools directory of the OKL4 source tree.
cd okl4_2.1.1-fix.7 ./tools/build.py project=iguana machine=ia32_pc99 toolprefix=i686-unknown-linux-gnu-
Building the OKL4 version of Genode
The OKL4 version of Genode is available at the Genode public subversion repository:
- http://genode.org/download/subversion-repository
- Information about accessing the Genode public subversion repository
Go to a directory where you want the Genode/OKL4 build directory to remain. Use the helper script in the tool/builddir directory of the Genode source tree to create the initial build environment.
cd ~/builds
<path_to_genode_src>/tool/builddir/create_builddir okl4_x86 \
L4_DIR=<path_to_okl4_src> \
GENODE_DIR=<path_to_genode_src> \
BUILD_DIR=genode-okl4-x86
Now, go to the newly created build directory and type make.
cd genode-okl4-x86 make
Building a boot image
To practically use the OKL4 kernel and applications running on top of it, Open Kernel Labs provide a tool called elfweaver, that is used to merge different application binaries and the kernel itself into one single elf binary that can be executed by your bootloader, e.g. Grub.
To configure elfweaver to merge the appropriated elf binaries you have to provide an XML file. A good starting point is the weaver.xml file that includes the Genode demo example. Simply copy that file to your Genode build directory and adapt the file attribute of the kernel tag to the absolute path of the OKL4 kernel we build previously.
cp <path_to_genode_src>/base-okl4/tool/weaver.xml .
The corresponding line in your weaver.xml should look like this:
<kernel file="<path_to_okl4_src>/build/pistachio/bin/kernel" xip="false" >
Before creating the image, we need to supply a Genode config file as well. For a quick start, you can copy and rename the template provided 'os/config/demo' to '<builddir>/bin/config'. Alternatively, you can assign another file to the 'filename' of the 'memsection' declaration for the config file in 'weaver.xml'. Now, we can use elfweaver to create the image. Go to the bin directory in the Genode build directory that contains all the binaries and invoke the script.
cd bin <path_to_okl4_src>/tools/pyelf/elfweaver merge --output=weaver.elf ../weaver.xml strip weaver.elf
Note: the given paths to the resulting elf file and the input xml file have to be relative.
Bug alert: Elfweaver triggers an assertion when too many memsections are declared in the weaver.xml file and just outputs the following message
An error occurred:
Apparently, elfweaver has a problem with calculating the size of the boot info section. As a quick fix, you can increase the value of BOOTINFO_GUESS_OPS in <okl4-dir>/tools/pyelf/weaver/bootinfo.py.
The resulting elf image can be loaded by Grub now.
Further Information
- genode/base-okl4/doc/notes.txt
- Technical Report on the OKL4 porting work
- genode/tool/builddir/README
- Reference manual for the create_builddir script
- http://genode.org/documentation/articles/genode-on-okl4
- Article about the porting work of Genode to OKL4, featuring many technical insights that are useful to understand the peculiarities of this base platform.
- okl4_2.1.1-fix.7/README
- OKL4 building guide
- http://wiki.ok-labs.com
- OKL4 developer wiki
- http://wiki.ok-labs.com/downloads/release-3.0/elfweaver-ref-manual-3.0.pdf
- Elfweaver reference manual

