Note: What's described on this page is automated as part of Build Apalis iMX8/Colibri iMX8X OpenEmbedded/Yocto Project Bring-up Image. This page is useful for U-Boot or Linux kernel development where one wants to avoid the much longer development cycle times if one uses an OpenEmbedded setup for this.
The NXP i.MX 8QuadMax / i.MX 8QuadXPlus SoC boot process is a bit more involved than the typical SoC used by Toradex. This article describes how to build the boot container (including required integration of firmware and boot loader) and Linux manually.
The NXP i.MX 8QuadMax / i.MX 8QuadXPlus boots using a Cortex-M4 boot CPU called System Controller Unit (SCU). The SCU firmware is to a large part provided by NXP, but has been slightly altered by Toradex for the Apalis iMX8QM/Colibri iMX8QXP. 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 is able to boot Linux.
The DDR memory timings, the SCU firmware, the ATF and U-Boot as well as 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 offset 33kB.
The Linaro cross-toolchain for AArch64 is required to build the Bootloaders/Linux from scratch. The toolchain can be found at linaro.org/downloads/. The latest aarch64-linux-gnu toolchain should work fine. At Toradex we tested the 2017.11 release which comes with GCC 7.2.1.
Make sure you extract the toolchain and setup the environment accordingly:
cd ~/tar xJf gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu.tar.xz
export ARCH=arm64export PATH=~/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu/bin/:$PATHexport CROSS_COMPILE=aarch64-linux-gnu-
Currently the SCU Firmware for Apalis iMX8QM and Colibri iMX8QXP is stored in the Bring-up BSP layer.
E.g. use wget for download:
wget https://github.com/toradex/meta-fsl-bsp-release/raw/toradex_morty-4.9.51-8qm_beta2-bring_up/imx/meta-bsp/recipes-bsp/imx-sc-firmware/files/apalis-imx8-scfw-tcm.binwget https://github.com/toradex/meta-fsl-bsp-release/raw/toradex_rocko-4.9.123-2.3.0_8mm_ga_bringup/imx/meta-bsp/recipes-bsp/imx-sc-firmware/files/colibri-imx8qxp-scfw-tcm.bin
The relevant file renamed to scfw_tcm.bin will be used in the final container.
Currently, there are no changes necessary for ARM Trusted Firmware. Hence ATF can be built directly from sources provided by NXP:
git clone https://source.codeaurora.org/external/imx/imx-atfcd imx-atfgit checkout <atf-branch>
Build the firmware:
make PLAT=<platform> bl31
The resulting binary file bl31.bin created in
<platform>/release/ will be used in the final container.
|Module||U-Boot Git Branch||U-Boot Configuration|
Toradex uses a customized version of the U-Boot boot loader provided by the NXP BSP. It can be found on our git server in the u-boot-toradex repository.
git clone https://git.toradex.com/u-boot-toradex.gitcd u-boot-toradexgit checkout <U-Boot Git Branch>
make <U-Boot Configuration>make -j 4
u-boot.bin will be used in the final container.
The utility imx-mkimage allows building the boot container. It needs small modifications which are available as patches from the Bring-up BSP layer.
Copy all three binaries SCU Firmware, ARM Trusted Firmware and U-Boot into a SoC-specific directory, iMX8QM for Apalis iMX8QM, iMX8QX for Colibri iMX8QXP. Rename the SCU Firmware to scfw_tcm.bin while copying. Then use make to build the boot container and dd to write the boot container onto the boot device.
|Module||Kernel Git Branch||Kernel Configuration||Device Tree||Kernel Binary|
git clone https://git.toradex.com/linux-toradex.gitcd linux-toradexgit checkout <Kernel Git Branch>
make defconfigmake -j 4
By default, the U-Boot boot scripts try to load the Linux kernel and device tree from the first FAT partition of the SD card. Check Build U-Boot and Linux Kernel from Source Code on how to deploy kernel modules.