blob: 4118472d9f22d13a2d4e874179368753b158d7da [file] [log] [blame]
Kever Yang4c4abd12019-11-15 10:27:07 +08001#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0+
3#
4# Copyright (C) 2019 Rockchip Electronic Co.,Ltd
5#
6# Script to generate FIT image source for 32-bit Rockchip SoCs with
7# U-Boot proper, OPTEE, and devicetree.
8#
9# usage: $0 <dt_name>
10
11[ -z "$TEE" ] && TEE="tee.bin"
12
13if [ ! -f $TEE ]; then
14 echo "WARNING: TEE file $TEE NOT found, U-Boot.itb is non-functional" >&2
15 echo "Please export path for TEE or copy tee.bin to U-Boot folder" >&2
16 TEE=/dev/null
17fi
18
19dtname=$1
Kever Yang16d20472019-12-05 18:11:52 +080020text_base=`sed -n "/SYS_TEXT_BASE=/s/CONFIG_SYS_TEXT_BASE=//p" .config \
21 |tr -d '\r'`
22dram_base=`sed -n "/SYS_SDRAM_BASE=/s/CONFIG_SYS_SDRAM_BASE=//p" \
23 include/autoconf.mk|tr -d '\r'`
24tee_base=`echo "obase=16;$(($dram_base+0x8400000))"|bc`
25tee_base='0x'$tee_base
Kever Yang4c4abd12019-11-15 10:27:07 +080026
27cat << __HEADER_EOF
28/*
29 * Copyright (C) 2017-2019 Rockchip Electronic Co.,Ltd
30 *
31 * Simple U-boot FIT source file containing U-Boot, dtb and optee
32 */
33
34/dts-v1/;
35
36/ {
37 description = "FIT image with OP-TEE support";
38 #address-cells = <1>;
39
40 images {
41 uboot {
42 description = "U-Boot";
43 data = /incbin/("u-boot-nodtb.bin");
44 type = "standalone";
45 os = "U-Boot";
46 arch = "arm";
47 compression = "none";
Kever Yang16d20472019-12-05 18:11:52 +080048 load = <$text_base>;
Kever Yang4c4abd12019-11-15 10:27:07 +080049 };
50 optee {
51 description = "OP-TEE";
52 data = /incbin/("$TEE");
53 type = "firmware";
54 arch = "arm";
55 os = "tee";
56 compression = "none";
Kever Yang16d20472019-12-05 18:11:52 +080057 load = <$tee_base>;
58 entry = <$tee_base>;
Kever Yang4c4abd12019-11-15 10:27:07 +080059 };
60 fdt {
61 description = "$(basename $dtname .dtb)";
62 data = /incbin/("$dtname");
63 type = "flat_dt";
64 compression = "none";
65 };
66__HEADER_EOF
67
68cat << __CONF_HEADER_EOF
69 };
70
71 configurations {
72 default = "conf";
73 conf {
74 description = "$(basename $dtname .dtb)";
75 firmware = "optee";
76 loadables = "uboot";
77 fdt = "fdt";
78 };
79__CONF_HEADER_EOF
80
81cat << __ITS_EOF
82 };
83};
84__ITS_EOF