rockchip: rk3288: use ARM arch timer instead of rk_timer
[oweals/u-boot.git] / arch / arm / mach-imx / mkimage_fit_atf.sh
1 #!/bin/sh
2 # SPDX-License-Identifier: GPL-2.0+
3 #
4 # script to generate FIT image source for i.MX8MQ boards with
5 # ARM Trusted Firmware and multiple device trees (given on the command line)
6 #
7 # usage: $0 <dt_name> [<dt_name> [<dt_name] ...]
8
9 [ -z "$BL31" ] && BL31="bl31.bin"
10 [ -z "$TEE_LOAD_ADDR" ] && TEE_LOAD_ADDR="0xfe000000"
11 [ -z "$ATF_LOAD_ADDR" ] && ATF_LOAD_ADDR="0x00910000"
12 [ -z "$BL33_LOAD_ADDR" ] && BL33_LOAD_ADDR="0x40200000"
13
14 if [ ! -f $BL31 ]; then
15         echo "ERROR: BL31 file $BL31 NOT found" >&2
16         exit 0
17 else
18         echo "$BL31 size: " >&2
19         ls -lct $BL31 | awk '{print $5}' >&2
20 fi
21
22 BL32="tee.bin"
23
24 if [ ! -f $BL32 ]; then
25         BL32=/dev/null
26 else
27         echo "Building with TEE support, make sure your $BL31 is compiled with spd. If you do not want tee, please delete $BL31" >&2
28         echo "$BL32 size: " >&2
29         ls -lct $BL32 | awk '{print $5}' >&2
30 fi
31
32 BL33="u-boot-nodtb.bin"
33
34 if [ ! -f $BL33 ]; then
35         echo "ERROR: $BL33 file NOT found" >&2
36         exit 0
37 else
38         echo "u-boot-nodtb.bin size: " >&2
39         ls -lct u-boot-nodtb.bin | awk '{print $5}' >&2
40 fi
41
42 for dtname in $*
43 do
44         echo "$dtname size: " >&2
45         ls -lct $dtname | awk '{print $5}' >&2
46 done
47
48
49 cat << __HEADER_EOF
50 /dts-v1/;
51
52 / {
53         description = "Configuration to load ATF before U-Boot";
54
55         images {
56                 uboot@1 {
57                         description = "U-Boot (64-bit)";
58                         data = /incbin/("$BL33");
59                         type = "standalone";
60                         arch = "arm64";
61                         compression = "none";
62                         load = <$BL33_LOAD_ADDR>;
63                 };
64                 atf@1 {
65                         description = "ARM Trusted Firmware";
66                         data = /incbin/("$BL31");
67                         type = "firmware";
68                         arch = "arm64";
69                         compression = "none";
70                         load = <$ATF_LOAD_ADDR>;
71                         entry = <$ATF_LOAD_ADDR>;
72                 };
73 __HEADER_EOF
74
75 if [ -f $BL32 ]; then
76 cat << __HEADER_EOF
77                 tee@1 {
78                         description = "TEE firmware";
79                         data = /incbin/("$BL32");
80                         type = "firmware";
81                         arch = "arm64";
82                         compression = "none";
83                         load = <$TEE_LOAD_ADDR>;
84                         entry = <$TEE_LOAD_ADDR>;
85                 };
86 __HEADER_EOF
87 fi
88
89 cnt=1
90 for dtname in $*
91 do
92         cat << __FDT_IMAGE_EOF
93                 fdt@$cnt {
94                         description = "$(basename $dtname .dtb)";
95                         data = /incbin/("$dtname");
96                         type = "flat_dt";
97                         compression = "none";
98                 };
99 __FDT_IMAGE_EOF
100 cnt=$((cnt+1))
101 done
102
103 cat << __CONF_HEADER_EOF
104         };
105         configurations {
106                 default = "config@1";
107
108 __CONF_HEADER_EOF
109
110 cnt=1
111 for dtname in $*
112 do
113 if [ -f $BL32 ]; then
114 cat << __CONF_SECTION_EOF
115                 config@$cnt {
116                         description = "$(basename $dtname .dtb)";
117                         firmware = "uboot@1";
118                         loadables = "atf@1", "tee@1";
119                         fdt = "fdt@$cnt";
120                 };
121 __CONF_SECTION_EOF
122 else
123 cat << __CONF_SECTION1_EOF
124                 config@$cnt {
125                         description = "$(basename $dtname .dtb)";
126                         firmware = "uboot@1";
127                         loadables = "atf@1";
128                         fdt = "fdt@$cnt";
129                 };
130 __CONF_SECTION1_EOF
131 fi
132 cnt=$((cnt+1))
133 done
134
135 cat << __ITS_EOF
136         };
137 };
138 __ITS_EOF