From f6640b04f0973d128309cc5d95e314ec25411f62 Mon Sep 17 00:00:00 2001 From: kszaq Date: Fri, 28 Jul 2017 21:48:47 +0200 Subject: [PATCH 1/3] aml-dtbtools: new package to create multi-dtbs for Amlogic. Thanks to Wilhansen for creating the tool --- packages/tools/aml-dtbtools/package.mk | 35 ++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 packages/tools/aml-dtbtools/package.mk diff --git a/packages/tools/aml-dtbtools/package.mk b/packages/tools/aml-dtbtools/package.mk new file mode 100644 index 0000000000..aaad0dd625 --- /dev/null +++ b/packages/tools/aml-dtbtools/package.mk @@ -0,0 +1,35 @@ +################################################################################ +# 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="aml-dtbtools" +PKG_VERSION="cce100f" +PKG_SHA256="8bcaa83fcc9e85c9c04930e7411447d96a97da0809c5ecd9af91c8b554133c41" +PKG_ARCH="any" +PKG_LICENSE="free" +PKG_SITE="https://github.com/Wilhansen/aml-dtbtools" +PKG_URL="https://github.com/Wilhansen/aml-dtbtools/archive/${PKG_VERSION}.tar.gz" +PKG_SECTION="tools" +PKG_SHORTDESC="AML DTB Tools" +PKG_LONGDESC="AML DTB Tools" + +PKG_MAKE_OPTS_HOST="dtbTool" + +makeinstall_host() { + mkdir -p $TOOLCHAIN/bin + cp dtbTool $TOOLCHAIN/bin +} From 90675d340b558d76f4e6d7185984c6d5c143377b Mon Sep 17 00:00:00 2001 From: kszaq Date: Fri, 7 Jul 2017 20:10:51 +0200 Subject: [PATCH 2/3] packages/linux: Add multi-dtb support for Amlogic devices --- packages/linux/package.mk | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/packages/linux/package.mk b/packages/linux/package.mk index 85a6273cd1..972127c5ec 100644 --- a/packages/linux/package.mk +++ b/packages/linux/package.mk @@ -36,6 +36,7 @@ case "$LINUX" in PKG_URL="https://github.com/LibreELEC/linux-amlogic/archive/$PKG_VERSION.tar.gz" PKG_SOURCE_DIR="$PKG_NAME-amlogic-$PKG_VERSION*" PKG_PATCH_DIRS="amlogic-3.10" + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET aml-dtbtools:host" ;; amlogic-3.14) PKG_VERSION="2e193b8" @@ -43,6 +44,7 @@ case "$LINUX" in PKG_URL="https://github.com/LibreELEC/linux-amlogic/archive/$PKG_VERSION.tar.gz" PKG_SOURCE_DIR="$PKG_NAME-amlogic-$PKG_VERSION*" PKG_PATCH_DIRS="amlogic-3.14" + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET aml-dtbtools:host" ;; *) PKG_VERSION="4.14" @@ -187,9 +189,24 @@ make_target() { LDFLAGS="" make $KERNEL_TARGET $KERNEL_MAKE_EXTRACMD if [ "$BUILD_ANDROID_BOOTIMG" = "yes" ]; then + DTB_BLOBS=($(ls arch/$TARGET_KERNEL_ARCH/boot/dts/amlogic/*.dtb 2>/dev/null || true)) + DTB_BLOBS_COUNT="${#DTB_BLOBS[@]}" + DTB_BLOB_OUTPUT="arch/$TARGET_KERNEL_ARCH/boot/dtb.img" + ANDROID_BOOTIMG_SECOND="--second $DTB_BLOB_OUTPUT" + + if [ "$DTB_BLOBS_COUNT" -gt 1 ]; then + $TOOLCHAIN/bin/dtbTool -o arch/$TARGET_KERNEL_ARCH/boot/dtb.img -p scripts/dtc/ arch/$TARGET_KERNEL_ARCH/boot/dts/amlogic/ + elif [ "$DTB_BLOBS_COUNT" -eq 1 ]; then + cp -PR $DTB_BLOBS $DTB_BLOB_OUTPUT + else + ANDROID_BOOTIMG_SECOND="" + fi + LDFLAGS="" mkbootimg --kernel arch/$TARGET_KERNEL_ARCH/boot/$KERNEL_TARGET --ramdisk $BUILD/image/initramfs.cpio \ - $ANDROID_BOOTIMG_OPTIONS --output arch/$TARGET_KERNEL_ARCH/boot/boot.img + $ANDROID_BOOTIMG_SECOND $ANDROID_BOOTIMG_OPTIONS --output arch/$TARGET_KERNEL_ARCH/boot/boot.img + mv -f arch/$TARGET_KERNEL_ARCH/boot/boot.img arch/$TARGET_KERNEL_ARCH/boot/$KERNEL_TARGET + fi } From 811790a18be8afde7f525e329f4065fda7c7f6e0 Mon Sep 17 00:00:00 2001 From: kszaq Date: Sat, 2 Dec 2017 00:05:26 +0100 Subject: [PATCH 3/3] projects/WeTek*: remove --second from ANDROID_BOOTIMG_OPTIONS now that it's generated automatically --- projects/WeTek_Core/options | 3 --- projects/WeTek_Hub/options | 2 +- projects/WeTek_Play_2/options | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/projects/WeTek_Core/options b/projects/WeTek_Core/options index d726943b3e..0ad46760aa 100644 --- a/projects/WeTek_Core/options +++ b/projects/WeTek_Core/options @@ -57,9 +57,6 @@ # Build Android kernel image using mkbootimg BUILD_ANDROID_BOOTIMG="yes" - # Additional options to be passed to Android mkbootimg - ANDROID_BOOTIMG_OPTIONS="--second arch/arm/boot/dts/amlogic/meson8m2_wetek_core.dtb" - # Additional kernel make parameters (for example to specify the u-boot loadaddress) KERNEL_MAKE_EXTRACMD="" diff --git a/projects/WeTek_Hub/options b/projects/WeTek_Hub/options index 4eb080dbf2..0664e781fd 100644 --- a/projects/WeTek_Hub/options +++ b/projects/WeTek_Hub/options @@ -55,7 +55,7 @@ BUILD_ANDROID_BOOTIMG="yes" # Additional options to be passed to Android mkbootimg - ANDROID_BOOTIMG_OPTIONS="--second arch/arm64/boot/dts/amlogic/gxbb_p200_1G_wetek_hub.dtb --base 0x0 --kernel_offset 0x1080000" + ANDROID_BOOTIMG_OPTIONS="--base 0x0 --kernel_offset 0x1080000" # Additional kernel make parameters (for example to specify the u-boot loadaddress) KERNEL_MAKE_EXTRACMD="" diff --git a/projects/WeTek_Play_2/options b/projects/WeTek_Play_2/options index ae82409cde..25dae6cdb9 100644 --- a/projects/WeTek_Play_2/options +++ b/projects/WeTek_Play_2/options @@ -55,7 +55,7 @@ BUILD_ANDROID_BOOTIMG="yes" # Additional options to be passed to Android mkbootimg - ANDROID_BOOTIMG_OPTIONS="--second arch/arm64/boot/dts/amlogic/gxbb_p200_2G_wetek_play_2.dtb --base 0x0 --kernel_offset 0x1080000" + ANDROID_BOOTIMG_OPTIONS="--base 0x0 --kernel_offset 0x1080000" # Additional kernel make parameters (for example to specify the u-boot loadaddress) KERNEL_MAKE_EXTRACMD=""