distribution/projects/Amlogic/bootloader/mkimage

81 lines
2 KiB
Text
Raw Normal View History

2023-03-22 21:56:33 +00:00
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2023-present BrooksyTech (https://github.com/brooksytech)
source ${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/options
2023-03-29 20:06:23 +00:00
#Write u-boot.bin to image
2023-04-20 21:40:42 +00:00
case "${PKG_SOC}" in
s922x)
2023-03-29 20:06:23 +00:00
if [ -f "${RELEASE_DIR}/3rdparty/bootloader/u-boot.bin" ]; then
2023-04-20 21:40:42 +00:00
echo "image: burn uboot.bin to image... (${PKG_SOC})"
2023-03-29 20:06:23 +00:00
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
2023-03-22 21:56:33 +00:00
2023-04-11 19:48:04 +00:00
#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
2023-04-22 14:23:31 +00:00
if [ -d "${RELEASE_DIR}/3rdparty/bootloader/res" ]; then
cp -r "${RELEASE_DIR}/3rdparty/bootloader/res" "${LE_TMP}/res"
mcopy -so "${LE_TMP}/res" ::
fi
2023-04-11 19:48:04 +00:00
fi
2023-03-29 20:06:23 +00:00
#Create boot.ini
2023-03-29 12:50:23 +00:00
if [ "${BOOT_INI}" == true ]
then
echo "image: create boot.ini..."
cat >"${LE_TMP}/boot.ini" <<EOF
JELOS-UBOOT-CONFIG
2023-03-29 12:50:23 +00:00
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
2023-07-03 15:15:02 +00:00
load mmc \${devno}:1 \${dtb_loadaddr} \${fdtfile}
2023-03-29 12:50:23 +00:00
fdt addr \${dtb_loadaddr}
booti \${loadaddr} - \${dtb_loadaddr}
2023-03-22 21:56:33 +00:00
2023-03-29 12:50:23 +00:00
EOF
mcopy -so "${LE_TMP}/boot.ini" ::
fi
#Copy device trees to part1
2023-03-22 21:56:33 +00:00
for DTB in ${DEVICE_DTB[@]}
do
if [ -e "${DTB}.dtb" ]
then
echo "image: copy device trees to image..."
mcopy -o "${DTB}.dtb" ::
fi
done
2023-03-29 12:50:23 +00:00
#Create extlinux.conf
if [ "${EXT_LINUX_CONF}" == true ]
then
2023-03-22 21:56:33 +00:00
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" ::
2023-03-29 12:50:23 +00:00
fi