1#!/bin/bash 2 3cat << EOF 4/* 5 * Copyright (C) 2017 Rockchip Electronic Co.,Ltd 6 * 7 * Simple U-boot fit source file containing U-Boot, dtb and optee 8 */ 9 10/dts-v1/; 11 12/ { 13 description = "Simple image with OP-TEE support"; 14 #address-cells = <1>; 15 16 images { 17 uboot@1 { 18 description = "U-Boot"; 19 image = "u-boot-nodtb.bin"; 20 data = /incbin/("./u-boot-nodtb.bin"); 21 type = "standalone"; 22 os = "U-Boot"; 23 arch = "arm"; 24 compression = "none"; 25EOF 26 27OUTDIR=$PWD 28DARM_BASE=`sed -n "/CONFIG_SYS_SDRAM_BASE=/s/CONFIG_SYS_SDRAM_BASE=//p" ${OUTDIR}/include/autoconf.mk|tr -d '\r'` 29UBOOT_BASE=`sed -n "/CONFIG_SYS_TEXT_BASE=/s/CONFIG_SYS_TEXT_BASE=//p" ${OUTDIR}/include/autoconf.mk|tr -d '\r'` 30echo " load = <"$UBOOT_BASE">;" 31cat << EOF 32 hash@1 { 33 algo = "sha256"; 34 }; 35 }; 36 optee@1 { 37 description = "OP-TEE"; 38 image = "tee.bin"; 39 data = /incbin/("./tee.bin"); 40 type = "firmware"; 41 arch = "arm"; 42 os = "op-tee"; 43 compression = "none"; 44EOF 45 46if [ -z "$1" -o ! -z "$(echo $1 | sed 's/[x, X, 0-9, a-f, A-F]//g')" ]; then 47 TEE_OFFSET=0x8400000 48else 49 TEE_OFFSET=$1 50fi 51TEE_LOAD_ADDR=$((DARM_BASE+TEE_OFFSET)) 52TEE_LOAD_ADDR=$(echo "obase=16;${TEE_LOAD_ADDR}"|bc) 53echo " load = <0x"$TEE_LOAD_ADDR">;" 54echo " entry = <0x"$TEE_LOAD_ADDR">;" 55cat << EOF 56 hash@1 { 57 algo = "sha256"; 58 }; 59 }; 60 fdt@1 { 61 description = "U-Boot dtb"; 62 image = "u-boot.dtb"; 63 data = /incbin/("./u-boot.dtb"); 64 type = "flat_dt"; 65 compression = "none"; 66 hash@1 { 67 algo = "sha256"; 68 }; 69 }; 70 }; 71 72 configurations { 73 default = "conf@1"; 74 conf@1 { 75 description = "Rockchip armv7 with OP-TEE"; 76 rollback-index = <0x0>; 77 firmware = "optee@1"; 78 loadables = "uboot@1"; 79 fdt = "fdt@1"; 80 signature@1 { 81 algo = "sha256,rsa2048"; 82 key-name-hint = "dev"; 83 sign-images = "fdt", "firmware", "loadables"; 84 }; 85 }; 86 }; 87}; 88EOF 89