diff --git a/packages/linux/package.mk b/packages/linux/package.mk index bb31df9053..58f7b94f9d 100644 --- a/packages/linux/package.mk +++ b/packages/linux/package.mk @@ -239,13 +239,14 @@ make_target() { makeinstall_target() { if [ "$BOOTLOADER" = "u-boot" ]; then mkdir -p $INSTALL/usr/share/bootloader - for dtb in arch/$TARGET_KERNEL_ARCH/boot/dts/*.dtb arch/$TARGET_KERNEL_ARCH/boot/dts/*/*.dtb; do - if [ -f $dtb ]; then - cp -v $dtb $INSTALL/usr/share/bootloader - fi - done if [ -d arch/$TARGET_KERNEL_ARCH/boot/dts/amlogic -a -f arch/$TARGET_KERNEL_ARCH/boot/dtb.img ]; then cp arch/$TARGET_KERNEL_ARCH/boot/dtb.img $INSTALL/usr/share/bootloader/dtb.img 2>/dev/null || : + else + for dtb in arch/$TARGET_KERNEL_ARCH/boot/dts/*.dtb arch/$TARGET_KERNEL_ARCH/boot/dts/*/*.dtb; do + if [ -f $dtb ]; then + cp -v $dtb $INSTALL/usr/share/bootloader + fi + done fi elif [ "$BOOTLOADER" = "bcm2835-bootloader" ]; then mkdir -p $INSTALL/usr/share/bootloader/overlays diff --git a/projects/Amlogic/bootloader/mkimage b/projects/Amlogic/bootloader/mkimage index e17ce7b94b..46ba3c3207 100644 --- a/projects/Amlogic/bootloader/mkimage +++ b/projects/Amlogic/bootloader/mkimage @@ -19,13 +19,23 @@ ################################################################################ # compile and copy amlogic autoscript files to part1 -for src in $INSTALL_SRC_DIR/*autoscript.src ; do - if [ -e "$src" ] ; then - $TOOLCHAIN/bin/mkimage -A $TARGET_KERNEL_ARCH -O linux -T script -C none -d "$src" "$LE_TMP/$(basename $src .src)" > /dev/null - mcopy "$LE_TMP/$(basename $src .src)" :: - fi -done +mcopy $RELEASE_DIR/3rdparty/bootloader/*autoscript :: 2>&1 > /dev/null || true # copy device trees to part1 -mmd device_trees - mcopy $RELEASE_DIR/3rdparty/bootloader/*.dtb ::/device_trees +for dtb in $RELEASE_DIR/3rdparty/bootloader/device_trees $RELEASE_DIR/3rdparty/bootloader/*.dtb $RELEASE_DIR/3rdparty/bootloader/dtb.img ; do + [ -e "$dtb" ] && mcopy -s "$dtb" :: +done + +if [ -f "$RELEASE_DIR/3rdparty/bootloader/u-boot" ]; then + echo "Writing u-boot to $(basename $DISK)" + dd if="$RELEASE_DIR/3rdparty/bootloader/u-boot" of="$DISK" conv=fsync,notrunc bs=1 count=112 >"$SAVE_ERROR" 2>&1 || show_error + dd if="$RELEASE_DIR/3rdparty/bootloader/u-boot" of="$DISK" conv=fsync,notrunc bs=512 skip=1 seek=1 >"$SAVE_ERROR" 2>&1 || show_error +fi + +if [ -f "$RELEASE_DIR/3rdparty/bootloader/boot.ini" ]; then + mcopy $RELEASE_DIR/3rdparty/bootloader/boot.ini :: +fi + +if [ -f "$RELEASE_DIR/3rdparty/bootloader/config.ini" ]; then + mcopy $RELEASE_DIR/3rdparty/bootloader/config.ini :: +fi diff --git a/projects/Amlogic/bootloader/release b/projects/Amlogic/bootloader/release index a8336ecc01..f64572b556 100755 --- a/projects/Amlogic/bootloader/release +++ b/projects/Amlogic/bootloader/release @@ -21,5 +21,4 @@ . config/options $1 mkdir -p $RELEASE_DIR/3rdparty/bootloader - cp -a $INSTALL/usr/share/bootloader/*.dtb $RELEASE_DIR/3rdparty/bootloader - cp $INSTALL/usr/share/bootloader/dtb.img $RELEASE_DIR/3rdparty/bootloader +cp -a $INSTALL/usr/share/bootloader/* $RELEASE_DIR/3rdparty/bootloader diff --git a/projects/Amlogic/bootloader/update.sh b/projects/Amlogic/bootloader/update.sh index 9207a34cdd..bd179b39d7 100755 --- a/projects/Amlogic/bootloader/update.sh +++ b/projects/Amlogic/bootloader/update.sh @@ -59,8 +59,8 @@ for arg in $(cat /proc/cmdline); do UPDATE_DTB_SOURCE="$UPDATE_DTB_IMG" elif [ -f "$UPDATE_DTB" ] ; then UPDATE_DTB_SOURCE="$UPDATE_DTB" - elif [ -n "$LE_DT_ID" -a -f "$SYSTEM_ROOT/usr/share/bootloader/$LE_DT_ID.dtb" ] ; then - UPDATE_DTB_SOURCE="$SYSTEM_ROOT/usr/share/bootloader/$LE_DT_ID.dtb" + elif [ -n "$LE_DT_ID" -a -f "$SYSTEM_ROOT/usr/share/bootloader/device_trees/$LE_DT_ID.dtb" ] ; then + UPDATE_DTB_SOURCE="$SYSTEM_ROOT/usr/share/bootloader/device_trees/$LE_DT_ID.dtb" fi if [ -f "$UPDATE_DTB_SOURCE" ] ; then diff --git a/projects/Amlogic/devices/KVIM/bootloader/boot.ini b/projects/Amlogic/devices/KVIM/bootloader/boot.ini new file mode 100644 index 0000000000..43e173e4e2 --- /dev/null +++ b/projects/Amlogic/devices/KVIM/bootloader/boot.ini @@ -0,0 +1,40 @@ +#------------------------------------------------------------------------------------------------------ +# +# boot.ini +# +# WARNING DO NOT MODIFY THIS FILE! ALL CHANGES WILL BE LOST WITH THE NEXT UPDATE! +# Set your own settings in config.ini +# +#------------------------------------------------------------------------------------------------------ +KHADAS-UBOOT-CONFIG + +setenv bootrootfs "BOOT_IMAGE=kernel.img boot=LABEL=LIBREELEC disk=LABEL=STORAGE" +setenv condev "ttyS0,115200" +setenv hdmimode "1080p60hz" +setenv hdmioutput "1" +setenv vpu "1" +setenv libreelec "quiet" +setenv hdmi_cec "1" +setenv uenv_addr 0x13000000 + +fatload mmc 0:1 ${loadaddr} kernel.img +fatload mmc 0:1 ${dtb_mem_addr} dtb.img + +if fatload mmc 0:1 ${uenv_addr} config.ini; then env import -t ${uenv_addr} $filesize; fi + +setenv khadas "no_console_suspend logo=osd1,loaded,0x3f800000,${hdmimode} vout=${hdmimode},enable hdmimode=${hdmimode} cvbsmode=nocvbs consoleblank=0" +if test "${hdmi_cec}" = "1"; then setenv cec "hdmitx=cec17"; fi +setenv bootargs "console=${condev} ${bootrootfs} ${khadas} ${cec} ${libreelec}" + +# Device tree modifications +bootm start +bootm loados +bootm fdt +if test "${vpu}" = "0"; then fdt rm /mesonstream; fdt rm /vdec; fdt rm /ppmgr; fi +if test "${hdmioutput}" = "0"; then fdt rm /mesonfb; fi +# Remove aml partition layout from device tree (required for eMMC boot) +fdt rm /partitions +bootm prep + +# Boot the board +bootm go diff --git a/projects/Amlogic/devices/KVIM/bootloader/config.ini b/projects/Amlogic/devices/KVIM/bootloader/config.ini new file mode 100644 index 0000000000..3cd4f541b2 --- /dev/null +++ b/projects/Amlogic/devices/KVIM/bootloader/config.ini @@ -0,0 +1,57 @@ +#------------------------------------------------------------------------------------------------------ +# +# config.ini +# +#------------------------------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------------------------------ +# +# Console Setup +# on serial port: +# condev='ttyS0,115200' +# +#------------------------------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------------------------------ +# +# Video +# Setup the video output +# hdmimode='480i60hz' +# hdmimode='480p60hz' +# hdmimode='576i50hz' +# hdmimode='576p50hz' +# hdmimode='720p60hz' +# hdmimode='720p50hz' +# hdmimode='1080i60hz' +# hdmimode='1080p60hz' +# hdmimode='1080i50hz' +# hdmimode='1080p50hz' +# hdmimode='1080p30hz' +# hdmimode='1080p25hz' +# hdmimode='1080p24hz' +# hdmimode='2160p60hz' +# hdmimode='2160p50hz' +# hdmimode='2160p30hz' +# hdmimode='2160p25hz' +# hdmimode='2160p24hz' +# +#------------------------------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------------------------------ +# +# LibreELEC variables +# +# Setup the LibreELEC options +# valid values are: textmode debugging progress nofsck nosplash noram overlay quiet ssh +# +# libreelec='quiet' +# +#------------------------------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------------------------------ +# +# Enable|Disable HDMI CEC Control +# hdmi_cec='0' +# hdmi_cec='1' +# +#------------------------------------------------------------------------------------------------------ diff --git a/projects/Amlogic/devices/KVIM/options b/projects/Amlogic/devices/KVIM/options new file mode 100644 index 0000000000..9a0ba1f363 --- /dev/null +++ b/projects/Amlogic/devices/KVIM/options @@ -0,0 +1,30 @@ + # u-boot version to use (default) + UBOOT_VERSION="vendor" + + # Configuration for u-boot + UBOOT_CONFIG="kvim_defconfig" + + # Target Configfile for u-boot + UBOOT_CONFIGFILE="boot.ini" + + # Kernel extra targets to build + KERNEL_UBOOT_EXTRA_TARGET="gxl_p212_2g_kvim.dtb" + + # 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, + # e.g. ADDITIONAL_DRIVERS="DRIVER1 DRIVER2" + ADDITIONAL_DRIVERS="$ADDITIONAL_DRIVERS ap6xxx-aml" + + # additional Firmware to use (dvb-firmware, misc-firmware, wlan-firmware) + # Space separated list is supported, + # e.g. FIRMWARE="dvb-firmware misc-firmware wlan-firmware" + FIRMWARE="$FIRMWARE brcmfmac_sdio-firmware-all-aml" + + # additional packages to install: + # Space separated list is supported, + # e.g. ADDITIONAL_PACKAGES="PACKAGE1 PACKAGE2" + ADDITIONAL_PACKAGES+=" autoscript-amlogic" diff --git a/projects/Amlogic/devices/KVIM2/bootloader/boot.ini b/projects/Amlogic/devices/KVIM2/bootloader/boot.ini new file mode 100644 index 0000000000..43e173e4e2 --- /dev/null +++ b/projects/Amlogic/devices/KVIM2/bootloader/boot.ini @@ -0,0 +1,40 @@ +#------------------------------------------------------------------------------------------------------ +# +# boot.ini +# +# WARNING DO NOT MODIFY THIS FILE! ALL CHANGES WILL BE LOST WITH THE NEXT UPDATE! +# Set your own settings in config.ini +# +#------------------------------------------------------------------------------------------------------ +KHADAS-UBOOT-CONFIG + +setenv bootrootfs "BOOT_IMAGE=kernel.img boot=LABEL=LIBREELEC disk=LABEL=STORAGE" +setenv condev "ttyS0,115200" +setenv hdmimode "1080p60hz" +setenv hdmioutput "1" +setenv vpu "1" +setenv libreelec "quiet" +setenv hdmi_cec "1" +setenv uenv_addr 0x13000000 + +fatload mmc 0:1 ${loadaddr} kernel.img +fatload mmc 0:1 ${dtb_mem_addr} dtb.img + +if fatload mmc 0:1 ${uenv_addr} config.ini; then env import -t ${uenv_addr} $filesize; fi + +setenv khadas "no_console_suspend logo=osd1,loaded,0x3f800000,${hdmimode} vout=${hdmimode},enable hdmimode=${hdmimode} cvbsmode=nocvbs consoleblank=0" +if test "${hdmi_cec}" = "1"; then setenv cec "hdmitx=cec17"; fi +setenv bootargs "console=${condev} ${bootrootfs} ${khadas} ${cec} ${libreelec}" + +# Device tree modifications +bootm start +bootm loados +bootm fdt +if test "${vpu}" = "0"; then fdt rm /mesonstream; fdt rm /vdec; fdt rm /ppmgr; fi +if test "${hdmioutput}" = "0"; then fdt rm /mesonfb; fi +# Remove aml partition layout from device tree (required for eMMC boot) +fdt rm /partitions +bootm prep + +# Boot the board +bootm go diff --git a/projects/Amlogic/devices/KVIM2/bootloader/config.ini b/projects/Amlogic/devices/KVIM2/bootloader/config.ini new file mode 100644 index 0000000000..3cd4f541b2 --- /dev/null +++ b/projects/Amlogic/devices/KVIM2/bootloader/config.ini @@ -0,0 +1,57 @@ +#------------------------------------------------------------------------------------------------------ +# +# config.ini +# +#------------------------------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------------------------------ +# +# Console Setup +# on serial port: +# condev='ttyS0,115200' +# +#------------------------------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------------------------------ +# +# Video +# Setup the video output +# hdmimode='480i60hz' +# hdmimode='480p60hz' +# hdmimode='576i50hz' +# hdmimode='576p50hz' +# hdmimode='720p60hz' +# hdmimode='720p50hz' +# hdmimode='1080i60hz' +# hdmimode='1080p60hz' +# hdmimode='1080i50hz' +# hdmimode='1080p50hz' +# hdmimode='1080p30hz' +# hdmimode='1080p25hz' +# hdmimode='1080p24hz' +# hdmimode='2160p60hz' +# hdmimode='2160p50hz' +# hdmimode='2160p30hz' +# hdmimode='2160p25hz' +# hdmimode='2160p24hz' +# +#------------------------------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------------------------------ +# +# LibreELEC variables +# +# Setup the LibreELEC options +# valid values are: textmode debugging progress nofsck nosplash noram overlay quiet ssh +# +# libreelec='quiet' +# +#------------------------------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------------------------------ +# +# Enable|Disable HDMI CEC Control +# hdmi_cec='0' +# hdmi_cec='1' +# +#------------------------------------------------------------------------------------------------------ diff --git a/projects/Amlogic/devices/KVIM2/filesystem/usr/lib/systemd/system/cpufreq.service b/projects/Amlogic/devices/KVIM2/filesystem/usr/lib/systemd/system/cpufreq.service new file mode 100644 index 0000000000..afbc794ecb --- /dev/null +++ b/projects/Amlogic/devices/KVIM2/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/KVIM2/options b/projects/Amlogic/devices/KVIM2/options new file mode 100644 index 0000000000..9d963aae83 --- /dev/null +++ b/projects/Amlogic/devices/KVIM2/options @@ -0,0 +1,36 @@ + # u-boot version to use (default) + UBOOT_VERSION="vendor" + + # Configuration for u-boot + UBOOT_CONFIG="kvim2_defconfig" + + # Target Configfile for u-boot + UBOOT_CONFIGFILE="boot.ini" + + # Kernel extra targets to build + KERNEL_UBOOT_EXTRA_TARGET="gxm_kvim2.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" + + # Amlogic Meson SOC family (8 / 6 / gxbb) + MESON_FAMILY="gxm" + + # additional drivers to install: + # for a list of additinoal drivers see packages/linux-drivers + # Space separated list is supported, + # e.g. ADDITIONAL_DRIVERS="DRIVER1 DRIVER2" + ADDITIONAL_DRIVERS="$ADDITIONAL_DRIVERS ap6xxx-aml" + + # additional Firmware to use (dvb-firmware, misc-firmware, wlan-firmware) + # Space separated list is supported, + # e.g. FIRMWARE="dvb-firmware misc-firmware wlan-firmware" + FIRMWARE="$FIRMWARE brcmfmac_sdio-firmware-all-aml" + + # additional packages to install: + # Space separated list is supported, + # e.g. ADDITIONAL_PACKAGES="PACKAGE1 PACKAGE2" + ADDITIONAL_PACKAGES+=" autoscript-amlogic" diff --git a/projects/Amlogic/devices/LePotato/bootloader/boot.ini b/projects/Amlogic/devices/LePotato/bootloader/boot.ini index f732af637d..d27a75a60b 100644 --- a/projects/Amlogic/devices/LePotato/bootloader/boot.ini +++ b/projects/Amlogic/devices/LePotato/bootloader/boot.ini @@ -32,6 +32,8 @@ bootm loados bootm fdt if test "${vpu}" = "0"; then fdt rm /mesonstream; fdt rm /vdec; fdt rm /ppmgr; fi if test "${hdmioutput}" = "0"; then fdt rm /mesonfb; fi +# Remove aml partition layout from device tree (required for eMMC boot) +fdt rm /partitions bootm prep # Boot the board diff --git a/projects/Amlogic/devices/LePotato/bootloader/mkimage b/projects/Amlogic/devices/LePotato/bootloader/mkimage deleted file mode 100644 index fd36183296..0000000000 --- a/projects/Amlogic/devices/LePotato/bootloader/mkimage +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash - -################################################################################ -# 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 . -################################################################################ - -if [ -f "$RELEASE_DIR/3rdparty/bootloader/u-boot.bin" ]; then - echo "Writing u-boot to $(basename $DISK)" - dd if="$RELEASE_DIR/3rdparty/bootloader/u-boot.bin" of="$DISK" conv=fsync,notrunc bs=1 count=112 >"$SAVE_ERROR" 2>&1 || show_error - dd if="$RELEASE_DIR/3rdparty/bootloader/u-boot.bin" of="$DISK" conv=fsync,notrunc bs=512 skip=1 seek=1 >"$SAVE_ERROR" 2>&1 || show_error -fi - -if [ -f "$RELEASE_DIR/3rdparty/bootloader/boot.ini" ]; then - mcopy $RELEASE_DIR/3rdparty/bootloader/boot.ini :: -fi - -if [ -f "$RELEASE_DIR/3rdparty/bootloader/config.ini" ]; then - mcopy $RELEASE_DIR/3rdparty/bootloader/config.ini :: -fi diff --git a/projects/Amlogic/devices/LePotato/bootloader/release b/projects/Amlogic/devices/LePotato/bootloader/release deleted file mode 100755 index f3b4418ef7..0000000000 --- a/projects/Amlogic/devices/LePotato/bootloader/release +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh - -################################################################################ -# 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 . -################################################################################ - -. config/options $1 - -mkdir -p $RELEASE_DIR/3rdparty/bootloader - cp -a $(get_build_dir linux)/arch/$TARGET_KERNEL_ARCH/boot/dtb.img $RELEASE_DIR/3rdparty/bootloader - cp -a $(get_build_dir $BOOTLOADER)/fip/u-boot.bin.sd.bin $RELEASE_DIR/3rdparty/bootloader/u-boot.bin - cp -a $PROJECT_DIR/$PROJECT/devices/$DEVICE/bootloader/boot.ini $RELEASE_DIR/3rdparty/bootloader - cp -a $PROJECT_DIR/$PROJECT/devices/$DEVICE/bootloader/config.ini $RELEASE_DIR/3rdparty/bootloader diff --git a/projects/Amlogic/devices/LePotato/options b/projects/Amlogic/devices/LePotato/options index 714daeb5a7..b45d8531a5 100644 --- a/projects/Amlogic/devices/LePotato/options +++ b/projects/Amlogic/devices/LePotato/options @@ -12,3 +12,8 @@ # Additional kernel dependencies KERNEL_EXTRA_DEPENDS_TARGET="device-trees-amlogic" + + # additional packages to install: + # Space separated list is supported, + # e.g. ADDITIONAL_PACKAGES="PACKAGE1 PACKAGE2" + ADDITIONAL_PACKAGES+=" autoscript-amlogic" diff --git a/projects/Amlogic/devices/LePotato/packages/u-boot/patches/u-boot-0003-use-arm-eabi-for-bl301-scp_task.patch b/projects/Amlogic/devices/LePotato/packages/u-boot/patches/u-boot-0003-use-arm-eabi-for-bl301-scp_task.patch deleted file mode 100644 index 84d8810514..0000000000 --- a/projects/Amlogic/devices/LePotato/packages/u-boot/patches/u-boot-0003-use-arm-eabi-for-bl301-scp_task.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 28c3064d6d3a89962e26f5c9ae3ee105d7377090 Mon Sep 17 00:00:00 2001 -From: Jonas Karlman -Date: Mon, 8 Aug 2016 01:59:07 +0200 -Subject: [PATCH] Use arm-eabi for bl301/scp_task - -For use with Linaro toolchain 4.9-2016.02 ---- - arch/arm/cpu/armv8/gxl/firmware/scp_task/Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/arch/arm/cpu/armv8/gxl/firmware/scp_task/Makefile b/arch/arm/cpu/armv8/gxl/firmware/scp_task/Makefile -index 865d142..d905365 100644 ---- a/arch/arm/cpu/armv8/gxl/firmware/scp_task/Makefile -+++ b/arch/arm/cpu/armv8/gxl/firmware/scp_task/Makefile -@@ -6,7 +6,7 @@ include $(buildtree)/include/autoconf.mk - include $(buildtree)/.config - - # Select ARMv7-m bare-metal toolchain --CROSS_COMPILE=arm-none-eabi- -+CROSS_COMPILE=arm-eabi- - ASM=$(CROSS_COMPILE)as - CC=$(CROSS_COMPILE)gcc - CPP=$(CROSS_COMPILE)cpp diff --git a/projects/Amlogic/devices/LePotato/packages/u-boot/patches/u-boot-0004-faster-boot.patch b/projects/Amlogic/devices/LePotato/packages/u-boot/patches/u-boot-0004-faster-boot.patch deleted file mode 100644 index 8b2426b39c..0000000000 --- a/projects/Amlogic/devices/LePotato/packages/u-boot/patches/u-boot-0004-faster-boot.patch +++ /dev/null @@ -1,97 +0,0 @@ -diff --git a/board/amlogic/configs/libretech_cc.h b/board/amlogic/configs/libretech_cc.h -index b3ccfae..6052a87 100644 ---- a/board/amlogic/configs/libretech_cc.h -+++ b/board/amlogic/configs/libretech_cc.h -@@ -45,10 +45,10 @@ - #define CONFIG_CEC_OSD_NAME "LibreTech-CC" - #define CONFIG_CEC_WAKEUP - --#define CONFIG_INSTABOOT -+// #define CONFIG_INSTABOOT - #define CONFIG_CMD_CFGLOAD - /* configs for dtb in boot.img */ --//#define DTB_BIND_KERNEL -+#define DTB_BIND_KERNEL - - /* SMP Definitinos */ - #define CPU_RELEASE_ADDR secondary_boot_func -@@ -209,7 +209,7 @@ - "if imgread kernel ${recovery_part} ${loadaddr} ${recovery_offset}; then wipeisb; bootm ${loadaddr}; fi;"\ - "\0"\ - "init_display="\ -- "osd open;osd clear;imgread pic logo bootup $loadaddr;bmp display $bootup_offset;bmp scale"\ -+ "osd open;osd clear;"\ - "\0"\ - "cmdline_keys="\ - "if keyman init 0x1234; then "\ -@@ -236,15 +236,8 @@ - "\0"\ - - #define CONFIG_PREBOOT \ -- "run bcb_cmd; "\ -- "run factory_reset_poweroff_protect;"\ -- "run upgrade_check;"\ -- "run init_display;"\ -- "run storeargs;"\ -- "run upgrade_key;" \ -- "run switch_bootmode;" \ -- "cfgload;" --#define CONFIG_BOOTCOMMAND "run storeboot" -+ "run init_display;" -+#define CONFIG_BOOTCOMMAND "cfgload" - - //#define CONFIG_ENV_IS_NOWHERE 1 - #define CONFIG_ENV_SIZE (64*1024) -@@ -298,7 +291,7 @@ - /* support for mtd */ - //#define CONFIG_AML_MTD 1 - /* support for nftl */ --#define CONFIG_AML_NAND 1 -+//#define CONFIG_AML_NAND 1 - - #if defined(CONFIG_AML_NAND) && defined(CONFIG_AML_MTD) - #error CONFIG_AML_NAND/CONFIG_AML_MTD can not support at the sametime; -@@ -390,7 +383,7 @@ - #endif //#if defined(CONFIG_CMD_USB) - - //UBOOT fastboot config --#define CONFIG_CMD_FASTBOOT 1 -+// #define CONFIG_CMD_FASTBOOT 1 - #define CONFIG_FASTBOOT_FLASH_MMC_DEV 1 - #define CONFIG_FASTBOOT_FLASH 1 - #define CONFIG_USB_GADGET 1 -diff --git a/board/amlogic/libretech_cc/libretech_cc.c b/board/amlogic/libretech_cc/libretech_cc.c -index 33bd007..b1748d9 100644 ---- a/board/amlogic/libretech_cc/libretech_cc.c -+++ b/board/amlogic/libretech_cc/libretech_cc.c -@@ -417,13 +417,6 @@ U_BOOT_CMD(hdmi_init, CONFIG_SYS_MAXARGS, 0, do_hdmi_init, - #endif - #ifdef CONFIG_BOARD_LATE_INIT - int board_late_init(void){ -- //update env before anyone using it -- run_command("get_rebootmode; echo reboot_mode=${reboot_mode}; "\ -- "if test ${reboot_mode} = factory_reset; then "\ -- "defenv_reserv aml_dt;setenv upgrade_step 2;save; fi;", 0); -- run_command("if itest ${upgrade_step} == 1; then "\ -- "defenv_reserv; setenv upgrade_step 2; saveenv; fi;", 0); -- - #ifndef CONFIG_AML_IRDETECT_EARLY - /* after */ - run_command("cvbs init;hdmitx hpd", 0); -@@ -448,16 +441,10 @@ int board_late_init(void){ - #elif defined(CONFIG_DTB_MEM_ADDR) - { - char cmd[128]; -- int ret; - if (!getenv("dtb_mem_addr")) { - sprintf(cmd, "setenv dtb_mem_addr 0x%x", CONFIG_DTB_MEM_ADDR); - run_command(cmd, 0); - } -- sprintf(cmd, "imgread dtb boot ${dtb_mem_addr}"); -- ret = run_command(cmd, 0); -- if (ret) { -- printf("%s(): cmd[%s] fail, ret=%d\n", __func__, cmd, ret); -- } - } - #endif// #ifndef DTB_BIND_KERNEL - #ifdef CONFIG_AML_V2_FACTORY_BURN diff --git a/projects/Amlogic/devices/Odroid_C2/bootloader/mkimage b/projects/Amlogic/devices/Odroid_C2/bootloader/mkimage deleted file mode 100644 index b2a077553d..0000000000 --- a/projects/Amlogic/devices/Odroid_C2/bootloader/mkimage +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash -################################################################################ -# 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 . -################################################################################ - -if [ -f "$RELEASE_DIR/3rdparty/bootloader/u-boot.bin" ]; then - echo "Writing u-boot to $(basename $DISK)" - dd if="$RELEASE_DIR/3rdparty/bootloader/u-boot.bin" of="$DISK" conv=fsync,notrunc bs=1 count=112 >"$SAVE_ERROR" 2>&1 || show_error - dd if="$RELEASE_DIR/3rdparty/bootloader/u-boot.bin" of="$DISK" conv=fsync,notrunc bs=512 skip=1 seek=1 >"$SAVE_ERROR" 2>&1 || show_error -fi - -if [ -f "$RELEASE_DIR/3rdparty/bootloader/boot.ini" ]; then - mcopy $RELEASE_DIR/3rdparty/bootloader/boot.ini :: -fi - -if [ -f "$RELEASE_DIR/3rdparty/bootloader/config.ini" ]; then - mcopy $RELEASE_DIR/3rdparty/bootloader/config.ini :: -fi - -if [ -f "$RELEASE_DIR/3rdparty/bootloader/meson64_odroidc2.dtb" ]; then - mcopy $RELEASE_DIR/3rdparty/bootloader/meson64_odroidc2.dtb :: -fi diff --git a/projects/Amlogic/devices/Odroid_C2/packages/u-boot/package.mk b/projects/Amlogic/devices/Odroid_C2/packages/u-boot/package.mk deleted file mode 100644 index e29a2be45e..0000000000 --- a/projects/Amlogic/devices/Odroid_C2/packages/u-boot/package.mk +++ /dev/null @@ -1,59 +0,0 @@ -################################################################################ -# 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="u-boot" -PKG_VERSION="6e4e886" -PKG_SHA256="0d05829e07e226d1acbc6b23ff038d6c92fa3ed738ddc28703d51987c0fab3bb" -PKG_SITE="https://github.com/hardkernel/u-boot" -PKG_URL="https://github.com/hardkernel/u-boot/archive/$PKG_VERSION.tar.gz" -PKG_DEPENDS_TARGET="toolchain gcc-linaro-aarch64-elf:host gcc-linaro-arm-eabi:host" -PKG_ARCH="arm aarch64" -PKG_LICENSE="GPL" -PKG_SECTION="tools" -PKG_SHORTDESC="u-boot: Universal Bootloader project (Hardkernel Fork)" -PKG_LONGDESC="Das U-Boot is a cross-platform bootloader for embedded systems, used as the default boot loader by several board vendors. It is intended to be easy to port and to debug, and runs on many supported architectures, including PPC, ARM, MIPS, x86, m68k, NIOS, and Microblaze." - -pre_configure_target() { - if [ -z "$UBOOT_CONFIG" ]; then - echo "$TARGET_PLATFORM does not define any u-boot configuration, aborting." - echo "Please add UBOOT_CONFIG to your project options file." - exit 1 - fi - - unset LDFLAGS - -# dont build in parallel because of problems - MAKEFLAGS=-j1 - -# copy compiler-gcc5.h to compiler-gcc6. for fake building - cp include/linux/compiler-gcc5.h include/linux/compiler-gcc6.h -} - -make_target() { - export PATH=$TOOLCHAIN/lib/gcc-linaro-aarch64-elf/bin/:$TOOLCHAIN/lib/gcc-linaro-arm-eabi/bin/:$PATH - CROSS_COMPILE=aarch64-elf- ARCH=arm CFLAGS="" LDFLAGS="" make mrproper - CROSS_COMPILE=aarch64-elf- ARCH=arm CFLAGS="" LDFLAGS="" make $UBOOT_CONFIG - CROSS_COMPILE=aarch64-elf- ARCH=arm CFLAGS="" LDFLAGS="" make HOSTCC="$HOST_CC" HOSTSTRIP="true" -} - -makeinstall_target() { - mkdir -p $INSTALL/usr/share/bootloader - cp $PROJECT_DIR/$PROJECT/devices/$DEVICE/bootloader/boot.ini $INSTALL/usr/share/bootloader - cp $PROJECT_DIR/$PROJECT/devices/$DEVICE/bootloader/config.ini $INSTALL/usr/share/bootloader - cp -av $PKG_BUILD/u-boot.bin $INSTALL/usr/share/bootloader/u-boot -} diff --git a/projects/Amlogic/devices/Odroid_C2/patches/u-boot/u-boot-0001-use-arm-eabi-for-bl301-scp_task.patch b/projects/Amlogic/devices/Odroid_C2/patches/u-boot/u-boot-0001-use-arm-eabi-for-bl301-scp_task.patch deleted file mode 100644 index de61acedbe..0000000000 --- a/projects/Amlogic/devices/Odroid_C2/patches/u-boot/u-boot-0001-use-arm-eabi-for-bl301-scp_task.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 28c3064d6d3a89962e26f5c9ae3ee105d7377090 Mon Sep 17 00:00:00 2001 -From: Jonas Karlman -Date: Mon, 8 Aug 2016 01:59:07 +0200 -Subject: [PATCH] Use arm-eabi for bl301/scp_task - -For use with Linaro toolchain 4.9-2016.02 ---- - arch/arm/cpu/armv8/gxb/firmware/scp_task/Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/arch/arm/cpu/armv8/gxb/firmware/scp_task/Makefile b/arch/arm/cpu/armv8/gxb/firmware/scp_task/Makefile -index 865d142..d905365 100644 ---- a/arch/arm/cpu/armv8/gxb/firmware/scp_task/Makefile -+++ b/arch/arm/cpu/armv8/gxb/firmware/scp_task/Makefile -@@ -6,7 +6,7 @@ include $(buildtree)/include/autoconf.mk - include $(buildtree)/.config - - # Select ARMv7-m bare-metal toolchain --CROSS_COMPILE=arm-none-eabi- -+CROSS_COMPILE=arm-eabi- - ASM=$(CROSS_COMPILE)as - CC=$(CROSS_COMPILE)gcc - CPP=$(CROSS_COMPILE)cpp diff --git a/projects/Amlogic/devices/S905/options b/projects/Amlogic/devices/S905/options index 0c0c43cd0e..3a5fa8567e 100644 --- a/projects/Amlogic/devices/S905/options +++ b/projects/Amlogic/devices/S905/options @@ -14,3 +14,8 @@ # Space separated list is supported, # e.g. FIRMWARE="dvb-firmware misc-firmware wlan-firmware" FIRMWARE="$FIRMWARE brcmfmac_sdio-firmware-all-aml rtl8723bs_bt qca9377-firmware-aml" + + # additional packages to install: + # Space separated list is supported, + # e.g. ADDITIONAL_PACKAGES="PACKAGE1 PACKAGE2" + ADDITIONAL_PACKAGES+=" autoscript-amlogic" diff --git a/projects/Amlogic/devices/S912/options b/projects/Amlogic/devices/S912/options index 814a0ff800..95dfe8cb2d 100644 --- a/projects/Amlogic/devices/S912/options +++ b/projects/Amlogic/devices/S912/options @@ -23,3 +23,8 @@ # Space separated list is supported, # e.g. FIRMWARE="dvb-firmware misc-firmware wlan-firmware" FIRMWARE="$FIRMWARE brcmfmac_sdio-firmware-all-aml rtl8723bs_bt qca9377-firmware-aml" + + # additional packages to install: + # Space separated list is supported, + # e.g. ADDITIONAL_PACKAGES="PACKAGE1 PACKAGE2" + ADDITIONAL_PACKAGES+=" autoscript-amlogic" diff --git a/projects/Amlogic/devices/WeTek_Hub/bootloader/release b/projects/Amlogic/devices/WeTek_Hub/bootloader/release deleted file mode 100755 index 28c339b330..0000000000 --- a/projects/Amlogic/devices/WeTek_Hub/bootloader/release +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of LibreELEC - https://LibreELEC.tv -# Copyright (C) 2016 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 . -################################################################################ - -. config/options $1 - -mkdir -p $RELEASE_DIR/3rdparty/bootloader -cp $INSTALL/usr/share/bootloader/dtb.img $RELEASE_DIR/3rdparty/bootloader diff --git a/projects/Amlogic/devices/WeTek_Play_2/bootloader/release b/projects/Amlogic/devices/WeTek_Play_2/bootloader/release deleted file mode 100755 index 28c339b330..0000000000 --- a/projects/Amlogic/devices/WeTek_Play_2/bootloader/release +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of LibreELEC - https://LibreELEC.tv -# Copyright (C) 2016 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 . -################################################################################ - -. config/options $1 - -mkdir -p $RELEASE_DIR/3rdparty/bootloader -cp $INSTALL/usr/share/bootloader/dtb.img $RELEASE_DIR/3rdparty/bootloader diff --git a/projects/Amlogic/install/aml_autoscript.src b/projects/Amlogic/install/aml_autoscript.src deleted file mode 100644 index bd71da92a7..0000000000 --- a/projects/Amlogic/install/aml_autoscript.src +++ /dev/null @@ -1,16 +0,0 @@ -defenv -setenv bootfromrecovery 0 -setenv bootfromnand 0 -setenv upgrade_step 2 -setenv start_autoscript 'if mmcinfo; then run start_mmc_autoscript; fi; if usb start; then run start_usb_autoscript; fi;' -setenv start_mmc_autoscript 'if fatload mmc 0 1020000 s905_autoscript; then autoscr 1020000; fi;' -setenv start_usb_autoscript 'if fatload usb 0 1020000 s905_autoscript; then autoscr 1020000; fi; if fatload usb 1 1020000 s905_autoscript; then autoscr 1020000; fi; if fatload usb 2 1020000 s905_autoscript; then autoscr 1020000; fi; if fatload usb 3 1020000 s905_autoscript; then autoscr 1020000; fi;' -setenv sddtb 'if fatload mmc 0 ${dtb_mem_addr} dtb.img; then echo sd dtb.img loaded; else store dtb read $dtb_mem_addr; fi' -setenv usbdtb 'if fatload usb 0 ${dtb_mem_addr} dtb.img; then echo usb dtb.img loaded; else store dtb read $dtb_mem_addr; fi' -setenv librefromsd 'if mmcinfo; then if fatload mmc 0 ${loadaddr} kernel.img; then run sddtb; setenv bootargs ${bootargs} bootfromsd; bootm; fi; fi' -setenv librefromusb 'if usb start 0; then if fatload usb 0 ${loadaddr} kernel.img; then run usbdtb; setenv bootargs ${bootargs} bootfromusb; bootm; fi; fi' -setenv bootcmd 'if test ${bootfromnand} = 1; then setenv bootfromnand 0; saveenv; else run start_autoscript; run librefromsd; run librefromusb; fi; run storeboot' -saveenv -run storeargs -run librefromsd -run librefromusb diff --git a/projects/Amlogic/install/s905_autoscript.src b/projects/Amlogic/install/s905_autoscript.src deleted file mode 100644 index 3efc523193..0000000000 --- a/projects/Amlogic/install/s905_autoscript.src +++ /dev/null @@ -1,6 +0,0 @@ -setenv bootargs ${bootargs} bootfromext -if fatload mmc 0 ${loadaddr} kernel.img; then if fatload mmc 0 ${dtb_mem_addr} dtb.img; then bootm ${loadaddr}; else store dtb read ${dtb_mem_addr}; bootm ${loadaddr}; fi; fi; -if fatload usb 0 ${loadaddr} kernel.img; then if fatload usb 0 ${dtb_mem_addr} dtb.img; then bootm ${loadaddr}; else store dtb read ${dtb_mem_addr}; bootm ${loadaddr}; fi; fi; -if fatload usb 1 ${loadaddr} kernel.img; then if fatload usb 1 ${dtb_mem_addr} dtb.img; then bootm ${loadaddr}; else store dtb read ${dtb_mem_addr}; bootm ${loadaddr}; fi; fi; -if fatload usb 2 ${loadaddr} kernel.img; then if fatload usb 2 ${dtb_mem_addr} dtb.img; then bootm ${loadaddr}; else store dtb read ${dtb_mem_addr}; bootm ${loadaddr}; fi; fi; -if fatload usb 3 ${loadaddr} kernel.img; then if fatload usb 3 ${dtb_mem_addr} dtb.img; then bootm ${loadaddr}; else store dtb read ${dtb_mem_addr}; bootm ${loadaddr}; fi; fi; diff --git a/projects/Amlogic/devices/S912/packages/android-headers/package.mk b/projects/Amlogic/packages/android-headers/package.mk similarity index 100% rename from projects/Amlogic/devices/S912/packages/android-headers/package.mk rename to projects/Amlogic/packages/android-headers/package.mk diff --git a/projects/Amlogic/devices/Odroid_C2/bootloader/release b/projects/Amlogic/packages/autoscript-amlogic/package.mk old mode 100755 new mode 100644 similarity index 62% rename from projects/Amlogic/devices/Odroid_C2/bootloader/release rename to projects/Amlogic/packages/autoscript-amlogic/package.mk index 5ef541a150..8228788801 --- a/projects/Amlogic/devices/Odroid_C2/bootloader/release +++ b/projects/Amlogic/packages/autoscript-amlogic/package.mk @@ -1,8 +1,6 @@ -#!/bin/sh - ################################################################################ # This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2017-present Team LibreELEC +# Copyright (C) 2018-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 @@ -18,10 +16,19 @@ # along with LibreELEC. If not, see . ################################################################################ -. config/options $1 +PKG_NAME="autoscript-amlogic" +PKG_VERSION="" +PKG_LICENSE="GPL" +PKG_DEPENDS_TARGET="toolchain" +PKG_TOOLCHAIN="manual" -mkdir -p $RELEASE_DIR/3rdparty/bootloader - cp -a $(get_build_dir linux)/arch/$TARGET_KERNEL_ARCH/boot/dts/meson64_odroidc2.dtb $RELEASE_DIR/3rdparty/bootloader - cp -a $(get_build_dir $BOOTLOADER)/u-boot.bin $RELEASE_DIR/3rdparty/bootloader - cp -a $PROJECT_DIR/$PROJECT/devices/$DEVICE/bootloader/boot.ini $RELEASE_DIR/3rdparty/bootloader - cp -a $PROJECT_DIR/$PROJECT/devices/$DEVICE/bootloader/config.ini $RELEASE_DIR/3rdparty/bootloader +make_target() { + for src in $PKG_DIR/scripts/*autoscript.src ; do + $TOOLCHAIN/bin/mkimage -A $TARGET_KERNEL_ARCH -O linux -T script -C none -d "$src" "$(basename $src .src)" > /dev/null + done +} + +makeinstall_target() { + mkdir -p $INSTALL/usr/share/bootloader + cp -a $PKG_BUILD/*autoscript $INSTALL/usr/share/bootloader/ +} diff --git a/projects/Amlogic/packages/autoscript-amlogic/scripts/aml_autoscript.src b/projects/Amlogic/packages/autoscript-amlogic/scripts/aml_autoscript.src new file mode 100644 index 0000000000..6d85670ab2 --- /dev/null +++ b/projects/Amlogic/packages/autoscript-amlogic/scripts/aml_autoscript.src @@ -0,0 +1,12 @@ +defenv +setenv bootfromnand 0 +setenv upgrade_step 2 +setenv libreelec 'run librefromsd; run librefromusb' +setenv sddtb 'if fatload mmc 0 ${dtb_mem_addr} dtb.img; then else store dtb read $dtb_mem_addr; fi' +setenv usbdtb 'if fatload usb 0 ${dtb_mem_addr} dtb.img; then else store dtb read $dtb_mem_addr; fi' +setenv librefromsd 'mmcinfo; if fatload mmc 0 ${loadaddr} kernel.img; then run sddtb; setenv bootargs ${bootargs} bootfromsd; bootm; fi' +setenv librefromusb 'usb start 0; if fatload usb 0 ${loadaddr} kernel.img; then run usbdtb; setenv bootargs ${bootargs} bootfromusb; bootm; fi' +setenv bootcmd 'if test ${bootfromnand} = 1; then setenv bootfromnand 0; saveenv; else run libreelec; fi; run storeboot' +saveenv +run storeargs +run libreelec diff --git a/projects/Amlogic/packages/device-trees-amlogic/package.mk b/projects/Amlogic/packages/device-trees-amlogic/package.mk index f3fbabbb21..dcc95ce4f1 100644 --- a/projects/Amlogic/packages/device-trees-amlogic/package.mk +++ b/projects/Amlogic/packages/device-trees-amlogic/package.mk @@ -73,6 +73,10 @@ make_target() { } makeinstall_target() { - mkdir -p $INSTALL/usr/share/bootloader - cp -a $PKG_BUILD/*.dtb $INSTALL/usr/share/bootloader + case "$DEVICE" in + S905|S912) + mkdir -p $INSTALL/usr/share/bootloader/device_trees + cp -a $PKG_BUILD/*.dtb $INSTALL/usr/share/bootloader/device_trees + ;; + esac } diff --git a/projects/Amlogic/devices/S912/packages/libhybris/package.mk b/projects/Amlogic/packages/libhybris/package.mk similarity index 100% rename from projects/Amlogic/devices/S912/packages/libhybris/package.mk rename to projects/Amlogic/packages/libhybris/package.mk diff --git a/projects/Amlogic/devices/S912/packages/libhybris/patches/libhybris-Build-only-EGL-GLESv1-and-GLESv2.patch b/projects/Amlogic/packages/libhybris/patches/libhybris-Build-only-EGL-GLESv1-and-GLESv2.patch similarity index 100% rename from projects/Amlogic/devices/S912/packages/libhybris/patches/libhybris-Build-only-EGL-GLESv1-and-GLESv2.patch rename to projects/Amlogic/packages/libhybris/patches/libhybris-Build-only-EGL-GLESv1-and-GLESv2.patch diff --git a/projects/Amlogic/devices/S912/packages/libhybris/patches/libhybris-eglplatform_fbdev-open-new-framebuffer-when-creating.patch b/projects/Amlogic/packages/libhybris/patches/libhybris-eglplatform_fbdev-open-new-framebuffer-when-creating.patch similarity index 100% rename from projects/Amlogic/devices/S912/packages/libhybris/patches/libhybris-eglplatform_fbdev-open-new-framebuffer-when-creating.patch rename to projects/Amlogic/packages/libhybris/patches/libhybris-eglplatform_fbdev-open-new-framebuffer-when-creating.patch diff --git a/projects/Amlogic/devices/S912/packages/opengl-meson-t82x/package.mk b/projects/Amlogic/packages/opengl-meson-t82x/package.mk similarity index 100% rename from projects/Amlogic/devices/S912/packages/opengl-meson-t82x/package.mk rename to projects/Amlogic/packages/opengl-meson-t82x/package.mk diff --git a/projects/Amlogic/devices/S912/packages/opengl-meson-t82x/system.d/unbind-console.service b/projects/Amlogic/packages/opengl-meson-t82x/system.d/unbind-console.service similarity index 100% rename from projects/Amlogic/devices/S912/packages/opengl-meson-t82x/system.d/unbind-console.service rename to projects/Amlogic/packages/opengl-meson-t82x/system.d/unbind-console.service diff --git a/projects/Amlogic/devices/LePotato/packages/u-boot/package.mk b/projects/Amlogic/packages/u-boot/package.mk similarity index 52% rename from projects/Amlogic/devices/LePotato/packages/u-boot/package.mk rename to projects/Amlogic/packages/u-boot/package.mk index 54e3a7331f..a1602bb6d4 100644 --- a/projects/Amlogic/devices/LePotato/packages/u-boot/package.mk +++ b/projects/Amlogic/packages/u-boot/package.mk @@ -1,6 +1,5 @@ ################################################################################ # This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) # Copyright (C) 2017-present Team LibreELEC # # LibreELEC is free software: you can redistribute it and/or modify @@ -18,26 +17,49 @@ ################################################################################ PKG_NAME="u-boot" -PKG_VERSION="a43076c" -PKG_ARCH="arm aarch64" PKG_SITE="https://www.denx.de/wiki/U-Boot" -PKG_URL="https://github.com/BayLibre/u-boot/archive/$PKG_VERSION.tar.gz" -PKG_SOURCE_DIR="u-boot-$PKG_VERSION*" -PKG_DEPENDS_TARGET="toolchain dtc:host gcc-linaro-aarch64-elf:host gcc-linaro-arm-eabi:host" +PKG_DEPENDS_TARGET="toolchain gcc-linaro-aarch64-elf:host gcc-linaro-arm-eabi:host" +PKG_ARCH="arm aarch64" PKG_LICENSE="GPL" PKG_SECTION="tools" PKG_SHORTDESC="u-boot: Universal Bootloader project" PKG_LONGDESC="Das U-Boot is a cross-platform bootloader for embedded systems, used as the default boot loader by several board vendors. It is intended to be easy to port and to debug, and runs on many supported architectures, including PPC, ARM, MIPS, x86, m68k, NIOS, and Microblaze." -PKG_IS_KERNEL_PKG="yes" + +case "$DEVICE" in + "Odroid_C2") + PKG_URL="https://github.com/hardkernel/u-boot/archive/$PKG_VERSION.tar.gz" + PKG_VERSION="6e4e886" + PKG_SHA256="0d05829e07e226d1acbc6b23ff038d6c92fa3ed738ddc28703d51987c0fab3bb" + ;; + "KVIM"*) + PKG_URL="https://github.com/khadas/u-boot/archive/$PKG_VERSION.tar.gz" + PKG_VERSION="ffc14fc" + PKG_SHA256="1326126ca7962d314cb522d95e657dbf71966e74c84fb093181910f9e4f2c1fa" + ;; + "LePotato") + PKG_URL="https://github.com/BayLibre/u-boot/archive/$PKG_VERSION.tar.gz" + PKG_VERSION="a43076c" + PKG_SHA256="0ae5fd97ba86fcd6cc7b2722580745a0ddbf651ffa0cc0bd188a05a9b668373f" + ;; + *) + PKG_TOOLCHAIN="manual" + ;; +esac PKG_NEED_UNPACK="$PROJECT_DIR/$PROJECT/bootloader" [ -n "$DEVICE" ] && PKG_NEED_UNPACK+=" $PROJECT_DIR/$PROJECT/devices/$DEVICE/bootloader" +post_unpack() { + sed -i "s|arm-none-eabi-|arm-eabi-|g" $PKG_BUILD/Makefile $PKG_BUILD/arch/arm/cpu/armv8/gx*/firmware/scp_task/Makefile 2>/dev/null || true +} + make_target() { - export PATH=$TOOLCHAIN/lib/gcc-linaro-aarch64-elf/bin/:$TOOLCHAIN/lib/gcc-linaro-arm-eabi/bin/:$PATH - CROSS_COMPILE=aarch64-elf- ARCH=arm CFLAGS="" LDFLAGS="" make mrproper - CROSS_COMPILE=aarch64-elf- ARCH=arm CFLAGS="" LDFLAGS="" make $UBOOT_CONFIG - CROSS_COMPILE=aarch64-elf- ARCH=arm CFLAGS="" LDFLAGS="" make HOSTCC="$HOST_CC" HOSTSTRIP="true" + if [ -n "$PKG_URL" ]; then + export PATH=$TOOLCHAIN/lib/gcc-linaro-aarch64-elf/bin/:$TOOLCHAIN/lib/gcc-linaro-arm-eabi/bin/:$PATH + CROSS_COMPILE=aarch64-elf- ARCH=arm CFLAGS="" LDFLAGS="" make mrproper + CROSS_COMPILE=aarch64-elf- ARCH=arm CFLAGS="" LDFLAGS="" make $UBOOT_CONFIG + CROSS_COMPILE=aarch64-elf- ARCH=arm CFLAGS="" LDFLAGS="" make HOSTCC="$HOST_CC" HOSTSTRIP="true" + fi } makeinstall_target() { @@ -49,8 +71,22 @@ makeinstall_target() { # Always install the update script find_file_path bootloader/update.sh && cp -av ${FOUND_PATH} $INSTALL/usr/share/bootloader - cp $PKG_BUILD/fip/u-boot.bin.sd.bin $INSTALL/usr/share/bootloader/u-boot + # Always install the canupdate script + if find_file_path bootloader/canupdate.sh; then + cp -av ${FOUND_PATH} $INSTALL/usr/share/bootloader + sed -e "s/@PROJECT@/${DEVICE:-$PROJECT}/g" \ + -i $INSTALL/usr/share/bootloader/canupdate.sh + fi find_file_path bootloader/boot.ini && cp -av ${FOUND_PATH} $INSTALL/usr/share/bootloader find_file_path bootloader/config.ini && cp -av ${FOUND_PATH} $INSTALL/usr/share/bootloader + + case "$DEVICE" in + "Odroid_C2") + cp -av $PKG_BUILD/u-boot.bin $INSTALL/usr/share/bootloader/u-boot + ;; + "KVIM"*|"LePotato") + cp -av $PKG_BUILD/fip/u-boot.bin.sd.bin $INSTALL/usr/share/bootloader/u-boot + ;; + esac } diff --git a/projects/Amlogic/devices/Odroid_C2/patches/u-boot/u-boot-0002-gcc7.patch b/projects/Amlogic/packages/u-boot/patches/6e4e886/u-boot-0002-gcc7.patch similarity index 100% rename from projects/Amlogic/devices/Odroid_C2/patches/u-boot/u-boot-0002-gcc7.patch rename to projects/Amlogic/packages/u-boot/patches/6e4e886/u-boot-0002-gcc7.patch diff --git a/projects/Amlogic/devices/Odroid_C2/patches/u-boot/u-boot-0003-set-default-boot-options.patch b/projects/Amlogic/packages/u-boot/patches/6e4e886/u-boot-0003-set-default-boot-options.patch similarity index 100% rename from projects/Amlogic/devices/Odroid_C2/patches/u-boot/u-boot-0003-set-default-boot-options.patch rename to projects/Amlogic/packages/u-boot/patches/6e4e886/u-boot-0003-set-default-boot-options.patch diff --git a/projects/Amlogic/devices/Odroid_C2/patches/u-boot/u-boot-0004-update_cec_wakeup_code.patch b/projects/Amlogic/packages/u-boot/patches/6e4e886/u-boot-0004-update_cec_wakeup_code.patch similarity index 100% rename from projects/Amlogic/devices/Odroid_C2/patches/u-boot/u-boot-0004-update_cec_wakeup_code.patch rename to projects/Amlogic/packages/u-boot/patches/6e4e886/u-boot-0004-update_cec_wakeup_code.patch diff --git a/projects/Amlogic/devices/Odroid_C2/patches/u-boot/u-boot-0005-update_cec_simplink_wakeup.patch b/projects/Amlogic/packages/u-boot/patches/6e4e886/u-boot-0005-update_cec_simplink_wakeup.patch similarity index 100% rename from projects/Amlogic/devices/Odroid_C2/patches/u-boot/u-boot-0005-update_cec_simplink_wakeup.patch rename to projects/Amlogic/packages/u-boot/patches/6e4e886/u-boot-0005-update_cec_simplink_wakeup.patch diff --git a/projects/Amlogic/devices/LePotato/packages/u-boot/patches/u-boot-0001-remove-hardcoded-toolchain-path.patch b/projects/Amlogic/packages/u-boot/patches/a43076c/u-boot-0001-remove-hardcoded-toolchain-path.patch similarity index 100% rename from projects/Amlogic/devices/LePotato/packages/u-boot/patches/u-boot-0001-remove-hardcoded-toolchain-path.patch rename to projects/Amlogic/packages/u-boot/patches/a43076c/u-boot-0001-remove-hardcoded-toolchain-path.patch diff --git a/projects/Amlogic/devices/LePotato/packages/u-boot/patches/u-boot-0002-add-linux-compiler-gcc5.h.patch b/projects/Amlogic/packages/u-boot/patches/a43076c/u-boot-0002-add-linux-compiler-gcc5.h.patch similarity index 100% rename from projects/Amlogic/devices/LePotato/packages/u-boot/patches/u-boot-0002-add-linux-compiler-gcc5.h.patch rename to projects/Amlogic/packages/u-boot/patches/a43076c/u-boot-0002-add-linux-compiler-gcc5.h.patch diff --git a/projects/Amlogic/packages/u-boot/patches/a43076c/u-boot-0004-faster-boot.patch b/projects/Amlogic/packages/u-boot/patches/a43076c/u-boot-0004-faster-boot.patch new file mode 100644 index 0000000000..047d4a5b7c --- /dev/null +++ b/projects/Amlogic/packages/u-boot/patches/a43076c/u-boot-0004-faster-boot.patch @@ -0,0 +1,242 @@ +From 2896063602000eb099eb0774d001bbdc76df264a Mon Sep 17 00:00:00 2001 +From: kszaq +Date: Mon, 12 Feb 2018 22:44:10 +0100 +Subject: [PATCH] libretech_cc: amend boot procedure for LibreELEC + +* make eMMC use MBR instead of AML partition structure +* port eMMC/SD renumbering from Hardkernel to allow booting from either SD or eMMC +* remove NAND driver (not in use) +* remove fastboot, bcb, store interface (not in use and conflicts with eMMC MBR) +* remove preboot steps that are not requried for faster booting +--- + board/amlogic/configs/libretech_cc.h | 47 ++++---------------- + board/amlogic/libretech_cc/libretech_cc.c | 71 ++++++++++++++----------------- + drivers/mmc/aml_sd_emmc.c | 1 - + 3 files changed, 41 insertions(+), 78 deletions(-) + +diff --git a/board/amlogic/configs/libretech_cc.h b/board/amlogic/configs/libretech_cc.h +index b3ccfae..84f66ae 100644 +--- a/board/amlogic/configs/libretech_cc.h ++++ b/board/amlogic/configs/libretech_cc.h +@@ -45,10 +45,10 @@ + #define CONFIG_CEC_OSD_NAME "LibreTech-CC" + #define CONFIG_CEC_WAKEUP + +-#define CONFIG_INSTABOOT ++// #define CONFIG_INSTABOOT + #define CONFIG_CMD_CFGLOAD + /* configs for dtb in boot.img */ +-//#define DTB_BIND_KERNEL ++#define DTB_BIND_KERNEL + + /* SMP Definitinos */ + #define CPU_RELEASE_ADDR secondary_boot_func +@@ -62,12 +62,6 @@ + /* support ext4*/ + #define CONFIG_CMD_EXT4 1 + +-/* Bootloader Control Block function +- That is used for recovery and the bootloader to talk to each other +- */ +-#define CONFIG_BOOTLOADER_CONTROL_BLOCK +- +- + /* Serial config */ + #define CONFIG_CONS_INDEX 2 + #define CONFIG_BAUDRATE 115200 +@@ -209,7 +203,7 @@ + "if imgread kernel ${recovery_part} ${loadaddr} ${recovery_offset}; then wipeisb; bootm ${loadaddr}; fi;"\ + "\0"\ + "init_display="\ +- "osd open;osd clear;imgread pic logo bootup $loadaddr;bmp display $bootup_offset;bmp scale"\ ++ "osd open;osd clear;"\ + "\0"\ + "cmdline_keys="\ + "if keyman init 0x1234; then "\ +@@ -236,17 +230,10 @@ + "\0"\ + + #define CONFIG_PREBOOT \ +- "run bcb_cmd; "\ +- "run factory_reset_poweroff_protect;"\ +- "run upgrade_check;"\ +- "run init_display;"\ +- "run storeargs;"\ +- "run upgrade_key;" \ +- "run switch_bootmode;" \ +- "cfgload;" +-#define CONFIG_BOOTCOMMAND "run storeboot" +- +-//#define CONFIG_ENV_IS_NOWHERE 1 ++ "run init_display;" ++#define CONFIG_BOOTCOMMAND "cfgload" ++ ++#define CONFIG_ENV_IS_NOWHERE 1 + #define CONFIG_ENV_SIZE (64*1024) + #define CONFIG_FIT 1 + #define CONFIG_OF_LIBFDT 1 +@@ -283,7 +270,7 @@ + #define CONFIG_DDR_USE_EXT_VREF 0 //0:disable, 1:enable. ddr use external vref + + /* storage: emmc/nand/sd */ +-#define CONFIG_STORE_COMPATIBLE 1 ++//#define CONFIG_STORE_COMPATIBLE 1 + /* + * storage + * |---------|---------| +@@ -298,7 +285,7 @@ + /* support for mtd */ + //#define CONFIG_AML_MTD 1 + /* support for nftl */ +-#define CONFIG_AML_NAND 1 ++//#define CONFIG_AML_NAND 1 + + #if defined(CONFIG_AML_NAND) && defined(CONFIG_AML_MTD) + #error CONFIG_AML_NAND/CONFIG_AML_MTD can not support at the sametime; +@@ -389,21 +376,6 @@ + #define CONFIG_USB_XHCI_AMLOGIC_GXL 1 + #endif //#if defined(CONFIG_CMD_USB) + +-//UBOOT fastboot config +-#define CONFIG_CMD_FASTBOOT 1 +-#define CONFIG_FASTBOOT_FLASH_MMC_DEV 1 +-#define CONFIG_FASTBOOT_FLASH 1 +-#define CONFIG_USB_GADGET 1 +-#define CONFIG_USBDOWNLOAD_GADGET 1 +-#define CONFIG_SYS_CACHELINE_SIZE 64 +-#define CONFIG_DEVICE_PRODUCT "libretech-cc" +- +-//UBOOT Facotry usb/sdcard burning config +-#define CONFIG_AML_V2_FACTORY_BURN 1 //support facotry usb burning +-#define CONFIG_AML_FACTORY_BURN_LOCAL_UPGRADE 1 //support factory sdcard burning +-#define CONFIG_POWER_KEY_NOT_SUPPORTED_FOR_BURN 1 //There isn't power-key for factory sdcard burning +-#define CONFIG_SD_BURNING_SUPPORT_UI 1 //Displaying upgrading progress bar when sdcard/udisk burning +- + #define CONFIG_AML_SECURITY_KEY 1 + #ifndef DTB_BIND_KERNEL + #define CONFIG_UNIFY_KEY_MANAGE 1 +@@ -449,7 +421,6 @@ + + /*file system*/ + #define CONFIG_DOS_PARTITION 1 +-#define CONFIG_AML_PARTITION 1 + #define CONFIG_MMC 1 + #define CONFIG_FS_FAT 1 + #define CONFIG_FS_EXT4 1 +diff --git a/board/amlogic/libretech_cc/libretech_cc.c b/board/amlogic/libretech_cc/libretech_cc.c +index 33bd007..fa66aaa 100644 +--- a/board/amlogic/libretech_cc/libretech_cc.c ++++ b/board/amlogic/libretech_cc/libretech_cc.c +@@ -71,6 +71,23 @@ int dram_init(void) + void secondary_boot_func(void) + { + } ++ ++/* ++ * Discover the boot device within MicroSD or eMMC ++ * and return 1 for eMMC, otherwise 0. ++ */ ++#define BOOT_DEVICE_RESERVED 0 ++#define BOOT_DEVICE_EMMC 1 ++#define BOOT_DEVICE_NAND 2 ++#define BOOT_DEVICE_SPI 3 ++#define BOOT_DEVICE_SD 4 ++#define BOOT_DEVICE_USB 5 ++ ++int get_boot_device(void) ++{ ++ return readl(AO_SEC_GP_CFG0) & 0xf; ++} ++ + void internalPhyConfig(struct phy_device *phydev) + { + /*Enable Analog and DSP register Bank access by*/ +@@ -263,8 +280,21 @@ int board_mmc_init(bd_t *bis) + #else + //board_mmc_register(SDIO_PORT_B); + #endif +- board_mmc_register(SDIO_PORT_B); +- board_mmc_register(SDIO_PORT_C); ++ switch (get_boot_device()) ++ { ++ case BOOT_DEVICE_EMMC: ++ board_mmc_register(SDIO_PORT_C); // "mmc0" ++ board_mmc_register(SDIO_PORT_B); ++ break; ++ case BOOT_DEVICE_SD: ++ board_mmc_register(SDIO_PORT_B); // "mmc0" ++ board_mmc_register(SDIO_PORT_C); ++ break; ++ default: ++ printf("No available mmc device! Check boot device!\n"); ++ do_reset(NULL, 0, 0, NULL); ++ break; ++ } + // board_mmc_register(SDIO_PORT_B1); + #if defined(CONFIG_ENV_IS_NOWHERE) && defined(CONFIG_AML_SD_EMMC) + /* try emmc here. */ +@@ -417,49 +447,12 @@ U_BOOT_CMD(hdmi_init, CONFIG_SYS_MAXARGS, 0, do_hdmi_init, + #endif + #ifdef CONFIG_BOARD_LATE_INIT + int board_late_init(void){ +- //update env before anyone using it +- run_command("get_rebootmode; echo reboot_mode=${reboot_mode}; "\ +- "if test ${reboot_mode} = factory_reset; then "\ +- "defenv_reserv aml_dt;setenv upgrade_step 2;save; fi;", 0); +- run_command("if itest ${upgrade_step} == 1; then "\ +- "defenv_reserv; setenv upgrade_step 2; saveenv; fi;", 0); +- + #ifndef CONFIG_AML_IRDETECT_EARLY + /* after */ + run_command("cvbs init;hdmitx hpd", 0); + run_command("vout output $outputmode", 0); + #endif + /*add board late init function here*/ +-#ifndef DTB_BIND_KERNEL +- int ret; +- ret = run_command("store dtb read $dtb_mem_addr", 1); +- if (ret) { +- printf("%s(): [store dtb read $dtb_mem_addr] fail\n", __func__); +- #ifdef CONFIG_DTB_MEM_ADDR +- char cmd[64]; +- printf("load dtb to %x\n", CONFIG_DTB_MEM_ADDR); +- sprintf(cmd, "store dtb read %x", CONFIG_DTB_MEM_ADDR); +- ret = run_command(cmd, 1); +- if (ret) { +- printf("%s(): %s fail\n", __func__, cmd); +- } +- #endif +- } +-#elif defined(CONFIG_DTB_MEM_ADDR) +- { +- char cmd[128]; +- int ret; +- if (!getenv("dtb_mem_addr")) { +- sprintf(cmd, "setenv dtb_mem_addr 0x%x", CONFIG_DTB_MEM_ADDR); +- run_command(cmd, 0); +- } +- sprintf(cmd, "imgread dtb boot ${dtb_mem_addr}"); +- ret = run_command(cmd, 0); +- if (ret) { +- printf("%s(): cmd[%s] fail, ret=%d\n", __func__, cmd, ret); +- } +- } +-#endif// #ifndef DTB_BIND_KERNEL + #ifdef CONFIG_AML_V2_FACTORY_BURN + if (0x1b8ec003 == readl(P_PREG_STICKY_REG2)) + aml_try_factory_usb_burning(1, gd->bd); +diff --git a/drivers/mmc/aml_sd_emmc.c b/drivers/mmc/aml_sd_emmc.c +index 57f949d..6ea60ee 100644 +--- a/drivers/mmc/aml_sd_emmc.c ++++ b/drivers/mmc/aml_sd_emmc.c +@@ -786,7 +786,6 @@ void sd_emmc_register(struct aml_card_sd_info * aml_priv) + #endif + cfg->f_min = 400000; + cfg->f_max = 40000000; +- cfg->part_type = PART_TYPE_AML; + cfg->b_max = 256; + mmc_create(cfg,aml_priv); + } +-- +2.7.4 + diff --git a/projects/Amlogic/packages/u-boot/patches/ffc14fc/u-boot-0001-khadas_vim-amend-boot-procedure-for-LibreELEC.patch b/projects/Amlogic/packages/u-boot/patches/ffc14fc/u-boot-0001-khadas_vim-amend-boot-procedure-for-LibreELEC.patch new file mode 100644 index 0000000000..82b0e6e4d9 --- /dev/null +++ b/projects/Amlogic/packages/u-boot/patches/ffc14fc/u-boot-0001-khadas_vim-amend-boot-procedure-for-LibreELEC.patch @@ -0,0 +1,464 @@ +From 1eab6c71f578b46bc9f33378252840ed46f9c443 Mon Sep 17 00:00:00 2001 +From: kszaq +Date: Sat, 17 Feb 2018 20:30:08 +0100 +Subject: [PATCH] khadas_vim: amend boot procedure for LibreELEC + +* make eMMC use MBR instead of AML partition structure +* port eMMC/SD renumbering from Hardkernel to allow booting from either SD or eMMC +* remove NAND driver (not in use) +* remove fastboot, bcb, store interface (not in use and conflicts with eMMC MBR) +* remove preboot steps that are not requried for faster booting +* fix eMMC for KVIM2 when CONFIG_ENV_IS_NOWHERE +--- + board/khadas/configs/kvim.h | 39 ++++----------------- + board/khadas/configs/kvim2.h | 37 +++----------------- + board/khadas/kvim/kvim.c | 83 +++++++++++++++++--------------------------- + board/khadas/kvim2/kvim2.c | 80 ++++++++++++++++++++++-------------------- + drivers/mmc/aml_sd_emmc.c | 1 - + 5 files changed, 85 insertions(+), 155 deletions(-) + +diff --git a/board/khadas/configs/kvim.h b/board/khadas/configs/kvim.h +index 0189f32..e95fc98 100644 +--- a/board/khadas/configs/kvim.h ++++ b/board/khadas/configs/kvim.h +@@ -47,7 +47,7 @@ + + //#define CONFIG_INSTABOOT + /* configs for dtb in boot.img */ +-//#define DTB_BIND_KERNEL ++#define DTB_BIND_KERNEL + + /* SMP Definitinos */ + #define CPU_RELEASE_ADDR secondary_boot_func +@@ -61,12 +61,6 @@ + /* support ext4*/ + #define CONFIG_CMD_EXT4 1 + +-/* Bootloader Control Block function +- That is used for recovery and the bootloader to talk to each other +- */ +-#define CONFIG_BOOTLOADER_CONTROL_BLOCK +- +- + /* Serial config */ + #define CONFIG_CONS_INDEX 2 + #define CONFIG_BAUDRATE 115200 +@@ -109,8 +103,6 @@ + "init_display=" \ + "osd open;" \ + "osd clear;" \ +- "imgread pic logo bootup ${loadaddr};" \ +- "bmp display ${bootup_offset}; bmp scale" \ + "\0"\ + "bootdisk=ramdisk\0" \ + "bootargs=" \ +@@ -140,13 +132,11 @@ + * - ramdisk: Ubuntu or Linux distro + */ + #define CONFIG_PREBOOT \ +- "run init_display;" \ +- "run combine_key;" \ +- "run upgrade_key;" ++ "run init_display;" + +-#define CONFIG_BOOTCOMMAND "cfgload;ext4load mmc 1:5 1080000 Image;ext4load mmc 1:5 10000000 uInitrd;ext4load mmc 1:5 20000000 kvim.dtb;booti 1080000 10000000 20000000" ++#define CONFIG_BOOTCOMMAND "cfgload" + +-//#define CONFIG_ENV_IS_NOWHERE 1 ++#define CONFIG_ENV_IS_NOWHERE 1 + #define CONFIG_ENV_SIZE (64*1024) + #define CONFIG_FIT 1 + #define CONFIG_OF_LIBFDT 1 +@@ -184,7 +174,7 @@ + #define CONFIG_DDR_FUNC_PRINT_WINDOW 0 //0:disable, 1:enable. print ddr training window + + /* storage: emmc/nand/sd */ +-#define CONFIG_STORE_COMPATIBLE 1 ++//#define CONFIG_STORE_COMPATIBLE 1 + /* + * storage + * |---------|---------| +@@ -199,7 +189,7 @@ + /* support for mtd */ + //#define CONFIG_AML_MTD 1 + /* support for nftl */ +-#define CONFIG_AML_NAND 1 ++// #define CONFIG_AML_NAND 1 + + #if defined(CONFIG_AML_NAND) && defined(CONFIG_AML_MTD) + #error CONFIG_AML_NAND/CONFIG_AML_MTD can not support at the sametime; +@@ -290,22 +280,6 @@ + #define CONFIG_USB_XHCI_AMLOGIC_GXL 1 + #endif //#if defined(CONFIG_CMD_USB) + +-//UBOOT fastboot config +-#define CONFIG_CMD_FASTBOOT 1 +-#define CONFIG_FASTBOOT_FLASH_MMC_DEV 1 +-#define CONFIG_FASTBOOT_FLASH 1 +-#define CONFIG_USB_GADGET 1 +-#define CONFIG_USBDOWNLOAD_GADGET 1 +-#define CONFIG_SYS_CACHELINE_SIZE 64 +-#define CONFIG_FASTBOOT_MAX_DOWN_SIZE 0x8000000 +-#define CONFIG_DEVICE_PRODUCT "p212" +- +-//UBOOT Facotry usb/sdcard burning config +-#define CONFIG_AML_V2_FACTORY_BURN 1 //support facotry usb burning +-#define CONFIG_AML_FACTORY_BURN_LOCAL_UPGRADE 1 //support factory sdcard burning +-#define CONFIG_POWER_KEY_NOT_SUPPORTED_FOR_BURN 1 //There isn't power-key for factory sdcard burning +-#define CONFIG_SD_BURNING_SUPPORT_UI 1 //Displaying upgrading progress bar when sdcard/udisk burning +- + #define CONFIG_AML_SECURITY_KEY 1 + #ifndef DTB_BIND_KERNEL + #define CONFIG_UNIFY_KEY_MANAGE 1 +@@ -352,7 +326,6 @@ + + /*file system*/ + #define CONFIG_DOS_PARTITION 1 +-#define CONFIG_AML_PARTITION 1 + #define CONFIG_MMC 1 + #define CONFIG_FS_FAT 1 + #define CONFIG_FS_EXT4 1 +diff --git a/board/khadas/configs/kvim2.h b/board/khadas/configs/kvim2.h +index 2b5f832..699b0ec 100644 +--- a/board/khadas/configs/kvim2.h ++++ b/board/khadas/configs/kvim2.h +@@ -54,11 +54,6 @@ + /* support ext4*/ + #define CONFIG_CMD_EXT4 1 + +-/* Bootloader Control Block function +- That is used for recovery and the bootloader to talk to each other +- */ +-#define CONFIG_BOOTLOADER_CONTROL_BLOCK +- + #define CONFIG_CMD_SARADC 1 + #define CONFIG_PHY_REALTEK 1 + +@@ -108,8 +103,6 @@ + "init_display=" \ + "osd open;" \ + "osd clear;" \ +- "imgread pic logo bootup ${loadaddr};" \ +- "bmp display ${bootup_offset}; bmp scale" \ + "\0"\ + "bootdisk=ramdisk\0" \ + "initargs=" \ +@@ -159,14 +152,11 @@ + + #define CONFIG_PREBOOT \ + "run init_display;"\ +- "run combine_key;" \ +- "run storeargs;"\ + "run wol_init;" \ +- "run upgrade_key;" \ + "run vim2_check;" +-#define CONFIG_BOOTCOMMAND "cfgload;ext4load mmc 1:5 1080000 Image;ext4load mmc 1:5 10000000 uInitrd;ext4load mmc 1:5 20000000 kvim2.dtb;booti 1080000 10000000 20000000" ++#define CONFIG_BOOTCOMMAND "cfgload" + +-//#define CONFIG_ENV_IS_NOWHERE 1 ++#define CONFIG_ENV_IS_NOWHERE 1 + #define CONFIG_ENV_SIZE (64*1024) + #define CONFIG_FIT 1 + #define CONFIG_OF_LIBFDT 1 +@@ -207,7 +197,7 @@ + #define CONFIG_DDR_PLL_BYPASS 0 //0:disable, 1:enable. ddr pll bypass function + + /* storage: emmc/nand/sd */ +-#define CONFIG_STORE_COMPATIBLE 1 ++//#define CONFIG_STORE_COMPATIBLE 1 + /* + * storage + * |---------|---------| +@@ -283,7 +273,7 @@ + + /*SPI*/ + //#define CONFIG_SPI_BOOT 1 +-#define CONFIG_AMLOGIC_SPI_FLASH 1 ++//#define CONFIG_AMLOGIC_SPI_FLASH 1 + #ifdef CONFIG_AMLOGIC_SPI_FLASH + #undef CONFIG_ENV_IS_NOWHERE + #define CONFIG_SPI_FLASH_WINBOND +@@ -329,24 +319,8 @@ + #define CONFIG_USB_XHCI_AMLOGIC_GXL 1 + #endif //#if defined(CONFIG_CMD_USB) + +-//UBOOT fastboot config +-#define CONFIG_CMD_FASTBOOT 1 +-#define CONFIG_FASTBOOT_FLASH_MMC_DEV 1 +-#define CONFIG_FASTBOOT_FLASH 1 +-#define CONFIG_USB_GADGET 1 +-#define CONFIG_USBDOWNLOAD_GADGET 1 +-#define CONFIG_SYS_CACHELINE_SIZE 64 +-#define CONFIG_FASTBOOT_MAX_DOWN_SIZE 0x8000000 +-#define CONFIG_DEVICE_PRODUCT "q200" +- +-//UBOOT Facotry usb/sdcard burning config +-#define CONFIG_AML_V2_FACTORY_BURN 1 //support facotry usb burning +-#define CONFIG_AML_FACTORY_BURN_LOCAL_UPGRADE 1 //support factory sdcard burning +-#define CONFIG_POWER_KEY_NOT_SUPPORTED_FOR_BURN 1 //There isn't power-key for factory sdcard burning +-#define CONFIG_SD_BURNING_SUPPORT_UI 1 //Displaying upgrading progress bar when sdcard/udisk burning +- + #define CONFIG_AML_SECURITY_KEY 1 +-#define CONFIG_UNIFY_KEY_MANAGE 1 ++//#define CONFIG_UNIFY_KEY_MANAGE 1 + + /* net */ + #define CONFIG_CMD_NET 1 +@@ -388,7 +362,6 @@ + + /*file system*/ + #define CONFIG_DOS_PARTITION 1 +-#define CONFIG_AML_PARTITION 1 + #define CONFIG_MMC 1 + #define CONFIG_FS_FAT 1 + #define CONFIG_FS_EXT4 1 +diff --git a/board/khadas/kvim/kvim.c b/board/khadas/kvim/kvim.c +index b1fdb96..41a056a 100644 +--- a/board/khadas/kvim/kvim.c ++++ b/board/khadas/kvim/kvim.c +@@ -71,6 +71,23 @@ int dram_init(void) + void secondary_boot_func(void) + { + } ++ ++/* ++ * Discover the boot device within MicroSD or eMMC ++ * and return 1 for eMMC, otherwise 0. ++ */ ++#define BOOT_DEVICE_RESERVED 0 ++#define BOOT_DEVICE_EMMC 1 ++#define BOOT_DEVICE_NAND 2 ++#define BOOT_DEVICE_SPI 3 ++#define BOOT_DEVICE_SD 4 ++#define BOOT_DEVICE_USB 5 ++ ++int get_boot_device(void) ++{ ++ return readl(AO_SEC_GP_CFG0) & 0xf; ++} ++ + void internalPhyConfig(struct phy_device *phydev) + { + /*Enable Analog and DSP register Bank access by*/ +@@ -263,8 +280,21 @@ int board_mmc_init(bd_t *bis) + #else + //board_mmc_register(SDIO_PORT_B); + #endif +- board_mmc_register(SDIO_PORT_B); +- board_mmc_register(SDIO_PORT_C); ++ switch (get_boot_device()) ++ { ++ case BOOT_DEVICE_EMMC: ++ board_mmc_register(SDIO_PORT_C); // "mmc0" ++ board_mmc_register(SDIO_PORT_B); ++ break; ++ case BOOT_DEVICE_SD: ++ board_mmc_register(SDIO_PORT_B); // "mmc0" ++ board_mmc_register(SDIO_PORT_C); ++ break; ++ default: ++ printf("No available mmc device! Check boot device!\n"); ++ do_reset(NULL, 0, 0, NULL); ++ break; ++ } + // board_mmc_register(SDIO_PORT_B1); + #if defined(CONFIG_ENV_IS_NOWHERE) && defined(CONFIG_AML_SD_EMMC) + /* try emmc here. */ +@@ -413,58 +443,9 @@ U_BOOT_CMD(hdmi_init, CONFIG_SYS_MAXARGS, 0, do_hdmi_init, + #endif + #ifdef CONFIG_BOARD_LATE_INIT + int board_late_init(void){ +- /* ENV need update in following cases: +- * - Bootloader upgrade +- * - New ROM upgrade(the built-in bootloader might be changed) +- */ +- run_command("get_rebootmode;" \ +- "echo reboot_mode=${reboot_mode};" \ +- "if test ${reboot_mode} = factory_reset; then " \ +- "defenv_reserv aml_dt;" \ +- "setenv upgrade_step 2;" \ +- "save;" \ +- "fi;", 0); +- run_command("if itest ${upgrade_step} == 1; then " \ +- "defenv_reserv;" \ +- "setenv upgrade_step 2;" \ +- "saveenv;" \ +- "fi;", 0); +- + /* HDMI setup */ + run_command("hdmitx hpd", 0); + run_command("vout output $outputmode", 0); +- /* Load DTB */ +-#ifndef DTB_BIND_KERNEL +- int ret; +- ret = run_command("store dtb read $dtb_mem_addr", 1); +- if (ret) { +- printf("%s(): [store dtb read $dtb_mem_addr] fail\n", __func__); +- #ifdef CONFIG_DTB_MEM_ADDR +- char cmd[64]; +- printf("load dtb to %x\n", CONFIG_DTB_MEM_ADDR); +- sprintf(cmd, "store dtb read %x", CONFIG_DTB_MEM_ADDR); +- ret = run_command(cmd, 1); +- if (ret) { +- printf("%s(): %s fail\n", __func__, cmd); +- } +- #endif +- } +-#elif defined(CONFIG_DTB_MEM_ADDR) +- { +- char cmd[128]; +- int ret; +- if (!getenv("dtb_mem_addr")) { +- sprintf(cmd, "setenv dtb_mem_addr 0x%x", CONFIG_DTB_MEM_ADDR); +- run_command(cmd, 0); +- } +- sprintf(cmd, "imgread dtb boot ${dtb_mem_addr}"); +- ret = run_command(cmd, 0); +- if (ret) { +- printf("%s(): cmd[%s] fail, ret=%d\n", __func__, cmd, ret); +- } +- } +-#endif// #ifndef DTB_BIND_KERNEL +- + /* Khadas VIM check */ + run_command("saradc open 1;" \ + "if saradc get_in_range 0x1a0 0x220; then " \ +diff --git a/board/khadas/kvim2/kvim2.c b/board/khadas/kvim2/kvim2.c +index 99a6181..3b9febf 100644 +--- a/board/khadas/kvim2/kvim2.c ++++ b/board/khadas/kvim2/kvim2.c +@@ -68,6 +68,23 @@ int dram_init(void) + void secondary_boot_func(void) + { + } ++ ++/* ++ * Discover the boot device within MicroSD or eMMC ++ * and return 1 for eMMC, otherwise 0. ++ */ ++#define BOOT_DEVICE_RESERVED 0 ++#define BOOT_DEVICE_EMMC 1 ++#define BOOT_DEVICE_NAND 2 ++#define BOOT_DEVICE_SPI 3 ++#define BOOT_DEVICE_SD 4 ++#define BOOT_DEVICE_USB 5 ++ ++int get_boot_device(void) ++{ ++ return readl(AO_SEC_GP_CFG0) & 0xf; ++} ++ + void internalPhyConfig(struct phy_device *phydev) + { + /*Enable Analog and DSP register Bank access by*/ +@@ -299,14 +316,36 @@ static void board_mmc_register(unsigned port) + } + int board_mmc_init(bd_t *bis) + { ++ __maybe_unused struct mmc *mmc; + #ifdef CONFIG_VLSI_EMULATOR + //board_mmc_register(SDIO_PORT_A); + #else + //board_mmc_register(SDIO_PORT_B); + #endif +- board_mmc_register(SDIO_PORT_B); +- board_mmc_register(SDIO_PORT_C); ++ switch (get_boot_device()) ++ { ++ case BOOT_DEVICE_EMMC: ++ board_mmc_register(SDIO_PORT_C); // "mmc0" ++ board_mmc_register(SDIO_PORT_B); ++ break; ++ case BOOT_DEVICE_SD: ++ board_mmc_register(SDIO_PORT_B); // "mmc0" ++ board_mmc_register(SDIO_PORT_C); ++ break; ++ default: ++ printf("No available mmc device! Check boot device!\n"); ++ do_reset(NULL, 0, 0, NULL); ++ break; ++ } + // board_mmc_register(SDIO_PORT_B1); ++#if defined(CONFIG_ENV_IS_NOWHERE) && defined(CONFIG_AML_SD_EMMC) ++ /* try emmc here. */ ++ mmc = find_mmc_device(CONFIG_SYS_MMC_ENV_DEV); ++ if (!mmc) ++ printf("%s() %d: No MMC found\n", __func__, __LINE__); ++ else if (mmc_init(mmc)) ++ printf("%s() %d: MMC init failed\n", __func__, __LINE__); ++#endif + return 0; + } + +@@ -446,34 +485,13 @@ U_BOOT_CMD(hdmi_init, CONFIG_SYS_MAXARGS, 0, do_hdmi_init, + #endif + #ifdef CONFIG_BOARD_LATE_INIT + int board_late_init(void){ +- int ret; +- +- //update env before anyone using it +- run_command("get_rebootmode; echo reboot_mode=${reboot_mode}; "\ +- "if test ${reboot_mode} = factory_reset; then "\ +- "defenv_reserv aml_dt;setenv upgrade_step 2;save; fi;", 0); +- run_command("if itest ${upgrade_step} == 1; then "\ +- "defenv_reserv; setenv upgrade_step 2; saveenv; fi;", 0); + + #ifndef CONFIG_AML_IRDETECT_EARLY + /* after */ +- run_command("cvbs init;hdmitx hpd", 0); ++ run_command("hdmitx hpd", 0); + run_command("vout output $outputmode", 0); + #endif + /*add board late init function here*/ +- ret = run_command("store dtb read $dtb_mem_addr", 1); +- if (ret) { +- printf("%s(): [store dtb read $dtb_mem_addr] fail\n", __func__); +- #ifdef CONFIG_DTB_MEM_ADDR +- char cmd[64]; +- printf("load dtb to %x\n", CONFIG_DTB_MEM_ADDR); +- sprintf(cmd, "store dtb read %x", CONFIG_DTB_MEM_ADDR); +- ret = run_command(cmd, 1); +- if (ret) { +- printf("%s(): %s fail\n", __func__, cmd); +- } +- #endif +- } + #ifdef CONFIG_AML_V2_FACTORY_BURN + if (0x1b8ec003 == readl(P_PREG_STICKY_REG2)) + aml_try_factory_usb_burning(1, gd->bd); +@@ -489,20 +507,6 @@ int board_late_init(void){ + /* load uboot pq value */ + vpp_pq_load(); + +- ret = run_command("store dtb read $dtb_mem_addr", 1); +- if (ret) { +- printf("%s(): [store dtb read $dtb_mem_addr] fail\n", __func__); +-#ifdef CONFIG_DTB_MEM_ADDR +- char cmd[64]; +- printf("load dtb to %x\n", CONFIG_DTB_MEM_ADDR); +- sprintf(cmd, "store dtb read %x", CONFIG_DTB_MEM_ADDR); +- ret = run_command(cmd, 1); +- if (ret) { +- printf("%s(): %s fail\n", __func__, cmd); +- } +-#endif +-} +- + return 0; + } + #endif +diff --git a/drivers/mmc/aml_sd_emmc.c b/drivers/mmc/aml_sd_emmc.c +index 4d3a84f..f8aa8f7 100644 +--- a/drivers/mmc/aml_sd_emmc.c ++++ b/drivers/mmc/aml_sd_emmc.c +@@ -787,7 +787,6 @@ void sd_emmc_register(struct aml_card_sd_info * aml_priv) + #endif + cfg->f_min = 400000; + cfg->f_max = 40000000; +- cfg->part_type = PART_TYPE_AML; + cfg->b_max = 256; + mmc_create(cfg,aml_priv); + } +-- +2.7.4 + diff --git a/scripts/mkimage b/scripts/mkimage index b99f12a279..6c64b454c5 100755 --- a/scripts/mkimage +++ b/scripts/mkimage @@ -263,11 +263,6 @@ EOF mcopy $RELEASE_DIR/target/KERNEL.md5 "::/$KERNEL_NAME.md5" mcopy $RELEASE_DIR/target/SYSTEM.md5 ::/SYSTEM.md5 - # copy Amlogic device tree image - if [ -f "$RELEASE_DIR/3rdparty/bootloader/dtb.img" ]; then - mcopy $RELEASE_DIR/3rdparty/bootloader/dtb.img :: - fi - elif [ "$BOOTLOADER" = "u-boot" ]; then echo "to make an image using u-boot UBOOT_SYSTEM must be set" cleanup