xref: /rk3399_rockchip-uboot/arch/arm/mach-rockchip/make_fit_optee.sh (revision a4d1e7eec003b64fb6dffab3cba3f114ef87b607)
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_BASE=`sed -n "/CONFIG_SYS_TEXT_BASE=/s/CONFIG_SYS_TEXT_BASE=//p" ${OUTDIR}/include/autoconf.mk|tr -d '\r'`
29echo "			load = <"$UBOOT_BASE">;"
30cat << EOF
31			hash@1 {
32				algo = "sha256";
33			};
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">;"
49cat << EOF
50			hash@1 {
51				algo = "sha256";
52			};
53		};
54		fdt@1 {
55			description = "U-Boot dtb";
56			data = /incbin/("./u-boot.dtb");
57			type = "flat_dt";
58			compression = "none";
59			hash@1 {
60				algo = "sha256";
61			};
62		};
63	};
64
65	configurations {
66		default = "conf@1";
67		conf@1 {
68			description = "Rockchip armv7 with OP-TEE";
69			rollback-index = <0x0>;
70			firmware = "optee@1";
71			loadables = "uboot@1";
72			fdt = "fdt@1";
73			signature@1 {
74				algo = "sha256,rsa2048";
75				key-name-hint = "dev";
76				sign-images = "fdt", "firmware", "loadables";
77			};
78		};
79	};
80};
81EOF
82