Yocto Linux BSP Ver.D User Guide for i.MX9 Series — Yocto 4.2
Introduction
This document describes how to set up the build environment, fetch the BSP, build images, and customize software for Advantech boards based on NXP i.MX9 series (e.g., i.MX93). It targets BSP Version D aligned with NXP release L6.1.36-2.1.0 (Yocto 4.2 mickledore).
Getting Started
System Requirements
- CPU Cores: Intel® Core™ i7 (≥ 8 cores)
- Memory: ≥ 16 GB
- Disk Space: ≥ 500 GB (SSD strongly recommended)
Conventions
${PREBUILT_IMAGE}— compressed prebuilt image (*.img.gz)${CONTAINER_NAME}— container name (e.g.,imx9LBVD0027)${BSP_TARBALL}— BSP tarball (*.tgz)${BSP_HOME}— BSP root directory${BDIR}— build directory (e.g.,build_xwayland)${IMX9PROC}— i.MX9 processor code (e.g.,imx93for i.MX93)${BOARD}— target board (e.g.,rom2820)${BOARD_REV}— board revision (e.g.,a1)${MC}— machine code =${IMX9PROC}${BOARD}${BOARD_REV}
Example:imx93rom2820a1for ROM‑2820 A1${MEM_SIZE}— memory size (one of:1G/2G/4G/6G)${UC}— U‑Boot config (e.g.,1G/2G/4G/6G/FSPI_1G/FSPI_2G/FSPI_4G/FSPI_6G...)${SD_DEVICE}— SD device path on host Linux (e.g.,/dev/sdf)${SDCARD_IMAGE}— SDCard image built by bitbake (*.wic.zst)${WORKSPACE}— host workspace folder mapped into the container${UBOOT}— U‑Boot version (e.g.,v2023.04_6.1.36-2.1.0)${KERNEL}— Linux kernel version (e.g.,6.1.36-2.1.0)${TOOLCHAIN}— toolchain install base (e.g.,/opt/fsl-imx-wayland/6.1-mickledore)
Debug console / serial console — Use a terminal tool (minicom/putty/teraterm) configured to 115200 8N1.
Terminal console — Any terminal emulator (gnome-terminal, xfce4-terminal, etc.).
You can list supported machines after sourcing the environment:
$ source setup-environment
Docker Install and Settings
If Docker is not available on your system, please install it first.
1) Install Docker Engine
Refer to the official Docker installation guide for your platform.
2) Pull base image (example)
$ docker pull advrisc/u20.04-imx8lbv1
Note: The example image name may reference i.MX8; it remains suitable as a general Ubuntu 20.04 base for i.MX9 BSP builds.
3) Create a container
$ docker run --privileged -it \
--name ${CONTAINER_NAME} \
-v ${WORKSPACE}:/home/adv/adv-release-bsp \
-v /dev:/dev \
advrisc/u20.04-imx8lbv1 /bin/bash
Get BSP
You can obtain the BSP in two ways.
Method A — Download BSP from GitHub
The following example downloads Advantech Yocto BSP into a project directory adv-release-bsp:
$ git config --global user.name "Your Name"
$ git config --global user.email you@example.com
$ sudo chown adv:adv adv-release-bsp
$ cd adv-release-bsp
$ repo init -u https://github.com/ADVANTECH-Corp/adv-arm-yocto-bsp.git \
-b imx-linux-mickledore \
-m adv-6.1.36-2.1.0.xml
$ repo sync
Troubleshooting tips:
-
If you see “server certificate verification failed”, you can temporarily disable SSL verification (for self‑signed certs) — only as a last resort:
export GIT_SSL_NO_VERIFY=1
# or
git config --global http.sslverify false -
If you see “The unauthenticated git protocol on port 9418 is no longer supported.”, use:
git config --global url."https://".insteadOf git://
Method B — Copy BSP tarball into the Container
If you already have a BSP tarball (e.g., imx9LBVD0042_2024-05-26.tgz), copy it into the container workspace.
- Exit container to host:
exit
- Copy tarball into
${WORKSPACE}and fix ownership:
cp imx9LBVD0042_2024-05-26.tgz ${WORKSPACE}
sudo chown adv:adv ${WORKSPACE}/imx9LBVD0042_2024-05-26.tgz
- Re‑attach to the container:
docker start ${CONTAINER_NAME}
docker attach ${CONTAINER_NAME}
- Unpack inside the container:
tar zxvf imx9LBVD0042_2024-05-26.tgz
Downloads Tarball (optional but recommended)
During Yocto builds, a downloads/ folder is created to cache sources. To reduce fetch failures, you can reuse a prepared archive, e.g., downloads_y40_6.1.36.tar.gz.
- Exit to host:
exit
- Copy the downloads tarball into
${WORKSPACE}:
cp downloads_y40_6.1.36.tar.gz ${WORKSPACE}
sudo chown adv:adv ${WORKSPACE}/downloads_y40_6.1.36.tar.gz
- Re‑attach to the container:
docker start ${CONTAINER_NAME}
docker attach ${CONTAINER_NAME}
- Unpack:
tar zxvf downloads_y40_6.1.36.tar.gz
- Link it into the BSP tree:
cd adv-release-bsp
ln -s ${WORKSPACE}/downloads_y40_6.1.36 downloads
Introducing the BSP
The BSP is based on the Yocto Project with NXP (Freescale) enhancements for i.MX93, plus Advantech board support. The top‑level directory contains:
sources/— all Yocto layers (community + NXP + Advantech)- build directories — one or more per configuration
- helper scripts for environment setup
Naming Rule
- BSP file name:
imx9LBVD0042_YYYY-MM-DD.tgzLB= Linux BSPVD0042= Version D, build 0042
- Prebuilt image name:
2820A1AIM36LIVD0042_iMX93_2G_YYYY-MM-DD.img.gz2820A1=ROM‑2820 A1LI= Linux Image (prebuilt)2G= DDR size
BSP Content (key items)
sources/meta-advantech/— Advantech meta‑layersources/meta-fsl-*— NXP (Freescale) meta‑layersfsl-setup-release.sh— create a new build envsetup-environment— resume an existing build env
Build Instructions
Create a New Build Environment
cd ${BSP_HOME}
MACHINE=${MC} DISTRO=fsl-imx-xwayland source imx-setup-release.sh -b ${BDIR}
To specify a default U‑Boot config at creation time:
MACHINE=${MC} UBOOT_CONFIG=${UC} DISTRO=fsl-imx-xwayland source imx-setup-release.sh -b ${BDIR}
You will be prompted to accept the EULA.
Continue an Existing Build Environment
cd ${BSP_HOME}
source setup-environment ${BDIR}
Build SDCard Image
bitbake imx-image-full
When complete, you will find:
imx-image-full-${MC}.wic.zstimx-image-full-${MC}.wic.bmap
in: ./tmp/deploy/images/${MC}
Build Toolchain Installer (SDK)
bitbake meta-toolchain
The installer will be in ./tmp/deploy/sdk/, e.g.:
fsl-imx-wayland-glibc-x86_64-meta-toolchain-armv8a-imx93rom2820a1-toolchain-${KERNEL}-mickledore.sh
Build Bootloader
bitbake imx-boot
Build Linux Kernel
If building inside Docker, install tmux so you can run menuconfig safely:
sudo apt-get update
sudo apt-get install -y tmux
tmux
bitbake linux-imx -c menuconfig
# After configuration, exit the tmux window:
exit
Build the kernel:
bitbake linux-imx
Resulting files:
ImageImage-${IMX9PROC}-${BOARD}-${BOARD_REV}.dtb
Both under: ./tmp/deploy/images/${MC}
Creating Bootable Media from a Prebuilt Image
Create a Boot SD Card (from prebuilt image)
Warning: Double‑check
${SD_DEVICE}before runningdd.
sudo sh -c 'gunzip -c ${PREBUILT_IMAGE} | dd of=${SD_DEVICE} bs=1M status=progress'
sync
Creating Bootable Media from a Built SDCard Image
Create a Boot SD Card (from ${SDCARD_IMAGE})
pushd ${BSP_HOME}/${BDIR}/tmp/deploy/images/${MC}
zstd -cd ${SDCARD_IMAGE} | sudo dd of=${SD_DEVICE} bs=1M status=progress
# Or, faster with bmaptool:
sudo bmaptool copy --bmap ${SDCARD_IMAGE/.zst/.bmap} ${SDCARD_IMAGE} ${SD_DEVICE}
sync
popd
Debug Console Information
If you need boot logs and kernel messages, prepare:
Hardware
- Please refer to your product’s Debug Port Information (connector location and pinout).
Software
- Use a serial terminal such as
minicomorputty. - Baud rate: 115200
Customization
Setting up SDK
Follow Build Toolchain Installer (SDK) to generate the installer, then run:
cd ${BSP_HOME}/${BDIR}/tmp/deploy/sdk
sudo ./fsl-imx-wayland-glibc-x86_64-meta-toolchain-armv8a-imx93rom2820a1-toolchain-6.1-mickledore.sh
When prompted, choose or confirm the installation directory and proceed.
Download SDK Link (for reference only): [downloads_SDK]
Setting up Cross‑Compiling Environment
After SDK installation, source the environment:
source ${TOOLCHAIN}/environment-setup-aarch64-poky-linux
Build U‑Boot in a Standalone Environment
Configure U‑Boot
make ${IMX9PROC}_${BOARD}${BOARD_REV}_${MEM_SIZE}_defconfig
# e.g.
make imx93_rom2820a1_2G_defconfig
Build U‑Boot
make -j$(nproc)
Build imx-boot Image using imx-mkimage (i.MX93)
- Obtain the
imx-boottarball for your product (example for ROM‑2820):
tar zxvf 2820A1AIM36LIVD0042_iMX93_2G_imx-boot.tgz
cd 2820A1AIM36LIVD0042_iMX93_2G_imx-boot/
- Copy necessary artifacts into the
imx-mkimagefolder:
cp u-boot.bin spl/u-boot-spl.bin arch/arm/dts/imx93-rom2820-a1.dtb tools/mkimage \
/path/to/imx-mkimage/iMX9/
- Build
flash.bin:
cd /path/to/imx-mkimage
make SOC=iMX9 REV=A1 flash_singleboot
Flash imx-boot
- Using uuu to eMMC:
cp flash.bin ~/mfgtools/uuu/
cd ~/mfgtools/uuu
sudo ./uuu -b emmc flash.bin
- Or writing raw to device (example uses
/dev/sdd, adjust as needed):
sudo dd if=flash.bin of=/dev/sdd bs=1K seek=32 conv=fsync
sync
Building & Updating Kernel / Modules / DTB Manually
Ensure your cross‑compile environment is sourced (see Setting up Cross‑Compiling Environment).
Get Linux‑imx Sources
If not already available, download per your workflow (e.g., from Advantech/NXP). (Reference: [adv_6.1.36_2.1.0])
Configure the Kernel
cd linux-imx
make distclean
make imx_v8_adv_defconfig
make menuconfig
Build Kernel Image
make -j$(nproc) Image
If you hit link flags issues, try:
unset LDFLAGS
make -j$(nproc) Image
The kernel Image is at: ./arch/arm64/boot/
Build Kernel Modules
make -j$(nproc) modules
make modules_install INSTALL_MOD_PATH=~/temp/rootfs
Build Device Tree Blob
make -j$(nproc) freescale/${IMX9PROC}-${BOARD}-${BOARD_REV}.dtb
# e.g.
make -j$(nproc) freescale/imx93-rom2820-a1.dtb
DTBs are at: ./arch/arm64/boot/dts/freescale/
Replace Kernel & DTB on Target Media
- Copy
Imageto the appropriate/boot(or partition) on SD/eMMC. - Copy
${IMX9PROC}-${BOARD}-${BOARD_REV}.dtbto the device’s DTB directory on SD/eMMC.
(Exact paths depend on your image layout and bootloader configuration.)
Improve Boot Speed
Bootloader
- Boot delay
Disable boot delay in U‑Boot:
setenv bootdelay 0
saveenv
reset
- Disable console output
Reducing console messages speeds boot.
- Kernel quiet mode in bootargs (example):
setenv mmcargs 'setenv bootargs ${jh_clk} console=${console} modprobe.blacklist=${modprobe_blacklist} root=${mmcroot} video=HDMI-A-1:${videores} quiet'
saveenv
reset
- Or disable console entirely:
setenv console
saveenv
reset
Rootfs
TBD — optimize services and startup scripts per application.
Services
Disable unneeded services:
sudo systemctl disable <service-name>
# e.g.
sudo systemctl disable boottimes
System Recovery
This section provides procedures to restore the eMMC image.
For more details, see the NXP mfgtools wiki (UUU).
Reflash eMMC from Boot SD Card
-
Download the
mksd-linux.shscript:
https://github.com/ADVANTECH-Corp/RISC_tools_scripts/blob/mickledore/imx8/mksd-linux.sh -
Download the
"Product_AIM_Release_version"_flash_tool.tgzbundle and unzip it. -
Copy
mksd-linux.shinto themk_inandfolder. -
Run
mksd-linux.shto prepare and flash from SD to eMMC (follow on‑screen prompts).
FreeRTOS (i.MX8ULP / i.MX9)
TBD — FreeRTOS bring-up notes and examples for i.MX93 (and references to i.MX8ULP when applicable).