Lakka-LibreELEC/projects/Samsung/bootloader/mkimage
Tomáš Kelemen (vudiq) 4f0cf20828
Exyons/Odroid: add boot.ini to enable boot from eMMC
Co-authored-by: Ntemis <ierokipides.dem@gmail.com>
2022-04-24 10:28:28 +02:00

56 lines
1.9 KiB
Plaintext

# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2020-present Team LibreELEC (https://libreelec.tv)
. config/options ""
mkimage_uboot(){
echo "image: writing u-boot to $(basename $DISK)"
dd if="$INSTALL/usr/share/bootloader/bl1.bin.hardkernel" of="$DISK" bs=512 seek=1 conv=notrunc >"$SAVE_ERROR" 2>&1 || show_error
dd if="$INSTALL/usr/share/bootloader/bl2.bin.hardkernel.720k_uboot" of="$DISK" bs=512 seek=31 conv=notrunc >"$SAVE_ERROR" 2>&1 || show_error
dd if="$INSTALL/usr/share/bootloader/u-boot-dtb.bin" of="$DISK" bs=512 seek=63 conv=notrunc >"$SAVE_ERROR" 2>&1 || show_error
dd if="$INSTALL/usr/share/bootloader/tzsw.bin.hardkernel" of="$DISK" bs=512 seek=1503 conv=notrunc >"$SAVE_ERROR" 2>&1 || show_error
mcopy -s -o "$INSTALL/usr/share/bootloader/u-boot-dtb.bin" ::
}
mkimage_extlinux(){
echo "image: copying exlinux.conf"
mkdir -p "${LE_TMP}/extlinux"
cat << EOF > "${LE_TMP}/extlinux/extlinux.conf"
LABEL ${DISTRO}
LINUX /${KERNEL_NAME}
FDT /${DTB}
APPEND boot=LABEL=${DISTRO_BOOTLABEL} disk=LABEL=${DISTRO_DISKLABEL} ${EXTRA_CMDLINE}
EOF
mcopy -s -o "${LE_TMP}/extlinux" ::
}
mkimage_dtb(){
if [ "$DTB" != "@@DTB_NAME@@" ]; then
echo "image: copying device tree"
mcopy -s -o "${RELEASE_DIR}/3rdparty/bootloader/dtb/$DTB" ::
else
echo "image: copying device trees"
mcopy -s -o "${RELEASE_DIR}/3rdparty/bootloader/dtb" ::
fi
}
case "${UBOOT_SYSTEM}" in
odroid*)
mkimage_uboot
mkimage_extlinux
mkimage_dtb
;;
esac
# Install boot.ini if exists for given UBOOT_SYSTEM
if find_file_path bootloader/${UBOOT_SYSTEM}.ini ; then
cp ${FOUND_PATH} ${RELEASE_DIR}/3rdparty/bootloader/boot.ini
sed -e "s|@BOOT_UUID@|${UUID_SYSTEM}|" \
-e "s|@DISK_UUID@|${UUID_STORAGE}|" \
-e "s|@KERNEL_NAME@|${KERNEL_NAME}|" \
-e "s|@DTB_NAME@|${DTB}|" \
-i "${RELEASE_DIR}/3rdparty/bootloader/boot.ini"
echo "image: installing boot.ini"
mcopy -s -o "${RELEASE_DIR}/3rdparty/bootloader/boot.ini" ::
fi