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:
sudo apt update
sudo apt install -y python3-cryptography python3-jsonschema python3-pyelftools python3-yaml swig yamllint
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
Fetch the U-Boot source:
cd $WORKDIR
git clone https://github.com/varigit/ti-u-boot -b ti-u-boot-2025.01_11.00.09.04_var01 ti-u-boot
Fetch ti-linux-firmware:
cd $WORKDIR
git clone https://git.ti.com/git/processor-firmware/ti-linux-firmware -b master ti-linux-firmware
cd ti-linux-firmware && \
git checkout 27003b6bff61a55dd1fff2cc777e5e07b092b1f7 && \
cd ../
Fetch arm-trusted-firmware:
cd $WORKDIR
git clone https://github.com/TexasInstruments/arm-trusted-firmware -b master arm-trusted-firmware
cd arm-trusted-firmware && \
git checkout b11beb2b6bd30b75c4bfb0e9925c0e72f16ca53f && \
cd ../
Fetch optee-os:
cd $WORKDIR
git clone https://github.com/OP-TEE/optee_os -b master optee_os
cd optee_os && \
git checkout ef1ebdc23034a804a72da2207f1a825ce96a1464 && \
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 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/arm-trusted-firmware &&
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 CFG_TEE_CORE_LOG_LEVEL=1
U-Boot R5 Images
Optional - Modify am62px_var_som_r5_defconfig:
cd $WORKDIR/ti-u-boot
make -j$(nproc) ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- am62px_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/am62px_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- am62px_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 AM62P SOC has multiple variants (HS-FS, HS-SE). For more information, see: Device types
U-Boot A53 Images
Optional - Modify am62px_var_som_a53_defconfig:
cd $WORKDIR/ti-u-boot
make -j$(nproc) ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- am62px_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/am62px_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- am62px_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):
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:
Verify this matches the versions printed by U-Boot:
U-Boot SPL 2025.01-g127cc39315ad (Feb 11 2026 - 15:45:29 +0000) <--- R5
U-Boot SPL 2025.01-g127cc39315ad (Feb 11 2026 - 15:45:29 +0000) <--- A53
U-Boot 2025.01-g127cc39315ad (Feb 11 2026 - 15:45:29 +0000) <--- 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-AM62P and interrupt U-Boot
- Start UMS on eMMC:
- Or...start UMS on SD card:
- Or...start UMS on the current boot device:
- 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:
- 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-AM62P and verify the R5 SPL, A53 SPL, and A53 U-Boot match the output of git rev-parse HEAD