3.3. Build U-Boot¶
During Linux development, the U-Boot source code may need to be modified and recompiled. For example, U-Boot must be recompiled if:
Enabling features which are disabled in the U-Boot defconfig
Disabling features which are enabled in the U-Boot defconfig
Modifying U-Boot source code to port U-Boot to a custom board
This section explains how to rebuild the U-Boot source code provided in the Processor SDK Linux package on the Development Host.
There are two methods to build the U-Boot in the Processor SDK:
Using the SDK top level Makefile
Using the U-Boot top level Makefile
The first method wraps the build steps in the second method to a single command, which is convenient but has a down side that it reduces the customization capability which the second method has. Therefor, pick the method which fits the use case.
3.3.1. Build U-Boot Using the SDK Top Level Makefile¶
$ cd <SDK_INSTALL_DIR>/
$ make u-boot sysfw-image
Target Images
The steps above will generate the following U-Boot images.
- tiboot3.bin
Located under folder
<SDK_INSTALL_DIR>/board-support/k3-image-gen-<version>/
. This is the first stage of the boot loader running on R5F core.- tispl.bin
Located under folder
<SDK_INSTALL_DIR>/board-support/u-boot_build/a53/
. This is the first stage of the boot loader running on A53 core.- u-boot.img
Located under folder
<SDK_INSTALL_DIR>/board-support/u-boot_build/a53/
. This is the second stage of the boot loader running on A53 core.
Update U-Boot on SD Card
After the U-Boot images are generated, they can be copied to an SD card that has already been flashed with a bootable Linux image. The SD card has two partitions, boot and root. The U-Boot images should be copied to the boot partition. Insert the SD card into a card reader and plug the card reader into a Linux PC. Then, copy the U-Boot images to the card. Assuming that the SD card boot partition is mounted to /media/<username>/boot:
$ ls /media/<username>/boot tiboot3.bin tispl.bin uboot.env u-boot.img uEnv.txt wificfg $ cd <SDK_INSTALL_DIR>/board-support/ $ sudo cp k3-image-gen-<version>/tiboot3.bin /media/<username>/boot/ $ sudo cp u-boot_build/a53/tispl.bin /media/<username>/boot/ $ sudo cp u-boot_build/a53/u-boot.img /media/<username>/boot/ $ sudo umount /media/<username>/boot
Now insert the SD card into the EVM. The EVM should boot with the updated U-Boot.
3.3.2. Build U-Boot Using the U-Boot Top Level Makefile¶
Once the Processor SDK Linux package is installed, the U-Boot source code is
under <SDK_INSTALL_DIR>/board-support/u-boot-<version>/
(referred as UBOOT_DIR/
below). The compile instructions below also use some prebuilt binaries which
are provided in the Processor SDK Linux package under <SDK_INSTALL_DIR>/board-support/prebuilt-images/
.
As explained in the previous section Linux Boot Flow, there are multiple U-Boot images running on AM62x R5 and ARM64 cores. Therefore, both 32bit and 64bit ARM cross-compile toolchains are required to compile U-Boot. The toolchains are provided in the Processor SDK Linux package.
Note
It is strongly recommended to use the toolchain provided in Processor SDK Linux package that corresponds to the U-Boot release. Using different versions of the toolchains could cause unexpected behavior.
Set Toolchain Path
$ export PATH=$PATH:<SDK_INSTALL_DIR>/linux-devkit/sysroots/x86_64-arago-linux/usr/bin $ export TI_SECURE_DEV_PKG=<SDK_INSTALL_DIR>/board-support/core-secdev-k3
Compile R5 Image
$ cd <UBOOT_DIR>/ $ export ARCH=arm $ export CROSS_COMPILE=arm-none-linux-gnueabihf- $ make am62x_evm_r5_defconfig O=build/r5 $ make O=build/r5 $ cd ../k3-image-gen-<version>/ $ make SOC=<SOC> SOC_TYPE=<SOC_TYPE> SBL=<UBOOT_DIR>/build/r5/spl/u-boot-spl.bin SYSFW_DIR=../prebuilt-images
where <SOC> is am62x
and <SOC_TYPE> is gp
for AM62x devices.
Note
The directory in parameter O=build/r5
can be changed
to a different location.
Compile ARM64 Image
$ cd <UBOOT_DIR>/ $ export ARCH=arm $ export CROSS_COMPILE=aarch64-none-linux-gnu- $ make am62x_evm_a53_defconfig O=build/arm64
$ make ATF=../prebuilt-images/bl31.bin TEE=../prebuilt-images/bl32.bin DM=../prebuilt-images/ipc_echo_testb_mcu1_0_release_strip.xer5f O=build/arm64
Note
The directory in parameter O=build/arm64
can be
changed to a different location.
Target Images
The steps above will generate the following U-Boot images.
- tiboot3.bin
Located under folder
<SDK_INSTALL_DIR>/board-support/k3-image-gen-<version>/
. This is the first stage of the boot loader running on R5F core.- tispl.bin
Located under folder
<UBOOT_DIR>/build/arm64/
. This is the first stage of the boot loader running on A53 core.- u-boot.img
Located under folder
<UBOOT_DIR>/build/arm64/
. This is the second stage of the boot loader running on A53 core.
Update U-Boot on SD Card
After the U-Boot images are generated, they can be copied to an SD card that has already been flashed with a bootable Linux image. The SD card has two partitions, boot and root. The U-Boot images should be copied to the boot partition. Insert the SD card into a card reader and plug the card reader into a Linux PC. Then, copy the U-Boot images to the card. Assuming that the SD card boot partition is mounted to /media/<username>/boot:
$ ls /media/<username>/boot tiboot3.bin tispl.bin uboot.env u-boot.img uEnv.txt wificfg $ cd <UBOOT_DIR> $ sudo cp ../k3-image-gen-<version>/tiboot3.bin /media/<username>/boot/ $ sudo cp build/arm64/tispl.bin /media/<username>/boot/ $ sudo cp build/arm64/u-boot.img /media/<username>/boot/ $ sudo umount /media/<username>/boot
Now insert the SD card into the EVM. The EVM should boot with the updated U-Boot.