Page 1 of 1

Building java VM

PostPosted: Wed Aug 17, 2011 4:42 pm
by mladen
JamVM is a new Java Virtual Machine which conforms to the JVM specification version 2 (blue book). In comparison to most other VM's (free and commercial) it is extremely small. Last available JamVM version in OpenEmbedded repository is 1.5.3, but we want to build last available version which is 1.5.4. Jamvm version is obtained at distribution level and it’s impossible to provide it at local configuration level. That’s why we will make our copy of distribution. Next few commands will copy all necessary files
Code: Select all
mkdir –p /angstrom/sources/local/conf/distro/include
cp /angstrom/sources/openembedded/conf/distro/angstrom-2008.1.conf /angstrom/sources/local/conf/distro/
cp /angstrom/sources/openembedded/conf/distro/include/angstrom-2008-preferred-versions.inc /angstrom/sources/local/conf/distro/include/
cp /angstrom/sources/openembedded/conf/distro/include/angstrom-codec-engine-latest-preferred-versions.inc /angstrom/sources/local/conf/distro/include/
cp /angstrom/sources/openembedded/conf/distro/include/angstrom-glibc.inc /angstrom/sources/local/conf/distro/include/
cp /angstrom/sources/openembedded/conf/distro/include/angstrom.inc /angstrom/sources/local/conf/distro/include/
cp /angstrom/sources/openembedded/conf/distro/include/angstrom-jalimo.conf /angstrom/sources/local/conf/distro/include/
cp /angstrom/sources/openembedded/conf/distro/include/angstrom-ldflags.inc /angstrom/sources/local/conf/distro/include/
cp /angstrom/sources/openembedded/conf/distro/include/angstrom-package-ipk.inc /angstrom/sources/local/conf/distro/include/
cp /angstrom/sources/openembedded/conf/distro/include/arm-thumb.inc /angstrom/sources/local/conf/distro/include/
cp /angstrom/sources/openembedded/conf/distro/include/glibc-internal.inc /angstrom/sources/local/conf/distro/include/
cp /angstrom/sources/openembedded/conf/distro/include/preferred-opie-versions-1.2.4.inc /angstrom/sources/local/conf/distro/include/
cp /angstrom/sources/openembedded/conf/distro/include/sane-toolchain-java.inc /angstrom/sources/local/conf/distro/include/
cp /angstrom/sources/openembedded/conf/distro/include/toolchain-internal.inc /angstrom/sources/local/conf/distro/include/

Edit file
Code: Select all
nano /angstrom/sources/local/conf/distro/include/angstrom-jalimo.conf

and change the content of file with the following
Code: Select all
# Put a 'require conf/distro/include/angstrom-jalimo.conf' in your local.conf if you want to build from the jalimo overlay

# initial stuff
PREFERRED_VERSION_jamvm-initial = "1.4.5"
PREFERRED_VERSION_classpath-initial = "0.93"

# Native VM
# Cacao native
#PREFERRED_PROVIDER_virtual/java-native ?= "cacao-native"
#SRCREV_pn-cacao-native ?= "c7bf150bfa46"
#PREFERRED_VERSION_cacao-native = "0.99.3"

# Classpath native
PREFERRED_VERSION_classpath-native = "0.98"

# JamVM native
PREFERRED_PROVIDER_virtual/java-native ?= "jamvm-native"
PREFERRED_VERSION_jamvm-native = "1.5.4"

# Native compiler settings
PREFERRED_PROVIDER_virtual/javac-native = "ecj-bootstrap-native"
PREFERRED_VERSION_libecj-bootstrap = "3.6"

# Target VM
PREFERRED_VERSION_cacao = "0.99.3"
PREFERRED_VERSION_cacaoh-native = "0.99.3"

PREFERRED_VERSION_jamvm = "1.5.4"
PREFERRED_PROVIDER_swt3.4-gtk = "swt3.4-gtk"
PREFERRED_PROVIDER_classpath = "classpath"

PREFERRED_VERSION_openjdk-6-jre = "6b18-1.8.5"
PREFERRED_VERSION_icedtea6-native = "1.7.10"

# Stage JAR files not into ARCH related dirs
STAGING_DIR_JAVA = "${STAGING_DIR}/java"
STAGING_DATADIR_JAVA ?= "${STAGING_DIR_JAVA}"

We are going to copy Jamvm recipe from OpenEmbedded repository
Code: Select all
mkdir –p /angstrom/sources/local/recipes/
cp –R /angstrom/sources/openembedded/recipes/jamvm /angstrom/sources/local/recipes

Next we have to create recipe for latest JamVM version by typing
Code: Select all
nano /angstrom/sources/local/recipes/jamvm /jamvm_1.5.4.bb

and finally add the following in file
Code: Select all
require jamvm.inc

SRC_URI += "file://debian-jni.patch;striplevel=0"

PR = "r3"

do_configure_prepend() {
  # Replaces the placeholder OE_LIBDIR_JNI with the JNI library directory
  # configured in OE.
  sed -i -e "s|OE_LIBDIR_JNI|${libdir_jni}|" src/dll.c
}

SRC_URI[md5sum] = "7654e9657691f5f09c4f481ed4686176"
SRC_URI[sha256sum] = "7865693698bc4322cabe1014a4b7ebdec1bc1daf45f1a4457b6e908a4446b124"

If JamVM have to be build without GUI support, edit file
Code: Select all
nano /angstrom/sources/local/recipes/jamvm /jamvm.inc

and change the lines
Code: Select all
EXTRA_OECONF = "--with-classpath-install-dir=${prefix} --libdir=${libdir}/jamvm"
CFLAGS += "-DDEFAULT_MAX_HEAP=16*MB"

with this one
Code: Select all
EXTRA_OECONF = "--without-x --without-alsa --disable-gtk-peer --disable-gconf-peer --disable-examples --with-classpath-install-dir=${prefix} --libdir=${libdir}/jamvm"
CFLAGS += "-DDEFAULT_MAX_HEAP=8*MB"

Everything about JamVM is now configured, so you can build it by
Code: Select all
bitbake jamvm