diff --git a/projects/Amlogic/bootloader/mkimage b/projects/Amlogic/bootloader/mkimage
index e17ce7b94b..314c8163e4 100644
--- a/projects/Amlogic/bootloader/mkimage
+++ b/projects/Amlogic/bootloader/mkimage
@@ -19,13 +19,32 @@
################################################################################
# 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
+case "$DEVICE" in
+ "S905"|"S912"|"LePotato"|"KVIM")
+ 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
+ ;;
+esac
# 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/devices/KVIM/bootloader/mkimage b/projects/Amlogic/devices/KVIM/bootloader/mkimage
deleted file mode 100644
index 155fc06b16..0000000000
--- a/projects/Amlogic/devices/KVIM/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=444 >"$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/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/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