From IcedTea

Jump to: navigation, search


1 What is OE-core ?

OE-core was created as a collaboration between the OpenEmbedded and the Yocto project to create a maintainable layered stack of cross-compile recipes.

OE-core is the main layer of a cross-compile infrastructure that can be used to build a complete root filesystem from scratch. Some people use the name meta-oe as a reference to OE-core and its layers.

1.1 meta-java

All the openjdk recipes are found inside the meta-java layer:

meta-java development currently uses the following git tree as upstream:

OE-core needs the meta-java layer in order to build openjdk from scratch. OE-core + meta-java are good to use if you want to cross-compile openjdk and also make sure that you can cross-compile openjdk- build and runtime dependencies. Many embedded Linux distributions use oe-core and meta-java for all their openjdk cross-compile needs.

2 Preparation

The instructions on this page have been tested and found to be working, tested on a 32bit x86 Ubuntu 11.10 host, 2012-01-08.

You will need about 40gb of free hard disk drive space, a fast Internet connection and about 12h compilation time on a 5 year old, 2Gb RAM, AMD 64 Live system in order to complete this tutorial.

2.1 Ubuntu/Debian packages needed

# First we need to install all packages needed to clone and run OpenEmbedded-core on Debian/Ubuntu.
# OpenEmbedded will stop and print all the packages you need if they are not already installed.
# svn is provided by the subversion package and
# makeinfo is provided by the texinfo package.
# libgl1-mesa-dev libglu1-mesa-dev libsdl1.2-dev are needed to build qemu-native

sudo apt-get install git g++ gawk zip diffstat texi2html texinfo subversion chrpath libgl1-mesa-dev libglu1-mesa-dev libsdl1.2-dev

2.2 Clone the git layers

# Clone the main oe-core git layer, bitbake and all the required sub-layers that meta-java depends on:
# oe-core git = 68.02 MiB
# bitbake git = 3.15 MiB
# meta-openembedded git = 14.91 MiB
# meta-java git = 141.86 KiB

git clone git:// oe-core
cd oe-core
git clone git:// bitbake
git clone git://
git clone

2.3 Initialize and edit configurations files

# Initialize the oe-core build environment and edit configuration files 
# This following command line line will create your build directory, setup your build environment,
# automatically place the current work directory inside the build dir and
# print out some useful information on how to bitbake packages.
# You can rerun this command every time you want to re-setup your build environment!

. ./oe-init-build-env

Now you have two options on how to add the layers and edit the oe configuration files:

3 option A manually edit the conf/*.conf files to enable the meta-java layer

# The default created configuration files inside the build dir are missing all the extra layers 
# that we need so we need to update the two configuration files conf/local.conf and conf/bblayers.conf 
# inside the build dir. 

gedit conf/local.conf

# Add the following META-JAVA SPECIFIC settings to the top of the local.conf file:

PREFERRED_PROVIDER_virtual/java-native = "jamvm-native"
PREFERRED_PROVIDER_virtual/javac-native = "ecj-bootstrap-native"
PREFERRED_VERSION_cacaoh-native = "0.99.3"
PREFERRED_VERSION_icedtea6-native = "1.8.11"

# A good idea are to read through the whole local.conf file and at least update/set

MACHINE ?= "qemuarm"

# Done with local.conf editing!

gedit conf/bblayers.conf

# Add the paths for all the bitbake layers so that the file looks something like this:

# LAYER_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly

  /home/user/oe-core/meta \
  /home/user/oe-core/meta-openembedded/meta-oe \
  /home/user/oe-core/meta-java \
# Done with bblayers.conf editing!

3.1 Run bitbake openjdk-6 to start the cross-compile build!

# Finally we are ready to start the bitbake cross compilation
# build of openjdk-6 and all its dependencies!
# During this bitbake step
# 2.8Gb of source-code data will be fetched and placed into the build/download directory.
# All the downloaded sourcecode that makes up openjdk-6 and all openjdk-6 build dependencies will then be built, be patient!
# The build is done in steps so the build can be restarted if one of the steps fails for some reason.
# It is quite common that one of the many servers used to host source code is down temporarily,
# if this happens, you can download the missing source-code archive manually and place it inside the build/download directory and then restart the build by simply rerunning this last command.
bitbake openjdk-6

4 option B run Hob to bring up the Hob Image Creation GUI where you can configure a rootfs image with openjdk-6 included

Hob is a nice Image Creation GUI [1], created by the Yocto project, and is included in oe-core. Hob makes it easy to edit the configuration files and prepare a complete rootfs including all the extra packages you need.

# run hob from inside your build dir!

You can add the meta-oe and meta-java layers by using the edit->Layers menu from inside the Hob GUI!

Select the openjdk-6-jre you want from the large package list inside Hob.

4.1 Push the Bake button to start the cross-compile build!

Finally start the cross-compilation by pressing the "Bake" button from inside the GUI.

5 Clean up the work directory after a successful build

The tmp-eglibc/work and tmp-eglibc/work-shared directories contains all unpacked source code and all compiled object files used during the cross compilation. You can safely remove these two directories to reclaim hard-disk space.

# safely reclaim ~29Gb hard-disk space after the first cross-compile build
rm -rf tmp-eglibc/work tmp-eglibc/work-shared

6 Produced package files

The tmp-eglibc/deploy directory contain built ipk,deb,rpm or tar.gz (package type depending on how you configured your conf/local.conf) install files for the cross compiled openjdk and all its dependencies.

7 Produced uncompressed rootfs

The tmp-eglibc/sysroots/ directory contains a complete cross-compiled rootfs directory.

You may copy the uncompressed tmp-eglibc/sysroots/qemuarm/usr/lib/jvm/java-6-openjdk/ directory, as is, to your target and test/run your newly cross compiled openjdk-6 build.

Personal tools