2023-01-08 22:49: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
|
|
|
|
|
2023-01-09 22:26:15 +00:00
|
|
|
IDBSEEK="bs=512 seek=64"
|
2023-01-08 22:49:32 +00:00
|
|
|
|
|
|
|
if [ -f "${RELEASE_DIR}/3rdparty/bootloader/idbloader.img" ]; then
|
|
|
|
echo "image: burn idbloader.img to image... (${PKG_SOC},${IDBSEEK})"
|
|
|
|
dd if="${RELEASE_DIR}/3rdparty/bootloader/idbloader.img" of="${DISK}" bs=512 seek=64 conv=sync,noerror,notrunc >"${SAVE_ERROR}" 2>&1 || show_error
|
|
|
|
fi
|
2023-01-09 22:26:15 +00:00
|
|
|
|
2023-01-08 22:49:32 +00:00
|
|
|
case "${PKG_SOC}" in
|
|
|
|
rk3588)
|
2023-01-09 22:26:15 +00:00
|
|
|
if [ -f "${RELEASE_DIR}/3rdparty/bootloader/u-boot.itb" ]; then
|
|
|
|
echo "image: burn uboot.itb to image... (${PKG_SOC})"
|
|
|
|
dd if="${RELEASE_DIR}/3rdparty/bootloader/u-boot.itb" of="${DISK}" bs=512 seek=16384 conv=sync,noerror,notrunc >"${SAVE_ERROR}" 2>&1 || show_error
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
if [ -f "${RELEASE_DIR}/3rdparty/bootloader/u-boot.img" ]; then
|
|
|
|
echo "image: burn uboot.img to image... (${PKG_SOC})"
|
|
|
|
dd if="${RELEASE_DIR}/3rdparty/bootloader/u-boot.img" of="${DISK}" bs=512 seek=16384 conv=sync,noerror,notrunc >"${SAVE_ERROR}" 2>&1 || show_error
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -f "${RELEASE_DIR}/3rdparty/bootloader/trust.img" ]; then
|
|
|
|
echo "image: burn trust.img to image..."
|
|
|
|
dd if="${RELEASE_DIR}/3rdparty/bootloader/trust.img" of="${DISK}" bs=512 seek=24576 conv=sync,noerror,notrunc >"${SAVE_ERROR}" 2>&1 || show_error
|
|
|
|
|
|
|
|
elif [ -f "${RELEASE_DIR}/3rdparty/bootloader/resource.img" ]; then
|
|
|
|
echo "image: burn resource.img to image..."
|
|
|
|
dd if="${RELEASE_DIR}/3rdparty/bootloader/resource.img" of="${DISK}" bs=512 seek=24576 conv=sync,noerror,notrunc >"${SAVE_ERROR}" 2>&1 || show_error
|
|
|
|
fi
|
|
|
|
;;
|
2023-01-08 22:49:32 +00:00
|
|
|
esac
|
|
|
|
|
|
|
|
if [ -f "${RELEASE_DIR}/3rdparty/bootloader/boot.ini" ]; then
|
|
|
|
cp "${RELEASE_DIR}/3rdparty/bootloader/boot.ini" "${LE_TMP}/boot.ini"
|
|
|
|
mcopy -so "${LE_TMP}/boot.ini" ::
|
|
|
|
fi
|
|
|
|
|
|
|
|
mkdir -p "${LE_TMP}/extlinux"
|
|
|
|
|
|
|
|
# copy device trees to part1
|
|
|
|
for DTB in ${DEVICE_DTB[@]}
|
|
|
|
do
|
|
|
|
if [ -e "${DTB}.dtb" ]
|
|
|
|
then
|
|
|
|
mcopy -o "${DTB}.dtb" ::
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
mkdir -p "${LE_TMP}/extlinux"
|
|
|
|
|
|
|
|
cat << EOF > "${LE_TMP}/extlinux/extlinux.conf"
|
|
|
|
LABEL ${DISTRO}
|
|
|
|
LINUX /${KERNEL_NAME}
|
|
|
|
FDT /${DEVICE_DTB[0]}.dtb
|
|
|
|
APPEND boot=UUID=${UUID_SYSTEM} disk=UUID=${UUID_STORAGE} ${EXTRA_CMDLINE}
|
|
|
|
EOF
|
|
|
|
|
|
|
|
mcopy -so "${LE_TMP}/extlinux" ::
|