Build U-Boot#
This module explains how to compile 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.
Build U-Boot Using the SDK Top Level Makefile#
$ cd <SDK_INSTALL_DIR>/
$ make u-boot
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 AM62Ax 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
$ source <SDK_INSTALL_DIR>/Rules.make
Compile R5 Image
$ cd <UBOOT_DIR>/ $ export ARCH=arm $ make CROSS_COMPILE=$CROSS_COMPILE_ARMV7 am62ax_evm_r5_defconfig O=build/r5 $ make -j8 CROSS_COMPILE=$CROSS_COMPILE_ARMV7 BINMAN_INDIRS=$(pwd)../prebuilt-images O=build/r5
Note
The directory in parameter O=build/r5
can be changed
to a different location.
Compile ARM64 Image
$ cd <UBOOT_DIR>/ $ export ARCH=arm $ make am62ax_evm_a53_defconfig O=build/a53 $ make -j8 BINMAN_INDIRS=$(pwd)/../prebuilt-images BL31=../prebuilt-images/bl31.bin TEE=../prebuilt-images/bl32.bin O=build/a53
Note
The directory in parameter O=build/a53
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/u-boot-<version>/build/r5
. 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-<version>/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-<version>/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/u-boot-<version> $ sudo cp r5/tiboot3.bin /media/<username>/boot/ $ sudo cp a53/tispl.bin /media/<username>/boot/ $ sudo cp 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.