CrossCompileFaq

From IcedTea

Jump to: navigation, search

Contents

Instructions?

Cross compilation are currently not supported out of the box with the Icedtea buildsystem although the Jalimo project have invented a way to cross compile Icedtea using the Openembedded infrastructure to build icedtea.

Why Cross Compile?

Icedtea requires the build to run on native hardware thus the build can take a long long time when run under a emulator or small embedded processor. The ARM port of icedtea takes about a Week compile time on native and emulated hardware. By cross compiling this build time can be compleated within a afternoon!

By using the Jalimo overlay and Openembedded it might also be possible to cross compile OpenJDK for linux running on uClibc and MMU less systems.

Please report if you manage to cross compile openjdk, we would be delighted to hear from your awesome porting efforts.

How do I make an automated crosscompile using Jalimo?

First make sure you have the following requirements: Harddrive space: about 50gig A fast internet connection: you will download about 2gig of sourcecode.

First decide a place to use for openembedded with sufficient disk space

mkdir /usr/src/openembedded
cd /usr/src/openembedded

Now you will have to create your own copy of bitbake, openembedded and jalimo from its various sources. The openembedded git tree are quite heavy about 500Mb in size, so be patient.

wget http://download.berlios.de/bitbake/bitbake-1.8.18.tar.gz
tar zxvf bitbake-1.8.18.tar.gz
git clone git://git.openembedded.net/openembedded org.openembedded.dev
svn co svn://svn.evolvis.org/svnroot/jalimo/trunk jalimo-trunk

Create your build directory

mkdir build
mkdir build/conf

Create your own local.conf A tested minimal build/conf/local.conf configuration can look like this:

DISTRO = "angstrom-2008.1"

# look in org.openembedded.dev/conf/machine 
# for various preconfigured machine targets.
# If you want to build packages for the same architecture
# as bitbake are running on then change this to MACHINE = "native"
MACHINE = "beagleboard"

#The Jalimo oe overlay  needs to download some souces that dont have
#their checksums added to the org.openembedded.dev/conf/checksums.ini file.
#Setting OE_ALLOW_INSECURE_DOWNLOADS to 1 allows OE to download and use these files.
OE_ALLOW_INSECURE_DOWNLOADS=1

# Comment out *one* of the two lines below
#DISTRO_TYPE = "debug"
DISTRO_TYPE = "release"

#This row instructs bitbake to both create jffs2 compressed filesystems for embedded flash disks
#and tar.gz tarballs to be unpacked on removable compact flash sd cards.
IMAGE_FSTYPES = "jffs2 tar.gz "

#
# The default build uses glibc
# Uncomment the line below if you want uclibc instead of glibc
# be prepared for a lot of package breakage!
# 'uclibc' or 'glibc' or 'eglibc'
ANGSTROMLIBC = "glibc"

#
# If you enable glibc and encounter qemu-native build issues
# uncomment the line below.
ENABLE_BINARY_LOCALE_GENERATION=0

# specifies where BitBake should place the downloaded sources
DL_DIR = "${OETOP}/sources"

# specifies where BitBake should create its temporary files
TMPDIR = ${OETOP}/${MYBUILDDIR}/tmp

# specifies that BitBake should emit the log if a build fails
BBINCLUDELOGS = "yes"

# collection setup
BBFILES="${OETOP}/jalimo-trunk/oe-overlay/packages/*/*.bb ${OEBRANCH}/recipes/*/*.bb ${USERBRANCH}/packages/*/*.bb"

BBFILE_COLLECTIONS="oe user" 

BBFILE_PATTERN_oe="^${OEBRANCH}/packages"
BBFILE_PATTERN_user="^${USERBRANCH}/packages"

BBFILE_PRIORITY_oe="5"
BBFILE_PRIORITY_user="15"

# Uncomment these lines to enable parallel make.
# This allows make to spawn mutliple processes to take advantage of multiple
# processors. Useful on SMP machines
PARALLEL_MAKE = "-j 4"
BB_NUMBER_THREADS = "4"

# some of the OE provided native tools are a bit buggy
# uncomment the line below if you run into build failures due to the packages listed below
# you will also need to install your distro's version of these packages on your build machine
#ASSUME_PROVIDED += "gdk-pixbuf-csource-native imagemagick-native librsvg-native


Then you have to configure your environment variables to place bitbake in your path and to make openembedded know about jalimo. Do this by creating a simple bash script like this:

#
# Environment setup for oe
#

export MYBUILDDIR="build"

