Yocto Build U-Boot TI: Difference between revisions

From Variscite Wiki
 
(99 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<!-- Set release according to "release" parameter in URL and use am62-yocto-dunfell-5.10.140_08.06.00.42-v1.0 as default
<!-- Set release according to "release" parameter in URL and use am62-yocto-dunfell-5.10.168_08.06.00.42-v1.0 as default
--> {{INIT_RELEASE_PARAM|am62-yocto-dunfell-5.10.140_08.06.00.42-v1.0}}<!--
--> {{INIT_RELEASE_PARAM|am62-yocto-kirkstone-6.1.46_09.01.00.08-v1.0}}<!--
--> {{#lst:Yocto_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!--
--> {{#lst:Yocto_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!--
--> {{#vardefine:WORKDIR|~/{{#var:MACHINE_NAME}}-u-boot}} <!--
--> {{#vardefine:WORKDIR|~/{{#var:MACHINE_NAME}}-u-boot}} <!--
--> {{#vardefine:WORKDIR_ENV|$WORKDIR}} <!--
--> {{PageHeader|Yocto Build U-Boot from source code}} {{DocImage|category1=Yocto|category2={{#var:HARDWARE_NAME}}}} __toc__
--> {{PageHeader|Yocto Build U-Boot from source code}} {{DocImage|category1=Yocto|category2={{#var:HARDWARE_NAME}}}} __toc__


= Introduction =
= Introduction =


This guide walks through the process for manually building and installing the U-Boot images from source. It is derived from TI's [https://software-dl.ti.com/processor-sdk-linux/esd/AM62X/{{#var:TI_RELEASE_}}/exports/docs/linux/Foundational_Components/U-Boot/UG-General-Info.html?highlight=build%20uboot General Information] guide
This guide walks through the process for manually building and installing the U-Boot images from source. It is derived from TI's [https://software-dl.ti.com/processor-sdk-linux/esd/AM62X/{{#var:TI_RELEASE_}}/exports/docs/linux/Foundational_Components/U-Boot/UG-General-Info.html?highlight=build%20uboot Build U-Boot] guide
 
= Installing required packages =
 
Install the required packages documented in the {{Varlink|Yocto_Build_Release|{{#var:RELEASE_LINK}}|'''Build Yocto from source code'''}} guide.
 
{{#ifexpr: {{#var:YOCTO_VERSION}} >= 4.1 |
Building U-boot requires Python 3.10 or newer, which is shipped with Ubuntu 22.04.
 
In addition to Python 3.10, the following python3 modules are required for binman:
$ pip3 install jsonschema pyelftools
}}


= Fetch source code and install dependencies =
= Fetch source code and install dependencies =
Line 17: Line 29:


Setup a working directory
Setup a working directory
  $ mkdir {{#var:WORKDIR}}
  $ export WORKDIR={{#var:WORKDIR}}
$ mkdir $WORKDIR


Fetch the U-Boot source:  
Fetch the U-Boot source:  
{{GIT_FETCH|NAME=U-BOOT|WORKDIR={{#var:WORKDIR}}}}
{{GIT_FETCH|NAME=U-BOOT|WORKDIR={{#var:WORKDIR_ENV}}}}<!--
 
-->{{#ifexpr: {{#var:YOCTO_VERSION}} < 4.1 |


Fetch the core-secdev-k3 Security Dev Tool:
Fetch the core-secdev-k3 Security Dev Tool:
{{GIT_FETCH|NAME=CORE_SECDEV_K3|WORKDIR={{#var:WORKDIR}}|USE_COMMIT=y}}
{{GIT_FETCH|NAME=CORE_SECDEV_K3|WORKDIR={{#var:WORKDIR_ENV}}|USE_COMMIT=y}}


Fetch ti-k3-image-gen:
Fetch ti-k3-image-gen:
{{GIT_FETCH|NAME=K3_IMAGE_GEN|WORKDIR={{#var:WORKDIR}}|USE_COMMIT=y}}
{{GIT_FETCH|NAME=K3_IMAGE_GEN|WORKDIR={{#var:WORKDIR_ENV}}|USE_COMMIT=y}}
}}


Fetch ti-linux-firmware:
Fetch ti-linux-firmware:
{{GIT_FETCH|NAME=TI_LINUX_FIRMWARE|WORKDIR={{#var:WORKDIR}}|USE_COMMIT=y}}
{{GIT_FETCH|NAME=TI_LINUX_FIRMWARE|WORKDIR={{#var:WORKDIR_ENV}}|USE_COMMIT=y}}


Fetch arm-trusted-firmawre:
Fetch arm-trusted-firmware:
{{GIT_FETCH|NAME=ATF|WORKDIR={{#var:WORKDIR}}|USE_COMMIT=y}}
{{GIT_FETCH|NAME=ATF|WORKDIR={{#var:WORKDIR_ENV}}|USE_COMMIT=y}}


Fetch optee-os:
Fetch optee-os:
{{GIT_FETCH|NAME=OPTEE|WORKDIR={{#var:WORKDIR}}|USE_COMMIT=y}}
{{GIT_FETCH|NAME=OPTEE|WORKDIR={{#var:WORKDIR_ENV}}|USE_COMMIT=y}}


= Build U-Boot out of Yocto tree =
= Build U-Boot out of Yocto tree =


After fetching the source code and installing dependencies, you may return to {{#var:WORKDIR}} anytime and follow these steps to build U-Boot:
After fetching the source code and installing dependencies, you may return to {{#var:WORKDIR_ENV}} anytime and follow these steps to build U-Boot:
 
== Setup the environment ==
 
Export the working directory
 
$ export WORKDIR={{#var:WORKDIR}}
 
Export variables for building U-Boot
 
$ export PATH=$HOME/{{#var:armv7_toolchain}}/bin:$PATH &&
  export PATH=$HOME/{{#var:armv8_toolchain}}/bin:$PATH && {{#ifexpr: {{#var:YOCTO_VERSION}} < 4.1 |&nbsp;
  export TI_SECURE_DEV_PKG={{#var:WORKDIR_ENV}}/{{#var:CORE_SECDEV_K3_REPO}} &&
  export K3IG_DIR={{#var:WORKDIR_ENV}}/{{#var:K3_IMAGE_GEN_REPO}} &&
  export SYSFW_DIR={{#var:WORKDIR_ENV}}/{{#var:TI_LINUX_FIRMWARE_REPO}}/ti-sysfw &&
  export DMFW_DIR={{#var:WORKDIR_ENV}}/{{#var:TI_LINUX_FIRMWARE_REPO}}/ti-dm/am62xx &&
  | &nbsp;
  export TI_LINUX_FW_DIR={{#var:WORKDIR_ENV}}/{{#var:TI_LINUX_FIRMWARE_REPO}} &&
  }}
  export UBOOT_DIR={{#var:WORKDIR_ENV}}/{{#var:U-BOOT_REPO}} &&
  export TFA_DIR={{#var:WORKDIR_ENV}}/{{#var:ATF_REPO}} &&
  export OPTEE_DIR={{#var:WORKDIR_ENV}}/{{#var:OPTEE_REPO}}


== Setup the environment: ==
== Build Images ==


  $ export PATH=$HOME/{{#var:armv7_toolchain}}/bin:$PATH && \
'''ATF'''
  export PATH=$HOME/{{#var:armv8_toolchain}}/bin:$PATH && \
  $ cd $TFA_DIR
  export export TI_SECURE_DEV_PKG={{#var:WORKDIR}}/{{#var:CORE_SECDEV_K3_REPO}} && \
$ make -j$(nproc) ARCH=aarch64 CROSS_COMPILE=aarch64-none-linux-gnu- PLAT=k3 TARGET_BOARD=lite SPD=opteed
  export UBOOT_DIR={{#var:WORKDIR}}/{{#var:U-BOOT_REPO}}  && \
  export K3IG_DIR={{#var:WORKDIR}}/{{#var:K3_IMAGE_GEN_REPO}} && \
  export SYSFW_DIR={{#var:WORKDIR}}/{{#var:TI_LINUX_FIRMWARE_REPO}}/ti-sysfw && \
  export DMFW_DIR={{#var:WORKDIR}}/{{#var:TI_LINUX_FIRMWARE_REPO}}/ti-dm/am62xx && \
  export TFA_DIR={{#var:WORKDIR}}/{{#var:ATF_REPO}} && \
  export OPTEE_DIR={{#var:WORKDIR}}/{{#var:OPTEE_REPO}}


== Build for GP {{#var:SOC}} SoC: ==
'''OP-TEE'''
$ cd $OPTEE_DIR
$ make -j$(nproc) CROSS_COMPILE64=aarch64-none-linux-gnu- CROSS_COMPILE32=arm-none-linux-gnueabihf- PLATFORM=k3-am62x CFG_ARM64_core=y
<!--optee documentation from ti is incorrect:
    https://software-dl.ti.com/processor-sdk-linux/esd/AM62X/08_06_00_42/exports/docs/linux/Foundational_Components_OPTEE.html#foundational-components-optee
See fix:
    https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1173632/processor-sdk-am64x-am64-compiler-aarch64-linux-gnu-gcc/4416840?tisearch=e2e-sitesearch&keymatch=CROSS_COMPILE64%3Daarch64-none-linux-gnu-#4416840
-->
'''U-Boot R5 Images'''


'''R5 Images'''
Optional - Modify {{#var:U-BOOT_R5_DEFCONFIG}}:
$ cd {{#var:WORKDIR_ENV}}/{{#var:U-BOOT_REPO}}
$ make -j$(nproc) ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- {{#var:U-BOOT_R5_DEFCONFIG}} O=$UBOOT_DIR/out/r5
$ make -j$(nproc) ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- O=$UBOOT_DIR/out/r5 menuconfig
... make and save some changes ...
$ make -j$(nproc) ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- O=$UBOOT_DIR/out/r5 savedefconfig
$ cp out/r5/defconfig configs/{{#var:U-BOOT_R5_DEFCONFIG}}


Build u-boot-spl.bin for tiboot3.bin. Saved in $UBOOT_DIR/out/r5:
Build u-boot-spl.bin for tiboot3.bin. Saved in $UBOOT_DIR/out/r5:


  $ cd {{#var:WORKDIR}}/{{#var:U-BOOT_REPO}}
  $ cd {{#var:WORKDIR_ENV}}/{{#var:U-BOOT_REPO}}
  $ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- {{#var:U-BOOT_R5_DEFCONFIG}} O=$UBOOT_DIR/out/r5
  $ make -j$(nproc) ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- {{#var:U-BOOT_R5_DEFCONFIG}} O=$UBOOT_DIR/out/r5
  $ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- O=$UBOOT_DIR/out/r5
  $ make -j$(nproc) ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- O=$UBOOT_DIR/out/r5 {{#ifexpr: {{#var:YOCTO_VERSION}} >= 4.1 | BINMAN_INDIRS=$TI_LINUX_FW_DIR}}{{#ifexpr: {{#var:YOCTO_VERSION}} < 4.1 |&nbsp;


Build tiboot3-am62x-gp-evm.bin. Saved in $K3IG_DIR. Requires u-boot-spl.bin and ti-fs-firmware-am62x-gp.bin.
Build tiboot3-am62x-hs-fs-evm.bin. Saved in $K3IG_DIR. Requires u-boot-spl.bin and ti-fs-firmware-am62x-hs-fs.bin.
$ cd {{#var:WORKDIR}}/{{#var:U-BOOT_REPO}}
  $ cd $K3IG_DIR
  $ 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
  $ make -j$(nproc) 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<!--
-->}}


'''A53 Images'''
{{Note|Note:
The AM62 SOC has multiple variants (GP, HS-FS, HS-SE). For more information, see: [https://software-dl.ti.com/processor-sdk-linux/esd/AM62X/08_06_00_42/exports/docs/linux/Foundational_Components_Migration_Guide.html#device-types Device types]
Early Variscite VAR-SOM-AM62 samples were shipped with the GP variant.
{{#ifexpr: {{#var:YOCTO_VERSION}} < 4.1 | To build U-Boot for the GP variant, replaces 'hs-fs' with 'gp' above.}}}}
 
'''U-Boot A53 Images'''
 
Optional - Modify {{#var:U-BOOT_A53_DEFCONFIG}}:
$ cd {{#var:WORKDIR_ENV}}/{{#var:U-BOOT_REPO}}
$ make -j$(nproc) ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- {{#var:U-BOOT_A53_DEFCONFIG}} O=$UBOOT_DIR/out/a53
$ make -j$(nproc) ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- O=$UBOOT_DIR/out/a53 menuconfig
  ... make and save some changes ...
$ make -j$(nproc) ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- O=$UBOOT_DIR/out/a53 savedefconfig
$ cp out/a53/defconfig configs/{{#var:U-BOOT_A53_DEFCONFIG}}


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.
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- U-BOOT_A53_DEFCONFIG O=$UBOOT_DIR/out/a53
$ cd {{#var:WORKDIR_ENV}}/{{#var:U-BOOT_REPO}}
  $ 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
  $ make -j$(nproc) ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- {{#var:U-BOOT_A53_DEFCONFIG}} O=$UBOOT_DIR/out/a53
  $ make -j$(nproc) ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- \
      {{#ifexpr: {{#var:YOCTO_VERSION}} < 4.1 | ATF= | BL31=}}$TFA_DIR/build/k3/lite/release/bl31.bin \
      TEE=$OPTEE_DIR/out/arm-plat-k3/core/tee-pager_v2.bin \{{#ifexpr: {{#var:YOCTO_VERSION}} < 4.1 |&nbsp;
      DM=$DMFW_DIR/ipc_echo_testb_mcu1_0_release_strip.xer5f \}}
      O=$UBOOT_DIR/out/a53 {{#ifexpr: {{#var:YOCTO_VERSION}} >= 4.1 | BINMAN_INDIRS=$TI_LINUX_FW_DIR}}{{#ifexpr: {{#var:YOCTO_VERSION}} < 4.1}}
 
= Update U-Boot on running system =
To update U-Boot on an existing system, the following SPL and U-Boot images need to be installed to the boot partition of the boot media (eMMC or SD):
{{#ifexpr: {{#var:YOCTO_VERSION}} < 4.1 | $K3IG_DIR/tiboot3.bin | $UBOOT_DIR/out/r5/tiboot3.bin }}
$UBOOT_DIR/out/a53/tispl.bin
$UBOOT_DIR/out/a53/u-boot.img
 
After updating the boot media, boot U-Boot and verify the commit ids of the R5 SPL, A53 SPL, and A53 U-Boot match the output of '''git rev-parse HEAD'''. For example:
 
$ cd $UBOOT_DIR && git rev-parse HEAD
{{#var:U-BOOT_COMMIT}}
 
Verify this matches the versions printed by U-Boot:
U-Boot SPL {{#var:U-BOOT_TI_VER}}-g{{#var:U-BOOT_COMMIT_SHORT}} (Mar 23 2023 - 22:04:15 +0000)    <--- R5
U-Boot SPL {{#var:U-BOOT_TI_VER}}-g{{#var:U-BOOT_COMMIT_SHORT}} (Mar 23 2023 - 22:04:15 +0000)    <--- A53
U-Boot {{#var:U-BOOT_TI_VER}}-g{{#var:U-BOOT_COMMIT_SHORT}} (Mar 24 2023 - 16:25:35 -0500)        <--- A53
 
=== Update U-Boot on an SD Card ===
To update U-Boot on an SD Card, copy the files to the sd card.
 
* Mount the SD card boot partition on your host computer and verify the previous U-Boot files are installed:
$ mkdir ~/.sdcard
$ sudo mount /dev/sdX ~/.sdcard
$ ls ~/.sdcard
tiboot3.bin  tispl.bin  u-boot.img  uEnv.txt
 
* Copy the new files and umount the SD card:
$ sudo cp {{#ifexpr: {{#var:YOCTO_VERSION}} < 4.1 | $K3IG_DIR/tiboot3.bin | $UBOOT_DIR/out/r5/tiboot3.bin}} $UBOOT_DIR/out/a53/tispl.bin $UBOOT_DIR/out/a53/u-boot.img ~/.sdcard
$ sudo umount ~/.sdcard && sync
 
* Boot the SD card and verify the R5 SPL, A53 SPL, and A53 U-Boot match the output of '''git rev-parse HEAD'''
 
=== Update U-Boot using UMS ===
U-Boot can be updated by using the USB Mass Storage gadget to mount the eMMC or SD card on your host computer.
 
* Connect the USB OTG port to host computer.
* Start the {{#var:HARDWARE_NAME}} and interrupt U-Boot
* Start UMS on eMMC:
u-boot> ums 0 mmc 1
* Or...start UMS on SD card:
u-boot> ums 0 mmc 2
* Or...start UMS on the current boot device:
u-boot> ums 0 mmc $mmcdev
* Mount the SD card boot partition and verify the previous U-Boot files are installed:
$ mkdir ~/.sdcard
$ sudo mount /dev/sdX ~/.sdcard
$ ls ~/.sdcard
tiboot3.bin  tispl.bin  u-boot.img  uEnv.txt
 
* Copy the new files and umount the SD card:
$ sudo cp {{#ifexpr: {{#var:YOCTO_VERSION}} < 4.1 | $K3IG_DIR/tiboot3.bin | $UBOOT_DIR/out/r5/tiboot3.bin}} $UBOOT_DIR/out/a53/tispl.bin $UBOOT_DIR/out/a53/u-boot.img ~/.sdcard
$ sudo umount ~/.sdcard && sync
 
* Boot the SD card and verify the R5 SPL, A53 SPL, and A53 U-Boot match the output of '''git rev-parse HEAD'''
 
=== Update U-Boot using Ethernet ===
U-Boot can be updated on a running system by using scp to transfer the files:
 
* Mount the eMMC boot partition and verify the previous U-Boot files are installed:
# mount /dev/mmcblk0p1 /mnt/
# ls /mnt
tiboot3.bin  tispl.bin  u-boot.img  uEnv.txt
 
* Transfer the new files:
$ scp {{#ifexpr: {{#var:YOCTO_VERSION}} < 4.1 | $K3IG_DIR/tiboot3.bin | $UBOOT_DIR/out/r5/tiboot3.bin}} $UBOOT_DIR/out/a53/tispl.bin $UBOOT_DIR/out/a53/u-boot.img root@<ip address>:/mnt/
 
* Reboot the {{#var:HARDWARE_NAME}} and verify the R5 SPL, A53 SPL, and A53 U-Boot match the output of '''git rev-parse HEAD'''

Latest revision as of 13:32, 1 October 2024

Warning: This page is designed to be used with a 'release' URL parameter.

This page is using the default release am62-yocto-kirkstone-6.1.46_09.01.00.08-v1.0.
To view this page for a specific Variscite SoM and software release, please follow these steps:

  1. Visit variwiki.com
  2. Select your SoM
  3. Select the software release
Yocto Build U-Boot from source code

Introduction

This guide walks through the process for manually building and installing the U-Boot images from source. It is derived from TI's Build U-Boot guide

Installing required packages

Install the required packages documented in the Build Yocto from source code guide.

Building U-boot requires Python 3.10 or newer, which is shipped with Ubuntu 22.04.

In addition to Python 3.10, the following python3 modules are required for binman:

$ pip3 install jsonschema pyelftools

Fetch source code and install dependencies

This section describes the one time process to install the toolchains and fetch the necessary source code for building U-Boot.

Install Toolchains to home directory

$ cd ~
$ wget https://developer.arm.com/-/media/Files/downloads/gnu/11.3.rel1/binrel/arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-linux-gnueabihf.tar.xz && \
   tar -Jxvf arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-linux-gnueabihf.tar.xz -C $HOME && \
   wget https://developer.arm.com/-/media/Files/downloads/gnu/11.3.rel1/binrel/arm-gnu-toolchain-11.3.rel1-x86_64-aarch64-none-linux-gnu.tar.xz && \
   tar -Jxvf arm-gnu-toolchain-11.3.rel1-x86_64-aarch64-none-linux-gnu.tar.xz -C $HOME

Fetch Source Code

Setup a working directory

$ export WORKDIR=~/am62x-var-som-u-boot
$ mkdir $WORKDIR

Fetch the U-Boot source:

$ cd $WORKDIR
$ git clone https://github.com/varigit/ti-u-boot -b ti-u-boot-2023.04_var01 ti-u-boot

Fetch ti-linux-firmware:

$ cd $WORKDIR
$ git clone https://git.ti.com/git/processor-firmware/ti-linux-firmware -b ti-linux-firmware ti-linux-firmware
$ cd ti-linux-firmware && \
  git checkout 9ee2fedb1fb4815f54310dd872d34faf9948c7c1 && \
  cd ../

Fetch arm-trusted-firmware:

$ cd $WORKDIR
$ git clone https://git.trustedfirmware.org/TF-A/trusted-firmware-a -b master trusted-firmware-a
$ cd trusted-firmware-a && \
  git checkout d7a7135d32a8c7da004c0c19b75bd4e2813f9759 && \
  cd ../

Fetch optee-os:

$ cd $WORKDIR
$ git clone https://github.com/OP-TEE/optee_os -b master optee_os
$ cd optee_os && \
  git checkout 2a5b1d1232f582056184367fb58a425ac7478ec6 && \
  cd ../

Build U-Boot out of Yocto tree

After fetching the source code and installing dependencies, you may return to $WORKDIR anytime and follow these steps to build U-Boot:

Setup the environment

Export the working directory

$ export WORKDIR=~/am62x-var-som-u-boot

Export variables for building U-Boot

$ export PATH=$HOME/arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-linux-gnueabihf/bin:$PATH &&
  export PATH=$HOME/arm-gnu-toolchain-11.3.rel1-x86_64-aarch64-none-linux-gnu/bin:$PATH &&  
  export TI_LINUX_FW_DIR=$WORKDIR/ti-linux-firmware &&
  export UBOOT_DIR=$WORKDIR/ti-u-boot && 
  export TFA_DIR=$WORKDIR/trusted-firmware-a && 
  export OPTEE_DIR=$WORKDIR/optee_os

Build Images

ATF

$ cd $TFA_DIR
$ make -j$(nproc) ARCH=aarch64 CROSS_COMPILE=aarch64-none-linux-gnu- PLAT=k3 TARGET_BOARD=lite SPD=opteed

OP-TEE

$ cd $OPTEE_DIR
$ make -j$(nproc) CROSS_COMPILE64=aarch64-none-linux-gnu- CROSS_COMPILE32=arm-none-linux-gnueabihf- PLATFORM=k3-am62x CFG_ARM64_core=y

U-Boot R5 Images

Optional - Modify am62x_var_som_r5_defconfig:

$ cd $WORKDIR/ti-u-boot
$ make -j$(nproc) ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- am62x_var_som_r5_defconfig O=$UBOOT_DIR/out/r5
$ make -j$(nproc) ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- O=$UBOOT_DIR/out/r5 menuconfig
... make and save some changes ... 
$ make -j$(nproc) ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- O=$UBOOT_DIR/out/r5 savedefconfig
$ cp out/r5/defconfig configs/am62x_var_som_r5_defconfig

Build u-boot-spl.bin for tiboot3.bin. Saved in $UBOOT_DIR/out/r5:

$ cd $WORKDIR/ti-u-boot
$ make -j$(nproc) ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- am62x_var_som_r5_defconfig O=$UBOOT_DIR/out/r5
$ make -j$(nproc) ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- O=$UBOOT_DIR/out/r5 BINMAN_INDIRS=$TI_LINUX_FW_DIR


Note:

The AM62 SOC has multiple variants (GP, HS-FS, HS-SE). For more information, see: Device types Early Variscite VAR-SOM-AM62 samples were shipped with the GP variant.

U-Boot A53 Images

Optional - Modify am62x_var_som_a53_defconfig:

$ cd $WORKDIR/ti-u-boot
$ make -j$(nproc) ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- am62x_var_som_a53_defconfig O=$UBOOT_DIR/out/a53
$ make -j$(nproc) ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- O=$UBOOT_DIR/out/a53 menuconfig
 ... make and save some changes ... 
$ make -j$(nproc) ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- O=$UBOOT_DIR/out/a53 savedefconfig
$ cp out/a53/defconfig configs/am62x_var_som_a53_defconfig

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.

$ cd $WORKDIR/ti-u-boot
$ make -j$(nproc) ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- am62x_var_som_a53_defconfig O=$UBOOT_DIR/out/a53
$ make -j$(nproc) ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- \
     BL31=$TFA_DIR/build/k3/lite/release/bl31.bin \
     TEE=$OPTEE_DIR/out/arm-plat-k3/core/tee-pager_v2.bin \
     O=$UBOOT_DIR/out/a53 BINMAN_INDIRS=$TI_LINUX_FW_DIR

Update U-Boot on running system

To update U-Boot on an existing system, the following SPL and U-Boot images need to be installed to the boot partition of the boot media (eMMC or SD):

$UBOOT_DIR/out/r5/tiboot3.bin
$UBOOT_DIR/out/a53/tispl.bin
$UBOOT_DIR/out/a53/u-boot.img

After updating the boot media, boot U-Boot and verify the commit ids of the R5 SPL, A53 SPL, and A53 U-Boot match the output of git rev-parse HEAD. For example:

$ cd $UBOOT_DIR && git rev-parse HEAD
a526abbae21127ac1e79cfc74adb21db97759fdf

Verify this matches the versions printed by U-Boot:

U-Boot SPL 2023.04-ga526abbae2 (Mar 23 2023 - 22:04:15 +0000)    <--- R5
U-Boot SPL 2023.04-ga526abbae2 (Mar 23 2023 - 22:04:15 +0000)    <--- A53
U-Boot 2023.04-ga526abbae2 (Mar 24 2023 - 16:25:35 -0500)        <--- A53

Update U-Boot on an SD Card

To update U-Boot on an SD Card, copy the files to the sd card.

  • Mount the SD card boot partition on your host computer and verify the previous U-Boot files are installed:
$ mkdir ~/.sdcard
$ sudo mount /dev/sdX ~/.sdcard
$ ls ~/.sdcard
tiboot3.bin  tispl.bin  u-boot.img  uEnv.txt
  • Copy the new files and umount the SD card:
$ sudo cp $UBOOT_DIR/out/r5/tiboot3.bin $UBOOT_DIR/out/a53/tispl.bin $UBOOT_DIR/out/a53/u-boot.img ~/.sdcard
$ sudo umount ~/.sdcard && sync
  • Boot the SD card and verify the R5 SPL, A53 SPL, and A53 U-Boot match the output of git rev-parse HEAD

Update U-Boot using UMS

U-Boot can be updated by using the USB Mass Storage gadget to mount the eMMC or SD card on your host computer.

  • Connect the USB OTG port to host computer.
  • Start the VAR-SOM-AM62 and interrupt U-Boot
  • Start UMS on eMMC:
u-boot> ums 0 mmc 1
  • Or...start UMS on SD card:
u-boot> ums 0 mmc 2
  • Or...start UMS on the current boot device:
u-boot> ums 0 mmc $mmcdev
  • Mount the SD card boot partition and verify the previous U-Boot files are installed:
$ mkdir ~/.sdcard
$ sudo mount /dev/sdX ~/.sdcard
$ ls ~/.sdcard
tiboot3.bin  tispl.bin  u-boot.img  uEnv.txt
  • Copy the new files and umount the SD card:
$ sudo cp $UBOOT_DIR/out/r5/tiboot3.bin $UBOOT_DIR/out/a53/tispl.bin $UBOOT_DIR/out/a53/u-boot.img ~/.sdcard
$ sudo umount ~/.sdcard && sync
  • Boot the SD card and verify the R5 SPL, A53 SPL, and A53 U-Boot match the output of git rev-parse HEAD

Update U-Boot using Ethernet

U-Boot can be updated on a running system by using scp to transfer the files:

  • Mount the eMMC boot partition and verify the previous U-Boot files are installed:
# mount /dev/mmcblk0p1 /mnt/
# ls /mnt
tiboot3.bin  tispl.bin  u-boot.img  uEnv.txt
  • Transfer the new files:
$ scp $UBOOT_DIR/out/r5/tiboot3.bin $UBOOT_DIR/out/a53/tispl.bin $UBOOT_DIR/out/a53/u-boot.img root@<ip address>:/mnt/
  • Reboot the VAR-SOM-AM62 and verify the R5 SPL, A53 SPL, and A53 U-Boot match the output of git rev-parse HEAD