Specifics: Build U-Boot for NXP i.MX 6/6ULL/7-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 6ULL/7-based System on Modules with NAND. It also brings information on how to proceed with the Toradex NXP i.MX6/6ULL/7-based System on Modules with eMMC.
Prerequisitesβ
Before continuing with this article, one must follow the steps in the article Build U-Boot From Source Code.
i.MX6/6ULL/7-based Modules with eMMCβ
In case of using a Colibri iMX6, Colibri iMX6ULL eMMC version, or Colibri iMX7 eMMC version, please, go to the Deploy the U-Boot binary to an Image section in the Build U-Boot From Source Code article. If you do not know which Toradex NXP i.MX 6ULL/7-based System on Module you are using, please, find the information in the Memory field of the Colibri iMX6ULL product page or the Colibri iMX7 product page.
i.MX6ULL/7-based Modules with NANDβ
The following procedures are only necessary when using the NAND version of Colibri iMX6ULL or Colibri iMX7.
Build U-Boot: SoC-specific Stepsβ
After the build succeeds, you will obtain a final u-boot-dtb.imx
IMX specific image, ready for flashing (however, check the next section for additional adjustments).
The final IMX program image includes (section 6.6.7
from IMX7DRM):
- Image Vector Table (IVT) for BootROM.
- Boot data - indicates the program image location, program image size in bytes, and the plugin flag.
- Device configuration data.
- User image: U-Boot image (
u-boot-dtb.bin
).
IMX Image Adjustments prior to Flashingβ
U-Boot for Colibri iMX7 NAND version is built with HABv4 support (AN4581.pdf) enabled by default, which requires to generate a proper Command Sequence File (CSF) by
srktool
from NXP (not included in the U-Boot tree) and to concatenate it to the finalu-boot-dtb.imx
. In case there is no need to generate a proper CSF, it is still necessary to pad the IMX image so it has the same size as specified in the Boot Data section of the IMX image. To obtain this size value, run:$ od -X -N 0x30 u-boot-dtb.imx
The output should be similar to the following:
0000000 402000d1 87800000 00000000 877ff42c
0000020 877ff420 **877ff400** 878b3000 00000000
0000040 **877ff000** **000b6060** 00000000 40b401d2
0000060Where, in this:
877ff400
is the IVT self address.877ff000
is the program image address.000b6060
is the program image size.
Pad the image:
2.1 To calculate the padding, use your output values following the example of this case:
- IVT offset =
0x877ff400
-0x877ff000
=0x400
- Padding =
0xb6060
-0x400
=0xb5c60
2.2 Then, pad the image:
$ objcopy -I binary -O binary --pad-to 0xb5c60 --gap-fill=0x00 u-boot-dtb.imx u-boot-dtb.imx.zero-padded
- IVT offset =
Also, according to the requirement from
6.6.7.1
, the final image should have a0x400
offset for the initial IVT table. For the eMMC setup, we handle this by flashing it to0x400
. However, for the NAND setup, we adjust the image prior to flashing, adding padding at the beginning of the image.$ dd bs=1024 count=1 if=/dev/zero | cat - u-boot-dtb.imx.zero-padded > u-boot-dtb.imx
Changing the final U-Boot specific image name is possible by replacing
u-boot-dtb.imx
in the command line above with another name of your preference, such asu-boot-dtb.imx.ready
. In any case, on step 3 of Deploy the U-Boot binary to an Image, you will have to changeu-boot-nand.imx
to the name of the final U-Boot specific image in theimage.json
file. For this, pressCTRL+F
, search foru-boot-nand.imx
, and replace it in all occurences.
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.