Skip to main content

Yocto 1.5 - i.MX6

# Yocto Linux BSP User Guide for i.MX6 Series (Y1.5)

Based on legacy ESS‑WIKI content. Cleaned to be MDX-safe for Docusaurus.

Introduction

This guide targets Ubuntu 12.04 LTS 64‑bit. (Historic reference)

If you run into environment setup issues today, consider using Docker to reproduce a legacy Ubuntu userspace more safely.


# Getting Started

Prerequisites

  • Host OS: Ubuntu 12.04 LTS 64‑bit
  • Memory: ≥ 2 GB (more recommended)

Example ISO: ubuntu-12.04.1-desktop-amd64.iso

Install required packages

Run on a fresh 12.04 host (historical package names kept as-is):

sudo apt-get install ssh
sudo apt-get install ia32-libs libx11-dev:i386 libreadline6-dev:i386 \
libgl1-mesa-glx:i386 zlib1g-dev:i386 uuid-dev:i386 liblzo2-dev:i386 \
libncurses5-dev:i386

sudo apt-get install \
bison build-essential ccache dpkg flex gcc g++ gettext intltool \
libarchive-zip-perl libfreetype6-dev libdbus-glib-1-dev liborbit2-dev \
libxml2-dev libgtk2.0-dev liblzo2-2 libtool m4 \
patch rpm tcl uboot-mkimage uuid zlib1g zlib1g-dev \
git gnupg flex bison gperf build-essential zip \
curl libc6-dev libncurses5-dev x11proto-core-dev libx11-dev:i386 \
libreadline6-dev:i386 libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib \
mingw32 tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386 \
gcc-4.6 g++-4.6 cpp-4.6 gcc-4.6-multilib uuid-dev liblzo2-dev \
uboot-mkimage libarchive-zip-perl \
wget git-core unzip texinfo gawk diffstat build-essential chrpath \
sed cvs subversion coreutils texi2html \
docbook-utils python-pysqlite2 help2man make gcc g++ \
desktop-file-utils libgl1-mesa-dev libglu1-mesa-dev mercurial \
autoconf automake groff curl lzop asciidoc xterm

sudo apt-get install libncurses5-dev:i386 liblzo2-dev:i386 uuid-dev:i386

sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

tar zcvf ~/usr_lib_i386-linux-gnu_for_Building_Android_KK.tar.gz \
/usr/lib/i386-linux-gnu/{libuuid.a,libuuid.so,liblzo2.so,liblzo2.a}

sudo apt-get install uuid-dev liblzo2-dev
sudo tar zxvf ~/usr_lib_i386-linux-gnu_for_Building_Android_KK.tar.gz -C /

Install JDK 6u45 (legacy requirement)

Manually download jdk-6u45-linux-x64.bin from Oracle to ~/FILES/, then:

cd /usr/lib
sudo ~/FILES/jdk-6u45-linux-x64.bin

sudo mkdir -p jvm
cd jvm
sudo mv ../jdk1.6.0_45 .
cd jdk1.6.0_45/

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_45/jre/bin/java 2
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_45/bin/javac 2
sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk1.6.0_45/bin/jar 2
sudo update-alternatives --install /usr/bin/javap javap /usr/lib/jvm/jdk1.6.0_45/bin/javap 2
sudo update-alternatives --install /usr/bin/javadoc javadoc /usr/lib/jvm/jdk1.6.0_45/bin/javadoc 2

sudo update-alternatives --config javap
sudo update-alternatives --config javadoc
sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo update-alternatives --config jar

cd ~/
sudo sh -c 'echo "JAVA_HOME=/usr/lib/jvm/jdk1.6.0_45" >> /etc/environment'

Conventions

Variables are rendered inline with backticks to avoid MDX parsing of {}.

  • ${PREBUILT_IMAGE}: compressed prebuilt image (*.img.gz)
  • ${BSP_TARBALL}: BSP tarball (*.tgz)
  • ${BSP_HOME}: BSP home directory
  • ${BDIR}: build directory (e.g., build-x11)
  • ${MX6PROC}: i.MX6 processor short code
    • mx6q for i.MX6 Quad/Dual Core
    • mx6dl for i.MX6 Dual Lite/Solo
  • ${IMX6PROC}: i.MX6 processor (e.g., imx6q / imx6dl)
  • ${BOARD}: one of ubc220 / rom3420 / rom5420 / rom7420 / rsb4410 / ubcds31 / wise3310
  • ${MC}: machine code = ${IMX6PROC}${BOARD}${BOARD_REV}
    • Examples: imx6dlubc220, imx6qrom3420, imx6qrom5420, imx6qrom7420, imx6qrsb4410, imx6qubcds31, imx6qwise3310
  • ${SD_DEVICE}: SD device path (e.g., /dev/sdf)
  • ${SDCARD_IMAGE}: bitbake output SD card image (*.sdcard)
  • ${UBOOT}: U‑Boot version (e.g., 2013.04-r0)
  • ${KERNEL}: kernel version (e.g., 3.14.28-r0)
  • ${POKY}: Poky version (e.g., 1.5.3)

