Skip to content
Permalink
Browse files

Add GPU userland libraries

Signed-off-by: Christophe Priouzeau <christophe.priouzeau@st.com>
  • Loading branch information...
cpriouzeau committed Feb 5, 2019
1 parent 8421ad5 commit a2f806d40bd8485f128e8232becdd8ac563c9b30
@@ -0,0 +1,13 @@
[Unit]
Description=Create link for gcnano-userland
Wants=systemd-udevd.service systemd-udev-trigger.service
After=systemd-remount-fs.service systemd-udevd.service

[Service]
Type=oneshot
ExecStartPre=-/bin/ln -sf /usr/lib/libEGL.so /usr/lib/libEGL.so.1
ExecStart=-/bin/ln -sf /usr/lib/libGLESv2.so /usr/lib/libGLESv2.so.2
ExecStartPost=/bin/systemctl disable gcnano-userland-make-link.service

[Install]
WantedBy=basic.target
@@ -0,0 +1,182 @@
DESCRIPTION = "STMicrolectronics port of the EGL, GLESv1_CM and GLES_v2 libraries from Vivante for the gcnano 3D core."
LICENSE = "Proprietary"
LIC_FILES_CHKSUM = "file://${TAR_FILENAME}/LICENSE;md5=dd36864f287701862a189a69fc50f1d8"

PACKAGE_ARCH = "${MACHINE_ARCH}"

DEPENDS += " gcnano-driver-stm32mp "

PROVIDES += "gcnano-userland virtual/libgles1 virtual/libgles2 virtual/egl virtual/libvg virtual/libgbm"

TAR_FILENAME = "gcnano-userland-${BACKEND}-${PV}-${GCNANO_USERLAND_FB_TARBALL_DATE}"

SRC_URI = "git://github.com/STMicroelectronics/gcnano-binaries;protocol=https;branch=gcnano-6.2.4_p3-binaries"
SRCREV = "271f87d816a957bf196f6328c34110cab1224d4d"

# service to create link at first boot
SRC_URI += "file://gcnano-userland-make-link.service"

PV = "6.2.4.p3"

S = "${WORKDIR}/git"

inherit systemd
SYSTEMD_PACKAGES += " gcnano-userland-multi-binary-stm32mp "
SYSTEMD_SERVICE_${PN} = "gcnano-userland-make-link.service"
SYSTEMD_AUTO_ENABLE_${PN} = "enable"

# Variable for using vendor directory instead of usr
GCNANO_USERLAND_USE_VENDOR_DIR ?= "1"
GCNANO_USERLAND_VENDOR_DIR ?= "/vendor"
GCNANO_USERLAND_OUTPUT_LIBDIR = "${@'${GCNANO_USERLAND_VENDOR_DIR}/lib' if d.getVar('GCNANO_USERLAND_USE_VENDOR_DIR') == '1' else '${libdir}'}"

# Action stubbed
do_configure[noexec] = "1"
do_compile[noexec] = "1"

#------------------------------------------
# Overwrite of do_unpack to untar the tarball
do_unpack[depends] += "xz-native:do_populate_sysroot"
gcnano_userland_binaries_unpack() {
cd ${S}
sh ${TAR_FILENAME}.bin --auto-accept
}

python do_unpack() {
eula = d.getVar('ACCEPT_EULA_'+d.getVar('MACHINE'))
eula_file = d.getVar('EULA_FILE_ST')
machine = d.getVar('MACHINE')
pkg = d.getVar('PN')
if eula == None:
bb.fatal("To use '%s' you need to accept the STMicroelectronics EULA at '%s'. "
"Please read it and in case you accept it, write: "
"ACCEPT_EULA_%s = \"1\" in your local.conf." % (pkg, eula_file, machine))
elif eula == '0':
bb.fatal("To use '%s' you need to accept the STMicroelectronics EULA." % pkg)
else:
bb.note("STMicroelectronics EULA has been accepted for '%s'" % pkg)

try:
externalsrc = d.getVar('EXTERNALSRC')
if not externalsrc:
bb.build.exec_func('base_do_unpack', d)
bb.build.exec_func('gcnano_userland_binaries_unpack', d)
except:
raise
}
do_unpack[vardepsexclude] += "EULA_FILE_ST"

#------------------------------------------
# clean
#
clean_release_file() {
rm -f ${D}/vendor/lib/*.multi.release.so
rm -f ${D}${libdir}/*.multi.release.so
}
clean_debug_file() {
rm -f ${D}/vendor/lib/*.multi.debug.so
rm -f ${D}${libdir}/*.multi.debug.so
}
#------------------------------------------
# Do install
#
do_install() {
if [ ${GCNANO_USERLAND_USE_VENDOR_DIR} -eq 1 ];
then
install -m 755 -d ${D}/${GCNANO_USERLAND_OUTPUT_LIBDIR}/ ${D}${libdir}
cp -R ${S}/${TAR_FILENAME}/usr ${D}/
mv ${D}${libdir}/*.so* ${D}/${GCNANO_USERLAND_OUTPUT_LIBDIR}/
cd ${D}${libdir}/
ln -sf ${GCNANO_USERLAND_OUTPUT_LIBDIR}/gbm_viv.so ${D}${libdir}/gbm_viv.so
ln -sf ${GCNANO_USERLAND_OUTPUT_LIBDIR}/libEGL.so ${D}${libdir}/libEGL.so
ln -sf ${GCNANO_USERLAND_OUTPUT_LIBDIR}/libGAL.so ${D}${libdir}/libGAL.so
ln -sf ${GCNANO_USERLAND_OUTPUT_LIBDIR}/libgbm.so ${D}${libdir}/libgbm.so
ln -sf ${GCNANO_USERLAND_OUTPUT_LIBDIR}/libgbm.so.1 ${D}${libdir}/libgbm.so.1
ln -sf ${GCNANO_USERLAND_OUTPUT_LIBDIR}/libGLESv1_CM.so ${D}${libdir}/libGLESv1_CM.so
ln -sf ${GCNANO_USERLAND_OUTPUT_LIBDIR}/libGLESv2.so ${D}${libdir}/libGLESv2.so
ln -sf ${GCNANO_USERLAND_OUTPUT_LIBDIR}/libGLSLC.so ${D}${libdir}/libGLSLC.so
ln -sf ${GCNANO_USERLAND_OUTPUT_LIBDIR}/libOpenVG.so ${D}${libdir}/libOpenVG.so
ln -sf ${GCNANO_USERLAND_OUTPUT_LIBDIR}/libVSC.so ${D}${libdir}/libVSC.so
LINK=`readlink ${D}${GCNANO_USERLAND_OUTPUT_LIBDIR}/libEGL.so`
ln -sf ${GCNANO_USERLAND_OUTPUT_LIBDIR}/$LINK ${D}${libdir}/libEGL.so.1
LINK=`readlink ${D}${GCNANO_USERLAND_OUTPUT_LIBDIR}/libGLESv2.so`
ln -sf ${GCNANO_USERLAND_OUTPUT_LIBDIR}/$LINK ${D}${libdir}/libGLESv2.so.2
# remove remove libwayland-egl which are now provided by wayland
if test -f ${D}${GCNANO_USERLAND_OUTPUT_LIBDIR}/libwayland-egl.so ;
then
rm ${D}${GCNANO_USERLAND_OUTPUT_LIBDIR}/libwayland-egl.so*
rm ${D}${libdir}/pkgconfig/wayland-egl.pc
fi
chown -R root.root ${D}/${GCNANO_USERLAND_OUTPUT_LIBDIR} ${D}${libdir}/
else
install -m 755 -d ${D}/usr/
cp -aR ${S}/${TAR_FILENAME}/usr ${D}/
fi
install -d ${D}${systemd_unitdir}/system
install -m 0644 ${WORKDIR}/gcnano-userland-make-link.service ${D}${systemd_unitdir}/system
}
# Cannot split or strip last added firmwares
INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
INHIBIT_PACKAGE_STRIP = "1"
INHIBIT_SYSROOT_STRIP = "1"
# Avoid QA Issue: No GNU_HASH in the elf binary
INSANE_SKIP_${PN} += "ldflags"
# Avoid QA Issue: non -dev/-dbg/nativesdk- package contains symlink .so
INSANE_SKIP_${PN} += "dev-so"
# Avoid QA Issue: file-rdeps
INSANE_SKIP_${PN} += "file-rdeps"
# Avoid QA Issue: debug-deps
INSANE_SKIP_${PN} += "debug-deps"
INSANE_SKIP_${PN}-dev += "dev-elf dev-so ldflags file-rdeps"
# Monolitic configuration
RPROVIDES_${PN} = "libegl libegl1 libgles1 libglesv1-cm1 libgles2 libglesv2-2 libvg libgbm gbm_viv"
RREPLACES_${PN} = "libegl libegl1 libgles1 libglesv1-cm1 libgles2 libglesv2-2 libvg libgbm gbm_viv"
RCONFLICTS_${PN} = "libegl libegl1 libgles1 libglesv1-cm1 libgles2 libglesv2-2 libvg libgbm gbm_viv"
PACKAGES = "${PN} ${PN}-dev "
SUMMARY_${PN} = "${SUMMARY}"
FILES_${PN} = "${GCNANO_USERLAND_OUTPUT_LIBDIR}/libEGL.so* ${GCNANO_USERLAND_OUTPUT_LIBDIR}/libEGL.*.${GCNANO_TYPE}.so"
FILES_${PN} += "${GCNANO_USERLAND_OUTPUT_LIBDIR}/libGLESv1_CM.so ${GCNANO_USERLAND_OUTPUT_LIBDIR}/libGLESv1_CM.*.${GCNANO_TYPE}.so"
FILES_${PN} += "${GCNANO_USERLAND_OUTPUT_LIBDIR}/libGLESv2.so* ${GCNANO_USERLAND_OUTPUT_LIBDIR}/libGLESv2.*.${GCNANO_TYPE}.so"
FILES_${PN} += "${GCNANO_USERLAND_OUTPUT_LIBDIR}/libOpenVG.so ${GCNANO_USERLAND_OUTPUT_LIBDIR}/libOpenVG.*.${GCNANO_TYPE}.so"
FILES_${PN} += "${GCNANO_USERLAND_OUTPUT_LIBDIR}/libGAL.so ${GCNANO_USERLAND_OUTPUT_LIBDIR}/libGAL.*.${GCNANO_TYPE}.so"
FILES_${PN} += "${GCNANO_USERLAND_OUTPUT_LIBDIR}/libVSC.so ${GCNANO_USERLAND_OUTPUT_LIBDIR}/libVSC.*.${GCNANO_TYPE}.so"
FILES_${PN} += "${GCNANO_USERLAND_OUTPUT_LIBDIR}/libGLSLC.so ${GCNANO_USERLAND_OUTPUT_LIBDIR}/libGLSLC.*.${GCNANO_TYPE}.so"
FILES_${PN} += "${GCNANO_USERLAND_OUTPUT_LIBDIR}/libgbm.so* ${GCNANO_USERLAND_OUTPUT_LIBDIR}/libgbm.*.${GCNANO_TYPE}.so*"
FILES_${PN} += "${GCNANO_USERLAND_OUTPUT_LIBDIR}/libwayland-viv*.so*"
FILES_${PN} += "${GCNANO_USERLAND_OUTPUT_LIBDIR}/gbm_viv.so ${GCNANO_USERLAND_OUTPUT_LIBDIR}/gbm_viv.*.${GCNANO_TYPE}.so"
FILES_${PN} += "${libdir}/"
FILES_${PN} += "${systemd_unitdir}/system"
SUMMARY_${PN}-dev = "${SUMMARY_${PN}} - Development files"
FILES_${PN}-dev = "${includedir} ${libdir}/pkgconfig/ ${libdir}/"
gcnano_sysroot() {
if [ ${GCNANO_USERLAND_USE_VENDOR_DIR} -eq 1 ];
then
# put all lthe library for on a same directory
# clean usr and ${GCNANO_USERLAND_OUTPUT_LIBDIR}
rm -rf ${SYSROOT_DESTDIR}/${libdir} ${SYSROOT_DESTDIR}/${GCNANO_USERLAND_OUTPUT_LIBDIR}
#copy from tarball
cp -aR ${S}/${TAR_FILENAME}/usr ${SYSROOT_DESTDIR}/
if test -f ${SYSROOT_DESTDIR}/${libdir}/libwayland-egl.so ;
then
rm ${SYSROOT_DESTDIR}${libdir}/libwayland-egl.so*
rm ${SYSROOT_DESTDIR}${libdir}/pkgconfig/wayland-egl.pc
fi
fi
}
SYSROOT_PREPROCESS_FUNCS =+ "gcnano_sysroot"
#SYSROOT_DIRS_append =+ " ${GCNANO_USERLAND_OUTPUT_LIBDIR} "
@@ -0,0 +1,19 @@
# Recipe for installing gcnano-userland binaries (gbm backend)
SUMMARY = "[DEBUG] Vivante libraries OpenGL ES, OpenVG and EGL (multi backend)"
LICENSE = "Proprietary"

BACKEND = "multi"

DEPENDS += " libdrm wayland "

GCNANO_TYPE = "debug"

GCNANO_USERLAND_FB_TARBALL_DATE = "20181210"

do_install_append() {
clean_release_file
}

include gcnano-userland-binary.inc

PROVIDES_remove = "gcnano-userland"
@@ -0,0 +1,17 @@
# Recipe for installing gcnano-userland binaries (gbm backend)
SUMMARY = "Vivante libraries OpenGL ES, OpenVG and EGL (multi backend)"
LICENSE = "Proprietary"

BACKEND = "multi"

DEPENDS += " libdrm wayland "

GCNANO_TYPE = "release"

GCNANO_USERLAND_FB_TARBALL_DATE = "20181210"

do_install_append() {
clean_debug_file
}

include gcnano-userland-binary.inc

0 comments on commit a2f806d

Please sign in to comment.
You can’t perform that action at this time.