]>
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 | # | |
8 | # usage: $0 <dt_name> [<dt_name> [<dt_name] ...] | |
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 | ||
24 | cat << __HEADER_EOF | |
25 | /dts-v1/; | |
26 | ||
27 | / { | |
28 | description = "Configuration to load ATF and SPL"; | |
29 | #address-cells = <1>; | |
30 | ||
31 | images { | |
32 | atf { | |
33 | description = "ARM Trusted Firmware"; | |
34 | data = /incbin/("$ATF"); | |
35 | type = "firmware"; | |
36 | arch = "arm64"; | |
37 | compression = "none"; | |
38 | os = "arm-trusted-firmware"; | |
39 | load = <0x70000000>; | |
40 | entry = <0x70000000>; | |
41 | }; | |
42 | tee { | |
43 | description = "OPTEE"; | |
44 | data = /incbin/("$TEE"); | |
45 | type = "tee"; | |
46 | arch = "arm64"; | |
47 | compression = "none"; | |
48 | os = "tee"; | |
49 | load = <0x9e800000>; | |
50 | entry = <0x9e800000>; | |
51 | }; | |
52 | spl { | |
53 | description = "SPL (64-bit)"; | |
54 | data = /incbin/("spl/u-boot-spl-nodtb.bin"); | |
55 | type = "standalone"; | |
56 | os = "U-Boot"; | |
57 | arch = "arm64"; | |
58 | compression = "none"; | |
59 | load = <0x80080000>; | |
60 | entry = <0x80080000>; | |
61 | }; | |
62 | __HEADER_EOF | |
63 | ||
64 | for dtname in $* | |
65 | do | |
66 | cat << __FDT_IMAGE_EOF | |
67 | $(basename $dtname) { | |
68 | description = "$(basename $dtname .dtb)"; | |
69 | data = /incbin/("$dtname"); | |
70 | type = "flat_dt"; | |
71 | arch = "arm"; | |
72 | compression = "none"; | |
73 | }; | |
74 | __FDT_IMAGE_EOF | |
75 | done | |
76 | ||
77 | cat << __CONF_HEADER_EOF | |
78 | }; | |
79 | configurations { | |
80 | default = "$(basename $1)"; | |
81 | ||
82 | __CONF_HEADER_EOF | |
83 | ||
84 | for dtname in $* | |
85 | do | |
86 | cat << __CONF_SECTION_EOF | |
87 | $(basename $dtname) { | |
88 | description = "$(basename $dtname .dtb)"; | |
89 | firmware = "atf"; | |
90 | loadables = "tee", "spl"; | |
91 | fdt = "$(basename $dtname)"; | |
92 | }; | |
93 | __CONF_SECTION_EOF | |
94 | done | |
95 | ||
96 | cat << __ITS_EOF | |
97 | }; | |
98 | }; | |
99 | __ITS_EOF |