Bryan Brattlof | 6d13813 | 2022-12-19 14:29:50 -0600 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause |
| 2 | .. sectionauthor:: Bryan Brattlof <bb@ti.com> |
| 3 | |
| 4 | K3 Generation |
| 5 | ============= |
| 6 | |
| 7 | Summary |
| 8 | ------- |
| 9 | |
| 10 | Texas Instrument's K3 family of SoCs utilize a heterogeneous multicore |
| 11 | and highly integrated device architecture targeted to maximize |
| 12 | performance and power efficiency for a wide range of industrial, |
| 13 | automotive and other broad market segments. |
| 14 | |
| 15 | Typically the processing cores and the peripherals for these devices are |
| 16 | partitioned into three functional domains to provide ultra-low power |
| 17 | modes as well as accommodating application and industrial safety systems |
| 18 | on the same SoC. These functional domains are typically called the: |
| 19 | |
| 20 | * Wakeup (WKUP) domain |
| 21 | * Micro-controller (MCU) domain |
| 22 | * Main domain |
| 23 | |
| 24 | For a more detailed view of what peripherals are attached to each |
| 25 | domain, consult the device specific documentation. |
| 26 | |
| 27 | K3 Based SoCs |
| 28 | ------------- |
| 29 | |
| 30 | .. toctree:: |
| 31 | :maxdepth: 1 |
| 32 | |
Bryan Brattlof | 6d13813 | 2022-12-19 14:29:50 -0600 | [diff] [blame] | 33 | am62x_sk |
Neha Malcom Francis | 507be12 | 2023-07-22 00:14:43 +0530 | [diff] [blame] | 34 | am65x_evm |
Nishanth Menon | e83fe67 | 2023-07-27 13:59:01 -0500 | [diff] [blame^] | 35 | j7200_evm |
| 36 | j721e_evm |
Bryan Brattlof | 6d13813 | 2022-12-19 14:29:50 -0600 | [diff] [blame] | 37 | |
| 38 | Boot Flow Overview |
| 39 | ------------------ |
| 40 | |
| 41 | For all K3 SoCs the first core started will be inside the Security |
| 42 | Management Subsystem (SMS) which will secure the device and start a core |
| 43 | in the wakeup domain to run the ROM code. ROM will then initialize the |
| 44 | boot media needed to load the binaries packaged inside `tiboot3.bin`, |
| 45 | including a 32bit U-Boot SPL, (called the wakup SPL) that ROM will jump |
| 46 | to after it has finished loading everything into internal SRAM. |
| 47 | |
| 48 | .. code-block:: text |
| 49 | |
| 50 | | WKUP Domain |
| 51 | ROM -> WKUP SPL -> |
| 52 | |
| 53 | The wakeup SPL, running on a wakeup domain core, will initialize DDR and |
| 54 | any peripherals needed load the larger binaries inside the `tispl.bin` |
| 55 | into DDR. Once loaded the wakeup SPL will start one of the 'big' |
| 56 | application cores inside the main domain to initialize the main domain, |
Neha Malcom Francis | 507be12 | 2023-07-22 00:14:43 +0530 | [diff] [blame] | 57 | starting with Trusted Firmware-A (TF-A), before moving on to start |
| 58 | OP-TEE and the main domain's U-Boot SPL. |
Bryan Brattlof | 6d13813 | 2022-12-19 14:29:50 -0600 | [diff] [blame] | 59 | |
| 60 | .. code-block:: text |
| 61 | |
| 62 | | WKUP Domain | Main Domain -> |
Neha Malcom Francis | 507be12 | 2023-07-22 00:14:43 +0530 | [diff] [blame] | 63 | ROM -> WKUP SPL -> TF-A -> OP-TEE -> Main SPL |
Bryan Brattlof | 6d13813 | 2022-12-19 14:29:50 -0600 | [diff] [blame] | 64 | |
| 65 | The main domain's SPL, running on a 64bit application core, has |
| 66 | virtually unlimited space (billions of bytes now that DDR is working) to |
| 67 | initialize even more peripherals needed to load in the `u-boot.img` |
| 68 | which loads more firmware into the micro-controller & wakeup domains and |
| 69 | finally prepare the main domain to run Linux. |
| 70 | |
| 71 | .. code-block:: text |
| 72 | |
| 73 | | WKUP Domain | Main Domain -> |
Neha Malcom Francis | 507be12 | 2023-07-22 00:14:43 +0530 | [diff] [blame] | 74 | ROM -> WKUP SPL -> TF-A -> OP-TEE -> Main SPL -> UBoot -> Linux |
Bryan Brattlof | 6d13813 | 2022-12-19 14:29:50 -0600 | [diff] [blame] | 75 | |
| 76 | This is the typical boot flow for all K3 based SoCs, however this flow |
| 77 | offers quite a lot in the terms of flexibility, especially on High |
| 78 | Security (HS) SoCs. |
| 79 | |
| 80 | Boot Flow Variations |
| 81 | ^^^^^^^^^^^^^^^^^^^^ |
| 82 | |
| 83 | All K3 SoCs will generally use the above boot flow with two main |
| 84 | differences depending on the capabilities of the boot ROM and the number |
| 85 | of cores inside the device. These differences split the bootflow into |
| 86 | essentially 4 unique but very similar flows: |
| 87 | |
| 88 | * Split binary with a combined firmware: (eg: AM65) |
| 89 | * Combined binary with a combined firmware: (eg: AM64) |
| 90 | * Split binary with a split firmware: (eg: J721E) |
| 91 | * Combined binary with a split firmware: (eg: AM62) |
| 92 | |
| 93 | For devices that utilize the split binary approach, ROM is not capable |
| 94 | of loading the firmware into the SoC requiring the wakeup domain's |
| 95 | U-Boot SPL to load the firmware. |
| 96 | |
| 97 | Devices with a split firmware will have two firmwares loaded into the |
| 98 | device at different times during the bootup process. TI's Foundational |
| 99 | Security (TIFS), needed to operate the Security Management Subsystem, |
| 100 | will either be loaded by ROM or the WKUP U-Boot SPL, then once the |
| 101 | wakeup U-Boot SPL has completed, the second Device Management (DM) |
| 102 | firmware can be loaded on the now free core in the wakeup domain. |
| 103 | |
| 104 | For more information on the bootup process of your SoC, consult the |
| 105 | device specific boot flow documentation. |
| 106 | |
| 107 | Software Sources |
| 108 | ---------------- |
| 109 | |
| 110 | All scripts and code needed to build the `tiboot3.bin`, `tispl.bin` and |
| 111 | `u-boot.img` for all K3 SoCs can be located at the following places |
| 112 | online |
| 113 | |
Nishanth Menon | ee91e48 | 2023-07-27 13:58:44 -0500 | [diff] [blame] | 114 | .. k3_rst_include_start_boot_sources |
| 115 | |
Bryan Brattlof | 6d13813 | 2022-12-19 14:29:50 -0600 | [diff] [blame] | 116 | * **Das U-Boot** |
| 117 | |
| 118 | | **source:** https://source.denx.de/u-boot/u-boot.git |
| 119 | | **branch:** master |
| 120 | |
Neha Malcom Francis | 507be12 | 2023-07-22 00:14:43 +0530 | [diff] [blame] | 121 | * **Trusted Firmware-A (TF-A)** |
Bryan Brattlof | 6d13813 | 2022-12-19 14:29:50 -0600 | [diff] [blame] | 122 | |
Neha Malcom Francis | 507be12 | 2023-07-22 00:14:43 +0530 | [diff] [blame] | 123 | | **source:** https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/ |
Bryan Brattlof | 6d13813 | 2022-12-19 14:29:50 -0600 | [diff] [blame] | 124 | | **branch:** master |
| 125 | |
Neha Malcom Francis | 507be12 | 2023-07-22 00:14:43 +0530 | [diff] [blame] | 126 | * **Open Portable Trusted Execution Environment (OP-TEE)** |
Bryan Brattlof | 6d13813 | 2022-12-19 14:29:50 -0600 | [diff] [blame] | 127 | |
| 128 | | **source:** https://github.com/OP-TEE/optee_os.git |
| 129 | | **branch:** master |
| 130 | |
| 131 | * **TI Firmware (TIFS, DM, DSMC)** |
| 132 | |
| 133 | | **source:** https://git.ti.com/git/processor-firmware/ti-linux-firmware.git |
| 134 | | **branch:** ti-linux-firmware |
| 135 | |
Nishanth Menon | ee91e48 | 2023-07-27 13:58:44 -0500 | [diff] [blame] | 136 | .. k3_rst_include_end_boot_sources |
| 137 | |
Bryan Brattlof | 6d13813 | 2022-12-19 14:29:50 -0600 | [diff] [blame] | 138 | Build Procedure |
| 139 | --------------- |
| 140 | |
| 141 | Depending on the specifics of your device, you will need three or more |
| 142 | binaries to boot your SoC. |
| 143 | |
| 144 | * `tiboot3.bin` (bootloader for the wakeup domain) |
| 145 | * `tispl.bin` (bootloader for the main domain) |
| 146 | * `u-boot.img` |
| 147 | |
| 148 | During the bootup process, both the 32bit wakeup domain and the 64bit |
| 149 | main domains will be involved. This means everything inside the |
| 150 | `tiboot3.bin` running in the wakeup domain will need to be compiled for |
| 151 | 32bit cores and most binaries in the `tispl.bin` will need to be |
| 152 | compiled for 64bit main domain CPU cores. |
| 153 | |
| 154 | All of that to say you will need both a 32bit and 64bit cross compiler |
| 155 | (assuming you're using an x86 desktop) |
| 156 | |
Nishanth Menon | b7ee22f | 2023-07-27 13:58:48 -0500 | [diff] [blame] | 157 | .. k3_rst_include_start_common_env_vars_desc |
| 158 | .. list-table:: Generic environment variables |
| 159 | :widths: 25 25 50 |
| 160 | :header-rows: 1 |
| 161 | |
| 162 | * - S/w Component |
| 163 | - Env Variable |
| 164 | - Description |
| 165 | * - All Software |
| 166 | - CC32 |
| 167 | - Cross compiler for ARMv7 (ARM 32bit), typically arm-linux-gnueabihf- |
| 168 | * - All Software |
| 169 | - CC64 |
| 170 | - Cross compiler for ARMv8 (ARM 64bit), typically aarch64-linux-gnu- |
| 171 | * - All Software |
| 172 | - LNX_FW_PATH |
| 173 | - Path to TI Linux firmware repository |
| 174 | * - All Software |
| 175 | - TFA_PATH |
| 176 | - Path to source of Trusted Firmware-A |
| 177 | * - All Software |
| 178 | - OPTEE_PATH |
| 179 | - Path to source of OP-TEE |
| 180 | .. k3_rst_include_end_common_env_vars_desc |
| 181 | |
| 182 | .. k3_rst_include_start_common_env_vars_defn |
Bryan Brattlof | 6d13813 | 2022-12-19 14:29:50 -0600 | [diff] [blame] | 183 | .. code-block:: bash |
| 184 | |
Neha Malcom Francis | 507be12 | 2023-07-22 00:14:43 +0530 | [diff] [blame] | 185 | $ export CC32=arm-linux-gnueabihf- |
| 186 | $ export CC64=aarch64-linux-gnu- |
Nishanth Menon | b7ee22f | 2023-07-27 13:58:48 -0500 | [diff] [blame] | 187 | $ export LNX_FW_PATH=path/to/ti-linux-firmware |
| 188 | $ export TFA_PATH=path/to/trusted-firmware-a |
| 189 | $ export OPTEE_PATH=path/to/optee_os |
| 190 | .. k3_rst_include_end_common_env_vars_defn |
| 191 | |
| 192 | We will also need some common environment variables set up for the various |
| 193 | other build sources. we shall use the following, in the build descriptions below: |
| 194 | |
| 195 | .. k3_rst_include_start_board_env_vars_desc |
| 196 | .. list-table:: Board specific environment variables |
| 197 | :widths: 25 25 50 |
| 198 | :header-rows: 1 |
| 199 | |
| 200 | * - S/w Component |
| 201 | - Env Variable |
| 202 | - Description |
| 203 | * - U-Boot |
| 204 | - UBOOT_CFG_CORTEXR |
| 205 | - Defconfig for Cortex-R (Boot processor). |
| 206 | * - U-Boot |
| 207 | - UBOOT_CFG_CORTEXA |
| 208 | - Defconfig for Cortex-A (MPU processor). |
| 209 | * - Trusted Firmware-A |
| 210 | - TFA_BOARD |
| 211 | - Platform name used for building TF-A for Cortex-A Processor. |
| 212 | * - Trusted Firmware-A |
| 213 | - TFA_EXTRA_ARGS |
| 214 | - Any extra arguments used for building TF-A. |
| 215 | * - OP-TEE |
| 216 | - OPTEE_PLATFORM |
| 217 | - Platform name used for building OP-TEE for Cortex-A Processor. |
| 218 | * - OP-TEE |
| 219 | - OPTEE_EXTRA_ARGS |
| 220 | - Any extra arguments used for building OP-TEE. |
| 221 | .. k3_rst_include_end_board_env_vars_desc |
Bryan Brattlof | 6d13813 | 2022-12-19 14:29:50 -0600 | [diff] [blame] | 222 | |
| 223 | Building tiboot3.bin |
| 224 | ^^^^^^^^^^^^^^^^^^^^^ |
| 225 | |
| 226 | 1. To generate the U-Boot SPL for the wakeup domain, use the following |
| 227 | commands, substituting :code:`{SOC}` for the name of your device (eg: |
Neha Malcom Francis | 507be12 | 2023-07-22 00:14:43 +0530 | [diff] [blame] | 228 | am62x) to package the various firmware and the wakeup UBoot SPL into |
| 229 | the final `tiboot3.bin` binary. (or the `sysfw.itb` if your device |
| 230 | uses the split binary flow) |
Bryan Brattlof | 6d13813 | 2022-12-19 14:29:50 -0600 | [diff] [blame] | 231 | |
Nishanth Menon | b7ee22f | 2023-07-27 13:58:48 -0500 | [diff] [blame] | 232 | .. k3_rst_include_start_build_steps_spl_r5 |
Bryan Brattlof | 6d13813 | 2022-12-19 14:29:50 -0600 | [diff] [blame] | 233 | .. code-block:: bash |
| 234 | |
Neha Malcom Francis | 507be12 | 2023-07-22 00:14:43 +0530 | [diff] [blame] | 235 | $ # inside u-boot source |
Nishanth Menon | b7ee22f | 2023-07-27 13:58:48 -0500 | [diff] [blame] | 236 | $ make $UBOOT_CFG_CORTEXR |
| 237 | $ make CROSS_COMPILE=$CC32 BINMAN_INDIRS=$LNX_FW_PATH |
| 238 | .. k3_rst_include_end_build_steps_spl_r5 |
Bryan Brattlof | 6d13813 | 2022-12-19 14:29:50 -0600 | [diff] [blame] | 239 | |
| 240 | At this point you should have all the needed binaries to boot the wakeup |
| 241 | domain of your K3 SoC. |
| 242 | |
| 243 | **Combined Binary Boot Flow** (eg: am62x, am64x, ... ) |
| 244 | |
Neha Malcom Francis | 507be12 | 2023-07-22 00:14:43 +0530 | [diff] [blame] | 245 | `tiboot3-{SOC}-{gp/hs-fs/hs}.bin` |
Bryan Brattlof | 6d13813 | 2022-12-19 14:29:50 -0600 | [diff] [blame] | 246 | |
| 247 | **Split Binary Boot Flow** (eg: j721e, am65x) |
| 248 | |
Neha Malcom Francis | 507be12 | 2023-07-22 00:14:43 +0530 | [diff] [blame] | 249 | | `tiboot3-{SOC}-{gp/hs-fs/hs}.bin` |
| 250 | | `sysfw-{SOC}-{gp/hs-fs/hs}-evm.itb` |
Bryan Brattlof | 6d13813 | 2022-12-19 14:29:50 -0600 | [diff] [blame] | 251 | |
| 252 | .. note :: |
| 253 | |
| 254 | It's important to rename the generated `tiboot3.bin` and `sysfw.itb` |
| 255 | to match exactly `tiboot3.bin` and `sysfw.itb` as ROM and the wakeup |
| 256 | UBoot SPL will only look for and load the files with these names. |
| 257 | |
| 258 | Building tispl.bin |
| 259 | ^^^^^^^^^^^^^^^^^^^ |
| 260 | |
| 261 | The `tispl.bin` is a standard fitImage combining the firmware need for |
| 262 | the main domain to function properly as well as Device Management (DM) |
| 263 | firmware if your device using a split firmware. |
| 264 | |
Neha Malcom Francis | 507be12 | 2023-07-22 00:14:43 +0530 | [diff] [blame] | 265 | 2. We will first need TF-A, as it's the first thing to run on the 'big' |
Bryan Brattlof | 6d13813 | 2022-12-19 14:29:50 -0600 | [diff] [blame] | 266 | application cores on the main domain. |
| 267 | |
Nishanth Menon | b7ee22f | 2023-07-27 13:58:48 -0500 | [diff] [blame] | 268 | .. k3_rst_include_start_build_steps_tfa |
Bryan Brattlof | 6d13813 | 2022-12-19 14:29:50 -0600 | [diff] [blame] | 269 | .. code-block:: bash |
| 270 | |
Neha Malcom Francis | 507be12 | 2023-07-22 00:14:43 +0530 | [diff] [blame] | 271 | $ # inside trusted-firmware-a source |
Nishanth Menon | b7ee22f | 2023-07-27 13:58:48 -0500 | [diff] [blame] | 272 | $ make CROSS_COMPILE=$CC64 ARCH=aarch64 PLAT=k3 SPD=opteed $TFA_EXTRA_ARGS \ |
| 273 | TARGET_BOARD=$TFA_BOARD |
| 274 | .. k3_rst_include_end_build_steps_tfa |
Bryan Brattlof | 6d13813 | 2022-12-19 14:29:50 -0600 | [diff] [blame] | 275 | |
Neha Malcom Francis | 507be12 | 2023-07-22 00:14:43 +0530 | [diff] [blame] | 276 | Typically all `j7*` devices will use `TARGET_BOARD=generic` or `TARGET_BOARD |
Nishanth Menon | b7ee22f | 2023-07-27 13:58:48 -0500 | [diff] [blame] | 277 | =j784s4` (if it is a J784S4 device), while typical Sitara (`am6*`) devices |
Neha Malcom Francis | 507be12 | 2023-07-22 00:14:43 +0530 | [diff] [blame] | 278 | use the `lite` option. |
Bryan Brattlof | 6d13813 | 2022-12-19 14:29:50 -0600 | [diff] [blame] | 279 | |
Neha Malcom Francis | 507be12 | 2023-07-22 00:14:43 +0530 | [diff] [blame] | 280 | 3. The Open Portable Trusted Execution Environment (OP-TEE) is designed |
Bryan Brattlof | 6d13813 | 2022-12-19 14:29:50 -0600 | [diff] [blame] | 281 | to run as a companion to a non-secure Linux kernel for Cortex-A cores |
| 282 | using the TrustZone technology built into the core. |
| 283 | |
Nishanth Menon | b7ee22f | 2023-07-27 13:58:48 -0500 | [diff] [blame] | 284 | .. k3_rst_include_start_build_steps_optee |
Bryan Brattlof | 6d13813 | 2022-12-19 14:29:50 -0600 | [diff] [blame] | 285 | .. code-block:: bash |
| 286 | |
Neha Malcom Francis | 507be12 | 2023-07-22 00:14:43 +0530 | [diff] [blame] | 287 | $ # inside optee_os source |
Nishanth Menon | b7ee22f | 2023-07-27 13:58:48 -0500 | [diff] [blame] | 288 | $ make CROSS_COMPILE=$CC32 CROSS_COMPILE64=$CC64 CFG_ARM64_core=y $OPTEE_EXTRA_ARGS \ |
| 289 | PLATFORM=$OPTEE_PLATFORM |
| 290 | .. k3_rst_include_end_build_steps_optee |
Bryan Brattlof | 6d13813 | 2022-12-19 14:29:50 -0600 | [diff] [blame] | 291 | |
Neha Malcom Francis | 507be12 | 2023-07-22 00:14:43 +0530 | [diff] [blame] | 292 | 4. Finally, after TF-A has initialized the main domain and OP-TEE has |
Bryan Brattlof | 6d13813 | 2022-12-19 14:29:50 -0600 | [diff] [blame] | 293 | finished, we can jump back into U-Boot again, this time running on a |
| 294 | 64bit core in the main domain. |
| 295 | |
Nishanth Menon | b7ee22f | 2023-07-27 13:58:48 -0500 | [diff] [blame] | 296 | .. k3_rst_include_start_build_steps_uboot |
Bryan Brattlof | 6d13813 | 2022-12-19 14:29:50 -0600 | [diff] [blame] | 297 | .. code-block:: bash |
| 298 | |
Neha Malcom Francis | 507be12 | 2023-07-22 00:14:43 +0530 | [diff] [blame] | 299 | $ # inside u-boot source |
Nishanth Menon | b7ee22f | 2023-07-27 13:58:48 -0500 | [diff] [blame] | 300 | $ make $UBOOT_CFG_CORTEXA |
| 301 | $ make CROSS_COMPILE=$CC64 BINMAN_INDIRS=$LNX_FW_PATH \ |
| 302 | BL31=$TFA_PATH/build/k3/$TFA_BOARD/release/bl31.bin \ |
| 303 | TEE=$OPTEE_PATH/out/arm-plat-k3/core/tee-raw.bin |
| 304 | .. k3_rst_include_end_build_steps_uboot |
Bryan Brattlof | 6d13813 | 2022-12-19 14:29:50 -0600 | [diff] [blame] | 305 | |
| 306 | At this point you should have every binary needed initialize both the |
| 307 | wakeup and main domain and to boot to the U-Boot prompt |
| 308 | |
| 309 | **Main Domain Bootloader** |
| 310 | |
Neha Malcom Francis | 507be12 | 2023-07-22 00:14:43 +0530 | [diff] [blame] | 311 | | `tispl.bin` for HS devices or `tispl.bin_unsigned` for GP devices |
| 312 | | `u-boot.img` for HS devices or `u-boot.img_unsigned` for GP devices |
Manorit Chawdhry | ce7a62f | 2023-07-14 11:22:29 +0530 | [diff] [blame] | 313 | |
| 314 | Fit Signature Signing |
| 315 | --------------------- |
| 316 | |
| 317 | K3 Platforms have fit signature signing enabled by default on their primary |
| 318 | platforms. Here we'll take an example for creating fit image for J721e platform |
| 319 | and the same can be extended to other platforms |
| 320 | |
| 321 | 1. Describing FIT source |
| 322 | |
| 323 | .. code-block:: bash |
| 324 | |
| 325 | /dts-v1/; |
| 326 | |
| 327 | / { |
| 328 | description = "Kernel fitImage for j721e-hs-evm"; |
| 329 | #address-cells = <1>; |
| 330 | |
| 331 | images { |
| 332 | kernel-1 { |
| 333 | description = "Linux kernel"; |
| 334 | data = /incbin/("Image"); |
| 335 | type = "kernel"; |
| 336 | arch = "arm64"; |
| 337 | os = "linux"; |
| 338 | compression = "none"; |
| 339 | load = <0x80080000>; |
| 340 | entry = <0x80080000>; |
| 341 | hash-1 { |
| 342 | algo = "sha512"; |
| 343 | }; |
| 344 | |
| 345 | }; |
| 346 | fdt-ti_k3-j721e-common-proc-board.dtb { |
| 347 | description = "Flattened Device Tree blob"; |
| 348 | data = /incbin/("k3-j721e-common-proc-board.dtb"); |
| 349 | type = "flat_dt"; |
| 350 | arch = "arm64"; |
| 351 | compression = "none"; |
| 352 | load = <0x83000000>; |
| 353 | hash-1 { |
| 354 | algo = "sha512"; |
| 355 | }; |
| 356 | |
| 357 | }; |
| 358 | }; |
| 359 | |
| 360 | configurations { |
| 361 | default = "conf-ti_k3-j721e-common-proc-board.dtb"; |
| 362 | conf-ti_k3-j721e-common-proc-board.dtb { |
| 363 | description = "Linux kernel, FDT blob"; |
| 364 | fdt = "fdt-ti_k3-j721e-common-proc-board.dtb"; |
| 365 | kernel = "kernel-1"; |
| 366 | signature-1 { |
| 367 | algo = "sha512,rsa4096"; |
| 368 | key-name-hint = "custMpk"; |
| 369 | sign-images = "kernel", "fdt"; |
| 370 | }; |
| 371 | }; |
| 372 | }; |
| 373 | }; |
| 374 | |
| 375 | You would require to change the '/incbin/' lines to point to the respective |
| 376 | files in your local machine and the key-name-hint also needs to be changed |
| 377 | if you are using some other key other than the TI dummy key that we are |
| 378 | using for this example. |
| 379 | |
| 380 | 2. Compile U-boot for the respective board |
| 381 | |
Nishanth Menon | b7ee22f | 2023-07-27 13:58:48 -0500 | [diff] [blame] | 382 | .. include:: k3.rst |
| 383 | :start-after: .. k3_rst_include_start_build_steps_uboot |
| 384 | :end-before: .. k3_rst_include_end_build_steps_uboot |
Manorit Chawdhry | ce7a62f | 2023-07-14 11:22:29 +0530 | [diff] [blame] | 385 | |
Nishanth Menon | b7ee22f | 2023-07-27 13:58:48 -0500 | [diff] [blame] | 386 | .. note:: |
Manorit Chawdhry | ce7a62f | 2023-07-14 11:22:29 +0530 | [diff] [blame] | 387 | |
| 388 | The changes only affect a72 binaries so the example just builds that |
| 389 | |
| 390 | 3. Sign the fit image and embed the dtb in uboot |
| 391 | |
| 392 | Now once the build is done, you'll have a dtb for your board that you'll |
| 393 | be passing to mkimage for signing the fitImage and embedding the key in |
| 394 | the u-boot dtb. |
| 395 | |
| 396 | .. code-block:: bash |
| 397 | |
| 398 | mkimage -r -f fitImage.its -k $UBOOT_PATH/board/ti/keys -K |
| 399 | $UBOOT_PATH/build/a72/dts/dt.dtb |
| 400 | |
| 401 | For signing a secondary platform, pass the -K parameter to that DTB |
| 402 | |
| 403 | .. code-block:: bash |
| 404 | |
| 405 | mkimage -f fitImage.its -k $UBOOT_PATH/board/ti/keys -K |
| 406 | $UBOOT_PATH/build/a72/arch/arm/dts/k3-j721e-sk.dtb |
| 407 | |
| 408 | .. note:: |
| 409 | |
| 410 | If changing `CONFIG_DEFAULT_DEVICE_TREE` to the secondary platform, |
| 411 | binman changes would also be required so that correct dtb gets packaged. |
| 412 | |
| 413 | .. code-block:: bash |
| 414 | |
| 415 | diff --git a/arch/arm/dts/k3-j721e-binman.dtsi b/arch/arm/dts/k3-j721e-binman.dtsi |
| 416 | index 673be646b1e3..752fa805fe8d 100644 |
| 417 | --- a/arch/arm/dts/k3-j721e-binman.dtsi |
| 418 | +++ b/arch/arm/dts/k3-j721e-binman.dtsi |
| 419 | @@ -299,8 +299,8 @@ |
| 420 | #define SPL_J721E_SK_DTB "spl/dts/k3-j721e-sk.dtb" |
| 421 | |
| 422 | #define UBOOT_NODTB "u-boot-nodtb.bin" |
| 423 | -#define J721E_EVM_DTB "u-boot.dtb" |
| 424 | -#define J721E_SK_DTB "arch/arm/dts/k3-j721e-sk.dtb" |
| 425 | +#define J721E_EVM_DTB "arch/arm/dts/k3-j721e-common-proc-board.dtb" |
| 426 | +#define J721E_SK_DTB "u-boot.dtb" |
| 427 | |
| 428 | 5. Rebuilt u-boot |
| 429 | |
| 430 | This is required so that the modified dtb gets updated in u-boot.img |
| 431 | |
Nishanth Menon | b7ee22f | 2023-07-27 13:58:48 -0500 | [diff] [blame] | 432 | .. include:: k3.rst |
| 433 | :start-after: .. k3_rst_include_start_build_steps_uboot |
| 434 | :end-before: .. k3_rst_include_end_build_steps_uboot |
Manorit Chawdhry | ce7a62f | 2023-07-14 11:22:29 +0530 | [diff] [blame] | 435 | |
| 436 | 6. (Optional) Enabled FIT_SIGNATURE_ENFORCED |
| 437 | |
| 438 | By default u-boot will boot up the fit image without any authentication as |
| 439 | such if the public key is not embedded properly, to check if the public key |
| 440 | nodes are proper you can enable FIT_SIGNATURE_ENFORCED that would not rely |
| 441 | on the dtb for anything else then the signature node for checking the fit |
| 442 | image, rest other things will be enforced such as the property of |
| 443 | required-keys. This is not an extensive check so do manual checks also |
| 444 | |
| 445 | This is by default enabled for devices with TI_SECURE_DEVICE enabled. |
| 446 | |
| 447 | .. note:: |
| 448 | |
| 449 | The devices now also have distroboot enabled so if the fit image doesn't |
| 450 | work then the fallback to normal distroboot will be there on hs devices, |
| 451 | this will need to be explicitly disabled by changing the boot_targets. |
| 452 | |
| 453 | Saving environment |
| 454 | ------------------ |
| 455 | |
| 456 | SAVEENV is disabled by default and for the new flow uses Uenv.txt as the default |
| 457 | way for saving the environments. This has been done as Uenv.txt is more granular |
| 458 | then the saveenv command and can be used across various bootmodes too. |
| 459 | |
| 460 | **Writing to MMC/EMMC** |
| 461 | |
| 462 | .. code-block:: |
| 463 | |
| 464 | => env export -t $loadaddr <list of variables> |
| 465 | => fatwrite mmc ${mmcdev} ${loadaddr} ${bootenvfile} ${filesize} |
| 466 | |
| 467 | **Reading from MMC/EMMC** |
| 468 | |
| 469 | By default run envboot will read it from the MMC/EMMC partition ( based on |
| 470 | mmcdev) and set the environments. |
| 471 | |
| 472 | If manually needs to be done then the environment can be read from the |
| 473 | filesystem and then imported |
| 474 | |
| 475 | .. code-block:: |
| 476 | |
| 477 | => fatload mmc ${mmcdev} ${loadaddr} ${bootenvfile} |
| 478 | => env import -t ${loadaddr} ${filesize} |