APPLICATION NOTE AN010:
Building OpenEmbedded KaeilOS with Java support

1. Overview
This article shows you how to add Java VM and Java library on PM9263 to enable Java application execution.

2. Prerequisites
- a PM9263
or
- a Starter Kit with ATMEL AT91SAM9263

3. Preparation
First you need to prepare your host Linux distribution in order to be able to get and build KaeilOS. A list of required packages for variety of host distributions is described in OEandYourDistro at OpenEmbedded web site. Lets prepare directory structure. Login on your host as ordinary user not a root (root privileges are not needed and a good practice is to avoid being root if not needed). You can login as a user you like. Starting point is being in the home directory. You may choose working directory at your decision, but be aware of the paths. For this article make is sure to be in home directory, so execute cd command.

$ cd

Make directory for doing things and go to it.

$ mkdir -p usr/src/oe
$ cd usr/src/oe

Now it is time to get bitbake - the building tool. All thing here are done with bitbake version 1.8. And don't install bitbake globally, install it as a sibling directory of openembedded/ and build/.

$ svn co svn://svn.berlios.de/bitbake/branches/bitbake-1.8/ bitbake

Follows getting openembedded - meta data, packages, relations and more. Get it, go to directory openembedded/ and update.

$ git clone git://git.openembedded.org/openembedded
$ cd openembedded
$ git pull

Now you have the development branch of openembedded org.openembedded.dev. To work on stable and tested branch get stable/2009 branch. And check that you are in stable branch.

$ git checkout origin/stable/2009 -b stable/2009
$ git pull
$ git branch
  org.openembedded.dev
* stable/2009
% cd ..

Get KaeilOS settings and configuration files. Then extract it.

$ wget ftp://ftp.koansoftware.com/public/kaeilos/kaeilos-4.05-config-files.tgz
$ tar xzvf kaeilos-4.05-config-files.tgz

Edit the listed below so that they contains the correct paths. Substitute the variables. See the List of variables. Use the full path from root(/) directory.
- in file setup-kaeilos.sh correct BB_DIR to point to $OEBASE/btibake/ and OE_DIR to point to $OEBASE/openembedded/
- in build/kaeilos/conf/auto.conf there is nothing to change
- in build/kaeilos/conf/local.conf correct DEPLY_DIR_STAGE to point of "$OEBASE/build/kaeilos/pstage/", and comment the lines as shown.

# Enable devshell with screen and bash
#SCREEN_TERMCMD = 'screen -D -m -t "$TERMWINDOWTITLE" -s /bin/bash'
#TERMCMD = "${SCREEN_TERMCMD}"
#TERMCMDRUN = "${SCREEN_TERMCMDRUN}"


# Enable this to send automatic success and failure reports
#http://wiki.openembedded.net/index.php/How_do_I_send_automatic_success_and_failure_reports
#INHERIT += "oestats-client"
#OESTATS_SERVER = "tinderbox.openembedded.net"
#OESTATS_BUILDER = "kaeilos-user"

- in build/kaeilos/conf/site.conf correct DL_DIR to become "$OEBASE/sources/" and correct BBFILES = "$OEBASE/openembedded/recipes/*/*.bb" Initial building of the system, you should be in $OEBASE directory. Running this command for the first time will take a some hours to finish. This creation of the image is to let downloading all required packages and all the configurations and compiling at once. After that you will configure the kernel and add the packages you want.

$ source setup-kaeilos.sh /home/ivan/usr/src/oe/build/kaeilos
$ bitbake x11-image

And from now one customization by adding JavaVM and Java classes. Open for edit $OEBASE/openembedded/conf/machine/ronetix-pm9263.conf and search for:

PREFERRED_VERSION_classpath ?= "0.97.2"

if the line doesn't exist add it. Also add packages needed to be included in the image file.

ANGSTROM_EXTRA_INSTALL += "\ <what ever packages a here> \
\
classpath \
classpath-common \
classpath-dev \
classpath-examples \
classpath-gconf \
classpath-gtk \
classpath-tools \
jamvm \
cacao \
ipkg \
mplayer \
kernel-modules \
xmms \
xmms-plugin-output-alsa \
xmms-plugin-input-mpg123 \
alsa-oss \
alsa-conf \
alsa-utils-alsaconf \
alsa-utils-alsamixer \
alsa-utils-spoeakertes \
alsa-lib \
portmap \
nfs-utils \
nfs-utils-client \
dosfstools \
dialog \
bash \
libX11 \
libxv \
<what ever packages a here>"

Configuring kernel so go to $OEBASE/build/kaeilos to configure and build your linux kernel

$ cd $OEBASE/build/kaeilos
$ bitbake virtual/kernel -c menuconfig

next comes to compile, populate stage directory, install the kernel. Executing these task will compile kernel and modules, make head files to be in the stage directory and finally copy kernel and modules to $DEPLOY directory.

$ bitbake virtual/kernel -c compile -f
$ bitbake virtual/kernel

To build what you have done go to $OEBASE/build/kaeilos if not there and do:

$ cd $OEBASE/build/kaeilos
$ bitbake pm9263-x11-image

Get build image, go to $DEPLOY directory, and take file KaeilOS-custom-extra-image-glibc-ipk-2009.1-test-20090916-ronetix-pm9263.rootfs.jffs2 this is the image you should write to pm9263. the 20090916 in the image name is the date of creation of image.

4. References
List of Variables:
$HOME - where is the user account home directory - for example /home/peter
$OEBASE - the base directory from where you start play with openembedded - for example $HOME/usr/src/oe
$DEPLOY - directory containing image files to burn to embedded device - for example $OEBASE/build/kaeilos/tmp/deploy/glibc/images/ronetix-pm9263

5. Literature
1. KaeilOS manual
2. OpenEmbedded Getting started
3. OpenEmbedded User Manual
4. BEC Systems adding package

Download Files
1. Root FS image
2. U-Boot image
3. Kernel image
4. KaeilOS configuration files v4.05