]> git.ipfire.org Git - people/ms/u-boot.git/blob - board/sunxi/mksunxi_fit_atf.sh
sun50i: h5: Add initial Orangepi Zero Plus 2 support
[people/ms/u-boot.git] / board / sunxi / mksunxi_fit_atf.sh
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
10 if [ ! -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
14 fi
15
16 cat << __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
43 cnt=1
44 for dtname in $*
45 do
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))
55 done
56
57 cat << __CONF_HEADER_EOF
58 };
59 configurations {
60 default = "config@1";
61
62 __CONF_HEADER_EOF
63
64 cnt=1
65 for dtname in $*
66 do
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))
76 done
77
78 cat << __ITS_EOF
79 };
80 };
81 __ITS_EOF