distribution/projects/Rockchip/devices/RG351V/bootloader/install
2022-02-05 09:23:32 -05:00

102 lines
2.3 KiB
Text

# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv)
PKG_RKBIN="$(get_build_dir rkbin)"
PKG_SOC="px30"
PKG_DATAFILE="$PKG_RKBIN/bin/rk33/rk3326_ddr_333MHz_v1.15.bin"
PKG_LOADER="$PKG_RKBIN/bin/rk33/rk3326_miniloader_v1.20.bin"
PKG_BL31="$PKG_RKBIN/bin/rk33/rk3326_bl31_v1.21.elf"
PKG_BL32="$PKG_RKBIN/bin/rk33/rk3326_bl32_v1.15.bin"
PKG_LOAD_ADDR="0x00200000"
if [ -n "$PKG_DATAFILE" -a -n "$PKG_LOADER" ]; then
tools/mkimage -n $PKG_SOC -T rksd -d "$PKG_DATAFILE" idbloader.img
cat "$PKG_LOADER" >> idbloader.img
cp -av idbloader.img $INSTALL/usr/share/bootloader
fi
if [ -n "$PKG_LOAD_ADDR" ]; then
$PKG_RKBIN/tools/loaderimage --pack --uboot u-boot-dtb.bin uboot.img $PKG_LOAD_ADDR
cp -av uboot.img $INSTALL/usr/share/bootloader
fi
cat >$INSTALL/usr/share/bootloader/boot.ini <<EOF
odroidgoa-uboot-config
setenv fdt_addr_r "0x01f00000"
setenv dtb_name "rk3326-rg351v-linux.dtb"
setenv loadaddr "${PKG_LOAD_ADDR}"
setenv scriptaddr "0x00500000"
setenv kernel_addr_r "0x02008000"
sysboot mmc 1:1 any \${scriptaddr} /extlinux/rk3326-rg351v-linux.dtb.conf
EOF
if [ $DEVICE = "AndroidGoAdvance" ]; then
if [ -n "$PKG_BL31" ]; then
cat >trust.ini <<EOF
[VERSION]
MAJOR=1
MINOR=0
[BL30_OPTION]
SEC=0
[BL31_OPTION]
SEC=1
PATH=$PKG_BL31
ADDR=0x00010000
[BL32_OPTION]
SEC=1
PATH=$PKG_BL32
ADDR=0x08400000
[BL33_OPTION]
SEC=0
[OUTPUT]
PATH=trust.img
EOF
$PKG_RKBIN/tools/trust_merger --rsa 3 --verbose trust.ini
cp -av trust.img $INSTALL/usr/share/bootloader
fi
else
if [ -n "$PKG_BL31" ]; then
cat >trust.ini <<EOF
[BL30_OPTION]
SEC=0
[BL31_OPTION]
SEC=1
PATH=$PKG_BL31
ADDR=0x00010000
[BL32_OPTION]
SEC=0
[BL33_OPTION]
SEC=0
[OUTPUT]
PATH=trust.img
EOF
$PKG_RKBIN/tools/trust_merger --verbose trust.ini
cp -av trust.img $INSTALL/usr/share/bootloader
fi
fi
LE_TMP=$(mktemp -d)
mkdir -p "${LE_TMP}/extlinux"
mkdir -p $INSTALL/usr/share/bootloader/extlinux
LINUX_DTS_DIR=$(get_build_dir linux)/.install_pkg/usr/share/bootloader
for dtb in $(find $LINUX_DTS_DIR -name "*.dtb")
do
cat << EOF > "${LE_TMP}/extlinux/$(basename ${dtb}).conf"
LABEL ${DISTRO}
LINUX /${KERNEL_NAME}
FDT /$(basename ${dtb})
APPEND boot=UUID=@BOOT_UUID@ disk=UUID=@DISK_UUID@ quiet ${EXTRA_CMDLINE}
EOF
cp -a "${LE_TMP}/extlinux/$(basename ${dtb}).conf" $INSTALL/usr/share/bootloader/extlinux
done