xref: /rk3399_rockchip-uboot/board/sunxi/mksunxi_fit_atf.sh (revision d29adf8eef4e9557326fd0bc09a08c7dfa688eab)
1#!/bin/sh
2#
3# script to generate FIT image source for 64-bit sunxi boards with
4# ARM Trusted Firmware and multiple device trees (given on the command line)
5#
6# usage: $0 <dt_name> [<dt_name> [<dt_name] ...]
7
8[ -z "$BL31" ] && BL31="bl31.bin"
9
10cat << __HEADER_EOF
11/dts-v1/;
12
13/ {
14	description = "Configuration to load ATF before U-Boot";
15	#address-cells = <1>;
16
17	images {
18		uboot@1 {
19			description = "U-Boot (64-bit)";
20			data = /incbin/("u-boot-nodtb.bin");
21			type = "standalone";
22			arch = "arm64";
23			compression = "none";
24			load = <0x4a000000>;
25		};
26		atf@1 {
27			description = "ARM Trusted Firmware";
28			data = /incbin/("$BL31");
29			type = "firmware";
30			arch = "arm64";
31			compression = "none";
32			load = <0x44000>;
33			entry = <0x44000>;
34		};
35__HEADER_EOF
36
37cnt=1
38for dtname in $*
39do
40	cat << __FDT_IMAGE_EOF
41		fdt@$cnt {
42			description = "$(basename $dtname .dtb)";
43			data = /incbin/("$dtname");
44			type = "flat_dt";
45			compression = "none";
46		};
47__FDT_IMAGE_EOF
48	cnt=$((cnt+1))
49done
50
51cat << __CONF_HEADER_EOF
52	};
53	configurations {
54		default = "config@1";
55
56__CONF_HEADER_EOF
57
58cnt=1
59for dtname in $*
60do
61	cat << __CONF_SECTION_EOF
62		config@$cnt {
63			description = "$(basename $dtname .dtb)";
64			firmware = "uboot@1";
65			loadables = "atf@1";
66			fdt = "fdt@$cnt";
67		};
68__CONF_SECTION_EOF
69	cnt=$((cnt+1))
70done
71
72cat << __ITS_EOF
73	};
74};
75__ITS_EOF
76