blob: b1d6e0e16a56e14a6efa1c87a8602fc497990602 [file] [log] [blame]
Andre Przywara4c160892017-04-26 01:32:46 +01001#!/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
Tom Rini6475fc92017-05-22 15:40:11 -040010if [ ! -f $BL31 ]; then
11 echo "WARNING: BL31 file $BL31 NOT found, resulting binary is non-functional" >&2
12 echo "Please read the section on ARM Trusted Firmware (ATF) in board/sunxi/README.sunxi64" >&2
13 BL31=/dev/null
14fi
15
Andre Przywara4c160892017-04-26 01:32:46 +010016cat << __HEADER_EOF
17/dts-v1/;
18
19/ {
20 description = "Configuration to load ATF before U-Boot";
21 #address-cells = <1>;
22
23 images {
24 uboot@1 {
25 description = "U-Boot (64-bit)";
26 data = /incbin/("u-boot-nodtb.bin");
27 type = "standalone";
28 arch = "arm64";
29 compression = "none";
30 load = <0x4a000000>;
31 };
32 atf@1 {
33 description = "ARM Trusted Firmware";
34 data = /incbin/("$BL31");
35 type = "firmware";
36 arch = "arm64";
37 compression = "none";
38 load = <0x44000>;
39 entry = <0x44000>;
40 };
41__HEADER_EOF
42
43cnt=1
44for dtname in $*
45do
46 cat << __FDT_IMAGE_EOF
47 fdt@$cnt {
48 description = "$(basename $dtname .dtb)";
49 data = /incbin/("$dtname");
50 type = "flat_dt";
51 compression = "none";
52 };
53__FDT_IMAGE_EOF
54 cnt=$((cnt+1))
55done
56
57cat << __CONF_HEADER_EOF
58 };
59 configurations {
60 default = "config@1";
61
62__CONF_HEADER_EOF
63
64cnt=1
65for dtname in $*
66do
67 cat << __CONF_SECTION_EOF
68 config@$cnt {
69 description = "$(basename $dtname .dtb)";
70 firmware = "uboot@1";
71 loadables = "atf@1";
72 fdt = "fdt@$cnt";
73 };
74__CONF_SECTION_EOF
75 cnt=$((cnt+1))
76done
77
78cat << __ITS_EOF
79 };
80};
81__ITS_EOF