blob: f60cc31fb1a6c7199f31f306f83e0fc5067a182e [file] [log] [blame]
Jagan Tekib22da752020-01-10 00:16:21 +05301// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright (C) 2019 Jagan Teki <jagan@amarulasolutions.com>
4 */
5
6#include <config.h>
7
Simon Glass6667c0e2025-04-13 19:59:34 +00008#ifdef CONFIG_ARM64
9#define FIT_ARCH "arm64"
10#else
11#define FIT_ARCH "arm"
12#endif
13
14#if defined(CONFIG_SPL_GZIP)
15#define FIT_UBOOT_COMP "gzip"
16#elif defined(CONFIG_SPL_LZMA)
17#define FIT_UBOOT_COMP "lzma"
18#else
19#define FIT_UBOOT_COMP "none"
20#endif
21
Simon Glass23265882025-04-13 19:59:35 +000022#if defined(CONFIG_SPL_FIT) && (defined(CONFIG_ARM64) || defined(CONFIG_SPL_OPTEE_IMAGE))
23#define HAS_FIT
24#endif
25
Jagan Tekib22da752020-01-10 00:16:21 +053026/ {
Simon Glass88315f72020-07-19 13:55:57 -060027 binman: binman {
28 multiple-images;
29 };
30};
31
Jagan Tekiffce0ff2023-01-27 12:51:33 +053032#ifdef CONFIG_SPL
Simon Glass88315f72020-07-19 13:55:57 -060033&binman {
Simon Glass23265882025-04-13 19:59:35 +000034#ifdef HAS_FIT
35 fit_template: template-1 {
Simon Glassa5bf4242025-04-13 19:59:36 +000036 type = "fit";
Alex Beec32c9dc2023-07-18 16:57:11 +020037#ifdef CONFIG_ARM64
Simon Glassa5bf4242025-04-13 19:59:36 +000038 description = "FIT image for U-Boot with bl31 (TF-A)";
Alex Beec32c9dc2023-07-18 16:57:11 +020039#else
Simon Glassa5bf4242025-04-13 19:59:36 +000040 description = "FIT image with OP-TEE";
Alex Beec32c9dc2023-07-18 16:57:11 +020041#endif
Simon Glassa5bf4242025-04-13 19:59:36 +000042 #address-cells = <1>;
43 fit,fdt-list = "of-list";
44 fit,external-offset = <CONFIG_FIT_EXTERNAL_OFFSET>;
45 fit,align = <512>;
46 images {
47 u-boot {
48 description = "U-Boot";
49 type = "standalone";
50 os = "u-boot";
51 arch = FIT_ARCH;
52 compression = FIT_UBOOT_COMP;
53 load = <CONFIG_TEXT_BASE>;
54 entry = <CONFIG_TEXT_BASE>;
55 u-boot-nodtb {
Simon Glass6667c0e2025-04-13 19:59:34 +000056 compress = FIT_UBOOT_COMP;
Simon Glassa5bf4242025-04-13 19:59:36 +000057 };
Jonas Karlmand20ecb82023-01-21 19:01:59 +000058#ifdef CONFIG_SPL_FIT_SIGNATURE
Simon Glassa5bf4242025-04-13 19:59:36 +000059 hash {
60 algo = "sha256";
Simon Glass4de36172023-01-07 14:07:18 -070061 };
Simon Glassa5bf4242025-04-13 19:59:36 +000062#endif
63 };
Simon Glass4de36172023-01-07 14:07:18 -070064
Alex Beec32c9dc2023-07-18 16:57:11 +020065#ifdef CONFIG_ARM64
Simon Glassa5bf4242025-04-13 19:59:36 +000066 @atf-SEQ {
67 fit,operation = "split-elf";
68 description = "ARM Trusted Firmware";
69 type = "firmware";
70 arch = FIT_ARCH;
71 os = "arm-trusted-firmware";
72 compression = "none";
73 fit,load;
74 fit,entry;
75 fit,data;
Simon Glass4de36172023-01-07 14:07:18 -070076
Simon Glassa5bf4242025-04-13 19:59:36 +000077 atf-bl31 {
78 };
Jonas Karlmand20ecb82023-01-21 19:01:59 +000079#ifdef CONFIG_SPL_FIT_SIGNATURE
Simon Glassa5bf4242025-04-13 19:59:36 +000080 hash {
81 algo = "sha256";
Simon Glass4de36172023-01-07 14:07:18 -070082 };
Simon Glassa5bf4242025-04-13 19:59:36 +000083#endif
84 };
85 @tee-SEQ {
86 fit,operation = "split-elf";
87 description = "TEE";
88 type = "tee";
89 arch = FIT_ARCH;
90 os = "tee";
91 compression = "none";
92 fit,load;
93 fit,entry;
94 fit,data;
Simon Glass4de36172023-01-07 14:07:18 -070095
Simon Glassa5bf4242025-04-13 19:59:36 +000096 tee-os {
97 optional;
98 };
Jonas Karlmand20ecb82023-01-21 19:01:59 +000099#ifdef CONFIG_SPL_FIT_SIGNATURE
Simon Glassa5bf4242025-04-13 19:59:36 +0000100 hash {
101 algo = "sha256";
Simon Glass4de36172023-01-07 14:07:18 -0700102 };
Simon Glassa5bf4242025-04-13 19:59:36 +0000103#endif
104 };
Simon Glass6667c0e2025-04-13 19:59:34 +0000105#else /* !CONFIG_ARM64 */
Simon Glassa5bf4242025-04-13 19:59:36 +0000106 op-tee {
107 description = "OP-TEE";
108 type = "tee";
109 arch = FIT_ARCH;
110 os = "tee";
111 compression = "none";
112 load = <(CFG_SYS_SDRAM_BASE + 0x8400000)>;
113 entry = <(CFG_SYS_SDRAM_BASE + 0x8400000)>;
Alex Beec32c9dc2023-07-18 16:57:11 +0200114
Simon Glassa5bf4242025-04-13 19:59:36 +0000115 tee-os {
116 };
Alex Beec32c9dc2023-07-18 16:57:11 +0200117#ifdef CONFIG_SPL_FIT_SIGNATURE
Simon Glassa5bf4242025-04-13 19:59:36 +0000118 hash {
119 algo = "sha256";
Alex Beec32c9dc2023-07-18 16:57:11 +0200120 };
Simon Glassa5bf4242025-04-13 19:59:36 +0000121#endif
122 };
Simon Glass6667c0e2025-04-13 19:59:34 +0000123#endif /* CONFIG_ARM64 */
Simon Glass4de36172023-01-07 14:07:18 -0700124
Simon Glassa5bf4242025-04-13 19:59:36 +0000125 @fdt-SEQ {
126 description = "fdt-NAME";
127 compression = "none";
128 type = "flat_dt";
Jonas Karlmand20ecb82023-01-21 19:01:59 +0000129#ifdef CONFIG_SPL_FIT_SIGNATURE
Simon Glassa5bf4242025-04-13 19:59:36 +0000130 hash {
131 algo = "sha256";
Simon Glass4de36172023-01-07 14:07:18 -0700132 };
Simon Glassa5bf4242025-04-13 19:59:36 +0000133#endif
Simon Glass4de36172023-01-07 14:07:18 -0700134 };
Simon Glassa5bf4242025-04-13 19:59:36 +0000135 };
Simon Glass4de36172023-01-07 14:07:18 -0700136
Simon Glassa5bf4242025-04-13 19:59:36 +0000137 configurations {
138 default = "@config-DEFAULT-SEQ";
139 @config-SEQ {
140 description = "NAME.dtb";
141 fdt = "fdt-SEQ";
Alex Beec32c9dc2023-07-18 16:57:11 +0200142#ifdef CONFIG_ARM64
Simon Glassa5bf4242025-04-13 19:59:36 +0000143 fit,firmware = "atf-1", "u-boot";
Alex Beec32c9dc2023-07-18 16:57:11 +0200144#else
Simon Glassa5bf4242025-04-13 19:59:36 +0000145 fit,firmware = "op-tee", "u-boot";
Alex Beec32c9dc2023-07-18 16:57:11 +0200146#endif
Simon Glassa5bf4242025-04-13 19:59:36 +0000147 fit,loadables;
Simon Glass36761d82025-04-13 19:59:38 +0000148 fit,compatible;
Simon Glass4de36172023-01-07 14:07:18 -0700149 };
Simon Glassa5bf4242025-04-13 19:59:36 +0000150 };
Simon Glass23265882025-04-13 19:59:35 +0000151 };
152#endif /* HAS_FIT */
153
154 simple-bin {
155 filename = "u-boot-rockchip.bin";
156 pad-byte = <0xff>;
157
158 mkimage {
159 filename = "idbloader.img";
160 args = "-n", CONFIG_SYS_SOC, "-T", "rksd";
161 multiple-data-files;
162
163#ifdef CONFIG_ROCKCHIP_EXTERNAL_TPL
164 rockchip-tpl {
165 };
166#elif defined(CONFIG_TPL)
167 u-boot-tpl {
168 };
169#endif
170 u-boot-spl {
171 };
Simon Glass4de36172023-01-07 14:07:18 -0700172 };
Simon Glass23265882025-04-13 19:59:35 +0000173
174#ifdef HAS_FIT
175 fit {
176 filename = "u-boot.itb";
177 insert-template = <&fit_template>;
Quentin Schulzd9ffa5e2022-09-02 15:10:52 +0200178#else
Jagan Tekib22da752020-01-10 00:16:21 +0530179 u-boot-img {
Simon Glass23265882025-04-13 19:59:35 +0000180#endif
Jagan Tekib22da752020-01-10 00:16:21 +0530181 offset = <CONFIG_SPL_PAD_TO>;
182 };
183 };
Quentin Schulz9c5217d2022-09-02 15:10:55 +0200184
185#ifdef CONFIG_ROCKCHIP_SPI_IMAGE
186 simple-bin-spi {
187 filename = "u-boot-rockchip-spi.bin";
188 pad-byte = <0xff>;
189
190 mkimage {
191 filename = "idbloader-spi.img";
192 args = "-n", CONFIG_SYS_SOC, "-T", "rkspi";
Quentin Schulz9c5217d2022-09-02 15:10:55 +0200193 multiple-data-files;
194
Jonas Karlman38ad6c92023-02-25 19:01:34 +0000195#ifdef CONFIG_ROCKCHIP_EXTERNAL_TPL
196 rockchip-tpl {
197 };
198#elif defined(CONFIG_TPL)
Quentin Schulz9c5217d2022-09-02 15:10:55 +0200199 u-boot-tpl {
200 };
201#endif
202 u-boot-spl {
203 };
204 };
205
Simon Glass23265882025-04-13 19:59:35 +0000206#ifdef HAS_FIT
Simon Glass4de36172023-01-07 14:07:18 -0700207 fit {
Simon Glass23265882025-04-13 19:59:35 +0000208 insert-template = <&fit_template>;
Quentin Schulz9c5217d2022-09-02 15:10:55 +0200209#else
210 u-boot-img {
211#endif
212 /* Sync with u-boot,spl-payload-offset if present */
213 offset = <CONFIG_SYS_SPI_U_BOOT_OFFS>;
214 };
215 };
Simon Glass4de36172023-01-07 14:07:18 -0700216#endif /* CONFIG_ROCKCHIP_SPI_IMAGE */
Jagan Tekib22da752020-01-10 00:16:21 +0530217};
Simon Glass4de36172023-01-07 14:07:18 -0700218#endif /* CONFIG_SPL */