Skip to main content
Version: BSP 7.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
7.0.0L6.6.23_2.0.0imx-seco-5.9.4.binimx-seco-5.9.4/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.9.4.bin
$ chmod u+x imx-seco-5.9.4.bin
$ ./imx-seco-5.9.4.bin
$ ls imx-seco-5.9.4/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
7.0.0L6.6.23_2.0.01.16.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-6.6.23-2.0.0
i.MX 8MM/8MPlf-6.6.23-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!