c9396577a92963e6d51426e9e312ee1b1f17fb60
[oweals/u-boot.git] / board / theobroma-systems / puma_rk3399 / fit_spl_atf.sh
1 #!/bin/sh
2 #
3 # SPDX-License-Identifier:      GPL-2.0+
4 #
5 # Copyright (C) 2019 Jagan Teki <jagan@amarulasolutions.com>
6 #
7 # Based on the board/sunxi/mksunxi_fit_atf.sh
8 #
9 # Script to generate FIT image source for 64-bit puma boards with
10 # U-Boot proper, ATF, PMU firmware and devicetree.
11 #
12 # usage: $0 <dt_name> [<dt_name> [<dt_name] ...]
13
14 [ -z "$BL31" ] && BL31="bl31.bin"
15
16 if [ ! -f $BL31 ]; then
17         echo "WARNING: BL31 file $BL31 NOT found, resulting binary is non-functional" >&2
18         echo "Please read Building section in doc/README.rockchip" >&2
19         BL31=/dev/null
20 fi
21
22 [ -z "$PMUM0" ] && PMUM0="rk3399m0.bin"
23
24 if [ ! -f $PMUM0 ]; then
25         echo "WARNING: PMUM0 file $PMUM0 NOT found, resulting binary is non-functional" >&2
26         echo "Please read Building section in doc/README.rockchip" >&2
27         PMUM0=/dev/null
28 fi
29
30 cat << __HEADER_EOF
31 /* SPDX-License-Identifier: GPL-2.0+ OR X11 */
32 /*
33  * Copyright (C) 2017 Theobroma Systems Design und Consulting GmbH
34  *
35  * Minimal dts for a SPL FIT image payload.
36  */
37
38 /dts-v1/;
39
40 / {
41         description = "FIT image with U-Boot proper, ATF bl31, M0 Firmware, DTB";
42         #address-cells = <1>;
43
44         images {
45                 uboot {
46                         description = "U-Boot (64-bit)";
47                         data = /incbin/("u-boot-nodtb.bin");
48                         type = "standalone";
49                         arch = "arm64";
50                         compression = "none";
51                         load = <0x4a000000>;
52                 };
53                 atf {
54                         description = "ARM Trusted Firmware";
55                         data = /incbin/("$BL31");
56                         type = "firmware";
57                         arch = "arm64";
58                         os = "arm-trusted-firmware";
59                         compression = "none";
60                         load = <0x1000>;
61                         entry = <0x1000>;
62                 };
63                 pmu {
64                         description = "Cortex-M0 firmware";
65                         data = /incbin/("$PMUM0");
66                         type = "pmu-firmware";
67                         compression = "none";
68                         load = <0x180000>;
69                 };
70                 fdt {
71                         description = "RK3399-Q7 (Puma) flat device-tree";
72                         data = /incbin/("$1");
73                         type = "flat_dt";
74                         compression = "none";
75                 };
76 __HEADER_EOF
77
78 cat << __CONF_HEADER_EOF
79         };
80
81         configurations {
82                 default = "conf";
83                 conf {
84                         description = "Theobroma Systems RK3399-Q7 (Puma) SoM";
85                         firmware = "atf";
86                         loadables = "uboot", "pmu";
87                         fdt = "fdt";
88                 };
89 __CONF_HEADER_EOF
90
91 cat << __ITS_EOF
92         };
93 };
94 __ITS_EOF