Serial console: 115200 8N1 (minicom/putty/teraterm).
Terminal console: any terminal (gnome‑terminal/xfce4‑terminal).


Introducing BSP

The BSP is based on Yocto (Freescale i.MX6 enhancements) with Advantech board support.

Naming Rule

  • BSP tarball: <model><LB><V><rev>_<date>.tgz
    Example: 4410LBV3240_2015-03-25.tgz

    • 4410 → RSB‑4410
    • LBLinux BSP
    • V3240 → Version 3.240
  • Prebuilt Linux image: <model><LI><V>_<SoC>_<date>.img.gz
    Example: 4410LIV3240_DualQuad_2015-03-25.img.gz (LI = Linux Image)

BSP tarball layout

Unpack to home:

tar xvf `${BSP_TARBALL}` -C ~/

After unpack, you should have a unique BSP home folder such as ~/imx6LBV3240_2015-03-25.

Key items:

  • sources/meta-advantech/: Advantech meta layer
  • meta-fsl-*/: Freescale meta layers
  • fsl-setup-release.sh: create a new build env
  • setup-environment: continue an existing build env

Prebuilt image to SD

gunzip -c `${PREBUILT_IMAGE}` | sudo dd of=`${SD_DEVICE}` bs=1M && sync

Build Instructions

Create a new build environment

cd `${BSP_HOME}`
MACHINE=`${MC}` source fsl-setup-release.sh -b `${BDIR}` -e x11
# Read and accept EULA when prompted

Accept EULA

Continue an existing build environment

cd ${BSP_HOME}
source setup-environment ${BDIR}

Build sdcard image (Qt 4.8.5)

bitbake fsl-image-x11

Output: ./tmp/deploy/images/${MC}/fsl-image-x11-${MC}.sdcard

Build sdcard image (Qt 5.2.1)

bitbake fsl-image-x11-qt5

Output: ./tmp/deploy/images/${MC}/fsl-image-x11-qt5-${MC}.sdcard

Build sdcard image (framebuffer, no Qt)

bitbake fsl-image-fb

Output: ./tmp/deploy/images/${MC}/fsl-image-fb-${MC}.sdcard

Build toolchain installer (Qt 4.8.5)

bitbake fsl-image-x11 -c populate_sdk

Output: ./tmp/deploy/sdk/poky-eglibc-x86_64-fsl-image-x11-cortexa9hf-vfp-neon-toolchain-qt4-${POKY}.sh

Build toolchain installer (Qt 5.2.1)

bitbake fsl-image-x11-qt5 -c populate_sdk

Output: ./tmp/deploy/sdk/poky-eglibc-x86_64-fsl-image-x11-qt5-cortexa9hf-vfp-neon-toolchain-${POKY}.sh

Build toolchain installer (no Qt)

bitbake fsl-image-fb -c populate_sdk

Output: ./tmp/deploy/sdk/poky-eglibc-x86_64-fsl-image-fb-cortexa9hf-vfp-neon-toolchain-${POKY}.sh

Build U‑Boot

bitbake u-boot-imx

Outputs: u-boot_crc.bin and u-boot_crc.bin.crc in ./tmp/deploy/images/${MC}.

Build Linux kernel

Menuconfig (if using Docker, install tmux first: sudo apt-get install tmux):

bitbake linux-imx -c menuconfig

Build:

bitbake linux-imx

Outputs: uImage and uImage-${IMX6PROC}-${BOARD}.dtb in ./tmp/deploy/images/${MC}.


Creating boot-up on-board flash from prebuilt image

Create bootable SD

gunzip -c `${PREBUILT_IMAGE}` | sudo dd of=`${SD_DEVICE}` bs=1M && sync

Transfer to on-board flash

Boot from SD, then on the target debug console:

cd /mk_inand
./mksd-linux.sh /dev/mmcblk0
# Confirm with 'y' when prompted

All_data_will_be_destroyed

When you see [Done], the transfer is finished.


Creating boot-up on-board flash from built sdcard image

Create bootable SD from bitbake output

pushd `${BSP_HOME}`/`${BDIR}`/tmp/deploy/images/`${MC}`
sudo dd if=`${SDCARD_IMAGE}` of=`${SD_DEVICE}` bs=1M && sync
popd

Transfer to on-board flash (manual dd)

Insert a USB stick with ${SDCARD_IMAGE} (auto‑mounted at /media/sda1), then:

umount /media/mmcblk0p? || true
cd /media/sda1
dd if=`${SDCARD_IMAGE}` of=/dev/mmcblk0 bs=4M conv=fsync

