Yocto Build U-Boot TI: Difference between revisions
(Use environment variable for working directory.) |
|||
Line 3: | Line 3: | ||
--> {{#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__ | ||
Line 17: | Line 18: | ||
Setup a working directory | Setup a working directory | ||
$ export WORKDIR={{#var:WORKDIR}} | |||
$ mkdir {{#var:WORKDIR}} | $ mkdir {{#var:WORKDIR}} | ||
Fetch the U-Boot source: | Fetch the U-Boot source: | ||
{{GIT_FETCH|NAME=U-BOOT|WORKDIR={{#var: | {{GIT_FETCH|NAME=U-BOOT|WORKDIR={{#var:WORKDIR_ENV}}}} | ||
Fetch the core-secdev-k3 Security Dev Tool: | Fetch the core-secdev-k3 Security Dev Tool: | ||
{{GIT_FETCH|NAME=CORE_SECDEV_K3|WORKDIR={{#var: | {{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: | {{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: | {{GIT_FETCH|NAME=TI_LINUX_FIRMWARE|WORKDIR={{#var:WORKDIR_ENV}}|USE_COMMIT=y}} | ||
Fetch arm-trusted-firmware: | Fetch arm-trusted-firmware: | ||
{{GIT_FETCH|NAME=ATF|WORKDIR={{#var: | {{GIT_FETCH|NAME=ATF|WORKDIR={{#var:WORKDIR_ENV}}|USE_COMMIT=y}} | ||
Fetch optee-os: | Fetch optee-os: | ||
{{GIT_FETCH|NAME=OPTEE|WORKDIR={{#var: | {{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: | 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: == | == 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:armv7_toolchain}}/bin:$PATH && \ | ||
export PATH=$HOME/{{#var:armv8_toolchain}}/bin:$PATH && \ | export PATH=$HOME/{{#var:armv8_toolchain}}/bin:$PATH && \ | ||
export export TI_SECURE_DEV_PKG={{#var: | export export TI_SECURE_DEV_PKG={{#var:WORKDIR_ENV}}/{{#var:CORE_SECDEV_K3_REPO}} && \ | ||
export UBOOT_DIR={{#var: | export UBOOT_DIR={{#var:WORKDIR_ENV}}/{{#var:U-BOOT_REPO}} && \ | ||
export K3IG_DIR={{#var: | export K3IG_DIR={{#var:WORKDIR_ENV}}/{{#var:K3_IMAGE_GEN_REPO}} && \ | ||
export SYSFW_DIR={{#var: | export SYSFW_DIR={{#var:WORKDIR_ENV}}/{{#var:TI_LINUX_FIRMWARE_REPO}}/ti-sysfw && \ | ||
export DMFW_DIR={{#var: | export DMFW_DIR={{#var:WORKDIR_ENV}}/{{#var:TI_LINUX_FIRMWARE_REPO}}/ti-dm/am62xx && \ | ||
export TFA_DIR={{#var: | export TFA_DIR={{#var:WORKDIR_ENV}}/{{#var:ATF_REPO}} && \ | ||
export OPTEE_DIR={{#var: | export OPTEE_DIR={{#var:WORKDIR_ENV}}/{{#var:OPTEE_REPO}} | ||
== Build for GP {{#var:SOC}} SoC: == | == Build for GP {{#var:SOC}} SoC: == | ||
Line 71: | Line 79: | ||
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: | $ 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- {{#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 | $ make -j$(nproc) ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- O=$UBOOT_DIR/out/r5 | ||
Line 82: | Line 90: | ||
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. | ||
$ cd {{#var: | $ 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- {{#var:U-BOOT_A53_DEFCONFIG}} O=$UBOOT_DIR/out/a53 | ||
$ make -j$(nproc) 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- 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 |
Revision as of 16:15, 27 March 2023
This page is using the default release am62-yocto-dunfell-5.10.140_08.06.00.42-v1.0.
To view this page for a specific Variscite SoM and software release, please follow these steps:
- Visit variwiki.com
- Select your SoM
- Select the software release
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
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 && \ tar -Jxvf -C $HOME && \ wget && \ tar -Jxvf -C $HOME
Fetch Source Code
Setup a working directory
$ export WORKDIR=~/-u-boot $ mkdir ~/-u-boot
Fetch the U-Boot source:
$ cd $WORKDIR $ git clone -b
Fetch the core-secdev-k3 Security Dev Tool:
$ cd $WORKDIR $ git clone -b $ cd && \ git checkout && \ cd ../
Fetch ti-k3-image-gen:
$ cd $WORKDIR $ git clone -b $ cd && \ git checkout && \ cd ../
Fetch ti-linux-firmware:
$ cd $WORKDIR $ git clone -b $ cd && \ git checkout && \ cd ../
Fetch arm-trusted-firmware:
$ cd $WORKDIR $ git clone -b $ cd && \ git checkout && \ cd ../
Fetch optee-os:
$ cd $WORKDIR $ git clone -b $ cd && \ git checkout && \ 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=~/-u-boot
Export variables for building U-Boot
$ export PATH=$HOME//bin:$PATH && \ export PATH=$HOME//bin:$PATH && \ export export TI_SECURE_DEV_PKG=$WORKDIR/ && \ export UBOOT_DIR=$WORKDIR/ && \ export K3IG_DIR=$WORKDIR/ && \ export SYSFW_DIR=$WORKDIR//ti-sysfw && \ export DMFW_DIR=$WORKDIR//ti-dm/am62xx && \ export TFA_DIR=$WORKDIR/ && \ export OPTEE_DIR=$WORKDIR/
Build for GP SoC:
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
R5 Images
Build u-boot-spl.bin for tiboot3.bin. Saved in $UBOOT_DIR/out/r5:
$ cd $WORKDIR/ $ make -j$(nproc) 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
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 -j$(nproc) 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 Images
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/ $ make -j$(nproc) ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- O=$UBOOT_DIR/out/a53 $ make -j$(nproc) 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
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):
$K3IG_DIR/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 aa251b91f7ff0d346db034ed6513fdaec3526871
Verify this matches the versions printed by U-Boot:
U-Boot SPL 2021.01-gaa251b91f7 (Mar 23 2023 - 22:04:15 +0000) <--- R5 U-Boot SPL 2021.01-gaa251b91f7 (Mar 23 2023 - 22:04:15 +0000) <--- A53 U-Boot 2021.01-gaa251b91f7 (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 $K3IG_DIR/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 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
- 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 $K3IG_DIR/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 $K3IG_DIR/tiboot3.bin $UBOOT_DIR/out/a53/tispl.bin $UBOOT_DIR/out/a53/u-boot.img root@<ip address>:/mnt/
- Reboot the and verify the R5 SPL, A53 SPL, and A53 U-Boot match the output of git rev-parse HEAD