distribution/projects/Rockchip/bootloader/mkimage
2022-02-05 09:23:32 -05:00

50 lines
1.7 KiB
Text

# 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
if [ -f "$RELEASE_DIR/3rdparty/bootloader/idbloader.img" ]; then
echo "image: burn idbloader.img to image..."
dd if="$RELEASE_DIR/3rdparty/bootloader/idbloader.img" of="$DISK" bs=32k seek=1 conv=fsync,notrunc >"$SAVE_ERROR" 2>&1 || show_error
fi
if [ -f "$RELEASE_DIR/3rdparty/bootloader/uboot.img" ]; then
echo "image: burn uboot.img to image..."
dd if="$RELEASE_DIR/3rdparty/bootloader/uboot.img" of="$DISK" bs=64k seek=128 conv=fsync,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=64k seek=192 conv=fsync,notrunc >"$SAVE_ERROR" 2>&1 || show_error
fi
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
#if [ -f "$RELEASE_DIR/3rdparty/bootloader/logo.bmp" ]; then
# cp "$RELEASE_DIR/3rdparty/bootloader/logo.bmp" "${LE_TMP}/logo.bmp"
# mcopy -so "${LE_TMP}/logo.bmp" ::
#fi
mkdir -p "${LE_TMP}/extlinux"
# copy device trees to part1
#for dtb in $RELEASE_DIR/3rdparty/bootloader/*.dtb; do
# [ -e "$dtb" ] && mcopy -o "$dtb" ::
#done
if [ -e "${DEVICE_DTB}.dtb" ]
then
mcopy -o "${DEVICE_DTB}.dtb" ::
fi
mkdir -p "${LE_TMP}/extlinux"
cat << EOF > "${LE_TMP}/extlinux/extlinux.conf"
LABEL ${DISTRO}
LINUX /${KERNEL_NAME}
FDT /${DEVICE_DTB}.dtb
APPEND boot=UUID=${UUID_SYSTEM} disk=UUID=${UUID_STORAGE} ${EXTRA_CMDLINE}
EOF
mcopy -so "${LE_TMP}/extlinux" ::