export BB_ENV_EXTRAWHITE="MACHINE DISTRO ANGSTROM_MODE OETOP OEBRANCH USERBRANCH MYBUILDDIR"

export OETOP="/usr/src/openembedded"
export OEBRANCH="${OETOP}/org.openembedded.dev"
export USERBRANCH="${OETOP}/user.collection"
export JALIMOOVERLAY="${OETOP}/jalimo-trunk/oe-overlay"


export PATH="${OETOP}/bitbake-1.8.18/bin/:$PATH"
export BBPATH="${OETOP}/${MYBUILDDIR}:${JALIMOOVERLAY}:${USERBRANCH}:${OEBRANCH}"

umask 0002
bash
#
# end oe setup
#

now run this script before you want to build something using oe.

If you have installed and configured bitbake, OE and jalimo oe-overlay created your configureation and run your setup script then CONGRATULATIONS! Now crosscompiling various configuration of icedtea are new very easy, simply run:

bitbake openjdk-6

You can look inside the jalimo-trunk/oe-overlay/packages/icedtea to see all the bitbake targets that you can use to bitbake icedtea.

Help! the compilation using bitbake failed for some reason. Now what?

If it complains that the checksum for a downloaded file are missing then add then add the checksum to org.openembedded.dev/conf/checksums.ini or add this line to your build/conf/local.conf

OE_ALLOW_INSECURE_DOWNLOADS=1

update the fast changing org.openembedded.dev and jalimo-trunk tree by running

cd org.openembedded.dev
git pull

cd jalimo-trunk
svn up

Try restart the failing build by first cleaning it up

bitbake -c clean openjdk-6
bitbake openjdk-6

Try fix bugs by entering the interactive devshell, it will openup a terminal window with initialized build environment, from here you can run make etc and poke around like you are used to when doing manual Icedtea build.

bitbake -c devshell openjdk-6

Openembedded and Jalimo uses the quilt tool to manage patches on top of the sourcetree, to list all applied extra patches inside the devshell run:

quilt series
quilt help

Keep your sources directory! it contains all compressed sourcecode files and you dont want to download this again (about 2gig).

If you need more information try make your best to follow these two guides:

http://wiki.openembedded.net/index.php/Getting_started
https://wiki.evolvis.org/jalimo/index.php/Building_with_OpenEmbedded

Help! my compilation succeeded, What now?

Erhm. say.. yay, wohoo!!! and blog about it!

You can find your created packages and image files in /usr/src/openembedded/build/tmp/deploy

You can find the compiled binarys used to make the packages in the /usr/src/openembedded/build/tmp/work/arch/openjdk-6-* directory.

How do I update the Packages.gz files so that the deploy directory can be used as a opkg .ipk feed?

Create a script like this one, tweak it to suit your needs and run it! It will recreate the Packages.gz index files inside the deploy directory and move outdated packages to a morgue directory. Devices using the opkg package system can then use these directorys to download and install individual built .ipk packages.

#!/bin/sh
# Updates the package metadata for the Jalimo feed.
#
# This script can be invoked locally as well as through a 'single command'
# SSH connection.
#

DEPLOY_DIR_IPK=/usr/src/openembedded/build/tmp/deploy/glibc/ipk/

export PATH=/usr/src/openembedded/jalimo-trunk/scripts:$PATH

make_index() {
  echo "Making index in ${1}"
  touch ${1}/Packages
  ipkg-make-index -r ${1}/Packages \
                -p ${1}/Packages \
                -l ${1}/Packages.filelist \
                -m ${1} || exit 1
  echo "Done!"
}

make_index $DEPLOY_DIR_IPK/all
make_index $DEPLOY_DIR_IPK/armv7a

How do I make a manual crosscompile setup?

You can of course do a manually crosscompile as well without using openembedded, instructions how to manually setup the cross compile environment have been put on the Jalimo wiki, see: http://wiki.evolvis.org/jalimo/index.php/CrossCompilingOpenJDK Some of the required patches for icedtea are in the jalimo svn tree: http://evolvis.org/scm/?group_id=11 -> trunk/oe-overlay/packages/icedtea/files/*.patch

Got any proof of a working Cross Compilation?

http://rschuster.blogs.evolvis.org/2008/12/21/serving-cross-compiled-openjdk-with-icedtea/ - nice screenshots by Robert Schuster of crosscompiled openjdk running various applications on embedded hardware and all the technical guts behind the cross compile effort. http://rschuster.blogs.evolvis.org/2008/12/23/comments-on-latest-post-on-openjdk/

Personal tools