diff --git a/projects/Amlogic/devices/LePotato/options b/projects/Amlogic/devices/LePotato/options index e7e44771f4..714daeb5a7 100644 --- a/projects/Amlogic/devices/LePotato/options +++ b/projects/Amlogic/devices/LePotato/options @@ -9,3 +9,6 @@ # Kernel extra targets to build KERNEL_UBOOT_EXTRA_TARGET="gxl_p212_1g_lepotato.dtb gxl_p212_2g_lepotato.dtb" + + # Additional kernel dependencies + KERNEL_EXTRA_DEPENDS_TARGET="device-trees-amlogic" diff --git a/projects/Amlogic/devices/LePotato/patches/linux/linux-0001-lepotato-dtb-overlay.patch b/projects/Amlogic/devices/LePotato/patches/linux/linux-0001-lepotato-dtb-overlay.patch deleted file mode 100644 index f1adf5743a..0000000000 --- a/projects/Amlogic/devices/LePotato/patches/linux/linux-0001-lepotato-dtb-overlay.patch +++ /dev/null @@ -1,62 +0,0 @@ -diff --git a/arch/arm64/boot/dts/amlogic/gxl_p212_1g_lepotato.dts b/arch/arm64/boot/dts/amlogic/gxl_p212_1g_lepotato.dts -new file mode 100644 -index 0000000..8272581 ---- /dev/null -+++ b/arch/arm64/boot/dts/amlogic/gxl_p212_1g_lepotato.dts -@@ -0,0 +1,25 @@ -+#include "gxl_p212_1g.dts" -+ -+/ { -+ leds: gpio_leds { -+ compatible = "gpio-leds"; -+ -+ system { -+ label = "librecomputer:system-status"; -+ gpios = <&gpio GPIODV_24 GPIO_ACTIVE_HIGH>; -+ default-state = "on"; -+ panic-indicator; -+ }; -+ -+ blue { -+ label = "librecomputer:blue"; -+ gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>; -+ default-state = "on"; -+ }; -+ }; -+ -+ gpio_keypad { -+ status = "disabled"; -+ }; -+ -+}; -diff --git a/arch/arm64/boot/dts/amlogic/gxl_p212_2g_lepotato.dts b/arch/arm64/boot/dts/amlogic/gxl_p212_2g_lepotato.dts -new file mode 100644 -index 0000000..75f8bc7 ---- /dev/null -+++ b/arch/arm64/boot/dts/amlogic/gxl_p212_2g_lepotato.dts -@@ -0,0 +1,25 @@ -+#include "gxl_p212_2g.dts" -+ -+/ { -+ leds: gpio_leds { -+ compatible = "gpio-leds"; -+ -+ system { -+ label = "librecomputer:system-status"; -+ gpios = <&gpio GPIODV_24 GPIO_ACTIVE_HIGH>; -+ default-state = "on"; -+ panic-indicator; -+ }; -+ -+ blue { -+ label = "librecomputer:blue"; -+ gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>; -+ default-state = "on"; -+ }; -+ }; -+ -+ gpio_keypad { -+ status = "disabled"; -+ }; -+ -+}; diff --git a/projects/Amlogic/devices/S905/options b/projects/Amlogic/devices/S905/options index 13a28c7fac..6f0250b69b 100644 --- a/projects/Amlogic/devices/S905/options +++ b/projects/Amlogic/devices/S905/options @@ -1,3 +1,6 @@ + # Additional kernel dependencies + KERNEL_EXTRA_DEPENDS_TARGET="device-trees-amlogic" + # additional drivers to install: # for a list of additinoal drivers see packages/linux-drivers # Space separated list is supported, diff --git a/projects/Amlogic/devices/S912/options b/projects/Amlogic/devices/S912/options index 177d31d8fa..6af65e3030 100644 --- a/projects/Amlogic/devices/S912/options +++ b/projects/Amlogic/devices/S912/options @@ -1,6 +1,9 @@ # Kernel extra targets to build KERNEL_UBOOT_EXTRA_TARGET="gxm_q200_2g.dtb gxm_q201_1g.dtb gxm_q201_2g.dtb" + # Additional kernel dependencies + KERNEL_EXTRA_DEPENDS_TARGET="device-trees-amlogic" + # OpenGL-ES implementation to use (no / bcm2835-driver / gpu-viv-bin-mx6q / opengl-meson) OPENGLES="opengl-meson-t82x" diff --git a/projects/Amlogic/options b/projects/Amlogic/options index a7e6ec9c33..b92f22ca94 100644 --- a/projects/Amlogic/options +++ b/projects/Amlogic/options @@ -64,7 +64,6 @@ # kernel image name KERNEL_NAME="kernel.img" - ################################################################################ # setup build defaults ################################################################################ diff --git a/projects/Amlogic/packages/device-trees-amlogic/package.mk b/projects/Amlogic/packages/device-trees-amlogic/package.mk new file mode 100644 index 0000000000..af6038cee8 --- /dev/null +++ b/projects/Amlogic/packages/device-trees-amlogic/package.mk @@ -0,0 +1,78 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016-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="device-trees-amlogic" +PKG_VERSION="8a3cfc7" +PKG_SHA256="377e43f346680ae93bb08120fefaa291ce9e4e7cc2947aae0aeba674d46674b8" +PKG_LICENSE="GPL" +PKG_URL="https://github.com/LibreELEC/device-trees-amlogic/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain" +PKG_IS_KERNEL_PKG="yes" +PKG_TOOLCHAIN="manual" + +make_target() { + # Enter kernel directory + pushd $BUILD/linux-$(kernel_version) > /dev/null + + # Device trees already present in kernel tree we want to include + EXTRA_TREES=(gxbb_p201 gxl_p212_1g gxl_p212_2g gxm_q200_2g gxm_q201_1g gxm_q201_2g gxl_p281_1g) + + # Add trees to the list + for f in ${EXTRA_TREES[@]}; do + DTB_LIST="$DTB_LIST $f.dtb" + done + + # Copy all device trees to kernel source folder and create a list + cp -f $PKG_BUILD/*.dts* arch/$TARGET_KERNEL_ARCH/boot/dts/amlogic/ + for f in $PKG_BUILD/*.dts; do + DTB_NAME="$(basename $f .dts).dtb" + DTB_LIST="$DTB_LIST $DTB_NAME" + done + + # Filter device tree list depending on project + case "$DEVICE" in + S905) + for f in ${DTB_LIST[@]}; do + [[ "$f" == gxbb* ]] || [[ "$f" == gxl* ]] && DTB_LIST_FILTERED="$DTB_LIST_FILTERED $f" + done + ;; + S912) + for f in ${DTB_LIST[@]}; do + [[ "$f" == gxm* ]] && DTB_LIST_FILTERED="$DTB_LIST_FILTERED $f" + done + ;; + *) + for f in ${DTB_LIST[@]}; do + if listcontains "$KERNEL_UBOOT_EXTRA_TARGET" "$f"; then + DTB_LIST_FILTERED="$DTB_LIST_FILTERED $f" + fi + done + ;; + esac + + # Compile device trees + LDFLAGS="" make $DTB_LIST_FILTERED + mv arch/$TARGET_KERNEL_ARCH/boot/dts/amlogic/*.dtb $PKG_BUILD + + popd > /dev/null +} + +makeinstall_target() { + mkdir -p $INSTALL/usr/share/bootloader + cp -a $PKG_BUILD/*.dtb $INSTALL/usr/share/bootloader +}