xref: /rk3399_rockchip-uboot/arch/arm/mach-rockchip/make_fit_optee.sh (revision 87e4c6020eff05133e40ab8b7b0e37e6a2be37e4)
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			data = /incbin/("./u-boot-nodtb.bin");
20			type = "standalone";
21			os = "U-Boot";
22			arch = "arm";
23			compression = "none";
24EOF
25
26OUTDIR=$PWD
27DARM_BASE=`sed -n "/CONFIG_SYS_SDRAM_BASE=/s/CONFIG_SYS_SDRAM_BASE=//p" ${OUTDIR}/include/autoconf.mk|tr -d '\r'`
28UBOOT_OFFSET=0x00200000
29UBOOT_BASE=$((DARM_BASE+UBOOT_OFFSET))
30UBOOT_BASE=$(echo "obase=16;${UBOOT_BASE}"|bc)
31echo "			load = <0x"$UBOOT_BASE">;"
32
33cat << EOF
34		};
35		optee@1 {
36			description = "OP-TEE";
37			data = /incbin/("./tee.bin");
38			type = "firmware";
39			arch = "arm";
40			os = "op-tee";
41			compression = "none";
42EOF
43
44TEE_OFFSET=0x8400000
45TEE_LOAD_ADDR=$((DARM_BASE+TEE_OFFSET))
46TEE_LOAD_ADDR=$(echo "obase=16;${TEE_LOAD_ADDR}"|bc)
47echo "			load = <0x"$TEE_LOAD_ADDR">;"
48echo "			entry = <0x"$TEE_LOAD_ADDR">;"
49
50cat << EOF
51		};
52		fdt@1 {
53			description = "dtb";
54			data = /incbin/("./u-boot.dtb");
55			type = "flat_dt";
56			compression = "none";
57		};
58	};
59
60	configurations {
61		default = "conf@1";
62		conf@1 {
63			description = "Rockchip armv7 with OP-TEE";
64			firmware = "optee@1";
65			loadables = "uboot@1";
66			fdt = "fdt@1";
67		};
68	};
69};
70EOF
71