Adding Openjdk support to zeus yocto layer

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Adding Openjdk support to zeus yocto layer

Adding Openjdk support to zeus yocto layer

Environment: openjdk-8 with L5.4.24-2.1.0 and GCC-9

1. Clone meta-java with dedicated branch name:

git clone git://git.yoctoproject.org/meta-java -b zeus

2. Update .bb file for compile error in meta-java:

diff --git a/recipes-core/icedtea/icedtea7-native.inc b/recipes-core/icedtea/icedtea7-native.inc
index 8d0dc71..153a604 100644
--- a/recipes-core/icedtea/icedtea7-native.inc
+++ b/recipes-core/icedtea/icedtea7-native.inc
@@ -26,7 +26,7 @@ CXXFLAGS_append = " -fno-tree-dse"
CXX_append = " -std=gnu++98"

# WORKAROUND: ignore errors from new compilers
-CFLAGS_append = " -Wno-error=stringop-overflow -Wno-error=return-type"
+CFLAGS_append = " -Wno-error=stringop-overflow -Wno-error=return-type -Wno-error=format-overflow"

inherit native java autotools pkgconfig
inherit openjdk-build-helper

3. Add meta-java layer into bblayers.conf:

BBLAYERS += "${BSPDIR}/sources/meta-java"

4. Edit the conf/local.conf to add openjdk variables

# 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"

PREFERRED_PROVIDER_java2-runtime = " openjdk-7-jre"
IMAGE_INSTALL_append = " openjdk-7-jdk "
diff --git a/recipes-core/openjdk/openjdk-8-common.inc b/recipes-core/openjdk/openjdk-8-common.inc
index d8b30b8..ed03d60 100644
--- a/recipes-core/openjdk/openjdk-8-common.inc
+++ b/recipes-core/openjdk/openjdk-8-common.inc
@@ -181,5 +181,5 @@ FLAGS_GCC9 = "-fno-lifetime-dse -fno-delete-null-pointer-checks"
BUILD_CFLAGS_append = " ${@openjdk_build_helper_get_build_cflags(d)}"
BUILD_CXXFLAGS_append = " ${@openjdk_build_helper_get_build_cflags(d)}"
# flags for -cross
-TARGET_CFLAGS_append = " ${@openjdk_build_helper_get_target_cflags(d)}"
+TARGET_CFLAGS_append = " ${@openjdk_build_helper_get_target_cflags(d)} -Wno-error=format-overflow"
TARGET_CXXFLAGS_append = " ${@openjdk_build_helper_get_target_cflags(d)}"
diff --git a/recipes-core/openjdk/openjdk-8-native.inc b/recipes-core/openjdk/openjdk-8-native.inc
index 321a43d..97ff03f 100644

5. Switch the host GCC to gcc-8 and g++-8:

sudo apt-get install gcc-8 g++-8
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 --slave /usr/bin/g++ g++ /usr/bin/g++-8 --slave /usr/bin/gcov gcov /usr/bin/gcov-8 --slave /usr/bin/gcov-tool gcov-tool /usr/bin/gcov-tool-8 --slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-8 --slave /usr/bin/gcc-nm gcc-nm /usr/bin/gcc-nm-8 --slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-8
sudo update-alternatives --config gcc 

6. And change the conf/local.conf from openjdk-7 -> openjdk-8:

