Skip to content

iMX8M imx boot image build (4.9.51)

vraevsky edited this page Jun 7, 2019 · 2 revisions

iMX8M imx-boot image build (4.9.51)

Supported machines:

  • cl-som-imx8

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

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 imx8
cd imx8
export SRC_ROOT=$(pwd)
  • Download CompuLab BSP with respect to the board revision.
revision# branch
1.0 BRANCH=devel_ga
1.1 BRANCH=devel_ga-rev1.1
git clone -b ${BRANCH} https://github.com/compulab-yokneam/meta-compulab-imx8.git
export BSP=$(pwd)/meta-compulab-bsp
export PATCHES=${BSP}/meta-bsp/recipes-bsp/u-boot/compulab/cl-som-imx8

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.9.51_8mq_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.9.51_8mq_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-7.5.bin
bash firmware-imx-7.5.bin --auto-accept
cp -v $(find firmware* | awk '/train|hdmi_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.9.51_8mq_ga
git -C uboot-imx am ${PATCHES}/*.patch
  • Compile the U-Boot

    • For U-Boot w/out memory detection define this CFG_OPT variable:
RAM Size CFG Option
1G CFG_OPT="CONFIG_RAM_1G=y CONFIG_RAM_2G=n"
2G CFG_OPT="CONFIG_RAM_1G=n CONFIG_RAM_2G=y"
make -C uboot-imx ${MACHINE}_defconfig
make -C uboot-imx ${CFG_OPT}
  • Copy files to the mkimage directory:
cp -v $(find uboot-imx | awk '/u-boot-spl.bin$|u-boot.bin$|u-boot-nodtb.bin$|imx8\.dtb$|mkimage$/' 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