1#!/bin/bash 2# 3# Copyright (c) 2022 Rockchip Electronics Co., Ltd 4# 5# SPDX-License-Identifier: GPL-2.0 6# 7set -e 8 9source ./scripts/fit-core.sh 10fit_process_args $* 11 12# Sign boot/recovery.img and it inserts the RSA pubkey into u-boot.dtb by default 13if [ ! -z "${ARG_VALIDATE}" ]; then 14 validate_arg ${ARG_VALIDATE} 15else 16 fit_raw_compile 17 if [ ! -z "${ARG_RECOVERY_IMG}" ]; then 18 fit_gen_recovery_itb 19 fit_gen_recovery_img 20 fi 21 if [ ! -z "${ARG_BOOT_IMG}" ]; then 22 fit_gen_boot_itb 23 fit_gen_boot_img 24 fi 25fi 26 27# New u-boot.bin with RSA pubkey 28cat u-boot-nodtb.bin u-boot.dtb > u-boot.bin 29 30# Pack image 31COMPRESS="lzma" 32ADDR=`sed -n "/CONFIG_SYS_TEXT_BASE=/s/CONFIG_SYS_TEXT_BASE=//p" include/autoconf.mk|tr -d '\r'` 33./scripts/lzma.sh u-boot.bin 34./tools/mkimage -A arm -O u-boot -T standalone -C ${COMPRESS} -a ${ADDR} -e ${ADDR} -d u-boot.bin.${COMPRESS} u-boot.bin.${COMPRESS}.uImage 35cp -f spl/u-boot-spl-nodtb.bin u-boot.bin.decomp 36if ! grep -q '^CONFIG_SPL_SEPARATE_BSS=y' .config ; then 37 cat spl/u-boot-spl-pad.bin >> u-boot.bin.decomp 38fi 39cat u-boot.bin.${COMPRESS}.uImage >> u-boot.bin.decomp 40cp -f u-boot.bin.decomp spl/u-boot-spl.bin 41 42# Pack loader 43./make.sh spl 44 45# Sign loader 46fit_gen_loader 47 48# Delelte 49rm -f uboot.img trust.img 50 51# Output msg 52echo 53echo "Image: $(ls *download*.bin) (with usbplug...) is ready" 54fit_msg_u_boot_loader 55fit_msg_recovery 56fit_msg_boot 57