PREFERRED_PROVIDER_java2-runtime = " openjdk-8-jre"
IMAGE_INSTALL_append = " openjdk-8 " 
%3CLINGO-SUB%20id%3D%22lingo-sub-1202244%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EAdding%20Openjdk%20support%20to%20zeus%20yocto%20layer%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1202244%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%0A%3CP%3EEnvironment%3A%26nbsp%3Bopenjdk-8%20with%20L5.4.24-2.1.0%20and%20GCC-9%3C%2FP%3E%0A%3CP%3E1.%20Clone%20meta-java%20with%20dedicated%20branch%20name%3A%3C%2FP%3E%0A%3CPRE%3Egit%20clone%20git%3A%2F%2Fgit.yoctoproject.org%2Fmeta-java%20-b%20zeus%3C%2FPRE%3E%0A%3CP%3E2.%20Update%20.bb%20file%20for%20compile%20error%20in%20meta-java%3A%3C%2FP%3E%0A%3CPRE%3Ediff%20--git%20a%2Frecipes-core%2Ficedtea%2Ficedtea7-native.inc%20b%2Frecipes-core%2Ficedtea%2Ficedtea7-native.inc%3CBR%20%2F%3Eindex%208d0dc71..153a604%20100644%3CBR%20%2F%3E---%20a%2Frecipes-core%2Ficedtea%2Ficedtea7-native.inc%3CBR%20%2F%3E%2B%2B%2B%20b%2Frecipes-core%2Ficedtea%2Ficedtea7-native.inc%3CBR%20%2F%3E%40%40%20-26%2C7%20%2B26%2C7%20%40%40%20CXXFLAGS_append%20%3D%20%22%20-fno-tree-dse%22%3CBR%20%2F%3ECXX_append%20%3D%20%22%20-std%3Dgnu%2B%2B98%22%3CBR%20%2F%3E%3CBR%20%2F%3E%23%20WORKAROUND%3A%20ignore%20errors%20from%20new%20compilers%3CBR%20%2F%3E-CFLAGS_append%20%3D%20%22%20-Wno-error%3Dstringop-overflow%20-Wno-error%3Dreturn-type%22%3CBR%20%2F%3E%2BCFLAGS_append%20%3D%20%22%20-Wno-error%3Dstringop-overflow%20-Wno-error%3Dreturn-type%20-Wno-error%3Dformat-overflow%22%3CBR%20%2F%3E%3CBR%20%2F%3Einherit%20native%20java%20autotools%20pkgconfig%3CBR%20%2F%3Einherit%20openjdk-build-helper%3C%2FPRE%3E%0A%3CP%3E3.%20Add%20meta-java%20layer%20into%20bblayers.conf%3A%3C%2FP%3E%0A%3CPRE%3EBBLAYERS%20%2B%3D%20%22%24%7BBSPDIR%7D%2Fsources%2Fmeta-java%22%3C%2FPRE%3E%0A%3CP%3E4.%20Edit%20the%20conf%2Flocal.conf%20to%20add%20openjdk%20variables%3C%2FP%3E%0A%3CPRE%3E%23%20Possible%20provider%3A%20cacao-initial-native%20and%20jamvm-initial-native%3CBR%20%2F%3EPREFERRED_PROVIDER_virtual%2Fjava-initial-native%20%3D%20%22cacao-initial-native%22%3CBR%20%2F%3E%3CBR%20%2F%3E%23%20Possible%20provider%3A%20cacao-native%20and%20jamvm-native%3CBR%20%2F%3EPREFERRED_PROVIDER_virtual%2Fjava-native%20%3D%20%22jamvm-native%22%3CBR%20%2F%3E%3CBR%20%2F%3E%23%20Optional%20since%20there%20is%20only%20one%20provider%20for%20now%3CBR%20%2F%3EPREFERRED_PROVIDER_virtual%2Fjavac-native%20%3D%20%22ecj-bootstrap-native%22%3CBR%20%2F%3E%3CBR%20%2F%3EPREFERRED_PROVIDER_java2-runtime%20%3D%20%22%20openjdk-7-jre%22%3CBR%20%2F%3EIMAGE_INSTALL_append%20%3D%20%22%20openjdk-7-jdk%20%22%3C%2FPRE%3E%0A%3CPRE%3Ediff%20--git%20a%2Frecipes-core%2Fopenjdk%2Fopenjdk-8-common.inc%20b%2Frecipes-core%2Fopenjdk%2Fopenjdk-8-common.inc%3CBR%20%2F%3Eindex%20d8b30b8..ed03d60%20100644%3CBR%20%2F%3E---%20a%2Frecipes-core%2Fopenjdk%2Fopenjdk-8-common.inc%3CBR%20%2F%3E%2B%2B%2B%20b%2Frecipes-core%2Fopenjdk%2Fopenjdk-8-common.inc%3CBR%20%2F%3E%40%40%20-181%2C5%20%2B181%2C5%20%40%40%20FLAGS_GCC9%20%3D%20%22-fno-lifetime-dse%20-fno-delete-null-pointer-checks%22%3CBR%20%2F%3EBUILD_CFLAGS_append%20%3D%20%22%20%24%7B%40openjdk_build_helper_get_build_cflags(d)%7D%22%3CBR%20%2F%3EBUILD_CXXFLAGS_append%20%3D%20%22%20%24%7B%40openjdk_build_helper_get_build_cflags(d)%7D%22%3CBR%20%2F%3E%23%20flags%20for%20-cross%3CBR%20%2F%3E-TARGET_CFLAGS_append%20%3D%20%22%20%24%7B%40openjdk_build_helper_get_target_cflags(d)%7D%22%3CBR%20%2F%3E%2BTARGET_CFLAGS_append%20%3D%20%22%20%24%7B%40openjdk_build_helper_get_target_cflags(d)%7D%20-Wno-error%3Dformat-overflow%22%3CBR%20%2F%3ETARGET_CXXFLAGS_append%20%3D%20%22%20%24%7B%40openjdk_build_helper_get_target_cflags(d)%7D%22%3CBR%20%2F%3Ediff%20--git%20a%2Frecipes-core%2Fopenjdk%2Fopenjdk-8-native.inc%20b%2Frecipes-core%2Fopenjdk%2Fopenjdk-8-native.inc%3CBR%20%2F%3Eindex%20321a43d..97ff03f%20100644%3C%2FPRE%3E%0A%3CP%3E5.%20Switch%20the%20host%20GCC%20to%20gcc-8%20and%20g%2B%2B-8%3A%3C%2FP%3E%0A%3CPRE%3Esudo%20apt-get%20install%20gcc-8%20g%2B%2B-8%3CBR%20%2F%3Esudo%20update-alternatives%20--install%20%2Fusr%2Fbin%2Fgcc%20gcc%20%2Fusr%2Fbin%2Fgcc-8%20--slave%20%2Fusr%2Fbin%2Fg%2B%2B%20g%2B%2B%20%2Fusr%2Fbin%2Fg%2B%2B-8%20--slave%20%2Fusr%2Fbin%2Fgcov%20gcov%20%2Fusr%2Fbin%2Fgcov-8%20--slave%20%2Fusr%2Fbin%2Fgcov-tool%20gcov-tool%20%2Fusr%2Fbin%2Fgcov-tool-8%20--slave%20%2Fusr%2Fbin%2Fgcc-ar%20gcc-ar%20%2Fusr%2Fbin%2Fgcc-ar-8%20--slave%20%2Fusr%2Fbin%2Fgcc-nm%20gcc-nm%20%2Fusr%2Fbin%2Fgcc-nm-8%20--slave%20%2Fusr%2Fbin%2Fgcc-ranlib%20gcc-ranlib%20%2Fusr%2Fbin%2Fgcc-ranlib-8%3CBR%20%2F%3Esudo%20update-alternatives%20--config%20gcc%26nbsp%3B%3C%2FPRE%3E%0A%3CP%3E6.%26nbsp%3BAnd%20change%20the%20conf%2Flocal.conf%20from%20openjdk-7%20-%26gt%3B%20openjdk-8%3A%3C%2FP%3E%0A%3CPRE%3EPREFERRED_PROVIDER_java2-runtime%20%3D%20%22%20openjdk-8-jre%22%3CBR%20%2F%3EIMAGE_INSTALL_append%20%3D%20%22%20openjdk-8%20%22%26nbsp%3B%3C%2FPRE%3E%0A%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1202244%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3Ei.MX%208%20Family%20%7C%20i.MX%208QuadMax%20(8QM)%20%7C%208QuadPlus%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
No ratings
Version history
Last update:
‎12-21-2020 12:05 AM
Updated by: