Files
meta-bsp-imx8mm/Documentation/imx_boot_image_build.md
T

3.5 KiB

Building Boot Firmware for CompuLab's i.MX8M Mini products

Supported machines:

  • mcm-imxi8-mini
  • ucm-imxi8-mini
  • iot-gate-imx8

Define a MACHINE environment variable for the target product:

Machine Command Line
mcm-imx8m-mini export MACHINE=mcm-imx8m-mini
ucm-imx8m-mini export MACHINE=ucm-imx8m-mini
iot-gate-imx8 export MACHINE=iot-gate-imx8

Define the following environment variables:

Description Command Line
NXP release name export NXP_RELEASE=imx_v2020.04_5.4.70_2.3.0
NXP firmware name export NXP_FIRMWARE=firmware-imx-8.8.bin
CompuLab branch name export CPL_BRANCH=rel_imx_5.4.70_2.3.0-stable

Prerequisites

It is up to developer to setup arm64 build environment:

  • Download and install the GNU tool chain

  • Create a folder to organize the files:

mkdir imx8mm
cd imx8mm
export SRC_ROOT=$(pwd)
  • Download CompuLab BSP
git clone -b ${CPL_BRANCH} https://github.com/compulab-yokneam/meta-bsp-imx8mm.git
export LAYER_DIR=$(pwd)/meta-bsp-imx8mm

Mkimage setup

  • Download the mkimage:
git clone https://source.codeaurora.org/external/imx/imx-mkimage.git
git -C imx-mkimage checkout ${NXP_RELEASE} -b ${CPL_BRANCH}

Arm Trusted Firmware (ATF) setup

  • Download the ATF:
git clone https://source.codeaurora.org/external/imx/imx-atf.git
git -C imx-atf checkout ${NXP_RELEASE} -b ${CPL_BRANCH}
git -C imx-atf am ${LAYER_DIR}/recipes-bsp/imx-atf/compulab/imx8mm/*.patch
  • Make bl31.bin
make -C imx-atf PLAT=imx8mm bl31
cp -v imx-atf/build/imx8mm/release/bl31.bin ${SRC_ROOT}/imx-mkimage/iMX8M/

Firmware iMX setup

  • Download the firmware-imx file:
wget http://www.freescale.com/lgfiles/NMG/MAD/YOCTO/${NXP_FIRMWARE}
bash -x ${NXP_FIRMWARE} --auto-accept
cp -v $(find firmware* | awk '/train|hdmi_imx8|dp_imx8/' ORS=" ") ${SRC_ROOT}/imx-mkimage/iMX8M/

U-Boot

  • Download the U-Boot source and apply CompuLab BSP patches:
git clone https://source.codeaurora.org/external/imx/uboot-imx.git
git -C uboot-imx checkout ${NXP_RELEASE} -b ${CPL_BRANCH}
git -C uboot-imx am ${LAYER_DIR}/recipes-bsp/u-boot/compulab/imx8mm/*.patch
  • Compile U-Boot:
make -C uboot-imx ${MACHINE}_defconfig
make -C uboot-imx
  • Copy files to the mkimage directory:
cp -v $(find uboot-imx | awk -v v=${MACHINE} '(/u-boot-spl.bin$|u-boot.bin$|u-boot-nodtb.bin$|tools\/mkimage$/)||($0~v".dtb$")' ORS=" ") ${SRC_ROOT}/imx-mkimage/iMX8M/

Compiling the flash.bin imx-boot image:

  • Unset these variables:
unset ARCH CROSS_COMPILE
  • Issue:
cd ${SRC_ROOT}/imx-mkimage/iMX8M
sed "s/\(^dtbs = \).*/\1${MACHINE}.dtb/;s/\(mkimage\)_uboot/\1/;s/\(^TEE_LOAD_ADDR \).*/\1= 0x7e000000/g" soc.mak > Makefile
make clean
make flash_evk SOC=iMX8MM

Flashing

dd if=flash.bin of=/dev/<your device> bs=1K seek=33 status=progress