blob: 36abe9efed45beedde0e1f278ec6f2d8b1f8ea26 [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 {
Andre Przywara2f23b1d2017-12-04 02:05:11 +000024 uboot {
Andre Przywara4c160892017-04-26 01:32:46 +010025 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 };
Andre Przywara2f23b1d2017-12-04 02:05:11 +000032 atf {
Andre Przywara4c160892017-04-26 01:32:46 +010033 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
Andre Przywara2f23b1d2017-12-04 02:05:11 +000047 fdt_$cnt {
Andre Przywara4c160892017-04-26 01:32:46 +010048 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 {
Andre Przywara2f23b1d2017-12-04 02:05:11 +000060 default = "config_1";
Andre Przywara4c160892017-04-26 01:32:46 +010061
62__CONF_HEADER_EOF
63
64cnt=1
65for dtname in $*
66do
67 cat << __CONF_SECTION_EOF
Andre Przywara2f23b1d2017-12-04 02:05:11 +000068 config_$cnt {
Andre Przywara4c160892017-04-26 01:32:46 +010069 description = "$(basename $dtname .dtb)";
Andre Przywara2f23b1d2017-12-04 02:05:11 +000070 firmware = "uboot";
71 loadables = "atf";
72 fdt = "fdt_$cnt";
Andre Przywara4c160892017-04-26 01:32:46 +010073 };
74__CONF_SECTION_EOF
75 cnt=$((cnt+1))
76done
77
78cat << __ITS_EOF
79 };
80};
81__ITS_EOF