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