Specifics: Build U-Boot for NXP i.MX 8M Mini/Plus-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 8M Mini/Plus-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β
Some SoCs will require additional steps to build the components necessary for the boot. Check on the tabs below each step that refer to your specific SoC. If you are targetting a different SoC, you can skip this session.
The NXP i.MX 8M Mini/8M Plus requires a boot container. The boot container is built with the Yocto recipe imx-boot
. Nevertheless, if you want to build it manually, this section provides information on how to do it.
Get and Build the ARM Trusted Firmware (Trusted Firmware A)β
Download the ARM Trusted Firmware (ATF).
$ git clone https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git
$ cd trusted-firmware-aBuild the ATF. Make sure the environment variables are defined as in step 3 of Prepare the Environment for Cross Compilation in the Build U-Boot From Source Code article.
$ export CROSS_COMPILE=aarch64-none-linux-gnu-
$ make PLAT=imx8mm IMX_BOOT_UART_BASE=0x30860000 bl31
$ cp build/imx8mm/release/bl31.bin ../$ export CROSS_COMPILE=aarch64-none-linux-gnu-
$ make PLAT=imx8mp IMX_BOOT_UART_BASE=0x30880000 bl31
$ cp build/imx8mp/release/bl31.bin ../
Get the DDR Firmwareβ
$ cd ../
$ wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-8.10.1.bin
$ chmod +x firmware-imx-8.10.1.bin
$ ./firmware-imx-8.10.1.bin
$ cp firmware-imx-8.10.1/firmware/ddr/synopsys/lpddr4*.bin ./
$ cd ../
$ wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-8.10.1.bin
$ chmod +x firmware-imx-8.10.1.bin
$ ./firmware-imx-8.10.1.bin
$ cp firmware-imx-8.10.1/firmware/ddr/synopsys/lpddr4*_202006.bin ./
Assemble the Boot Containerβ
Finally, to assemble the boot container, you need to obtain the imx-mkimage
utility.
Clone it from the NXP repository:
$ git clone -b lf-6.6.23-2.0.0 https://github.com/nxp-imx/imx-mkimage.git
The binary
u-boot.bin
is necessary for the final boot container. Make sure you followed the previous instructions in the Build U-Boot From Source Code article.The binary i.MX 8M Mini/8M Plus SoC boot container aggregates:
- DDR training firmware (
lpddr4_pmu_train*
) - TF-A firmware (
bl31.bin
) - U-Boot SPL (
spl/u-boot-spl.bin
) - U-Boot proper (
u-boot-nodtb.bin
) - U-Boot device tree:
- for Verdin iMX8M Mini: (
arch/arm/dts/imx8mm-verdin.dtb
renamed tofsl-imx8mm-evk.dtb
) - for Verdin iMX8M Plus: (
arch/arm/dts/imx8mp-verdin.dtb
renamed tofsl-imx8mp-evk.dtb
) mkimage
executable (tools/mkimage
renamed tomkimage_uboot
)
- DDR training firmware (
Copy them to the
iMX8M
SoC directory insideimx-mkimage
. For example, for Verdin iMX8MM:$ cd ./imx-mkimage/
$ cp ../firmware-imx-*/firmware/ddr/synopsys/lpddr4_pmu_train_1d_dmem_202006.bin iMX8M
$ cp ../firmware-imx-*/firmware/ddr/synopsys/lpddr4_pmu_train_2d_dmem_202006.bin iMX8M
$ cp ../firmware-imx-*/firmware/ddr/synopsys/lpddr4_pmu_train_1d_imem_202006.bin iMX8M
$ cp ../firmware-imx-*/firmware/ddr/synopsys/lpddr4_pmu_train_2d_imem_202006.bin iMX8M
$ cp ../trusted-firmware-a/build/imx8mm/release/bl31.bin iMX8M
$ cp ../workdir/u-boot-toradex/spl/u-boot-spl.bin iMX8M
$ cp ../workdir/u-boot-toradex/u-boot-nodtb.bin iMX8M
$ cp ../workdir/u-boot-toradex/arch/arm/dts/imx8mm-verdin.dtb iMX8M/fsl-imx8mm-evk.dtb
$ cp ../workdir/u-boot-toradex/tools/mkimage iMX8M/mkimage_uboot$ cd ./imx-mkimage/
$ cp ../firmware-imx-*/firmware/ddr/synopsys/lpddr4_pmu_train_1d_dmem_202006.bin iMX8M
$ cp ../firmware-imx-*/firmware/ddr/synopsys/lpddr4_pmu_train_2d_dmem_202006.bin iMX8M
$ cp ../firmware-imx-*/firmware/ddr/synopsys/lpddr4_pmu_train_1d_imem_202006.bin iMX8M
$ cp ../firmware-imx-*/firmware/ddr/synopsys/lpddr4_pmu_train_2d_imem_202006.bin iMX8M
$ cp ../trusted-firmware-a/build/imx8mp/release/bl31.bin iMX8M
$ cp ../workdir/u-boot-toradex/spl/u-boot-spl.bin iMX8M
$ cp ../workdir/u-boot-toradex/u-boot-nodtb.bin iMX8M
$ cp ../workdir/u-boot-toradex/arch/arm/dts/imx8mp-verdin.dtb iMX8M/fsl-imx8mp-evk.dtb
$ cp ../workdir/u-boot-toradex/tools/mkimage iMX8M/mkimage_ubootUse
make
to build the boot container:$ make clean; make SOC=iMX8MM flash_evk_emmc_fastboot
$ ls iMX8M/flash.bin$ make clean; make SOC=iMX8MP DCD_BOARD=imx8mp_evk flash_evk_emmc_fastboot
$ ls iMX8M/flash.binRename the file
flash.bin
toimx-boot
so it will be suitable for a Toradex Easy Installer Image.$ mv iMX8M/flash.bin iMX8M/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.