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