Template:ReviewersList Template:ArticleProposedVersion
The goal of this page is to describe the way to install the openJDK on your STM32 MPU board and your desktop (native), in a Distribution Package Environment.
It is the "open Standard Edition Java Development Kit" installation process.
According to the openstlinux-weston software architecture, we use xwayland for all Java application based on X11, means AWT/SWING Java display/graphical applications.
By default the Java Development Kit is installed on the rootfs partition of the target.
1. Prerequisites[edit source]
- one MPU board
- the STM32MP1 Distribution Package
- an Internet connection
- a Computer with Linux OS Ubuntu
2. Add the yoctoproject meta-java in your environment[edit source]
JAVA for Linux-based system for embedded system is available as a meta data in yoctoproject.
The tar file can be loaded from the Internet site yoctoproject [1]
Download the file release linked to your yocto baseline (example meta-java-rocko.tar.gz for the yocto branch rocko).
You are able to select the last commit on the right branch, in the "summary" menu option on the "index:meta-java" page.
- Untar the file in your distribution software environment :
In the following example we install the "meta-java" component for yocto rocko released in the "meta-st" folder. The <TOP-DIR> is the folder you installed your Distribution Package.
cd <TOP-DIR>/meta-st tar -xf meta-java-rocko.tar.gz
- If not done, setup your build environment
cd <TOP-DIR> source ./meta-st/script/envsetup.sh (Select for the DISTRO openstlinux-weston and for MACHINE stm32mp1)
- Add the meta layer in your yocto environment
cd <TOP-DIR>/build-openstlinuxweston-stm32mp1 bitbake-layers add-layer <top-DIR>/meta-st/meta-java-rocko
- Define at least the following variables in a distro include file or local.conf
(<TOP-DIR>/build-openstlinuxweston-stm32mp1/conf/local.conf) #Possible provider: cacao-initial-native and jamvm-initial-native PREFERRED_PROVIDER_virtual/java-initial-native = "cacao-initial-native" #Possible provider: cacao-native and jamvm-native PREFERRED_PROVIDER_virtual/java-native = "jamvm-native" #Optional since there is only one provider for now PREFERRED_PROVIDER_virtual/javac-native = "ecj-bootstrap-native"
- Include in your image the openjdk-8 component
cd <TOP-DIR>/meta-st/meta-st-openstlinux/recipes-st/images Edit the file st-image-weston.bb and add the following line under CORE_IMAGE_EXTRA_INSTALL openjdk-8 \
- Build the image
cd <TOP-DIR>/build-openstlinuxweston-stm32mp1 bitbake st-image-weston
3. Compil and execute some demo[edit source]
The target has to be connected on ethernet, the target IP address <YOUR_TARGET_IP> is read with the following command to execute in a linux weston console.
ifconfig
- Go to deb package folder :
cd <TOP-DIR>/build-openstlinuxweston-stm32mp1/tmp-glibc/deploy/deb/cortexa7hf-neon-vfpv4
- Copy the openjdk-8-demo package on the target :
scp openjdk-8-demo_102b14-r0_armhf.deb root@<YOUR_TARGET_IP>:/home/root/
- Install the openjdk-8-demo package :
On a target linux console, executes the command :
dpkg -i openjdk-8-demo_102b14-r0_armhf.deb
- forkjoin benchmark Java application
cd /usr/lib/jvm/openjdk-8/sample/forkjoin/mergesort javac MergeDemo.java java MergeDemo 200 100 3 1 1 3 Running with parameters: 200 100 3 1 1 3 Time in milliseconds. Y-axis: number of elements. X-axis parallelism used. 1 2 3 200: 10 7 8 300: 17 12 12 400: 20 14 14 Total: 47 33 34
- SampleTree Java application
Read the README.txt file for details
cd /usr/lib/jvm/openjdk-8/demo/jfc/SampleTree java -jar SampleTree.jar
4. Reference list[edit source]
- ↑ http://git.yoctoproject.org/cgit/cgit.cgi/meta-java/commit/ "link to get the Yocto meta-java tar file""