blob: 2c0287a63394773b1660b4b1565dab6890ac3db7 [file] [log] [blame]
Lokesh Vutla59b6ba72018-08-27 15:57:14 +05301#!/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#
Aswath Govindraju560ea8a2021-06-04 22:00:31 +05308# usage: $0 <atf_load_addr> <dt_name> [<dt_name> [<dt_name] ...]
Lokesh Vutla59b6ba72018-08-27 15:57:14 +05309
10[ -z "$ATF" ] && ATF="bl31.bin"
11
12if [ ! -f $ATF ]; then
13 echo "WARNING ATF file $ATF NOT found, resulting binary is non-functional" >&2
14 ATF=/dev/null
15fi
16
17[ -z "$TEE" ] && TEE="bl32.bin"
18
19if [ ! -f $TEE ]; then
20 echo "WARNING OPTEE file $TEE NOT found, resulting might be non-functional" >&2
21 TEE=/dev/null
22fi
23
Andrew F. Davis3fa338d2019-04-12 12:54:46 -040024if [ ! -z "$IS_HS" ]; then
25 HS_APPEND=_HS
26fi
27
Lokesh Vutla59b6ba72018-08-27 15:57:14 +053028cat << __HEADER_EOF
29/dts-v1/;
30
31/ {
32 description = "Configuration to load ATF and SPL";
33 #address-cells = <1>;
34
35 images {
36 atf {
37 description = "ARM Trusted Firmware";
38 data = /incbin/("$ATF");
39 type = "firmware";
40 arch = "arm64";
41 compression = "none";
42 os = "arm-trusted-firmware";
Aswath Govindraju560ea8a2021-06-04 22:00:31 +053043 load = <$1>;
44 entry = <$1>;
Lokesh Vutla59b6ba72018-08-27 15:57:14 +053045 };
46 tee {
47 description = "OPTEE";
48 data = /incbin/("$TEE");
49 type = "tee";
50 arch = "arm64";
51 compression = "none";
52 os = "tee";
53 load = <0x9e800000>;
54 entry = <0x9e800000>;
55 };
56 spl {
57 description = "SPL (64-bit)";
Andrew F. Davis3fa338d2019-04-12 12:54:46 -040058 data = /incbin/("spl/u-boot-spl-nodtb.bin$HS_APPEND");
Lokesh Vutla59b6ba72018-08-27 15:57:14 +053059 type = "standalone";
60 os = "U-Boot";
61 arch = "arm64";
62 compression = "none";
63 load = <0x80080000>;
64 entry = <0x80080000>;
65 };
66__HEADER_EOF
67
Aswath Govindraju560ea8a2021-06-04 22:00:31 +053068# shift through ATF load address in the command line arguments
69shift
70
Lokesh Vutla59b6ba72018-08-27 15:57:14 +053071for dtname in $*
72do
73 cat << __FDT_IMAGE_EOF
74 $(basename $dtname) {
75 description = "$(basename $dtname .dtb)";
Andrew F. Davis3fa338d2019-04-12 12:54:46 -040076 data = /incbin/("$dtname$HS_APPEND");
Lokesh Vutla59b6ba72018-08-27 15:57:14 +053077 type = "flat_dt";
78 arch = "arm";
79 compression = "none";
80 };
81__FDT_IMAGE_EOF
82done
83
84cat << __CONF_HEADER_EOF
85 };
86 configurations {
87 default = "$(basename $1)";
88
89__CONF_HEADER_EOF
90
91for dtname in $*
92do
93 cat << __CONF_SECTION_EOF
94 $(basename $dtname) {
95 description = "$(basename $dtname .dtb)";
96 firmware = "atf";
97 loadables = "tee", "spl";
98 fdt = "$(basename $dtname)";
99 };
100__CONF_SECTION_EOF
101done
102
103cat << __ITS_EOF
104 };
105};
106__ITS_EOF