Jagan Teki | b22da75 | 2020-01-10 00:16:21 +0530 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * Copyright (C) 2019 Jagan Teki <jagan@amarulasolutions.com> |
| 4 | */ |
| 5 | |
| 6 | #include <config.h> |
| 7 | |
Simon Glass | 6667c0e | 2025-04-13 19:59:34 +0000 | [diff] [blame] | 8 | #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 Glass | 2326588 | 2025-04-13 19:59:35 +0000 | [diff] [blame] | 22 | #if defined(CONFIG_SPL_FIT) && (defined(CONFIG_ARM64) || defined(CONFIG_SPL_OPTEE_IMAGE)) |
| 23 | #define HAS_FIT |
| 24 | #endif |
| 25 | |
Jagan Teki | b22da75 | 2020-01-10 00:16:21 +0530 | [diff] [blame] | 26 | / { |
Simon Glass | 88315f7 | 2020-07-19 13:55:57 -0600 | [diff] [blame] | 27 | binman: binman { |
| 28 | multiple-images; |
| 29 | }; |
| 30 | }; |
| 31 | |
Jagan Teki | ffce0ff | 2023-01-27 12:51:33 +0530 | [diff] [blame] | 32 | #ifdef CONFIG_SPL |
Simon Glass | 88315f7 | 2020-07-19 13:55:57 -0600 | [diff] [blame] | 33 | &binman { |
Simon Glass | 2326588 | 2025-04-13 19:59:35 +0000 | [diff] [blame] | 34 | #ifdef HAS_FIT |
| 35 | fit_template: template-1 { |
Simon Glass | a5bf424 | 2025-04-13 19:59:36 +0000 | [diff] [blame] | 36 | type = "fit"; |
Alex Bee | c32c9dc | 2023-07-18 16:57:11 +0200 | [diff] [blame] | 37 | #ifdef CONFIG_ARM64 |
Simon Glass | a5bf424 | 2025-04-13 19:59:36 +0000 | [diff] [blame] | 38 | description = "FIT image for U-Boot with bl31 (TF-A)"; |
Alex Bee | c32c9dc | 2023-07-18 16:57:11 +0200 | [diff] [blame] | 39 | #else |
Simon Glass | a5bf424 | 2025-04-13 19:59:36 +0000 | [diff] [blame] | 40 | description = "FIT image with OP-TEE"; |
Alex Bee | c32c9dc | 2023-07-18 16:57:11 +0200 | [diff] [blame] | 41 | #endif |
Simon Glass | a5bf424 | 2025-04-13 19:59:36 +0000 | [diff] [blame] | 42 | #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 Glass | 6667c0e | 2025-04-13 19:59:34 +0000 | [diff] [blame] | 56 | compress = FIT_UBOOT_COMP; |
Simon Glass | a5bf424 | 2025-04-13 19:59:36 +0000 | [diff] [blame] | 57 | }; |
Jonas Karlman | d20ecb8 | 2023-01-21 19:01:59 +0000 | [diff] [blame] | 58 | #ifdef CONFIG_SPL_FIT_SIGNATURE |
Simon Glass | a5bf424 | 2025-04-13 19:59:36 +0000 | [diff] [blame] | 59 | hash { |
| 60 | algo = "sha256"; |
Simon Glass | 4de3617 | 2023-01-07 14:07:18 -0700 | [diff] [blame] | 61 | }; |
Simon Glass | a5bf424 | 2025-04-13 19:59:36 +0000 | [diff] [blame] | 62 | #endif |
| 63 | }; |
Simon Glass | 4de3617 | 2023-01-07 14:07:18 -0700 | [diff] [blame] | 64 | |
Alex Bee | c32c9dc | 2023-07-18 16:57:11 +0200 | [diff] [blame] | 65 | #ifdef CONFIG_ARM64 |
Simon Glass | a5bf424 | 2025-04-13 19:59:36 +0000 | [diff] [blame] | 66 | @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 Glass | 4de3617 | 2023-01-07 14:07:18 -0700 | [diff] [blame] | 76 | |
Simon Glass | a5bf424 | 2025-04-13 19:59:36 +0000 | [diff] [blame] | 77 | atf-bl31 { |
| 78 | }; |
Jonas Karlman | d20ecb8 | 2023-01-21 19:01:59 +0000 | [diff] [blame] | 79 | #ifdef CONFIG_SPL_FIT_SIGNATURE |
Simon Glass | a5bf424 | 2025-04-13 19:59:36 +0000 | [diff] [blame] | 80 | hash { |
| 81 | algo = "sha256"; |
Simon Glass | 4de3617 | 2023-01-07 14:07:18 -0700 | [diff] [blame] | 82 | }; |
Simon Glass | a5bf424 | 2025-04-13 19:59:36 +0000 | [diff] [blame] | 83 | #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 Glass | 4de3617 | 2023-01-07 14:07:18 -0700 | [diff] [blame] | 95 | |
Simon Glass | a5bf424 | 2025-04-13 19:59:36 +0000 | [diff] [blame] | 96 | tee-os { |
| 97 | optional; |
| 98 | }; |
Jonas Karlman | d20ecb8 | 2023-01-21 19:01:59 +0000 | [diff] [blame] | 99 | #ifdef CONFIG_SPL_FIT_SIGNATURE |
Simon Glass | a5bf424 | 2025-04-13 19:59:36 +0000 | [diff] [blame] | 100 | hash { |
| 101 | algo = "sha256"; |
Simon Glass | 4de3617 | 2023-01-07 14:07:18 -0700 | [diff] [blame] | 102 | }; |
Simon Glass | a5bf424 | 2025-04-13 19:59:36 +0000 | [diff] [blame] | 103 | #endif |
| 104 | }; |
Simon Glass | 6667c0e | 2025-04-13 19:59:34 +0000 | [diff] [blame] | 105 | #else /* !CONFIG_ARM64 */ |
Simon Glass | a5bf424 | 2025-04-13 19:59:36 +0000 | [diff] [blame] | 106 | 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 Bee | c32c9dc | 2023-07-18 16:57:11 +0200 | [diff] [blame] | 114 | |
Simon Glass | a5bf424 | 2025-04-13 19:59:36 +0000 | [diff] [blame] | 115 | tee-os { |
| 116 | }; |
Alex Bee | c32c9dc | 2023-07-18 16:57:11 +0200 | [diff] [blame] | 117 | #ifdef CONFIG_SPL_FIT_SIGNATURE |
Simon Glass | a5bf424 | 2025-04-13 19:59:36 +0000 | [diff] [blame] | 118 | hash { |
| 119 | algo = "sha256"; |
Alex Bee | c32c9dc | 2023-07-18 16:57:11 +0200 | [diff] [blame] | 120 | }; |
Simon Glass | a5bf424 | 2025-04-13 19:59:36 +0000 | [diff] [blame] | 121 | #endif |
| 122 | }; |
Simon Glass | 6667c0e | 2025-04-13 19:59:34 +0000 | [diff] [blame] | 123 | #endif /* CONFIG_ARM64 */ |
Simon Glass | 4de3617 | 2023-01-07 14:07:18 -0700 | [diff] [blame] | 124 | |
Simon Glass | a5bf424 | 2025-04-13 19:59:36 +0000 | [diff] [blame] | 125 | @fdt-SEQ { |
| 126 | description = "fdt-NAME"; |
| 127 | compression = "none"; |
| 128 | type = "flat_dt"; |
Jonas Karlman | d20ecb8 | 2023-01-21 19:01:59 +0000 | [diff] [blame] | 129 | #ifdef CONFIG_SPL_FIT_SIGNATURE |
Simon Glass | a5bf424 | 2025-04-13 19:59:36 +0000 | [diff] [blame] | 130 | hash { |
| 131 | algo = "sha256"; |
Simon Glass | 4de3617 | 2023-01-07 14:07:18 -0700 | [diff] [blame] | 132 | }; |
Simon Glass | a5bf424 | 2025-04-13 19:59:36 +0000 | [diff] [blame] | 133 | #endif |
Simon Glass | 4de3617 | 2023-01-07 14:07:18 -0700 | [diff] [blame] | 134 | }; |
Simon Glass | a5bf424 | 2025-04-13 19:59:36 +0000 | [diff] [blame] | 135 | }; |
Simon Glass | 4de3617 | 2023-01-07 14:07:18 -0700 | [diff] [blame] | 136 | |
Simon Glass | a5bf424 | 2025-04-13 19:59:36 +0000 | [diff] [blame] | 137 | configurations { |
| 138 | default = "@config-DEFAULT-SEQ"; |
| 139 | @config-SEQ { |
| 140 | description = "NAME.dtb"; |
| 141 | fdt = "fdt-SEQ"; |
Alex Bee | c32c9dc | 2023-07-18 16:57:11 +0200 | [diff] [blame] | 142 | #ifdef CONFIG_ARM64 |
Simon Glass | a5bf424 | 2025-04-13 19:59:36 +0000 | [diff] [blame] | 143 | fit,firmware = "atf-1", "u-boot"; |
Alex Bee | c32c9dc | 2023-07-18 16:57:11 +0200 | [diff] [blame] | 144 | #else |
Simon Glass | a5bf424 | 2025-04-13 19:59:36 +0000 | [diff] [blame] | 145 | fit,firmware = "op-tee", "u-boot"; |
Alex Bee | c32c9dc | 2023-07-18 16:57:11 +0200 | [diff] [blame] | 146 | #endif |
Simon Glass | a5bf424 | 2025-04-13 19:59:36 +0000 | [diff] [blame] | 147 | fit,loadables; |
Simon Glass | 36761d8 | 2025-04-13 19:59:38 +0000 | [diff] [blame^] | 148 | fit,compatible; |
Simon Glass | 4de3617 | 2023-01-07 14:07:18 -0700 | [diff] [blame] | 149 | }; |
Simon Glass | a5bf424 | 2025-04-13 19:59:36 +0000 | [diff] [blame] | 150 | }; |
Simon Glass | 2326588 | 2025-04-13 19:59:35 +0000 | [diff] [blame] | 151 | }; |
| 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 Glass | 4de3617 | 2023-01-07 14:07:18 -0700 | [diff] [blame] | 172 | }; |
Simon Glass | 2326588 | 2025-04-13 19:59:35 +0000 | [diff] [blame] | 173 | |
| 174 | #ifdef HAS_FIT |
| 175 | fit { |
| 176 | filename = "u-boot.itb"; |
| 177 | insert-template = <&fit_template>; |
Quentin Schulz | d9ffa5e | 2022-09-02 15:10:52 +0200 | [diff] [blame] | 178 | #else |
Jagan Teki | b22da75 | 2020-01-10 00:16:21 +0530 | [diff] [blame] | 179 | u-boot-img { |
Simon Glass | 2326588 | 2025-04-13 19:59:35 +0000 | [diff] [blame] | 180 | #endif |
Jagan Teki | b22da75 | 2020-01-10 00:16:21 +0530 | [diff] [blame] | 181 | offset = <CONFIG_SPL_PAD_TO>; |
| 182 | }; |
| 183 | }; |
Quentin Schulz | 9c5217d | 2022-09-02 15:10:55 +0200 | [diff] [blame] | 184 | |
| 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 Schulz | 9c5217d | 2022-09-02 15:10:55 +0200 | [diff] [blame] | 193 | multiple-data-files; |
| 194 | |
Jonas Karlman | 38ad6c9 | 2023-02-25 19:01:34 +0000 | [diff] [blame] | 195 | #ifdef CONFIG_ROCKCHIP_EXTERNAL_TPL |
| 196 | rockchip-tpl { |
| 197 | }; |
| 198 | #elif defined(CONFIG_TPL) |
Quentin Schulz | 9c5217d | 2022-09-02 15:10:55 +0200 | [diff] [blame] | 199 | u-boot-tpl { |
| 200 | }; |
| 201 | #endif |
| 202 | u-boot-spl { |
| 203 | }; |
| 204 | }; |
| 205 | |
Simon Glass | 2326588 | 2025-04-13 19:59:35 +0000 | [diff] [blame] | 206 | #ifdef HAS_FIT |
Simon Glass | 4de3617 | 2023-01-07 14:07:18 -0700 | [diff] [blame] | 207 | fit { |
Simon Glass | 2326588 | 2025-04-13 19:59:35 +0000 | [diff] [blame] | 208 | insert-template = <&fit_template>; |
Quentin Schulz | 9c5217d | 2022-09-02 15:10:55 +0200 | [diff] [blame] | 209 | #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 Glass | 4de3617 | 2023-01-07 14:07:18 -0700 | [diff] [blame] | 216 | #endif /* CONFIG_ROCKCHIP_SPI_IMAGE */ |
Jagan Teki | b22da75 | 2020-01-10 00:16:21 +0530 | [diff] [blame] | 217 | }; |
Simon Glass | 4de3617 | 2023-01-07 14:07:18 -0700 | [diff] [blame] | 218 | #endif /* CONFIG_SPL */ |