2022-02-05 14:23:32 +00:00
|
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
|
|
# Copyright (C) 2017-2021 Team LibreELEC (https://libreelec.tv)
|
|
|
|
# Copyright (C) 2021-present Fewtarius
|
|
|
|
|
|
|
|
PKG_RKBIN="$(get_build_dir rkbin)"
|
|
|
|
source ${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/options
|
|
|
|
|
2022-05-30 22:12:33 +00:00
|
|
|
if [ -n "${PKG_DATAFILE}" -a -n "${PKG_LOADER}" ]; then
|
|
|
|
echo "loader: Make idbloader.img from ${PKG_DATAFILE}:${PKG_LOADER}..."
|
2022-08-01 21:52:51 +00:00
|
|
|
case "${PKG_SOC}" in
|
|
|
|
rk356x|rk3399)
|
|
|
|
tools/mkimage -n ${PKG_SOC} -T rksd -d ${PKG_DATAFILE}:${PKG_LOADER} -C bzip2 idbloader.img
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
tools/mkimage -n ${PKG_SOC} -T rksd -d "${PKG_DATAFILE}" -C bzip2 idbloader.img
|
|
|
|
cat "${PKG_LOADER}" >> idbloader.img
|
|
|
|
;;
|
|
|
|
esac
|
2022-05-30 22:12:33 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
cp -av idbloader.img ${INSTALL}/usr/share/bootloader
|
|
|
|
|
2022-02-05 14:23:32 +00:00
|
|
|
if [ ! -n "${PKG_LOAD_ADDR}" ]; then
|
|
|
|
PKG_LOAD_ADDR="0x00200000"
|
|
|
|
fi
|
|
|
|
|
2022-08-01 21:52:51 +00:00
|
|
|
case "${PKG_SOC}" in
|
|
|
|
rk356x)
|
|
|
|
echo "uboot: copy uboot image to ${INSTALL}/usr/share/bootloader..."
|
|
|
|
cp -av uboot.img ${INSTALL}/usr/share/bootloader
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "uboot: build loader image uboot.img at ${PKG_LOAD_ADDR}..."
|
|
|
|
${PKG_RKBIN}/tools/loaderimage --pack --uboot u-boot-dtb.bin uboot.img ${PKG_LOAD_ADDR} ||:
|
|
|
|
cp -av uboot.img ${INSTALL}/usr/share/bootloader
|
|
|
|
;;
|
|
|
|
esac
|
2022-02-05 14:23:32 +00:00
|
|
|
|
2022-03-17 00:15:21 +00:00
|
|
|
if [ -n "${PKG_BL31}" ]; then
|
2022-05-27 22:33:28 +00:00
|
|
|
echo "trust: create trust.ini..."
|
2022-02-05 14:23:32 +00:00
|
|
|
cat >trust.ini <<EOF
|
|
|
|
[BL30_OPTION]
|
|
|
|
SEC=0
|
|
|
|
[BL31_OPTION]
|
|
|
|
SEC=1
|
2022-03-17 00:15:21 +00:00
|
|
|
PATH=${PKG_BL31}
|
2022-02-05 14:23:32 +00:00
|
|
|
ADDR=0x00010000
|
|
|
|
[BL32_OPTION]
|
|
|
|
SEC=0
|
|
|
|
[BL33_OPTION]
|
|
|
|
SEC=0
|
|
|
|
[OUTPUT]
|
|
|
|
PATH=trust.img
|
|
|
|
EOF
|
2022-03-26 02:28:08 +00:00
|
|
|
TROPTS="--verbose"
|
2022-03-17 00:15:21 +00:00
|
|
|
${PKG_RKBIN}/tools/trust_merger ${TROPTS} trust.ini
|
|
|
|
cp -av trust.img ${INSTALL}/usr/share/bootloader
|
2022-02-05 14:23:32 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "${BOOT_INI}" == true ]
|
|
|
|
then
|
2022-05-27 22:33:28 +00:00
|
|
|
echo "boot: create boot.ini..."
|
|
|
|
cat >${INSTALL}/usr/share/bootloader/boot.ini <<EOF
|
2022-05-29 18:33:05 +00:00
|
|
|
odroidgoa-uboot-config
|
2022-02-05 14:23:32 +00:00
|
|
|
|
|
|
|
setenv fdt_addr_r "0x01f00000"
|
|
|
|
setenv dtb_name "${DEVICE_DTB}.dtb"
|
|
|
|
setenv loadaddr "${PKG_LOAD_ADDR}"
|
|
|
|
setenv scriptaddr "0x00500000"
|
|
|
|
setenv kernel_addr_r "0x02008000"
|
|
|
|
|
2022-05-27 22:33:28 +00:00
|
|
|
sysboot mmc ${BOOT_PART} any \${scriptaddr} /extlinux/extlinux.conf
|
2022-02-05 14:23:32 +00:00
|
|
|
|
|
|
|
EOF
|
|
|
|
fi
|
2022-03-17 00:15:21 +00:00
|
|
|
|
2022-05-27 22:33:28 +00:00
|
|
|
echo "boot: create extlinux.conf..."
|
2022-03-17 00:15:21 +00:00
|
|
|
mkdir -p "${INSTALL}/usr/share/bootloader/extlinux"
|
|
|
|
cat << EOF > "${INSTALL}/usr/share/bootloader/extlinux/extlinux.conf"
|
|
|
|
LABEL ${DISTRO}
|
|
|
|
LINUX /${KERNEL_NAME}
|
|
|
|
FDT /${DEVICE_DTB}.dtb
|
|
|
|
APPEND boot=UUID=@BOOT_UUID@ disk=UUID=@DISK_UUID@ ${EXTRA_CMDLINE}
|
|
|
|
EOF
|