]>
Commit | Line | Data |
---|---|---|
9d4f8c42 LV |
1 | #!/bin/sh |
2 | # SPDX-License-Identifier: GPL-2.0+ | |
3 | # | |
4 | # script to generate FIT image source for K3 Family boards with | |
5 | # ATF, OPTEE, SPL and multiple device trees (given on the command line). | |
6 | # Inspired from board/sunxi/mksunxi_fit_atf.sh | |
7 | # | |
0c515092 | 8 | # usage: $0 <atf_load_addr> <dt_name> [<dt_name> [<dt_name] ...] |
9d4f8c42 LV |
9 | |
10 | [ -z "$ATF" ] && ATF="bl31.bin" | |
11 | ||
12 | if [ ! -f $ATF ]; then | |
13 | echo "WARNING ATF file $ATF NOT found, resulting binary is non-functional" >&2 | |
14 | ATF=/dev/null | |
15 | fi | |
16 | ||
17 | [ -z "$TEE" ] && TEE="bl32.bin" | |
18 | ||
19 | if [ ! -f $TEE ]; then | |
20 | echo "WARNING OPTEE file $TEE NOT found, resulting might be non-functional" >&2 | |
21 | TEE=/dev/null | |
22 | fi | |
23 | ||
df5363a6 TK |
24 | [ -z "$DM" ] && DM="dm.bin" |
25 | ||
26 | if [ ! -e $DM ]; then | |
27 | echo "WARNING DM file $DM NOT found, resulting might be non-functional" >&2 | |
28 | DM=/dev/null | |
29 | fi | |
30 | ||
50836967 AD |
31 | if [ ! -z "$IS_HS" ]; then |
32 | HS_APPEND=_HS | |
33 | fi | |
34 | ||
9d4f8c42 LV |
35 | cat << __HEADER_EOF |
36 | /dts-v1/; | |
37 | ||
38 | / { | |
39 | description = "Configuration to load ATF and SPL"; | |
40 | #address-cells = <1>; | |
41 | ||
42 | images { | |
43 | atf { | |
44 | description = "ARM Trusted Firmware"; | |
45 | data = /incbin/("$ATF"); | |
46 | type = "firmware"; | |
47 | arch = "arm64"; | |
48 | compression = "none"; | |
49 | os = "arm-trusted-firmware"; | |
0c515092 AG |
50 | load = <$1>; |
51 | entry = <$1>; | |
9d4f8c42 LV |
52 | }; |
53 | tee { | |
54 | description = "OPTEE"; | |
55 | data = /incbin/("$TEE"); | |
56 | type = "tee"; | |
57 | arch = "arm64"; | |
58 | compression = "none"; | |
59 | os = "tee"; | |
60 | load = <0x9e800000>; | |
61 | entry = <0x9e800000>; | |
62 | }; | |
df5363a6 TK |
63 | dm { |
64 | description = "DM binary"; | |
65 | data = /incbin/("$DM"); | |
66 | type = "firmware"; | |
67 | arch = "arm32"; | |
68 | compression = "none"; | |
69 | os = "DM"; | |
7d67334d SA |
70 | load = <0x89000000>; |
71 | entry = <0x89000000>; | |
df5363a6 | 72 | }; |
9d4f8c42 LV |
73 | spl { |
74 | description = "SPL (64-bit)"; | |
50836967 | 75 | data = /incbin/("spl/u-boot-spl-nodtb.bin$HS_APPEND"); |
9d4f8c42 LV |
76 | type = "standalone"; |
77 | os = "U-Boot"; | |
78 | arch = "arm64"; | |
79 | compression = "none"; | |
80 | load = <0x80080000>; | |
81 | entry = <0x80080000>; | |
82 | }; | |
83 | __HEADER_EOF | |
84 | ||
0c515092 AG |
85 | # shift through ATF load address in the command line arguments |
86 | shift | |
87 | ||
9d4f8c42 LV |
88 | for dtname in $* |
89 | do | |
90 | cat << __FDT_IMAGE_EOF | |
91 | $(basename $dtname) { | |
92 | description = "$(basename $dtname .dtb)"; | |
50836967 | 93 | data = /incbin/("$dtname$HS_APPEND"); |
9d4f8c42 LV |
94 | type = "flat_dt"; |
95 | arch = "arm"; | |
96 | compression = "none"; | |
97 | }; | |
98 | __FDT_IMAGE_EOF | |
99 | done | |
100 | ||
101 | cat << __CONF_HEADER_EOF | |
102 | }; | |
103 | configurations { | |
104 | default = "$(basename $1)"; | |
105 | ||
106 | __CONF_HEADER_EOF | |
107 | ||
108 | for dtname in $* | |
109 | do | |
110 | cat << __CONF_SECTION_EOF | |
111 | $(basename $dtname) { | |
112 | description = "$(basename $dtname .dtb)"; | |
113 | firmware = "atf"; | |
df5363a6 | 114 | loadables = "tee", "dm", "spl"; |
9d4f8c42 LV |
115 | fdt = "$(basename $dtname)"; |
116 | }; | |
117 | __CONF_SECTION_EOF | |
118 | done | |
119 | ||
120 | cat << __ITS_EOF | |
121 | }; | |
122 | }; | |
123 | __ITS_EOF |