2022-02-05 14:23:32 +00:00
|
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
|
|
# Copyright (C) 2017-2020 Team LibreELEC (https://libreelec.tv)
|
|
|
|
# Copyright (C) 2021-present Fewtarius
|
|
|
|
|
|
|
|
source ${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/options
|
|
|
|
|
2022-08-01 21:52:51 +00:00
|
|
|
case "${PKG_SOC}" in
|
|
|
|
rk356x|rk3399)
|
|
|
|
IDBSEEK="bs=512 seek=64"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
IDBSEEK="bs=32k seek=1"
|
|
|
|
;;
|
|
|
|
esac
|
2022-05-27 22:33:28 +00:00
|
|
|
|
2022-03-17 00:15:21 +00:00
|
|
|
if [ -f "${RELEASE_DIR}/3rdparty/bootloader/idbloader.img" ]; then
|
2022-06-23 23:53:12 +00:00
|
|
|
echo "image: burn idbloader.img to image... (${PKG_SOC},${IDBSEEK})"
|
2022-06-20 01:03:49 +00:00
|
|
|
dd if="${RELEASE_DIR}/3rdparty/bootloader/idbloader.img" of="$DISK" ${IDBSEEK} conv=sync,noerror,notrunc >"${SAVE_ERROR}" 2>&1 || show_error
|
2022-02-05 14:23:32 +00:00
|
|
|
fi
|
2022-03-17 00:15:21 +00:00
|
|
|
if [ -f "${RELEASE_DIR}/3rdparty/bootloader/uboot.img" ]; then
|
2022-02-05 14:23:32 +00:00
|
|
|
echo "image: burn uboot.img to image..."
|
2022-06-20 01:03:49 +00:00
|
|
|
dd if="${RELEASE_DIR}/3rdparty/bootloader/uboot.img" of="$DISK" bs=512 seek=16384 conv=sync,noerror,notrunc >"${SAVE_ERROR}" 2>&1 || show_error
|
2022-02-05 14:23:32 +00:00
|
|
|
fi
|
2022-03-17 00:15:21 +00:00
|
|
|
if [ -f "${RELEASE_DIR}/3rdparty/bootloader/trust.img" ]; then
|
2022-02-05 14:23:32 +00:00
|
|
|
echo "image: burn trust.img to image..."
|
2022-06-20 01:03:49 +00:00
|
|
|
dd if="${RELEASE_DIR}/3rdparty/bootloader/trust.img" of="$DISK" bs=512 seek=24576 conv=sync,noerror,notrunc >"${SAVE_ERROR}" 2>&1 || show_error
|
2022-05-27 22:33:28 +00:00
|
|
|
elif [ -f "${RELEASE_DIR}/3rdparty/bootloader/resource.img" ]; then
|
|
|
|
echo "image: burn resource.img to image..."
|
2022-06-20 01:03:49 +00:00
|
|
|
dd if="${RELEASE_DIR}/3rdparty/bootloader/resource.img" of="$DISK" bs=512 seek=24576 conv=sync,noerror,notrunc >"${SAVE_ERROR}" 2>&1 || show_error
|
2022-02-05 14:23:32 +00:00
|
|
|
fi
|
|
|
|
|
2022-03-17 00:15:21 +00:00
|
|
|
if [ -f "${RELEASE_DIR}/3rdparty/bootloader/boot.ini" ]; then
|
|
|
|
cp "${RELEASE_DIR}/3rdparty/bootloader/boot.ini" "${LE_TMP}/boot.ini"
|
2022-02-05 14:23:32 +00:00
|
|
|
mcopy -so "${LE_TMP}/boot.ini" ::
|
|
|
|
fi
|
|
|
|
|
|
|
|
mkdir -p "${LE_TMP}/extlinux"
|
|
|
|
|
|
|
|
# copy device trees to part1
|
2022-10-01 00:40:33 +00:00
|
|
|
for DTB in ${DEVICE_DTB[@]}
|
|
|
|
do
|
|
|
|
if [ -e "${DTB}.dtb" ]
|
|
|
|
then
|
|
|
|
mcopy -o "${DTB}.dtb" ::
|
|
|
|
fi
|
|
|
|
done
|
2022-02-05 14:23:32 +00:00
|
|
|
|
|
|
|
mkdir -p "${LE_TMP}/extlinux"
|
|
|
|
|
|
|
|
cat << EOF > "${LE_TMP}/extlinux/extlinux.conf"
|
|
|
|
LABEL ${DISTRO}
|
|
|
|
LINUX /${KERNEL_NAME}
|
2022-10-01 00:40:33 +00:00
|
|
|
FDT /${DEVICE_DTB[0]}.dtb
|
2022-02-05 14:23:32 +00:00
|
|
|
APPEND boot=UUID=${UUID_SYSTEM} disk=UUID=${UUID_STORAGE} ${EXTRA_CMDLINE}
|
|
|
|
EOF
|
|
|
|
|
|
|
|
mcopy -so "${LE_TMP}/extlinux" ::
|