Skip to main content
Version: BSP 6.x.y

Specifics: Build U-Boot for NXP i.MX 8/8X-based SoMs

Introductionโ€‹

This article describes additional specific steps about the compilation and the configuration of the boot container of the Toradex NXP i.MX 8/8X-based System on Modules.

Prerequisitesโ€‹

Before continuing with this article, one must follow the steps in the article Build U-Boot From Source Code.

Build U-Boot: SoC-specific Stepsโ€‹

The NXP i.MX 8QuadMax / i.MX 8QuadXPlus boots using a Cortex-M4 boot CPU called System Controller Unit (SCU). The SCU firmware (SCFW) is in large part provided by NXP, but Toradex has slightly altered it for the Apalis iMX8/Apalis iMX8X and Colibri iMX8X. The firmware also loads an intermediate firmware running on the Cortex-A class CPUs: The ARM trusted firmware (ATF). The ARM trusted firmware then hands over control to U-Boot, which then can boot Linux.

To learn more about SCFW, see the Build Custom i.MX 8/8X System Controller Firmware (SCFW) article.

The DDR memory timings, the SCU firmware, the ATF and U-Boot, and any potential Cortex-M4 auxiliary firmware are all stored in a single boot container. This boot container is read by the boot ROM from the boot device, starting at a specific offset (33kB for V1.0A modules booting from SD cards).

Obtaining the Security Controller (SECO) Firmwareโ€‹

BSP VersionNXP BSP VersionNXP Firmware File NameNXP Firmware Path
6.0.0L5.15.32_2.0.0imx-seco-3.8.6.binimx-seco-3.8.6/firmware/seco/<SoC>-ahab-container.img
6.1.0L5.15.52_2.1.0imx-seco_5.8.7.1.binimx-seco-5.8.7.1/firmware/seco/<SoC>-ahab-container.img

Replace <SoC> for one of the following:

  • Apalis iMX8: mx8qmb0
  • Colibri iMX8X V1.0B and earlier: mx8qxb0
  • Colibri iMX8X V1.0C and later: mx8qxc0

You can use wget for download, and extract the firmware. For example:

$ cd ~/workdir
$ wget -c https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/imx-seco-5.8.7.bin
$ chmod u+x imx-seco-5.8.7.bin
$ ./imx-seco-5.8.7.bin
$ ls imx-seco-5.8.7/firmware/seco/

NXP provides the SECO firmware in binary form. You will need to accept the NXP End-User License Agreement (EULA) as part of the unpacking process.

Build the SCU Firmware (SCFW)โ€‹

Toradex customers rarely need to rebuild SCFW. Therefore, in the following instructions, we will show how you can download the SCFW firmware. If you, for any reason, need to customize SCFW, see the Build Custom i.MX 8/8X System Controller Firmware (SCFW) article.

The SCU firmwares for Apalis iMX8/Apalis iMX8X and Colibri iMX8X are available in our i.MX-System-Controller-Firmware GitHub repository.

BSP VersionNXP BSP VersionSCFW Version
6.0.0L5.15.32_2.0.01.14.0
6.1.0L5.15.52_2.1.01.14.0

You can use clone the SFCW repository from Toradex Github:

$ mkdir -p ~/workdir/scfw-bin && cd ~/workdir/scfw-bin
$ git clone https://github.com/toradex/i.MX-System-Controller-Firmware.git
$ mv ./i.MX-System-Controller-Firmware/src/scfw_export_<mx8qm-or-mx8qx>_b0/build_<mx8qm-or-mx8qx>_b0/mx8qm-apalis-scfw-tcm.bin ./scfw_tcm.bin

If you need, you can use wget to download an specific version. For example:

$ wget https://github.com/toradex/i.MX-System-Controller-Firmware/raw/d8d7320aec228cd73c4512a92d55c900786873e0/src/scfw_export_mx8qx_b0/build_mx8qx_b0/mx8qx-colibri-scfw-tcm.bin -O scfw-tcm.bin

The file scfw_tcm.bin is necessary for the final container.

Build the ARM trusted firmware (ATF/TF-A)โ€‹

For the i.MX 8/8X and i.MX 8MM/8MP based modules, the ATF/TF-A Branch is lf_v2.6 and the binary is always the following form:

  • build/<Platform>/release/bl31.bin

Replace <Platform> by the one of the platforms indicated below.

  • Apalis iMX8: imx8qm
  • Colibri iMX8X: imx8qx
  • Verdin iMX8M Mini: imx8mm
  • Verdin iMX8M Plus: imx8mp

On top of it, OpenEmbedded applies two patches, necessary for the system to behave as expected:

The patches can be found at: files ยป imx-atf ยป recipes-bsp - meta-toradex-nxp.git and you can apply them manually using git am or git apply.

ATF / TF-A can be obtained from NXP git servers:

$ cd ~/workdir
$ git clone https://github.com/nxp-imx/imx-atf.git -b lf_v2.6

Currently, there are no changes necessary for ARM Trusted Firmware. To be able to build the ATF firmware, first you'll need to download and setup the GNU Toolchain for Hard Float Calling Convention. When the toolchain is installed and you have the CROSS_COMPILE, ARCH and PATH correctly pointing to it, you can proceed to build the firmware directly:

$ cd imx-atf
$ make PLAT=<Platform> bl31

The resulting binary file bl31.bin created in build/<Platform>/release/ is necessary for the final container.

Assemble the Boot Containerโ€‹

Finally, to assembly the boot container, you need to obtain the imx-mkimage utility.

SoCBranch
i.MX 8/8xlf-5.15.32_2.0.0
i.MX 8MM/8MPlf-5.15.32_2.0.0

Git clone it from the repository:

$ cd ~/workdir
$ git clone -b <Branch> https://github.com/nxp-imx/imx-mkimage.git

Replace <Branch> by the Branch for your specific configuration as indicated in the above table.

The binary u-boot.bin is necessary for the final boot container. Make sure you followed the previous instructions on how to build U-Boot.

Copy all the binaries to the corresponding SoC directory inside imx-mkimage. For Apalis iMX8QM, for example

$ cd ~/workdir/imx-mkimage
$ cp ~/workdir/scfw-bin/scfw_tcm.bin iMX8QM
$ cp ~/workdir/imx-atf/build/imx8qm/release/bl31.bin iMX8QM
$ cp ~/workdir/u-boot-toradex/u-boot.bin iMX8QM
$ cp ~/workdir/imx-seco-3.7.4/firmware/seco/<SECO Firmware File> iMX8QM

Finally, use make to build the boot container. For Apalis iMX8QM:

$ make SOC=iMX8QM flash_b0
$ ls iMX8QM/flash.bin

And for Colibri iMX8QX:

$ make REV=C0 SOC=iMX8QX flash
$ ls iMX8QX/flash.bin

Replace <SECO Firmware File> by the SECO Firmware File for your specific configuration as indicated before and rename the file flash.bin to imx-boot so it will be suitable for a Toradex Easy Installer Image. Make sure to remove REV=C0 if you are building for B0 or older silicon versions.

$ mv iMX8<QM-or-QX>/flash.bin iMX8<QM-or-QX>/imx-boot

Deploy the U-Boot binary to an Imageโ€‹

Now that the adjustments were made, return to the Build U-Boot From Source Code article to deploy the U-Boot binary to an image.



Send Feedback!