Registered User |
Registered User mNo edit summary Tag: 2017 source edit |
||
(44 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
The goal of this page is to describe the OpenJDK installation procedure on your STM32 MPU board and (native) desktop, in a Distribution Package environment. | <noinclude>{{ApplicableFor | ||
|MPUs list=STM32MP13x, STM32MP15x, STM32MP25x | |||
|MPUs checklist=STM32MP13x, STM32MP15x, STM32MP25x | |||
}} | |||
</noinclude> | |||
{{FlowCompatibility/Generic|'''The JAVA JDK, subject of this article, is not part of STM32MPU ecosystem releases, for which ST provides some support. <br>This article only provides, as example, some helper guidelines (tips): you may need to make some adaptations depending on your system setup.''' | |||
This article has been written taken as example {{Board | type=157x-DKx}} or {{Board | type=157x-EV1}} on top of {{EcosystemRelease | revision=5.0.0}} , but the recommendations, given below, could be adapted to install JAVA JDK on any other boards with STM32 MPU, populated with any STM32MPU ecosystem releases.}} | |||
The goal of this page is to describe the OpenJDK installation procedure on your STM32 MPU board and (native) desktop, in a STM32MPU Distribution Package environment. <br> | |||
It is the "Open Standard Edition Java Development Kit" installation process. | It is the "Open Standard Edition Java Development Kit" installation process. | ||
According to the OpenstLinux Weston software architecture, '''XWayland''' is used for all Java applications based on '''X11''', which means '''AWT/SWING''' Java display/graphical applications. | According to the OpenstLinux Weston software architecture, '''XWayland''' is used for all Java applications based on '''X11''', which means '''AWT/SWING''' Java display/graphical applications.<br> | ||
By default the Java Development Kit is installed on the rootfs partition of the target. | By default the Java Development Kit is installed on the rootfs partition of the target. | ||
==Prerequisites== | ==Prerequisites== | ||
===Hardware prerequisites=== | ===Hardware prerequisites=== | ||
*{{Board | type=157x-DKx}} | *{{Board | type=157x-DKx}} or {{Board | type=157x-EV1}} | ||
* a keyboard and a mouse connected to the board | * a keyboard and a mouse connected to the board | ||
===Software prerequisites=== | ===Software prerequisites=== | ||
The | The STM32MPU Distribution Package must be installed on your host. To do this, follow the procedure described in the [[STM32MPU Distribution Package#Installing the OpenSTLinux distribution]] article. | ||
{{Info|The Host OS Ubuntu release 18.04 and next is required}} | |||
The process has been verified with {{EcosystemRelease | revision=5.0.0}} of the OpenSTlinux distribution. | |||
{{Info|The Host OS Ubuntu release 18.04 and next is required. See [[PC prerequisites]]}} | |||
==The yoctoproject meta-java == | ==The yoctoproject meta-java == | ||
JAVA for Linux-based embedded systems is available as metadata in the Yocto project. | JAVA for Linux-based embedded systems is available as metadata in the Yocto project. | ||
* Clone the following git repository into [your | * Clone the following git repository into [your STM32MPU Distribution path]/layers | ||
{{PC$}}cd [your | {{PC$}}cd [your STM32MPU Distribution path]/layers | ||
{{PC$}}git clone git://git.yoctoproject.org/meta-java | {{PC$}}git clone git://git.yoctoproject.org/meta-java | ||
Depending on the Yocto release, select the right branch. (for example, branch | Depending on the Yocto release, select the right branch. (for example, branch mickledore for the {{EcosystemRelease | revision=5.0.0}}) | ||
{{Info|The last commit tested is | {{Info|The last commit tested is ae2952c7668db180fa6acefe82457df913342837 : openjdk-8: Add compatability with GCC 12.x}} | ||
{{PC$}}cd meta-java | {{PC$}}cd meta-java | ||
{{PC$}}git checkout | {{PC$}}git checkout remotes/origin/mickledore | ||
</pre> | |||
* Two patches need to be applied to meta-java layers: | |||
{{PC$}}cd [your STM32MPU Distribution path]/layers/meta-java | |||
1- In recipes-core/xml-commons/xml-commons-resolver1.1_1.2.bb | |||
<pre> | |||
-SRC_URI = "http://archive.apache.org/dist/xml/commons/xml-commons-resolver-${PV}.tar.gz" | |||
+SRC_URI = "http://archive.apache.org/dist/xml/commons/binaries/xml-commons-resolver-${PV}.tar.gz" | |||
</pre> | |||
2- In recipes-core/openjdk/openjdk-8_272.bb | |||
<pre> | |||
+ERROR_QA:remove = "patch-fuzz" | |||
</pre> | </pre> | ||
* If not already done, set up your build environment | * If not already done, set up your build environment | ||
{{PC$}} cd [your | {{PC$}}cd [your STM32MPU Distribution path] | ||
{{PC$}} source layers/meta-st/scripts/envsetup.sh | {{PC$}}source layers/meta-st/scripts/envsetup.sh | ||
(Select for the DISTRO openstlinux-weston and for MACHINE | (Select for the DISTRO openstlinux-weston and for MACHINE stm32mpx) | ||
* Add the meta layer in your Yocto environment | * Add the meta layer in your Yocto environment | ||
{{PC$}} cd [your | {{PC$}}cd [your STM32MPU Distribution path]/build-openstlinuxweston-stm32mpx | ||
{{PC$}} bitbake-layers add-layer [your | {{PC$}}bitbake-layers add-layer [your STM32MPU Distribution path]/layers/meta-java | ||
* Define at least the following variables in your local.conf file | * Define at least the following variables in your local.conf file | ||
([your | ([your STM32MPU Distribution path]/build-openstlinuxweston-stm32mpx/conf/local.conf) | ||
#Possible provider: cacao-initial-native and jamvm-initial-native | #Possible provider: cacao-initial-native and jamvm-initial-native | ||
Line 69: | Line 76: | ||
* Include in your image the '''openjdk-8''' component | * Include in your image the '''openjdk-8''' component | ||
{{PC$}} cd [your | {{PC$}}cd [your STM32MPU Distribution path]/layers/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 | |||
<pre> | <pre> | ||
openjdk-8 \ | openjdk-8 \ | ||
openjdk-8-demo \ | openjdk-8-demo \ | ||
</pre> | |||
* Choose '''XWayland''' configuration in meta-st/meta-st-openstlinux. | |||
{{PC$}}cd [your STM32MPU Distribution path]/layers/meta-st/meta-st-openstlinux | |||
Three modifications to be done: | |||
1- conf/distro/openstlinux-weston.conf | |||
<pre> | |||
-DISTRO_FEATURES:remove = " x11 " | |||
+DISTRO_FEATURES:append = " x11 wayland " | |||
# with X11 | |||
-#PREFERRED_PROVIDER_virtual/xserver = "${@bb.utils.contains('DISTRO_FEATURES', 'x11 wayland', 'xwayland', 'xserver-xorg', d)}" | |||
+PREFERRED_PROVIDER_virtual/xserver = "${@bb.utils.contains('DISTRO_FEATURES', 'x11 wayland', 'xwayland', 'xserver-xorg', d)}" | |||
</pre> | |||
2- recipes-st/packagegroups/packagegroup-framework-core-extra.bb | |||
<pre> | |||
- ${@bb.utils.contains('DISTRO_FEATURES', 'x11 wayland', 'xf86-input-keyboard', '', d)} \ | |||
</pre> | |||
3- recipes-graphics/xorg-xserver/xserver-xorg_%.bbappend (new file) | |||
<pre> | |||
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" | |||
DEPENDS += "libxshmfence" | |||
</pre> | |||
* Increase the Rootfs partition size | |||
Update the file (''[your STM32MPU Distribution path]/layers/meta-st/meta-st-stm32mp/conf/machine/include/st-machine-common-stm32mp.inc'') | |||
<pre style="overflow-y: visible; max-height: none;"> | |||
IMAGE_ROOTFS_MAXSIZE = "819200" | |||
</pre> | </pre> | ||
* Build the image | * Build the image | ||
{{PC$}} cd [your | {{PC$}}cd [your STM32MPU Distribution path]/build-openstlinuxweston-stm32mpx | ||
{{PC$}} bitbake st-image-weston | {{PC$}}bitbake st-image-weston | ||
==Compilation and execution of some JAVA demos== | ==Compilation and execution of some JAVA demos== | ||
* '''forkjoin''' benchmark Java application | * '''forkjoin''' benchmark Java application | ||
{{Board$}} cd /usr/lib/jvm/openjdk-8/sample/forkjoin/mergesort | {{Board$}}cd /usr/lib/jvm/openjdk-8/sample/forkjoin/mergesort | ||
{{Board$}} javac MergeDemo.java | {{Board$}}javac MergeDemo.java | ||
{{Board$}} java MergeDemo 200 100 3 1 1 3 | {{Board$}}java MergeDemo 200 100 3 1 1 3 | ||
Running with parameters: 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. | Time in milliseconds. Y-axis: number of elements. X-axis parallelism used. | ||
Line 95: | Line 131: | ||
Total: 47 33 34 | Total: 47 33 34 | ||
* '''SampleTree''' Java application | * For all GUI Java application, user must export DISPLAY variable and launch a '''XWayland''' socket. | ||
The same ":N" DISPLAY value is used to launch '''XWayland''' socket (only one instance can be run for one "N" value). | |||
{{Board$}}export DISPLAY=:1 | |||
Choose 'X' and 'Y' according to your Java application: | |||
{{Board$}}Xwayland :1 -geometry 'X'x'Y'& | |||
Remove some glamor warnings | |||
{{Board$}}export XWAYLAND_NO_GLAMOR=1 | |||
Note that some XKEYBOARD not fatal warnings can occur | |||
1- '''SampleTree''' Java application | |||
Read the README.txt file for details. | Read the README.txt file for details. | ||
To execute in a Linux Weston console on the board, with a keyboard and a mouse. | To execute in a Linux Weston console on the board, with a keyboard and a mouse. | ||
{{Board$}} cd /usr/lib/jvm/openjdk-8/demo/jfc/SampleTree | {{Board$}}export DISPLAY=:1 | ||
{{Board$}} java -jar SampleTree.jar | {{Board$}}Xwayland :1 -geometry 350x450& | ||
{{Board$}}cd /usr/lib/jvm/openjdk-8/demo/jfc/SampleTree | |||
{{Board$}}java -jar SampleTree.jar | |||
[[File:Sampletree.png|link=]] | [[File:Sampletree.png|link=]] | ||
2- '''GraphicsTest''' Java applet | |||
Read the README.txt file for details. | |||
To execute in a Linux Weston console on the board, with a keyboard and a mouse. | |||
{{Board$}}export DISPLAY=:1 | |||
{{Board$}}Xwayland :1 -geometry 400x400& | |||
{{Board$}}cd /usr/lib/jvm/openjdk-8/demo/applets/GraphicsTest | |||
{{Board$}}/usr/lib/jvm/openjdk-8/bin/appletviewer example1.html | |||
[[File:AppletGraphicTest.png|link=]] | |||
<noinclude> | <noinclude> | ||
[[Category:How to run use cases with expansions]] | [[Category:How to run use cases with expansions]] | ||
{{PublicationRequestId | 17583 | 2020-10-02 | Philip Sage}} | {{PublicationRequestId | 17583 | 2020-10-02 | Philip Sage}} | ||
</noinclude> | </noinclude> |
Latest revision as of 16:55, 15 November 2024
The goal of this page is to describe the OpenJDK installation procedure on your STM32 MPU board and (native) desktop, in a STM32MPU Distribution Package environment.
It is the "Open Standard Edition Java Development Kit" installation process.
According to the OpenstLinux Weston software architecture, XWayland is used for all Java applications based on X11, which 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 | edit source]
1.1. Hardware prerequisites[edit | edit source]
- STM32MP157x-DKx Discovery kit
or STM32MP157x-EV1 Evaluation board
- a keyboard and a mouse connected to the board
1.2. Software prerequisites[edit | edit source]
The STM32MPU Distribution Package must be installed on your host. To do this, follow the procedure described in the STM32MPU Distribution Package#Installing the OpenSTLinux distribution article.
The process has been verified with ecosystem release unknown revision 5.0.0 of the OpenSTlinux distribution.
![]() |
The Host OS Ubuntu release 18.04 and next is required. See PC prerequisites |
2. The yoctoproject meta-java[edit | edit source]
JAVA for Linux-based embedded systems is available as metadata in the Yocto project.
- Clone the following git repository into [your STM32MPU Distribution path]/layers
git://git.yoctoproject.org/meta-javaPC $>cd [your STM32MPU Distribution path]/layers PC $>git clone
Depending on the Yocto release, select the right branch. (for example, branch mickledore for the ecosystem release unknown revision 5.0.0 )
![]() |
The last commit tested is ae2952c7668db180fa6acefe82457df913342837 : openjdk-8: Add compatability with GCC 12.x |
PC $>cd meta-java
PC $>git checkout remotes/origin/mickledore
- Two patches need to be applied to meta-java layers:
PC $>cd [your STM32MPU Distribution path]/layers/meta-java
1- In recipes-core/xml-commons/xml-commons-resolver1.1_1.2.bb
-SRC_URI = "http://archive.apache.org/dist/xml/commons/xml-commons-resolver-${PV}.tar.gz"
+SRC_URI = "http://archive.apache.org/dist/xml/commons/binaries/xml-commons-resolver-${PV}.tar.gz"
2- In recipes-core/openjdk/openjdk-8_272.bb
+ERROR_QA:remove = "patch-fuzz"
- If not already done, set up your build environment
PC $>cd [your STM32MPU Distribution path]
PC $>source layers/meta-st/scripts/envsetup.sh
(Select for the DISTRO openstlinux-weston and for MACHINE stm32mpx)
- Add the meta layer in your Yocto environment
PC $>cd [your STM32MPU Distribution path]/build-openstlinuxweston-stm32mpx
PC $>bitbake-layers add-layer [your STM32MPU Distribution path]/layers/meta-java
- Define at least the following variables in your local.conf file
([your STM32MPU Distribution path]/build-openstlinuxweston-stm32mpx/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
PC $>cd [your STM32MPU Distribution path]/layers/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 \
openjdk-8-demo \
- Choose XWayland configuration in meta-st/meta-st-openstlinux.
PC $>cd [your STM32MPU Distribution path]/layers/meta-st/meta-st-openstlinux
Three modifications to be done:
1- conf/distro/openstlinux-weston.conf
-DISTRO_FEATURES:remove = " x11 "
+DISTRO_FEATURES:append = " x11 wayland "
# with X11
-#PREFERRED_PROVIDER_virtual/xserver = "${@bb.utils.contains('DISTRO_FEATURES', 'x11 wayland', 'xwayland', 'xserver-xorg', d)}"
+PREFERRED_PROVIDER_virtual/xserver = "${@bb.utils.contains('DISTRO_FEATURES', 'x11 wayland', 'xwayland', 'xserver-xorg', d)}"
2- recipes-st/packagegroups/packagegroup-framework-core-extra.bb
- ${@bb.utils.contains('DISTRO_FEATURES', 'x11 wayland', 'xf86-input-keyboard', '', d)} \
3- recipes-graphics/xorg-xserver/xserver-xorg_%.bbappend (new file)
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
DEPENDS += "libxshmfence"
- Increase the Rootfs partition size
Update the file ([your STM32MPU Distribution path]/layers/meta-st/meta-st-stm32mp/conf/machine/include/st-machine-common-stm32mp.inc)
IMAGE_ROOTFS_MAXSIZE = "819200"
- Build the image
PC $>cd [your STM32MPU Distribution path]/build-openstlinuxweston-stm32mpx
PC $>bitbake st-image-weston
3. Compilation and execution of some JAVA demos[edit | edit source]
- forkjoin benchmark Java application
Board $>cd /usr/lib/jvm/openjdk-8/sample/forkjoin/mergesort
Board $>javac MergeDemo.java
Board $>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
- For all GUI Java application, user must export DISPLAY variable and launch a XWayland socket.
The same ":N" DISPLAY value is used to launch XWayland socket (only one instance can be run for one "N" value).
Board $>export DISPLAY=:1
Choose 'X' and 'Y' according to your Java application:
Board $>Xwayland :1 -geometry 'X'x'Y'&
Remove some glamor warnings
Board $>export XWAYLAND_NO_GLAMOR=1
Note that some XKEYBOARD not fatal warnings can occur
1- SampleTree Java application
Read the README.txt file for details.
To execute in a Linux Weston console on the board, with a keyboard and a mouse.
Board $>export DISPLAY=:1
Board $>Xwayland :1 -geometry 350x450&
Board $>cd /usr/lib/jvm/openjdk-8/demo/jfc/SampleTree
Board $>java -jar SampleTree.jar
2- GraphicsTest Java applet
Read the README.txt file for details.
To execute in a Linux Weston console on the board, with a keyboard and a mouse.
Board $>export DISPLAY=:1
Board $>Xwayland :1 -geometry 400x400&
Board $>cd /usr/lib/jvm/openjdk-8/demo/applets/GraphicsTest
Board $>/usr/lib/jvm/openjdk-8/bin/appletviewer example1.html