How to do it...

To build OpenJDK 8, you need to clone the meta-java layer, as follows:

$ cd /opt/yocto/fsl-community-bsp/sources/
$ git clone git://git.yoctoproject.org/meta-java

At the time of writing, there is no Rocko branch yet, so we will work directly from the master branch. Add the layer to your conf/bblayers.conf file:

$ bitbake-layers add-layer /opt/yocto/fsl-community-bsp/sources/meta-java

Then, configure the project by adding the following to your conf/local.conf file:

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

You can then add the OpenJDK package to your image with the following:

IMAGE_INSTALL_append = " openjre-8" 

Finally, you can build the image of your choice:

$ cd /opt/yocto/fsl-community-bsp/
$ source setup-environment wandboard
$ bitbake core-image-minimal
If you have installed the dependencies listed in Setting up the host system on Chapter 1, The Build System you should be ready to go. Otherwise, you may need to install the libx11-dev package to your host for the build to succeed.

When you run the target image, you will get the following Java version:

# java -version
openjdk version "1.8.0_102-internal"
OpenJDK Runtime Environment (build 1.8.0_102-internal-b14)
OpenJDK Zero VM (build 25.102-b14, interpreted mode)
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset