Hands on Yocto: Building for Freescale MX6 (HummingBoard)
This part of our multi-part yocto tutorial shows how to build a yocto image for a freescale device, the Solid Run HummingBoard-i2eX with a Freescale MX6 Dual processor. The HummingBoard-i2ex is a powerful miniature computer sporting a PCIe slot (e.g. for use wit a 3G modem module) and spare space to mount a SIM card holder, thus making it ideal for in-the-field deployment.
Getting the requisite components
To start a yocto build for a new board, you should first check for existing solutions. The OpenEmbedded Layer Index list most (if not all) of the available yocto layers.
Search for
- meta-fsl-arm
- meta-fsl-arm-extra
- meta-fsl-pcc
- meta-fsl-demos
meta-fsl-pcc
is for the power pc based line and of no relevance. meta-fsl-demos
is an application level layer show casing various line feature (mostly multimedia) which we also can dispense with. meta-fsl-arm-extra
contains additional information of various boards built with the Freescale ARM processor series. A quick look on the “Machines” tab reveils, that cubox-i
is a machine defintion for SolidRuns CuBox and HummingBoard boards.meta-fsl-arm
is the layer containing the Freescale ARM support. Thus we need to install the meta-fsl-arm
and meta-fsl-arm-extra
layers.
Initialising the build system
To get started with the HummingBoard we’ll need to load the corresponding BSP layer (meta-fsl-arm) and create a new build directory named fslbuild.
$ cd ~/yocto/poky
$ git clone git://git.yoctoproject.org/meta-fsl-arm
$ git clone git://git.yoctoproject.org/meta-fsl-arm-extra
$ . .oe-init-build-env fslbuild
.oe-init-build-env
is the environment setup script that will setup local path and other variables for you build directory. rpibuild
is the name of the build directory (yocto name: TOPDIR
, BUILDDIR
). rpibuild stands for Raspberry Pi build, as we will be building a distro for the Raspberry Pi in the next chapter of this tutorial. If you dont’t provide a build directory name it will default to build
. Please note the extra point “.” in . .oe-init-build-env
. The first point is a shortcut for the source
command, the second point makes .oe-init-build-env a hidden file.
The first call to .oe-init-build-env with a new directory name will create the directory and its contents, all subsequient calls will only set the environment variables accordingly. You have to call .oe-init-build-env once per terminal session, otherwise building and many other tools will not work (as in file not found errors). The source command runs the contents of the script as if typed onto the current shell. This includes directory changes, thus running the .oe-init-build-env script will leave you inside the build directory.
A quick look at the Freescale Extra Layer:
Board specific definations and adaptations for all supported freescale processors reside inside the meta-fsl-arm-extra
layer.
The layer consists of the following directories
conf
recipes-bsp
recipes-core
recipes-kernel
Supported machines reside inside the conf/machine directory
$ ls -1 meta-fsl-arm-extra/conf/machine/*.conf
results in the following machines
cfa10036.conf
cfa10037.conf
cfa10049.conf
cfa10055.conf
cfa10056.conf
cfa10057.conf
cfa10058.conf
cgtqmx6.conf
cm-fx6.conf
colibri-vf.conf
cubox-i.conf
imx233-olinuxino-maxi.conf
imx233-olinuxino-micro.conf
imx233-olinuxino-mini.conf
imx233-olinuxino-nano.conf
imx6dl-riotboard.conf
imx6qsabrelite.conf
imx6sl-warp.conf
m28evk.conf
m53evk.conf
nitrogen6x.conf
nitrogen6x-lite.conf
pcl052.conf
pcm052.conf
quartz.conf
ventana.conf
wandboard-dual.conf
wandboard-quad.conf
wandboard-solo.conf
where cubox-i.conf
is the relevant machine defintion. Let’s have a closer look
#@TYPE: Machine
#@NAME: SolidRun CuBox-i and HummingBoard
#@SOC: i.MX6 Q/DL
#@DESCRIPTION: Machine configuration for SolidRun CuBox-i and HummingBoard machines
#@MAINTAINER: Carlos Rafael Giani <dv@pseudoterminal.org>
# Machine config for the SolidRun CuBox-i and HummingBoard machines.
# They all use the same machine config, since the u-boot SPL autodetects the
# machine type upon booting. SOC_FAMILY includes all SoCs from all of these machines
# to let recipes include firmware etc. for all of these SoCs.
require conf/machine/include/imx-base.inc
require conf/machine/include/tune-cortexa9.inc
SOC_FAMILY = "mx6:mx6dl:mx6q"
PREFERRED_PROVIDER_virtual/kernel = "linux-cubox-i"
UBOOT_MAKE_TARGET = ""
UBOOT_SUFFIX = "img"
UBOOT_CONFIG ??= "sd"
UBOOT_CONFIG[sd] = "mx6cuboxi_defconfig,sdcard"
UENV_FILENAME = "uEnv-${MACHINE}.txt"
SPL_BINARY = "SPL"
KERNEL_IMAGETYPE = "zImage"
KERNEL_DEVICETREE = "imx6dl-cubox-i.dtb imx6q-cubox-i.dtb imx6dl-hummingboard.dtb imx6q-hummingboard.dtb"
MACHINE_FEATURES += "pci wifi bluetooth alsa irda serial usbhost"
MACHINE_EXTRA_RRECOMMENDS += "bcm4330-nvram-config"
SERIAL_CONSOLE = "115200 ttymxc0"
Thus we can tell that the HummingBoards sport a MX6 processor. It also comes with a custom kernel linux-cubox-i
, uses uboot for booting and a kernel device tree to seperate the hardware description form the rest of the kernel.
The HummingBoard machine description alos include two other machine definition files
require conf/machine/include/imx-base.inc
require conf/machine/include/tune-cortexa9.inc
The are loaded from other layers. imx-base
is part of the meta-fsl-arm
layer and tune-cortexa9.inc
reside inside the meta
layer that ist part of the yocto base.
imx-base
includes several preferred provider entries for Freescale Processors, as well as the uboot entry points for said processors.
Configuring the build
Edit your local.conf
file
$ nano conf/local.conf
- Search for the line
#DL_DIR ?= "${TOPDIR}/downloads"
and change it to reflect your shared download directory. - At the end of the file append the following lines to activate the build history
INHERIT += "buildhistory"
BUILDHISTORY_COMMIT = "1"
- At the MACHIN
Ee section add
MACHINE ?= "cubox-i"
Adding the freescale and freescale-extra BSP layers
Edit your bblayers.conf
file
$ nano conf/bblayers.conf
Add the freescale layer to the BBLAYERS block by changing
BBLAYERS ?= " \
/home/lari/yocto_ordi/poky/meta \
/home/lari/yocto_ordi/poky/meta-yocto \
/home/lari/yocto_ordi/poky/meta-yocto-bsp \
"
to
BBLAYERS ?= " \
/home/lari/yocto_ordi/poky/meta \
/home/lari/yocto_ordi/poky/meta-yocto \
/home/lari/yocto_ordi/poky/meta-yocto-bsp \
/home/lari/yocto_ordi/poky/meta-fls-arm \
/home/lari/yocto_ordi/poky/meta-fls-arm-extra \
"