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.
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
Compile R5 Image
$ cd <UBOOT_DIR>/
$ export ARCH=arm
$ export CROSS_COMPILE=arm-none-linux-gnueabihf-
$ make <DEVICE>_evm_r5_defconfig O=build/r5
$ make O=build/r5
$ cd ../k3-image-gen-<version>/
$ ln ../prebuilt-images/<TI-SYSFW.bin> .
$ make SOC=<DEVICE> SBL=<UBOOT_DIR>/build/r5/spl/u-boot-spl.bin
where <DEVICE> is “am62x”, and <TI-SYSFW.bin> is “ti-fs-firmware-am62x-gp.bin” 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 <DEVICE>_evm_a53_defconfig O=build/arm64
$ make ATF=$(pwd)/../prebuilt-images/bl31.bin TEE=$(pwd)/../prebuilt-images/bl32.bin DM=$(pwd)/../prebuilt-images/ipc_echo_testb_mcu1_0_release_strip.xer5f O=build/arm64
where <DEVICE> is “am62x” for AM62x devices.
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.