This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[FAQ] Buildroot Support for Sitara AM62x/AM62Ax/AM62Px/AM64x Devices

Part Number: AM6442
Other Parts Discussed in Thread: SK-AM62B, SK-AM64B, SK-AM62, AM625,

(also applicable to other AM62x, AM62Ax, AM62Px, AM64x parts with changes)

Introduction

Buildroot (https://buildroot.org/) is a simple, efficient, and easy-to-use tool for generating bootable images for Embedded Linux systems through cross-compilation. Due to this it is a popular alternative to the widely-used Yocto-based build system. Some key differentiators are that it is easy to configure most aspects of the target image including but not limited to adding, configuring, and removing packages all using a menu-based system and that the build system itself behind the scenes is Makefile-based and with this will be immediately familiar to many developers (as opposed to the complex scripting language and layered approach Yocto uses). All this is what makes Buildroot very approachable and suitable especially for embedded systems engineers moving from MCUs into the world of Linux-based MPUs.

ExclamationDisclaimer: As of May 2024 the officially recommended and TI-supported way of generating full-featured bootable Embedded Linux images for use on Sitara AM6x devices is using the Yocto-based Linux SDKs for the different AM6x devices available at https://www.ti.com/tool/PROCESSOR-SDK-AM62X and https://www.ti.com/tool/PROCESSOR-SDK-AM64X. The steps outlined here to enable AM6x on Buildroot are provided as-is.

Current State of Support for TI's AM6x Devices

Upstream Support

As of March 2024 support for TI's AM62x (via SK-AM62B EVM) and AM64x (via SK-AM64B EVM) devices is available in the upstream Buildroot tree at https://git.busybox.net/buildroot/. The associated defconfig files are setup to only use community trees for all firmware artifacts such as the Linux Kernel, U-Boot, ATF, and OP-TEE.

In order to build an SD card image to run on an SK-AM62B EVM, refer to the instructions provided here: https://git.busybox.net/buildroot/tree/board/ti/am62x-sk/readme.txt. Similarly, to build an SD card image for an SK-AM64B EVM, refer to the readme here: https://git.busybox.net/buildroot/tree/board/ti/am64x-sk/readme.txt.

Here's an overview about which configuration to use depending on the TI Starter Kit SKU and Device Variant that is used:

TI Starter Kit SKU Device Variant

BR2_TARGET_TI_K3_R5_LOADER_TIBOOT3_BIN
Customization Required

Buildroot defconfig
SK-AM62 AM625 GP Change to "tiboot3-am62x-gp-evm.bin" ti_am62x_sk_defconfig
SK-AM62B AM625 HS-FS Not needed ti_am62x_sk_defconfig
SK-AM64 AM6442 GP Change to "tiboot3-am64x-gp-evm.bin" ti_am64x_sk_defconfig
SK-AM64B AM6442 HS-FS Not needed ti_am64x_sk_defconfig

TI Yocto SDK v9.2 Baseline Equivalent

It is a common request wanting to use the source trees for the various firmwares that are used as part of the TI Processor SDK Linux rather than the upstream trees that Buildroot usually uses. To accommodate this, this E2E FAQ provides a patch that can be applied on top of the community Buildroot tree which adds new AM62x and AM64x defconfigs that are based on the existing defconfigs for those devices but customized to use the
following source trees as used in the recent TI SDK v9.2 releases for AM62x (link) and AM64x (link).

  • TI Kernel 6.1.80 (w/ TI config-pruning step applied)
  • TI U-Boot 2023.04
  • ATF 2.10 (public tree)
  • OPTEE 4.1 (public tree)
  • TIFS/DM/DMSC Device Firmwares 9.2

The patch provided here is partially based on a patch that was previously proposed on the Buildroot mailing list ("configs/am62x-sk: Add fragment for TI tree integration") but simplified for ease of use and extended to also encompass ATF and OPTEE firmwares while specifically targeting the sources used as part of the TI SDK v9.2 release.

Here's an overview about which configuration to use depending on the TI Starter Kit SKU and Device Variant that is used:

TI Starter Kit SKU Device Variant

BR2_TARGET_TI_K3_R5_LOADER_TIBOOT3_BIN
Customization Required

Buildroot defconfig
SK-AM62 AM625 GP Change to "tiboot3-am62x-gp-evm.bin" ti_am62x_sk_tisdk_defconfig
SK-AM62B AM625 HS-FS Not needed ti_am62x_sk_tisdk_defconfig
SK-AM64 AM6442 GP Change to "tiboot3-am64x-gp-evm.bin" ti_am64x_sk_tisdk_defconfig
SK-AM64B AM6442 HS-FS Not needed ti_am64x_sk_tisdk_defconfig

0001-configs-ti_am6-2-4-x_sk_tisdk-Add-TI-SDK-v9.2-equiva-7-May-2024.patch

Building Bootable SD Card Images for AM62x and AM64x

Setting up the Build Environment

As with most aspects of Buildroot setting up the build environment is pretty straightforward, and usually only involves cloning the official Buildroot Git repository to a Linux machine. This section uses the TI Yocto SDK Baseline Equivalent approach discussed earlier which requires applying one additional patch.

Also while Buildroot itself supports a wide range of host systems the steps outlined in this section were specifically tested using Ubuntu 22.04. Note that Buildroot expects a few basic packages to be present on the host system, many of which should already be preinstalled on a typical Ubuntu 22.04 system however. Usually installing the 'build-essential' and 'libncurses-dev' (for using the menuconfig interface) additional packages should be most/all that's needed. Refer to the official Buildroot documentation for additional details: https://buildroot.org/downloads/manual/manual.html#requirement

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Clone the Buildroot Git repository from the official sources
a0797059@dasso:~/tmp
$ git clone https://git.buildroot.net/buildroot
Cloning into 'buildroot'...
remote: Enumerating objects: 39138, done.
remote: Counting objects: 100% (39138/39138), done.
remote: Compressing objects: 100% (19298/19298), done.
remote: Total 540781 (delta 24543), reused 32185 (delta 19668), pack-reused 501643
Receiving objects: 100% (540781/540781), 118.74 MiB | 3.67 MiB/s, done.
Resolving deltas: 100% (377635/377635), done.
# Change into the Buildroot folder
a0797059@dasso:~/tmp
$ cd buildroot/
# Optional/Recommended: Establish a new branch with a the same baseline commit
# that was used to create the patch set that needs to be applied. Skipping this
# step may cause issues over time such as merge conflicts that may require
# manual resolution, as 'master' advances further due to ongoing upstream work.
a0797059@dasso:~/tmp/buildroot (master)
$ git checkout -b am6x-dev 9b25246e9b
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Building SD Card Images

After the basic build environment was setup there's nothing special really about using Buildroot and building images at this point, so all the steps outlined in the Buildroot quick start guide (https://buildroot.org/downloads/manual/manual.html#_buildroot_quick_start) apply as-is. Below log capture shows a typical session building an SD card image for the SK-AM62B board via ti_am62x_sk_tisdk_defconfig. The steps for the SK-AM64B board are the same except that the ti_am64x_sk_tisdk_defconfig will need to be used.

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Establish the Buildroot baseline configuration for building for the SK-AM62B board
a0797059@dasso:~/tmp/buildroot (am6x-dev)
$ make ti_am62x_sk_tisdk_defconfig
mkdir -p /home/a0797059/tmp/buildroot/output/build/buildroot-config/lxdialog
PKG_CONFIG_PATH="" make CC="/usr/bin/gcc" HOSTCC="/usr/bin/gcc" \
obj=/home/a0797059/tmp/buildroot/output/build/buildroot-config -C support/kconfig -f Makefile.br conf
/usr/bin/gcc -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -DCURSES_LOC="<ncurses.h>" -DNCURSES_WIDECHAR=1 -DLOCALE -I/home/a0797059/tmp/buildroot/output/build/buildroot-config -DCONFIG_=\"\" -MM *.c > /home/a0797059/
tmp/buildroot/output/build/buildroot-config/.depend 2>/dev/null || :
/usr/bin/gcc -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -DCURSES_LOC="<ncurses.h>" -DNCURSES_WIDECHAR=1 -DLOCALE -I/home/a0797059/tmp/buildroot/output/build/buildroot-config -DCONFIG_=\"\" -c conf.c -o /home/a0797
059/tmp/buildroot/output/build/buildroot-config/conf.o
/usr/bin/gcc -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -DCURSES_LOC="<ncurses.h>" -DNCURSES_WIDECHAR=1 -DLOCALE -I/home/a0797059/tmp/buildroot/output/build/buildroot-config -DCONFIG_=\"\" -I. -c /home/a0797059/tmp
/buildroot/output/build/buildroot-config/zconf.tab.c -o /home/a0797059/tmp/buildroot/output/build/buildroot-config/zconf.tab.o
/usr/bin/gcc -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -DCURSES_LOC="<ncurses.h>" -DNCURSES_WIDECHAR=1 -DLOCALE -I/home/a0797059/tmp/buildroot/output/build/buildroot-config -DCONFIG_=\"\" /home/a0797059/tmp/build
root/output/build/buildroot-config/conf.o /home/a0797059/tmp/buildroot/output/build/buildroot-config/zconf.tab.o -o /home/a0797059/tmp/buildroot/output/build/buildroot-config/conf
rm /home/a0797059/tmp/buildroot/output/build/buildroot-config/zconf.tab.c
#
# configuration written to /home/a0797059/tmp/buildroot/.config
#
# Optional: Inspect and modify the Buildroot configuration (add/configure/remove packages, etc.)
# It's recommended to configure BR2_CCACHE=y for faster builds
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Programming the SD Card Images

The generated SD card images are ready to be used to boot the SK-AM62B and SK-AM64B boards and can be written to an SD card using the 'dd' command as follows:

Fullscreen
1
2
3
4
5
6
7
8
9
# Copy image to SD card. Make sure you use the proper output device for your
# system, otherwise data loss may occur (use 'lsblk' to double-check)
a0797059@dasso:~/tmp/buildroot (am6x-dev)
$ sudo umount /dev/sdc?
a0797059@dasso:~/tmp/buildroot (am6x-dev)
$ sudo dd if=output/images/sdcard.img of=/dev/sdc bs=1M status=progress && sync
136+1 records in
136+1 records out
142606848 bytes (143 MB, 136 MiB) copied, 6.35363 s, 22.4 MB/s
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Testing the SD Card Image on the SK-AM62B Board

The resulting boot log should look as follows:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
U-Boot SPL 2023.04 (May 06 2024 - 07:08:46 -0500)
SYSFW ABI: 3.1 (firmware rev 0x0009 '9.2.7--v09.02.07 (Kool Koala)')
SPL initial stack usage: 13392 bytes
Trying to boot from MMC2
Authentication passed
Authentication passed
Authentication passed
Authentication passed
Authentication passed
Starting ATF on ARM64 core...
NOTICE: BL31: v2.10.0(release):00f1ec6b8740ccd403e641131e294aabacf2a48b
NOTICE: BL31: Built : 07:06:20, May 6 2024
I/TC:
I/TC: OP-TEE version: Unknown_4.1 (gcc version 12.3.0 (Buildroot 2024.02-601-g4066df4afd)) #1 Mon May 6 12:06:15 UTC 2024 aarch64
I/TC: WARNING: This OP-TEE configuration might be insecure!
I/TC: WARNING: Please check https://optee.readthedocs.io/en/latest/architecture/porting_guidelines.html
I/TC: Primary CPU initializing
I/TC: GIC redistributor base address not provided
I/TC: Assuming default GIC group status and modifier
I/TC: SYSFW ABI: 3.1 (firmware rev 0x0009 '9.2.7--v09.02.07 (Kool Koala)')
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Testing the SD Card Image on the SK-AM64B Board

The resulting boot log should look as follows:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
U-Boot SPL 2023.04 (May 06 2024 - 07:49:15 -0500)
EEPROM not available at 0x50, trying to read at 0x51
SYSFW ABI: 3.1 (firmware rev 0x0009 '9.2.7--v09.02.07 (Kool Koala)')
SPL initial stack usage: 13392 bytes
Trying to boot from MMC2
Authentication passed
Authentication passed
Loading Environment from MMC... MMC Device 0 not found
*** Warning - No MMC card found, using default environment
Authentication passed
Authentication passed
Starting ATF on ARM64 core...
NOTICE: BL31: v2.10.0(release):00f1ec6b8740ccd403e641131e294aabacf2a48b
NOTICE: BL31: Built : 07:46:46, May 6 2024
I/TC:
I/TC: OP-TEE version: Unknown_4.1 (gcc version 12.3.0 (Buildroot 2024.02-602-g554c1050b8)) #1 Mon May 6 12:46:41 UTC 2024 aarch64
I/TC: WARNING: This OP-TEE configuration might be insecure!
I/TC: WARNING: Please check https://optee.readthedocs.io/en/latest/architecture/porting_guidelines.html
I/TC: Primary CPU initializing
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Future Work / Roadmap

We are currently exploring how to start providing official Buildroot-based releases that are in sync with our regular TI Yocto SDK-based releases, targeting the same level of device feature support and software quality, potentially intersecting with our next major SDK release stream. Until this is available, this E2E FAQ here serves as a go-to page to enable a basic TI Yocto SDK Baseline Equivalent solution for selected TI Yocto SDK releases and device variants. In parallel, several members of the TI Platform Software Team continue to engage with the Buildroot community to help moving the upstream project forward.