P2START=$(fdisk -lu | grep mmcblk0p2 | awk '{print $2}')
echo -e "d\n2\nn\np\n2\n${P2START}\n\nw\n" | fdisk -u /dev/mmcblk0

umount /media/mmcblk0p2 || true
e2fsck -f -y /dev/mmcblk0p2
resize2fs /dev/mmcblk0p2
poweroff

Customization

Add packages: tcf-agent & openssh-sftp-server

Go to the image recipe folder:

cd `${BSP_HOME}`/sources/meta-advantech/recipes-fsl/images

Append to fsl-image-x11.inc:

IMAGE_INSTALL += " tcf-agent openssh-sftp-server "

Rebuild the image (see build sections above).

Add Chromium browser

Edit local.conf:

cd `${BSP_HOME}`/`${BDIR}`/conf

Append:

CORE_IMAGE_EXTRA_INSTALL += "chromium"
LICENSE_FLAGS_WHITELIST = "commercial"

Rebuild the image.


Setting up SDK

After generating the SDK (see above), install it:

cd `${BSP_HOME}`/`${BDIR}`/tmp/deploy/sdk
sudo ./poky-eglibc-x86_64-fsl-image-qt5-cortexa9hf-vfp-neon-toolchain-${POKY}.sh

Enter directory or press Enter while following question shows up:

Setting_up_sdk153_1

Just press Enter while following question shows up:

Setting_up_sdk153_2

While following message shows up means the SDK is ready.

Setting_up_sdk153_3

Setting up cross-compiling environment


Perform the following command in terminal console

source /opt/poky/${POKY}/environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi

Building & updating U‑Boot manually

Build U‑Boot

The cross compiling environment has been set up. (ref. 2.3) Make one copy from Yocto working directory

	$ mkdir -p ~/code
$ pushd `${BSP_HOME}`/`${BDIR}`/tmp/work/`${MC}`-poky-linux-gnueabi/
$ rm -rf ~/code/u-boot-imx
$ cp -a ./u-boot-imx/${UBOOT}/git ~/code/u-boot-imx
$ popd

Configure u-boot
$ cd ~/code/u-boot-imx
$ make distclean
$ make ${MX6PROC}${BOARD}_<Memory-Size>_config
# e.g. make mx6qrom3420_1G_config
# You can also check boards.cfg for available configs

Start building u-boot
$ make -j4 LDFLAGS=
The two files, u-boot-crc.bin & u-boot-crc.bin.crc, are located in directory "~/code/u-boot-imx".
To update u-boot to target device

Update U‑Boot to SD / on-board flash

Perform the following command to transfer to existed boot-up SD card

# To SD card:
sudo dd if=u-boot_crc.bin.crc of=`${SD_DEVICE}` bs=512 seek=2 conv=fsync
sudo dd if=u-boot_crc.bin of=`${SD_DEVICE}` bs=512 seek=3 conv=fsync

# Make sure new u-boot does work then perform the following commands to transfer to on-board flash

sudo dd if=u-boot_crc.bin.crc of=/dev/mmcblk0 bs=512 seek=2 conv=fsync
sudo dd if=u-boot_crc.bin of=/dev/mmcblk0 bs=512 seek=3 conv=fsync

Building & updating kernel/modules/dtb manually

###z To build kernel/modules/dtb

The cross compiling environment has been set up.

Make one copy from Yocto working directory

$ mkdir -p ~/code
$ pushd `${BSP_HOME}`/`${BDIR}`/tmp/work/`${MC}`-poky-linux-gnueabi/
$ rm -rf ~/code/linux-imx
$ cp -a ./linux-imx/${KERNEL}/git ~/code/linux-imx
$ popd

# Configure linux kernel
$ cd ~/code/linux-imx
$ make distclean
$ make imx_v7_adv_defconfig
$ make menuconfig PKG_CONFIG_SYSROOT_DIR= PKG_CONFIG_PATH=

# Start building linux kernel
$ make -j4 zImage LOADADDR=0x10008000 LDFLAGS=

# The kernel image file, zImage, is located in the directory "./arch/arm/boot/".
# Start building kernel modules

$ make -j4 modules LDFLAGS=
# Copy all modules to a temporary rootfs directory, "~/temp/rootfs"
$ make modules_install INSTALL_MOD_PATH=~/temp/rootfs

# Start building device tree blob
$ make -j4 ${IMX6PROC}-${BOARD}.dtb
# -> ./arch/arm/boot/dts/${IMX6PROC}-${BOARD}.dtb

Update kernel/modules/dtb on target

  • Copy zImage and ${IMX6PROC}-${BOARD}.dtb to the 1st SD partition.
  • Copy installed modules from ~/temp/rootfs to the 2nd SD partition.
  • Verify boot, then copy into on‑board flash as needed.