distribution/projects/Amlogic/bootloader/mkimage
2023-04-11 19:48:04 +00:00

76 lines
1.9 KiB
Text

# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2023-present BrooksyTech (https://github.com/brooksytech)
source ${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/options
#Write u-boot.bin to image
case "${DEVICE}" in
S922X)
if [ -f "${RELEASE_DIR}/3rdparty/bootloader/u-boot.bin" ]; then
echo "image: burn uboot.itb to image... (${PKG_SOC})"
dd if="${RELEASE_DIR}/3rdparty/bootloader/u-boot.bin" of="${DISK}" bs=512 seek=1 conv=sync,noerror,notrunc >"${SAVE_ERROR}" 2>&1 || show_error
fi
esac
#Copy bios bin
if [ "${BIOS_BIN}" == true ]; then
if [ -f "${RELEASE_DIR}/3rdparty/bootloader/ODROIDBIOS.BIN" ]; then
echo "image: copy bios bin image..."
cp "${RELEASE_DIR}/3rdparty/bootloader/ODROIDBIOS.BIN" "${LE_TMP}/ODROIDBIOS.BIN"
mcopy -so "${LE_TMP}/ODROIDBIOS.BIN" ::
fi
fi
#Create boot.ini
if [ "${BOOT_INI}" == true ]
then
echo "image: create boot.ini..."
cat >"${LE_TMP}/boot.ini" <<EOF
ODROIDGOU-UBOOT-CONFIG
setenv dtb_loadaddr "0x10000000"
setenv loadaddr "0x1B00000"
setenv bootargs "boot=UUID=${UUID_SYSTEM} disk=UUID=${UUID_STORAGE} ${EXTRA_CMDLINE}"
load mmc \${devno}:1 \${loadaddr} KERNEL
load mmc \${devno}:1 \${dtb_loadaddr} meson-g12b-odroid-go-ultra.dtb
fdt addr \${dtb_loadaddr}
booti \${loadaddr} - \${dtb_loadaddr}
EOF
mcopy -so "${LE_TMP}/boot.ini" ::
fi
#Copy device trees to part1
for DTB in ${DEVICE_DTB[@]}
do
if [ -e "${DTB}.dtb" ]
then
echo "image: copy device trees to image..."
mcopy -o "${DTB}.dtb" ::
fi
done
#Create extlinux.conf
if [ "${EXT_LINUX_CONF}" == true ]
then
mkdir -p "${LE_TMP}/extlinux"
echo "image: Set FTD to ${DEVICE_DTB}..."
FDTMODE="FDT /${DEVICE_DTB}.dtb"
echo "image: Set extlinux.conf..."
cat << EOF > "${LE_TMP}/extlinux/extlinux.conf"
LABEL ${DISTRO}
LINUX /${KERNEL_NAME}
${FDTMODE}
APPEND boot=UUID=${UUID_SYSTEM} disk=UUID=${UUID_STORAGE} ${EXTRA_CMDLINE}
EOF
mcopy -so "${LE_TMP}/extlinux" ::
fi