diff --git a/packages/graphics/libmali/package.mk b/packages/graphics/libmali/package.mk index cfcbd17abd7..5e92262fa56 100644 --- a/packages/graphics/libmali/package.mk +++ b/packages/graphics/libmali/package.mk @@ -2,13 +2,14 @@ # Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv) PKG_NAME="libmali" -PKG_VERSION="ad56ed30985471c0950a654cc9db1e86310650d5" -PKG_SHA256="72438ea73cf6c2e8e770545872386b66ccad200c568261e5304845547099c9ed" +PKG_VERSION="28f97bf45f5e71cf760b6d8a7abba231998c68c1" +PKG_SHA256="bf4de370efb2ead9153594a617430611af5b6801a93f6825b9ede2b7f5692cd6" PKG_ARCH="arm aarch64" PKG_LICENSE="nonfree" PKG_SITE="https://github.com/LibreELEC/libmali" PKG_URL="https://github.com/LibreELEC/libmali/archive/$PKG_VERSION.tar.gz" PKG_LONGDESC="OpenGL ES user-space binary for the ARM Mali GPU family" +PKG_STAMP="$MALI_FAMILY" PKG_DEPENDS_TARGET="libdrm" @@ -18,10 +19,19 @@ fi PKG_CMAKE_OPTS_TARGET="-DMALI_VARIANT=$MALI_FAMILY" -if [ -n "$MALI_REVISION" ]; then - PKG_CMAKE_OPTS_TARGET+=" -DMALI_REVISION=$MALI_REVISION" -fi - if [ "$TARGET_ARCH" = "aarch64" ]; then PKG_CMAKE_OPTS_TARGET+=" -DMALI_ARCH=aarch64-linux-gnu" fi + +post_makeinstall_target() { + mkdir -p $INSTALL/usr/bin + cp -v $PKG_DIR/scripts/libmali-setup $INSTALL/usr/bin + + if [ $(ls -1q $INSTALL/usr/lib/libmali-*.so | wc -l) -gt 1 ]; then + ln -sfv /var/lib/libmali/libmali.so $INSTALL/usr/lib/libmali.so + fi +} + +post_install() { + enable_service libmali-setup.service +} diff --git a/packages/graphics/libmali/scripts/libmali-setup b/packages/graphics/libmali/scripts/libmali-setup new file mode 100755 index 00000000000..0061695cdea --- /dev/null +++ b/packages/graphics/libmali/scripts/libmali-setup @@ -0,0 +1,44 @@ +#!/bin/sh + +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv) + +GPUINFO=/sys/kernel/debug/mali/version +[ ! -f "$GPUINFO" ] && GPUINFO=$(find /sys/devices/platform -name gpuinfo) + +echo "GPUINFO: $GPUINFO" +[ ! -f "$GPUINFO" ] && exit + +GPU=$(cat $GPUINFO) +echo "GPU: $GPU" + +case $GPU in + Mali-400*) LIB="libmali-utgard-400-*.so" ;; + Mali-450*) LIB="libmali-utgard-450-*.so" ;; + Mali-T60x*) LIB="libmali-midgard-t60x-*.so" ;; + Mali-T62x*) LIB="libmali-midgard-t620-*.so" ;; + Mali-T72x*) LIB="libmali-midgard-t720-*.so" ;; + Mali-T76x*r0p0*) LIB="libmali-midgard-t76x-*-r0p0-*.so" ;; + Mali-T76x*r1p0*) LIB="libmali-midgard-t76x-*-r1p0-*.so" ;; + Mali-T82x*) LIB="libmali-midgard-t82x-*.so" ;; + Mali-T83x*) LIB="libmali-midgard-t83x-*.so" ;; + Mali-T86x*) LIB="libmali-midgard-t86x-*.so" ;; + Mali-T88x*) LIB="libmali-midgard-t88x-*.so" ;; + Mali-G31*) LIB="libmali-bifrost-g31-*.so" ;; + Mali-G51*) LIB="libmali-bifrost-g51-*.so" ;; + Mali-G52*) LIB="libmali-bifrost-g52-*.so" ;; + Mali-G71*) LIB="libmali-bifrost-g71-*.so" ;; + Mali-G72*) LIB="libmali-bifrost-g72-*.so" ;; + Mali-G76*) LIB="libmali-bifrost-g76-*.so" ;; +esac + +echo "LIB: $LIB" +[ -z "$LIB" ] && exit + +LIBMALI=$(find /usr/lib -name $LIB) + +echo "LIBMALI: $LIBMALI" +[ ! -f "$LIBMALI" ] && exit + +mkdir -p /var/lib/libmali +ln -sf $LIBMALI /var/lib/libmali/libmali.so diff --git a/packages/graphics/libmali/system.d/libmali-setup.service b/packages/graphics/libmali/system.d/libmali-setup.service new file mode 100644 index 00000000000..b1eb1b42d0e --- /dev/null +++ b/packages/graphics/libmali/system.d/libmali-setup.service @@ -0,0 +1,12 @@ +[Unit] +Description=Setup symlink for ARM Mali library +Before=graphical.target +After=multi-user.target + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/usr/bin/libmali-setup + +[Install] +WantedBy=multi-user.target