blob: 0c074c0ec6b9af0908da759895de071db4885338 [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 {
36 type = "fit";
Alex Beec32c9dc2023-07-18 16:57:11 +020037#ifdef CONFIG_ARM64
Simon Glass4de36172023-01-07 14:07:18 -070038 description = "FIT image for U-Boot with bl31 (TF-A)";
Alex Beec32c9dc2023-07-18 16:57:11 +020039#else
40 description = "FIT image with OP-TEE";
41#endif
Simon Glass4de36172023-01-07 14:07:18 -070042 #address-cells = <1>;
43 fit,fdt-list = "of-list";
Simon Glass4de36172023-01-07 14:07:18 -070044 fit,external-offset = <CONFIG_FIT_EXTERNAL_OFFSET>;
Jonas Karlman42d201a2023-01-21 19:01:39 +000045 fit,align = <512>;
Simon Glass4de36172023-01-07 14:07:18 -070046 images {
47 u-boot {
Alex Beec32c9dc2023-07-18 16:57:11 +020048 description = "U-Boot";
Simon Glass4de36172023-01-07 14:07:18 -070049 type = "standalone";
Simon Glass031fa4f2025-04-13 19:59:33 +000050 os = "u-boot";
Simon Glass6667c0e2025-04-13 19:59:34 +000051 arch = FIT_ARCH;
52 compression = FIT_UBOOT_COMP;
Simon Glass4de36172023-01-07 14:07:18 -070053 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 Glass4de36172023-01-07 14:07:18 -070057 };
Jonas Karlmand20ecb82023-01-21 19:01:59 +000058#ifdef CONFIG_SPL_FIT_SIGNATURE
59 hash {
60 algo = "sha256";
61 };
62#endif
Simon Glass4de36172023-01-07 14:07:18 -070063 };
64
Alex Beec32c9dc2023-07-18 16:57:11 +020065#ifdef CONFIG_ARM64
Simon Glass4de36172023-01-07 14:07:18 -070066 @atf-SEQ {
67 fit,operation = "split-elf";
68 description = "ARM Trusted Firmware";
69 type = "firmware";
Simon Glass6667c0e2025-04-13 19:59:34 +000070 arch = FIT_ARCH;
Simon Glass4de36172023-01-07 14:07:18 -070071 os = "arm-trusted-firmware";
72 compression = "none";
73 fit,load;
74 fit,entry;
75 fit,data;
76
77 atf-bl31 {
78 };
Jonas Karlmand20ecb82023-01-21 19:01:59 +000079#ifdef CONFIG_SPL_FIT_SIGNATURE
80 hash {
81 algo = "sha256";
82 };
83#endif
Simon Glass4de36172023-01-07 14:07:18 -070084 };
85 @tee-SEQ {
86 fit,operation = "split-elf";
87 description = "TEE";
88 type = "tee";
Simon Glass6667c0e2025-04-13 19:59:34 +000089 arch = FIT_ARCH;
Simon Glass4de36172023-01-07 14:07:18 -070090 os = "tee";
91 compression = "none";
92 fit,load;
93 fit,entry;
94 fit,data;
95
96 tee-os {
97 optional;
98 };
Jonas Karlmand20ecb82023-01-21 19:01:59 +000099#ifdef CONFIG_SPL_FIT_SIGNATURE
100 hash {
101 algo = "sha256";
102 };
103#endif
Simon Glass4de36172023-01-07 14:07:18 -0700104 };
Simon Glass6667c0e2025-04-13 19:59:34 +0000105#else /* !CONFIG_ARM64 */
Alex Beec32c9dc2023-07-18 16:57:11 +0200106 op-tee {
107 description = "OP-TEE";
108 type = "tee";
Simon Glass6667c0e2025-04-13 19:59:34 +0000109 arch = FIT_ARCH;
Alex Beec32c9dc2023-07-18 16:57:11 +0200110 os = "tee";
111 compression = "none";
112 load = <(CFG_SYS_SDRAM_BASE + 0x8400000)>;
113 entry = <(CFG_SYS_SDRAM_BASE + 0x8400000)>;
114
115 tee-os {
116 };
117#ifdef CONFIG_SPL_FIT_SIGNATURE
118 hash {
119 algo = "sha256";
120 };
121#endif
122 };
Simon Glass6667c0e2025-04-13 19:59:34 +0000123#endif /* CONFIG_ARM64 */
Simon Glass4de36172023-01-07 14:07:18 -0700124
125 @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
130 hash {
131 algo = "sha256";
132 };
133#endif
Simon Glass4de36172023-01-07 14:07:18 -0700134 };
135 };
136
137 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
Jonas Karlman60ee1922023-01-21 19:02:26 +0000143 fit,firmware = "atf-1", "u-boot";
Alex Beec32c9dc2023-07-18 16:57:11 +0200144#else
145 fit,firmware = "op-tee", "u-boot";
146#endif
Simon Glass4de36172023-01-07 14:07:18 -0700147 fit,loadables;
148 };
149 };
Simon Glass23265882025-04-13 19:59:35 +0000150 };
151#endif /* HAS_FIT */
152
153 simple-bin {
154 filename = "u-boot-rockchip.bin";
155 pad-byte = <0xff>;
156
157 mkimage {
158 filename = "idbloader.img";
159 args = "-n", CONFIG_SYS_SOC, "-T", "rksd";
160 multiple-data-files;
161
162#ifdef CONFIG_ROCKCHIP_EXTERNAL_TPL
163 rockchip-tpl {
164 };
165#elif defined(CONFIG_TPL)
166 u-boot-tpl {
167 };
168#endif
169 u-boot-spl {
170 };
Simon Glass4de36172023-01-07 14:07:18 -0700171 };
Simon Glass23265882025-04-13 19:59:35 +0000172
173#ifdef HAS_FIT
174 fit {
175 filename = "u-boot.itb";
176 insert-template = <&fit_template>;
Quentin Schulzd9ffa5e2022-09-02 15:10:52 +0200177#else
Jagan Tekib22da752020-01-10 00:16:21 +0530178 u-boot-img {
Simon Glass23265882025-04-13 19:59:35 +0000179#endif
Jagan Tekib22da752020-01-10 00:16:21 +0530180 offset = <CONFIG_SPL_PAD_TO>;
181 };
182 };
Quentin Schulz9c5217d2022-09-02 15:10:55 +0200183
184#ifdef CONFIG_ROCKCHIP_SPI_IMAGE
185 simple-bin-spi {
186 filename = "u-boot-rockchip-spi.bin";
187 pad-byte = <0xff>;
188
189 mkimage {
190 filename = "idbloader-spi.img";
191 args = "-n", CONFIG_SYS_SOC, "-T", "rkspi";
Quentin Schulz9c5217d2022-09-02 15:10:55 +0200192 multiple-data-files;
193
Jonas Karlman38ad6c92023-02-25 19:01:34 +0000194#ifdef CONFIG_ROCKCHIP_EXTERNAL_TPL
195 rockchip-tpl {
196 };
197#elif defined(CONFIG_TPL)
Quentin Schulz9c5217d2022-09-02 15:10:55 +0200198 u-boot-tpl {
199 };
200#endif
201 u-boot-spl {
202 };
203 };
204
Simon Glass23265882025-04-13 19:59:35 +0000205#ifdef HAS_FIT
Simon Glass4de36172023-01-07 14:07:18 -0700206 fit {
Simon Glass23265882025-04-13 19:59:35 +0000207 insert-template = <&fit_template>;
Quentin Schulz9c5217d2022-09-02 15:10:55 +0200208#else
209 u-boot-img {
210#endif
211 /* Sync with u-boot,spl-payload-offset if present */
212 offset = <CONFIG_SYS_SPI_U_BOOT_OFFS>;
213 };
214 };
Simon Glass4de36172023-01-07 14:07:18 -0700215#endif /* CONFIG_ROCKCHIP_SPI_IMAGE */
Jagan Tekib22da752020-01-10 00:16:21 +0530216};
Simon Glass4de36172023-01-07 14:07:18 -0700217#endif /* CONFIG_SPL */