diff --git a/projects/Amlogic/devices/S912/filesystem/usr/lib/systemd/system/cpufreq.service b/projects/Amlogic/devices/S912/filesystem/usr/lib/systemd/system/cpufreq.service new file mode 100644 index 0000000000..afbc794ecb --- /dev/null +++ b/projects/Amlogic/devices/S912/filesystem/usr/lib/systemd/system/cpufreq.service @@ -0,0 +1,9 @@ +[Unit] +Description=Set minimum frequency to 1GHz for both CPU clusters + +[Service] +Type=simple +ExecStart=-/usr/bin/sh -c 'echo 1000000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq; echo 1000000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq' + +[Install] +WantedBy=basic.target diff --git a/projects/Amlogic/devices/S912/options b/projects/Amlogic/devices/S912/options new file mode 100644 index 0000000000..2c77cc8ff7 --- /dev/null +++ b/projects/Amlogic/devices/S912/options @@ -0,0 +1,8 @@ + # Kernel extra targets to build + KERNEL_UBOOT_EXTRA_TARGET="gxm_q200_2g.dtb gxm_q201_1g.dtb gxm_q201_2g.dtb" + + # OpenGL-ES implementation to use (no / bcm2835-driver / gpu-viv-bin-mx6q / opengl-meson) + OPENGLES="opengl-meson-t82x" + + # Amlogic Meson SOC family (8 / 6 / gxbb) + MESON_FAMILY="gxm" diff --git a/projects/Amlogic/devices/S912/packages/android-headers/package.mk b/projects/Amlogic/devices/S912/packages/android-headers/package.mk new file mode 100644 index 0000000000..d34b9a9244 --- /dev/null +++ b/projects/Amlogic/devices/S912/packages/android-headers/package.mk @@ -0,0 +1,29 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2017-present Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="android-headers" +PKG_VERSION="25" +PKG_SHA256="1e0ecdf56c33aaa523109254e2c475878d8cfc5795ebd4bb5ecbaf80926f4fe9" +PKG_ARCH="any" +PKG_LICENSE="Apache" +PKG_SITE="https://android.googlesource.com/" +PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_SECTION="devel" +PKG_SHORTDESC="android-headers: Android Platform Headers from AOSP releases" +PKG_TOOLCHAIN="manual" diff --git a/projects/Amlogic/devices/S912/packages/libhybris/package.mk b/projects/Amlogic/devices/S912/packages/libhybris/package.mk new file mode 100644 index 0000000000..7244425c17 --- /dev/null +++ b/projects/Amlogic/devices/S912/packages/libhybris/package.mk @@ -0,0 +1,36 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2017-present Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="libhybris" +PKG_VERSION="070c3ab" +PKG_SHA256="070dcf48aa424c1c56c1d95f5116051a22a76bd5ac0c877febf04b63d9559ea2" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/libhybris/libhybris" +PKG_URL="https://github.com/libhybris/libhybris/archive/$PKG_VERSION.tar.gz" +PKG_SOURCE_DIR="$PKG_NAME-$PKG_VERSION*/hybris" +PKG_DEPENDS_TARGET="toolchain android-headers" +PKG_SECTION="devel" +PKG_SHORTDESC="libhybris: Allows to run bionic-based HW adaptations in glibc systems - libs" +PKG_TOOLCHAIN="autotools" + +PKG_CONFIGURE_OPTS_TARGET="--enable-arch=$TARGET_ARCH \ + --with-default-egl-platform=fbdev \ + --with-android-headers=$BUILD/android-headers-25 \ + --with-default-hybris-ld-library-path=/system/lib \ + --enable-mali-quirks" diff --git a/projects/Amlogic/devices/S912/packages/libhybris/patches/libhybris-Build-only-EGL-GLESv1-and-GLESv2.patch b/projects/Amlogic/devices/S912/packages/libhybris/patches/libhybris-Build-only-EGL-GLESv1-and-GLESv2.patch new file mode 100644 index 0000000000..35178890f5 --- /dev/null +++ b/projects/Amlogic/devices/S912/packages/libhybris/patches/libhybris-Build-only-EGL-GLESv1-and-GLESv2.patch @@ -0,0 +1,19 @@ +diff --git a/Makefile.am b/Makefile.am +index 906140e..75888ae 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -6,13 +6,7 @@ endif + if HAS_ANDROID_5_0_0 + SUBDIRS += libsync + endif +-SUBDIRS += egl glesv1 glesv2 ui sf input camera vibrator media wifi +- +-if HAS_LIBNFC_NXP_HEADERS +-SUBDIRS += libnfc_nxp libnfc_ndef_nxp +-endif +-SUBDIRS += utils tests +- ++SUBDIRS += egl glesv1 glesv2 + + MAINTAINERCLEANFILES = \ + aclocal.m4 compile config.guess config.sub \ diff --git a/projects/Amlogic/devices/S912/packages/libhybris/patches/libhybris-eglplatform_fbdev-open-new-framebuffer-when-creating.patch b/projects/Amlogic/devices/S912/packages/libhybris/patches/libhybris-eglplatform_fbdev-open-new-framebuffer-when-creating.patch new file mode 100644 index 0000000000..db135a7c1b --- /dev/null +++ b/projects/Amlogic/devices/S912/packages/libhybris/patches/libhybris-eglplatform_fbdev-open-new-framebuffer-when-creating.patch @@ -0,0 +1,51 @@ +From bd11dbc285303c0fe4039b5058360f38c5614cae Mon Sep 17 00:00:00 2001 +From: kszaq +Date: Tue, 16 Jan 2018 23:41:52 +0100 +Subject: [PATCH] eglplatform_fbdev: open new framebuffer when creating a + window + +Framebuffer device has to be reopened when creating a new window +to adapt its size to display. This is required e.g. after screen +resolution changed. +--- + hybris/egl/platforms/fbdev/eglplatform_fbdev.cpp | 17 ++++++++++------- + 1 file changed, 10 insertions(+), 7 deletions(-) + +diff --git a/egl/platforms/fbdev/eglplatform_fbdev.cpp b/egl/platforms/fbdev/eglplatform_fbdev.cpp +index c25a2d7..c75073f 100644 +--- a/egl/platforms/fbdev/eglplatform_fbdev.cpp ++++ b/egl/platforms/fbdev/eglplatform_fbdev.cpp +@@ -29,13 +29,6 @@ extern "C" void fbdevws_init_module(struct ws_egl_interface *egl_iface) + assert(0); + } + +- err = framebuffer_open((hw_module_t *) gralloc, &framebuffer); +- if (err) { +- fprintf(stderr, "ERROR: failed to open framebuffer: (%s)\n",strerror(-err)); +- assert(0); +- } +- TRACE("** framebuffer_open: status=(%s) format=x%x", strerror(-err), framebuffer->format); +- + err = gralloc_open((const hw_module_t *) gralloc, &alloc); + if (err) { + fprintf(stderr, "ERROR: failed to open gralloc: (%s)\n",strerror(-err)); +@@ -66,6 +59,16 @@ extern "C" EGLNativeWindowType fbdevws_CreateWindow(EGLNativeWindowType win, _EG + assert (gralloc != NULL); + assert (_nativewindow == NULL); + ++ if (framebuffer) ++ framebuffer_close(framebuffer); ++ ++ int err = framebuffer_open((hw_module_t *) gralloc, &framebuffer); ++ if (err) { ++ fprintf(stderr, "ERROR: failed to open framebuffer: (%s)\n",strerror(-err)); ++ assert(0); ++ } ++ TRACE("** framebuffer_open: status=(%s) format=x%x", strerror(-err), framebuffer->format); ++ + _nativewindow = new FbDevNativeWindow(alloc, framebuffer); + _nativewindow->common.incRef(&_nativewindow->common); + return (EGLNativeWindowType) static_cast(_nativewindow); +-- +2.7.4 + diff --git a/projects/Amlogic/devices/S912/packages/opengl-meson-t82x/package.mk b/projects/Amlogic/devices/S912/packages/opengl-meson-t82x/package.mk new file mode 100644 index 0000000000..45150c729c --- /dev/null +++ b/projects/Amlogic/devices/S912/packages/opengl-meson-t82x/package.mk @@ -0,0 +1,40 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2017-present Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="opengl-meson-t82x" +PKG_VERSION="915cb48" +PKG_SHA256="9b5f65afa21250b67578c250da030a5829e69131ce91b2f167b01b1ed30be781" +PKG_ARCH="arm" +PKG_LICENSE="nonfree" +PKG_SITE="https://github.com/kszaq/opengl-meson-t82x" +PKG_URL="https://github.com/kszaq/opengl-meson-t82x/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain libhybris" +PKG_SOURCE_DIR="$PKG_NAME-$PKG_VERSION*" +PKG_SECTION="graphics" +PKG_SHORTDESC="opengl-meson: OpenGL ES pre-compiled libraries for Mali GPUs found in Amlogic Meson SoCs" +PKG_LONGDESC="opengl-meson: OpenGL ES pre-compiled libraries for Mali GPUs found in Amlogic Meson SoCs. The libraries were extracted from Khadas VIM2 Android firmware." +PKG_TOOLCHAIN="manual" + +makeinstall_target() { + mkdir -p $INSTALL/system + cp -a system/* $INSTALL/system +} + +post_install() { + enable_service unbind-console.service +} diff --git a/projects/Amlogic/devices/S912/packages/opengl-meson-t82x/system.d/unbind-console.service b/projects/Amlogic/devices/S912/packages/opengl-meson-t82x/system.d/unbind-console.service new file mode 100644 index 0000000000..a79c37ad11 --- /dev/null +++ b/projects/Amlogic/devices/S912/packages/opengl-meson-t82x/system.d/unbind-console.service @@ -0,0 +1,11 @@ +[Unit] +Description=Unbind framebuffer console + +ConditionPathExists=/sys/class/vtconsole/vtcon1/bind + +[Service] +Type=oneshot +ExecStart=/bin/sh -c 'echo 0 > /sys/class/vtconsole/vtcon1/bind' + +[Install] +WantedBy=graphical.target