Skip to content

iMX8M imx boot image build

vraevsky edited this page Jul 1, 2019 · 18 revisions

iMX8M imx-boot image build

Supported machines:

  • cl-som-imx8

Define a MACHINE environment variable with respect to a required machine:

export MACHINE=cl-som-imx8

Prerequisites

It is up to developer to setup arm64 build environment:

  • Download a tool chain from Linaro
  • Set environment variables:
export ARCH=arm64
export CROSS_COMPILE=/usr/bin/aarch64-linux-gnu-
  • Create a folder to organize the files:
mkdir imx8mq
cd imx8mq
export SRC_ROOT=$(pwd)
  • Download CompuLab BSP
git clone -b devel-imx8mq-4.14.78 https://github.com/compulab-yokneam/meta-compulab-bsp.git
export BSP=$(pwd)/meta-compulab-bsp
export PATCHES=${BSP}/meta-bsp-imx8mq/recipes-bsp/u-boot/compulab/imx8mq

Mkimage Setup

  • Download the mkimage from:
git clone https://source.codeaurora.org/external/imx/imx-mkimage.git
git -C imx-mkimage checkout rel_imx_4.14.78_1.0.0_ga

Arm Trusted Firmware Setup

Download the ATF from:

git clone https://source.codeaurora.org/external/imx/imx-atf.git
git -C imx-atf checkout rel_imx_4.14.78_1.0.0_ga
  • Make bl31.bin
make -C imx-atf PLAT=imx8mq bl31
cp -v imx-atf/build/imx8mq/release/bl31.bin ${SRC_ROOT}/imx-mkimage/iMX8M/

Firmware iMX setup

Download the firmware-imx file from:

wget http://www.freescale.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-8.0.bin
bash firmware-imx-8.0.bin --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 the CompuLab BSP patches:
git clone https://source.codeaurora.org/external/imx/uboot-imx.git
git -C uboot-imx checkout -b uboot-compulab rel_imx_4.14.78_1.0.0_ga
git -C uboot-imx am ${PATCHES}/*.patch
  • Compile the U-Boot
make -C uboot-imx ${MACHINE}_defconfig
make -C uboot-imx
  • Copy files to the mkimage directory:
cp -v $(find uboot-imx | awk '(/u-boot-spl.bin$|u-boot.bin$|u-boot-nodtb.bin$|cl-som-imx8.*\.dtb$|mkimage$/)&&(!/doc/&&!/include/)' ORS=" ") ${SRC_ROOT}/imx-mkimage/iMX8M/

Compiling the flash.bin imx-boot image:

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

Flashing

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