Adding OpenJDK (Java support) to VAR-SOM-AM43 image

Moderator: Oren.R

Shuki.Z
Posts: 21
Joined: Wed Dec 31, 2014 12:26 pm

Adding OpenJDK (Java support) to VAR-SOM-AM43 image

Postby Shuki.Z » Wed Apr 15, 2015 2:34 pm

Hi,

Please see below some instructions how to add Java support to VAR-SOM-AM43 image:

1) Download the latest VAR-SOM-AM43 YOCTO 1.6 Variscite release.
2) cd yocto_daisy_varsomamxx/tisdk/sources
3) git clone http://git.yoctoproject.org/git/meta-java
4) cd meta-java
5) patch -p1 < ~/yocto_varsomxx_daisy/var_yocto_installation/variscite_utils/patches/meta-java/0001-Fix-java-compilation-for-var-som-amxx.patch

6) ~/yocto_daisy_varsomamxx/tisdk/build$ gedit conf/local.conf
Add this to the end of the file:

#Java
PREFERRED_PROVIDER_virtual/java-initial = "cacao-initial"
PREFERRED_PROVIDER_virtual/java-native = "jamvm-native"
PREFERRED_PROVIDER_virtual/javac-native = "ecj-bootstrap-native"

#For openjdk6:
#PREFERRED_VERSION_openjdk-6-jre = "6b24-1.11.9"
#or
#PREFERRED_VERSION_openjdk-6-jre = "6b27-1.12.8"
#or
#PREFERRED_VERSION_openjdk-6-jre = "6b32-1.13.4"
#PREFERRED_VERSION_icedtea6-native = "1.8.11"
#For openjdk7:
PREFERRED_VERSION_openjdk-7-jre = "25b30-2.3.12"
PREFERRED_VERSION_icedtea7-native = "2.1.3"

#Sometimes the following is needed:
#PREFERRED_PROVIDER_openjdk-6-jre = "openjdk-6-jre"
#PREFERRED_PROVIDER_openjdk-7-jre = "openjdk-7-jre"
IMAGE_INSTALL_append = " busybox modutils-initscripts initscripts opkg udev sysvinit netbase base-files base-passwd busybox-hwclock \
${ROOTFS_PKGMANAGE_BOOTSTRAP} ${CORE_IMAGE_EXTRA_INSTALL} \
openjdk-7-jre openjdk-7-vm-jamvm openjdk-7-vm-cacao \
strace dropbear binutils \
classpath \
classpath-common \
classpath-examples \
classpath-tools \
jamvm \
cacao \
"

7) ~/yocto_daisy_varsomamxx/tisdk/build$ gedit conf/bblayers.conf
and make sure it looks like this:
# This template file was created by taking the oe-core/meta/conf/bblayers.conf
# file and removing the BBLAYERS section at the end.

# LAYER_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
LCONF_VERSION = "5"

BBPATH = "${TOPDIR}"
BBFILES ?= ""

# Layers configured by oe-core-setup script
BBLAYERS += " \
~/yocto_daisy_varsomamxx/tisdk/sources/meta-arago/meta-arago-distro \
~/yocto_daisy_varsomamxx/tisdk/sources/meta-arago/meta-arago-extras \
~/yocto_daisy_varsomamxx/tisdk/sources/meta-qt5 \
~/yocto_daisy_varsomamxx/tisdk/sources/meta-openembedded/toolchain-layer \
~/yocto_daisy_varsomamxx/tisdk/sources/meta-openembedded/meta-networking \
~/yocto_daisy_varsomamxx/tisdk/sources/meta-openembedded/meta-ruby \
~/yocto_daisy_varsomamxx/tisdk/sources/meta-openembedded/meta-oe \
~/yocto_daisy_varsomamxx/tisdk/sources/meta-ti \
~/yocto_daisy_varsomamxx/tisdk/sources/meta-linaro/meta-linaro-toolchain \
~/yocto_daisy_varsomamxx/tisdk/sources/oe-core/meta \
~/yocto_daisy_varsomamxx/tisdk/sources/meta-java \
~/yocto_daisy_varsomamxx/tisdk/sources/meta-variscite \
"


8)
$ gedit tisdk/sources/meta-variscite/conf/machine/varsomam43.conf

Change FROM:
#DISTRO_FEATURES_append = " x11"
DISTRO_FEATURES_append = " wayland"

TO:
DISTRO_FEATURES_append = " x11"
#DISTRO_FEATURES_append = " wayland"


9) Build:
$ MACHINE=varsomam43 bitbake core-image-sato-var

10) Extract rootfs as follows (it's not the same image as on Variscite Wiki):

$ cd tisdk/build
$ sudo mkdir ../../rootfs_am33
$ sudo tar xvf ./arago-tmp-external-linaro-toolchain/deploy/images/varsomam33/core-image-sato-var-varsomam43.tar.bz2 -C ../../rootfs_am33


11) To build your application on the Ubuntu Host, you should use the open jdk java, as follows:

sudo /usr/lib/jvm/java-7-openjdk-amd64/bin/javac HelloWorld.java

12) To test on the target, you can use the example "helloworld" binary attached.
java -classpath . HelloWorld

Regards,
Shuki

Return to “Yocto”

Who is online

Users browsing this forum: No registered users and 0 guests