109 lines
2.7 KiB
Plaintext
109 lines
2.7 KiB
Plaintext
source "${BASH_SOURCE%/*}/include/rockchip64_common.inc"
|
|
|
|
BOOTPATCHDIR="u-boot-rk3399"
|
|
|
|
case $BRANCH in
|
|
|
|
legacy)
|
|
|
|
KERNELSOURCE='https://github.com/friendlyarm/kernel-rockchip'
|
|
KERNELBRANCH='branch:nanopi4-linux-v4.4.y'
|
|
KERNELDIR='linux-rockchip64'
|
|
KERNELCONFIG='linux-rockchip64'
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
RKBIN_DIR="$SRC/cache/sources/rkbin-tools"
|
|
|
|
if [[ $BOARD == roc-rk3399-pc ]]; then
|
|
|
|
BOOT_USE_MAINLINE_ATF=yes
|
|
|
|
elif [[ $BOARD == rockpi-4* ]]; then
|
|
|
|
BOOT_USE_TPL_SPL_BLOB=yes
|
|
BL31_BLOB='rk33/rk3399_bl31_v1.30.elf'
|
|
|
|
elif [[ $BOARD == nanopim4v2 ]]; then
|
|
|
|
BOOT_USE_BLOBS=yes
|
|
DDR_BLOB='rk33/rk3399_ddr_933MHz_v1.24.bin'
|
|
MINILOADER_BLOB='rk33/rk3399_miniloader_v1.19.bin'
|
|
BL31_BLOB='rk33/rk3399_bl31_v1.30.elf'
|
|
|
|
else
|
|
|
|
BOOT_USE_BLOBS=yes
|
|
DDR_BLOB='rk33/rk3399_ddr_800MHz_v1.24.bin'
|
|
MINILOADER_BLOB='rk33/rk3399_miniloader_v1.19.bin'
|
|
BL31_BLOB='rk33/rk3399_bl31_v1.30.elf'
|
|
|
|
fi
|
|
|
|
if [[ $BOOT_USE_MAINLINE_ATF == yes ]]; then
|
|
|
|
UBOOT_TARGET_MAP="BL31=bl31.bin idbloader.img u-boot.itb;;idbloader.img u-boot.itb"
|
|
ATFSOURCE='https://github.com/ARM-software/arm-trusted-firmware'
|
|
ATFDIR='arm-trusted-firmware'
|
|
ATFBRANCH='tag:v2.2'
|
|
ATF_USE_GCC='> 6.3'
|
|
ATF_TARGET_MAP='M0_CROSS_COMPILE=arm-linux-gnueabi- PLAT=rk3399 bl31;;build/rk3399/release/bl31/bl31.elf:bl31.bin'
|
|
ATF_TOOLCHAIN2="arm-linux-gnueabi-:> 5.0"
|
|
|
|
elif [[ $BOOT_USE_TPL_SPL_BLOB == yes ]]; then
|
|
|
|
UBOOT_TARGET_MAP="BL31=$RKBIN_DIR/$BL31_BLOB idbloader.img u-boot.itb;;idbloader.img u-boot.itb"
|
|
ATFSOURCE=''
|
|
ATF_COMPILE='no'
|
|
|
|
elif [[ $BOOT_USE_BLOBS == yes ]]; then
|
|
|
|
UBOOT_TARGET_MAP="u-boot-dtb.bin;;idbloader.bin uboot.img trust.bin"
|
|
ATFSOURCE=''
|
|
ATF_COMPILE='no'
|
|
|
|
fi
|
|
|
|
write_uboot_platform()
|
|
{
|
|
if [[ $BOOT_USE_MAINLINE_ATF == yes || $BOOT_USE_TPL_SPL_BLOB == yes ]]; then
|
|
|
|
dd if=$1/idbloader.img of=$2 seek=64 conv=notrunc status=none >/dev/null 2>&1
|
|
dd if=$1/u-boot.itb of=$2 seek=16384 conv=notrunc status=none >/dev/null 2>&1
|
|
|
|
elif [[ $BOOT_USE_BLOBS == yes ]] ; then
|
|
|
|
dd if=$1/idbloader.bin of=$2 seek=64 conv=notrunc status=none >/dev/null 2>&1
|
|
dd if=$1/uboot.img of=$2 seek=16384 conv=notrunc status=none >/dev/null 2>&1
|
|
dd if=$1/trust.bin of=$2 seek=24576 conv=notrunc status=none >/dev/null 2>&1
|
|
|
|
else
|
|
echo "Unsupported u-boot processing configuration!"
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
uboot_custom_postprocess()
|
|
{
|
|
if [[ $BOOT_USE_MAINLINE_ATF == yes || $BOOT_USE_TPL_SPL_BLOB == yes ]]; then
|
|
|
|
:
|
|
|
|
elif [[ $BOOT_USE_BLOBS == yes ]]; then
|
|
|
|
local tempfile=$(mktemp)
|
|
tools/mkimage -n rk3399 -T rksd -d $RKBIN_DIR/$DDR_BLOB idbloader.bin
|
|
cat $RKBIN_DIR/$MINILOADER_BLOB >> idbloader.bin
|
|
loaderimage --pack --uboot ./u-boot-dtb.bin uboot.img 0x200000
|
|
trust_merger --replace ./build/rk3399/debug/bl31/bl31.elf $RKBIN_DIR/$BL31_BLOB trust.ini
|
|
|
|
else
|
|
echo "Unsupported u-boot processing configuration!"
|
|
exit 1
|
|
fi
|
|
}
|