I wanted to try to use the Liberica JDK provided by https://bell-sw.com/ in Yocto. I didn't see a recipe for it so I tried to create my own. It simply pulls down the 32 bit arm pre-compiled binaries and installs them. This is my .bb
file.
LICENSE = "CLOSED"
SRC_URI += "\
https://download.bell-sw.com/java/11.0.11+9/bellsoft-jdk11.0.11+9-linux-arm32-vfp-hflt-full.tar.gz \
"
SRC_URI[sha1sum] = "973d357361fd2a9c328e37c93e6f546ee43ade5f"
S = "${WORKDIR}/jdk-11.0.11-full"
INSANE_SKIP_${PN} = "ldflags"
INHIBIT_PACKAGE_STRIP = "1"
INHIBIT_SYSROOT_STRIP = "1"
INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
do_install() {
install -d ${D}/usr/share/java/
install -d ${D}/usr/lib/jvm/jdk-11.0.11-bellsoft
cp -r "${S}" ${D}/usr/lib/jvm/jdk-11.0.11-bellsoft
}
FILES_${PN} += "/"
do_package_qa[noexec] = "1"
EXCLUDE_FROM_SHLIBS = "1"
This pulls it down and adds it to my image fine. However, when I flash the image and boot it up, the java binary segfaults. I thought this was weird so I manually downloaded the same exact tarball on the target with the same checksum and extracted it and that one worked just fine. I then diff
ed the two binaries and noticed that some how they are different! Which makes me wonder if yocto/bitbake could be doing something to the precompiled binaries.
Doing an ls -l
shows that the binaries are a different size as well. This made me check through the workspace to see if the file changed during extracting and it didn't.
# Checking the workspace where I install the binary has the correct size
ls -l tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/bellsoft-jdk/11.0.11-r0/image/usr/lib/jvm/jdk-11.0.11-bellsoft/jdk-11.0.11-full/bin/java | awk '{print $5}'
8120
# Checking on the target where the image is installed has the incorrect size
ls -l /usr/lib/jvm/jdk-11.0.11-bellsoft/jdk-11.0.11-full/bin/java | awk '{print $5}'
9788
Does anyone know what might result in the binary changing?
The problem is the image-prelink
task running during do_image
. Prelink modifies the binaries in a list of directories, including /usr/lib
, but not /usr/share
. In newer versions of Yocto, prelink is not enabled by default, as it can sometimes cause issues and is not helpful for reproducible builds.
You can also disable it by removing image-prelink
from USER_CLASSES
in your local.conf
.