3.1.1.1. General Information¶
3.1.1.1.1. Getting the U-Boot Source Code¶
The GIT repo URL, branch and commit id can be found in the release-specific-build-information-u-boot section of the release notes.
3.1.1.1.2. Build U-Boot¶
Note
The following commands are intended to be run from the root of the U-Boot tree unless otherwise specified. The root of the U-Boot tree is the top-level directory and can be identified by looking for the “MAINTAINERS” file.
Note
Note about HSM Rearchitecture
After HSM rearchitecture in bootloader, loading of remote cores with firmware will be supported at A72 SPL stage only and not at R5 SPL stage. Early loading of remote core firmware in R5 SPL requires core reset functionality. As part of HSM rearchitecture, this functionality has moved into the DM service which requires SPL to re-implement device and clock control. This support is not present in Uboot R5 SPL due to memory constraints on the existing 64-bit TI devices.
Several prebuilt images are required from the TI Processor SDK for building U-Boot on K3 based platforms.
Go here to download and install the SDK.
TI-u-boot is included in the SDK in <path to tisdk>/board-support. Ensure that the u-boot version matches the release-specific-build-information-u-boot.
Getting Security Dev Tool
core-secdev-k3 is included in the SDK inside board-support directory.
$ export TI_SECURE_DEV_PKG=<path-to-board-support-directory>/core-secdev-k3Setting the tool chain path
We strongly recommend using the toolchain that came with the Linux Core release that corresponds to this U-Boot release. For e.g:
export PATH=$HOME/gcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf/bin:$PATH export PATH=$HOME/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/bin:$PATHCompiling R5 and ARM64 images
Use the following table to determine what defconfig to use to configure with:
Board | SD Boot | eMMC Boot | UART boot | OSPI boot | USB DFU |
---|---|---|---|---|---|
AM62X SK | am62x_evm_r5_defconfig am62x_evm_a53_defconfig | am62x_evm_r5_defconfig am62x_evm_a53_defconfig | am62x_evm_r5_defconfig am62x_evm_a53_defconfig | am62x_evm_r5_defconfig am62x_evm_a53_defconfig | am62x_evm_r5_usbdfu_defconfig am62x_evm_a53_defconfig |
AM62X LP SK | am62x_lpsk_r5_defconfig am62x_lpsk_a53_defconfig | am62x_lpsk_r5_defconfig am62x_lpsk_a53_defconfig | am62x_lpsk_r5_defconfig am62x_lpsk_a53_defconfig | am62x_lpsk_r5_defconfig am62x_lpsk_a53_defconfig |
Note
Where to get the sources:
- ti-u-boot Branch: ti-u-boot-2021.01
- ti-k3-image-gen Branch: master
- ti-linux-firmware Branch: ti-linux-firmware
- arm-trusted-firmware Commit: 1309c6c805190bd376c0561597653f3f8ecd0f58
- optee-os Commit: d6c5d0037b46f46caf71d67d7825d4b722cbcddf
Notice: arm-trusted-firmware and optee-os are now sourced from upstream.
$ export UBOOT_DIR=<path-to-ti-u-boot>
$ export K3IG_DIR=<path-to-k3-image-gen>
$ export SYSFW_DIR=<path-to-ti-linux-firmware>/ti-sysfw
$ export DMFW_DIR=<path-to-ti-linux-firmware>/ti-dm/am62xx
$ export TFA_DIR=<path-to-arm-trusted-firmware>
$ export OPTEE_DIR=<path-to-ti-optee-os>
Note
The instructions below assume all binaries are built manually. For instructions to build bl31.bin go to: OP-TEE. For instructions to build tee-pager_v2.bin (bl32.bin) go to: ARM Trusted Firmware-A. To use existing images, go to <path-to-tisdk>/board-support/prebuilt-images to obtain pre-build binares that come in the pre-built sdk.
on HS-FS
R5
To build u-boot-spl.bin for signed tiboot3.bin. Saved in $UBOOT_DIR/out/r5.
$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- am62x_evm_r5_defconfig O=$UBOOT_DIR/out/r5
$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- O=$UBOOT_DIR/out/r5
To build tiboot3-am62x-hs-fs-evm.bin. Saved in $K3IG_DIR. Requires u-boot-spl.bin and HS-FS TIFS FW.
$ cd $K3IG_DIR
$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- SOC=am62x SOC_TYPE=hs-fs SBL=$UBOOT_DIR/out/r5/spl/u-boot-spl.bin SYSFW_DIR=$SYSFW_DIR
Sign bl31.bin binary found in $OPTEE_DIR/out/arm-plat-k3/core, sign tee-pager_v2.bin (bl32.bin) found in $TFA_DIR/build/k3/lite/release, and ipc_echo_testb_mcu1_0_release_strip.xer5f found in $DMFW_DIR.
$ $TI_SECURE_DEV_PKG/scripts/secure-binary-image.sh bl31.bin bl31.bin.signed
$ $TI_SECURE_DEV_PKG/scripts/secure-binary-image.sh tee-pager_v2.bin bl32.bin.signed
$ $TI_SECURE_DEV_PKG/scripts/secure-binary-image.sh ipc_echo_testb_mcu1_0_release_strip.xer5f ipc_echo_testb_mcu1_0_release_strip.xer5f.signed
A53
To build signed tispl.bin_HS and signed u-boot.img_HS. Saved in $UBOOT_DIR/out/a53. Requires bl31.bin.signed and bl32.bin.signed.
$ make ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- am62x_evm_a53_defconfig O=$UBOOT_DIR/out/a53
$ make ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- ATF=$TFA_DIR/build/k3/lite/release/bl31.bin.signed TEE=$OPTEE_DIR/out/arm-plat-k3/core/bl32.bin.signed DM=$DMFW_DIR/ipc_echo_testb_mcu1_0_release_strip.xer5f.signed O=$UBOOT_DIR/out/a53
on GP
R5
To build u-boot-spl.bin for tiboot3.bin. Saved in $UBOOT_DIR/out/r5.
$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- am62x_evm_r5_defconfig O=$UBOOT_DIR/out/r5
$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- O=$UBOOT_DIR/out/r5
To build tiboot3-am62x-gp-evm.bin. Saved in $K3IG_DIR. Requires u-boot-spl.bin and ti-fs-firmware-am62x-gp.bin.
$ cd $K3IG_DIR
$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- SOC=am62x SOC_TYPE=gp SBL=$UBOOT_DIR/out/r5/spl/u-boot-spl.bin SYSFW_DIR=$SYSFW_DIR
A53
To build tispl.bin and u-boot.img. Saved in $UBOOT_DIR/out/a53. Requires bl31.bin, tee-pager_v2.bin, and ipc_echo_testb_mcu1_0_release_strip.xer5f.
$ make ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- am62x_evm_a53_defconfig O=$UBOOT_DIR/out/a53
$ make ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- ATF=$TFA_DIR/build/k3/lite/release/bl31.bin TEE=$OPTEE_DIR/out/arm-plat-k3/core/tee-pager_v2.bin DM=$DMFW_DIR/ipc_echo_testb_mcu1_0_release_strip.xer5f O=$UBOOT_DIR/out/a53
on HS
R5
To build u-boot-spl.bin for signed tiboot3.bin. Saved in $UBOOT_DIR/out/r5.
$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- am62x_evm_r5_defconfig O=$UBOOT_DIR/out/r5
$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- O=$UBOOT_DIR/out/r5
To build tiboot3-am62x-hs-evm.bin. Saved in $K3IG_DIR. Requires u-boot-spl.bin and TIFS HS-SE FW.
$ cd $K3IG_DIR
$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- SOC=am62x SOC_TYPE=hs SBL=$UBOOT_DIR/out/r5/spl/u-boot-spl.bin SYSFW_DIR=$SYSFW_DIR
Sign bl31.bin binary found in $OPTEE_DIR/out/arm-plat-k3/core, sign tee-pager_v2.bin (bl32.bin) found in $TFA_DIR/build/k3/lite/release, and ipc_echo_testb_mcu1_0_release_strip.xer5f found in $DMFW_DIR.
$ $TI_SECURE_DEV_PKG/scripts/secure-binary-image.sh bl31.bin bl31.bin.signed
$ $TI_SECURE_DEV_PKG/scripts/secure-binary-image.sh tee-pager_v2.bin bl32.bin.signed
$ $TI_SECURE_DEV_PKG/scripts/secure-binary-image.sh ipc_echo_testb_mcu1_0_release_strip.xer5f ipc_echo_testb_mcu1_0_release_strip.xer5f.signed
A53
To build signed tispl.bin_HS and signed u-boot.img_HS. Saved in $UBOOT_DIR/out/a53. Requires bl31.bin.signed and bl32.bin.signed.
$ make ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- am62x_evm_a53_defconfig O=$UBOOT_DIR/out/a53
$ make ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- ATF=$TFA_DIR/build/k3/lite/release/bl31.bin.signed TEE=$OPTEE_DIR/out/arm-plat-k3/core/bl32.bin.signed DM=$DMFW_DIR/ipc_echo_testb_mcu1_0_release_strip.xer5f.signed O=$UBOOT_DIR/out/a53
Target Images
Copy the below images to the boot partition of an SD card and boot. Instructions to format the SD card can be found here.
- tiboot3.bin from <path to K3-image-gen>
- tispl.bin, u-boot.img from <output directory>/a53
3.1.1.1.3. Image Formats¶
- tiboot3.bin:
+-----------------------+ | X.509 | | Certificate | | +-------------------+ | | | | | | | R5 | | | | u-boot-spl.bin | | | | | | | +-------------------+ | | | | | | |TIFS with board cfg| | | | | | | +-------------------+ | | | | | | | | | | | FIT header | | | | +---------------+ | | | | | | | | | | | DTB 1...N | | | | | +---------------+ | | | +-------------------+ | +-----------------------+
- tispl.bin
+-----------------------+ | | | FIT HEADER | | +-------------------+ | | | | | | | A53 ATF | | | +-------------------+ | | | | | | | A53 OPTEE | | | +-------------------+ | | | | | | | R5 DM FW | | | +-------------------+ | | | | | | | A53 SPL | | | +-------------------+ | | | | | | | SPL DTB 1...N | | | +-------------------+ | +-----------------------+
3.1.1.1.4. Boot Flow¶
On K3 architecture based devices, ROM supports boot only via MCU(R5). This means that bootloader has to run on R5 core. In order to meet this constraint, keeping safety in picture and to have faster boot time, the software boot architecture is designed as below:
+------------------------------------------------------------------------+
| TIFS | Main R5 | A53 |
+------------------------------------------------------------------------+
| +--------+ | | |
| | Reset | | | |
| +--------+ | | |
| : | | |
| +--------+ | +-----------+ | |
| | *ROM* |----------|-->| Reset rls | | |
| +--------+ | +-----------+ | |
| | | | : | |
| | ROM | | : | |
| |services| | : | |
| | | | +-------------+ | |
| | | | | *R5 ROM* | | |
| | | | +-------------+ | |
| | |<---------|---|Load and auth| | |
| | | | | tiboot3.bin | | |
| +--------+ | +-------------+ | |
| | |<---------|---| Load sysfw | | |
| | | | | part to TIFS| | |
| | | | | core | | |
| | | | +-------------+ | |
| | | | : | |
| | | | : | |
| | | | : | |
| | | | +-------------+ | |
| | | | | *R5 SPL* | | |
| | | | +-------------+ | |
| | | | | DDR | | |
| | | | | config | | |
| | | | +-------------+ | |
| | | | | Load | | |
| | | | | tispl.bin | | |
| | | | +-------------+ | |
| | | | | Load R5 | | |
| | | | | firmware | | |
| | | | +-------------+ | |
| | |<---------|---| Start A53 | | |
| | | | | and jump to | | |
| | | | | DM fw image | | |
| | | | +-------------+ | |
| | | | | +-----------+ |
| | |----------|-----------------------|---->| Reset rls | |
| | | | | +-----------+ |
| | TIFS | | | : |
| |Services| | | +-----------+ |
| | |<---------|-----------------------|---->|*ATF/OPTEE*| |
| | | | | +-----------+ |
| | | | | : |
| | | | | +-----------+ |
| | |<---------|-----------------------|---->| *A53 SPL* | |
| | | | | +-----------+ |
| | | | | | Load | |
| | | | | | u-boot.img| |
| | | | | +-----------+ |
| | | | | : |
| | | | | +-----------+ |
| | |<---------|-----------------------|---->| *U-Boot* | |
| | | | | +-----------+ |
| | | | | | prompt | |
| | |----------|-----------------------|-----+-----------+-----|
| +--------+ | | |
| | | |
+------------------------------------------------------------------------+
Here TIFS acts as master and provides all the critical services. R5/ARM64 requests TIFS to get these services done as shown in the above diagram.
3.1.1.1.5. U-Boot Environment¶
Please note that on many boards we modify the environment during system start for a variety of variables such as board_name and if unset, ethaddr. When we restore defaults some variables will become unset, and this can lead to other things not working such as findfdt that rely on these run-time set variables.
Restoring defaults
It is possible to reset the set of U-Boot environment variables to their defaults and if desired, save them to where the environment is stored, if applicable. It is also required to restore the default setting when u-boot version changes from an upgrade or downgrade. To do so, issue the following commands:
U-Boot # env default -f -a
U-Boot # saveenv
Networking Environment
When using a USB-Ethernet dongle a valid MAC address must be set in the environment. To create a valid address please read **this page**. Then issue the following command:
U-Boot # setenv usbethaddr value:from:link:above
You can use the printenv command to see if usbethaddr is already set.
Then start the USB subsystem:
U-Boot # usb start
The default behavior of U-Boot is to utilize all information that a DHCP server passes to us when the user issues the dhcp command. This will include the dhcp parameter next-server which indicates where to fetch files from via TFTP. There may be times however where the dhcp server on your network provides incorrect information and you are unable to modify the server. In this case the following steps can be helpful:
U-Boot # setenv autoload no
U-Boot # dhcp
U-Boot # setenv serverip correct.server.ip
U-Boot # tftp
Another alternative is to utilize the full syntax of the tftp command:
U-Boot # setenv autoload no
U-Boot # dhcp
U-Boot # tftp ${loadaddr} server.ip:fileName
3.1.1.1.6. Available RAM for image download¶
To know the amount of RAM available for downloading images or for other
usage, use bdinfo
command.
=> bdinfo
arch_number = 0x00000000
boot_params = 0x80000100
DRAM bank = 0x00000000
-> start = 0x80000000
-> size = 0x7F000000
baudrate = 115200 bps
TLB addr = 0xFEFF0000
relocaddr = 0xFEF30000
reloc off = 0x7E730000
irq_sp = 0xFCEF8880
sp start = 0xFCEF8870
Early malloc usage: 890 / 2000
After booting, U-Boot relocates itself (along with its various reserved
RAM areas) and places itself at end of available RAM (starting at
relocaddr
in bdinfo
output above). Only the stack is located
just before that area. The address of top of the stack is in
sp start
in bdinfo
output and it grows downwards. Users should
reserve at least about 1MB for stack, so in the example output above,
RAM in the range of [0x80000000, 0xFCE00000]
is safely available for
use.
3.1.1.1.7. Device Trees¶
A note about device trees. Now all supported boards are required to use a device tree to boot. To facilitate this in supported platforms, a command in U-Boot environment findfdt is available that will set the fdtfile variable to the name of the device tree to use, as found with the kernel sources. In the Keystone-2 family devices (K2H/K/E/L/G), it is specified by name_fdt variable for each platform. The device tree is expected to be loaded from the same media as the kernel, and from the same relative path.
3.1.1.1.8. SRAM memory Layout during R5 SPL bootloader stage¶
The SRAM memory layout explains the memory used for Bootloader’s operation.
┌──────────────────────────────────────┐0x43c00000 │ │ │ │ │ SPL IMAGE │ │ (Max size 204 KB) │ │ (excluding BSS) │ │ │ │ │ ├──────────────────────────────────────┤0x43c33000 │ │ │ EMPTY (18KB) │ │ │ ├──────────────────────────────────────┤0x43c37800 │ │ │ │ │ BSS (20 KB) │ │ │ │ │ ├──────────────────────────────────────┤0x43c3c800 │ │ │ DM config data (1.5KB) │ │ │ ├──────────────────────────────────────┤0x43c3cd82 │ │ │ │ │ EMPTY (9KB) │ │ │ │ │ ├──────────────────────────────────────┤0x43c3f290 │ │ │ ROM Boot parameter table │ │ + Extended boot info (3.5 KB) │ │ │ ├──────────────────────────────────────┤0x43c3ffff . . . . . . ├──────────────────────────────────────┤0x70000000 │ │ │ │ │ STACK │ │ │ │ │ ├──────────────────────────────────────┤0x70006f1f │ Global Data │ ├──────────────────────────────────────┤0x70006fff │ │ │ HEAP │ │ │ └──────────────────────────────────────┘0x7000ffff