This document describes how Embedian builds a customized version of NXP’s i.MX6 official Yocto Mickledore BSP release for Embedian’s SMARC-FiMX6 product platform. The approach is to pull from Embedian’s Github repository and build that using bitbake. The reason why we use this approach is that it allows co-development. The build output is comprised of binary images, feed packages, and an SDK for SMARC-FiMX6 specific development.

NXP makes their i.MX series official bsp build scripts available via the following GIT repository:
Freescale community BSP release build script is available via the following repository:
It is this repository that actually pulls in the meta-imx/meta-bsp project to perform the Linux BSP builds for NXP’s i.MX6 ARM Cortext-A9 chips.
Overview of the meta-embedian Yocto Layer
The supplied meta-embedian Yocto compliant layer has the following organization:
.
|-- conf
| |-- layer.conf
| |-- machine
| |-- include
| | |-- imx8mp-emb.inc
| |-- smarcimx932g.conf
| |-- smarcimx931g.conf
| |-- pitximx8mp2g.conf
| |-- pitximx8mp4g.conf
| |-- pitximx8mp6g.conf
| |-- smarcimx8qm8g.conf
| |-- smarcimx8qm4g.conf
| |-- smarcimx8mp6g.conf
| |-- smarcimx8mp4g.conf
| |-- smarcimx8mp2g.conf
| |-- smarcimx8mq4g.conf
| |-- smarcimx8mq2g.conf
| |-- smarcimx8mm4g.conf
| |-- smarcimx8mm2g.conf
| |-- smarcfimx7d2g.conf
| |-- smarcfimx7d.conf
| |-- smarcfimx7s.conf
| |-- smarcfimx6qp2g.conf
| |-- smarcfimx6qp1g.conf
| |-- smarcfimx6q2g.conf
| |-- smarcfimx6q1g.conf
| |-- smarcfimx6dl1g.conf
| | `-- smarcfimx6solo.conf
|-- README
|-- recipes-bsp
| |-- u-boot
| |-- u-boot-imx-common_2023.04.inc
| `-- u-boot-imx_2023.04.bb
| |-- imx-atf
| `-- imx-atf_2.8.bbappend
| | |-- imx-atf
| | | |-- 0001-imx8mm-allocate-uart4-to-cortex-a53.patch
| | | `-- 0001-imx8mp-pitx-change-console-port-to-ttymxc3.patch
| |-- imx-sc-firmware
| `-- imx-sc-firmware_%.bbappend
| | |-- imx-sc-firmware
| | | |-- mx8qm-smarc-8g-scfw-tcm.bin
| | | `-- mx8qm-smarc-4g-scfw-tcm.bin
| |-- alsa-state
| | |-- alsa-state
| | | `-- asound.state
| `-- alsa-state.bbappend
| |-- pm-utils
| `-- pm-utils_%.bbappend
| |-- imx-mkimage
| `-- imx-boot_1.0.bbappend
|-- recipes-core
| |-- busybox
| `-- busybox_%.bbappend
| | |-- busybox
| | | |-- ftpget.cfg
| | | `-- defconfig
| |-- base-files
| `-- base-files_%.bbappend
| | |-- base-files
| | | |-- issue
| | | `-- issue.net
| |-- systemd
| |-- systemd_%.bbappend
| | |-- systemd
| | | |-- 0001-units-add-dependencies-to-avoid-conflict-between-con.patch
| | | `-- 0002-units-disable-systemd-networkd-wait-online-if-Network.patch
| `-- systemd-serialgetty.bbappend
| | |-- systemd-serialgetty
| | | |-- disable-serialgetty.service
| | | `-- disable-serialgetty.sh
| |-- packagegroups
| `-- packagegroup-core-tools-testapps.bbappend
| |-- psplash
| `-- psplash_git.bbappend
| | |-- files
| | | |-- 0001-psplash-Change-colors-for-the-Embedian-Yocto-logo.patch
| | | |-- psplash-poky.png
| | | `-- psplash-bar.png
| |-- udev
| | |-- files
| | | | `-- usb-power.rules
| `-- udev-rules-imx.bbappend
|-- recipes-multimedia
| |-- gstreamer
| `-- gstreamer1.0-plugins-bad_1.22.5.imx.bbappend
| | |-- gstreamer1.0-plugins-bad
| | | `-- 0001-fix-display-fullscreen-vertical-positioning-issue.patch
`-- scripts
| `-- emb_mk_yocto_sdcard
Notes on meta-embedian layer content
conf/machine/*
This folder contains the machine definitions for all Embedian’s platform and backup repository in Embedian. These select the associated kernel, kernel config, u-boot, u-boot config, and tar.bz2 image settings.
recipes-bsp/u-boot/*
This folder contains recipes used to build DAS U-boot for all Embedian’s platform.
recipes-bsp/imx-atf/*
This folder contains recipes used to enable console port for Embedian’s i.MX8MM and pITX-MX8M-Plus platform.
recipes-bsp/imx-sc-firmware/*
This folder contains system control firmware binary for Embedian’s i.MX8QM platform.
recipes-bsp/alsa-state/*
This folder contains sgtl5000 sound chip default state for all Embedian’s platform.
recipes-bsp/imx-mkimage/*
This folder contains imx-mkimage tool for Embedian’s i.MX93, i.MX8MQ, i.MX8MM, i.MX8QM, i.MX8MP platform.
recipes-core/busybox/*
This folder remove telnetd from bysybox for all Embedian’s platform.
recipes-core/psplash/*
This folder customized Yocto boot psplash for all Embedian’s platform.
recipes-kernel/linux/*
Contains the recipes needed to build for all Embedian’s platform Linux kernels.
Setting Up the Tools and Build Environment
To build the latest NXP i.MX6 meta-bsp, you first need an Ubuntu 20.04 or 22.04 LTS installation. Since bitbake does not accept building images using root privileges, please do not login as a root user when performing the instructions in this section.
Once you have Ubuntu 20.04 or 22.04 LTS running, install the additional required support packages using the following console command:
$ sudo apt install gawk wget git diffstat unzip texinfo gcc build-essential chrpath socat cpio python3 python3-pip python3-pexpect xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev python3-subunit mesa-common-dev zstd liblz4-tool file libssl-dev pv device-tree-compiler locales -y
$ sudo locale-gen en_US.UTF-8
To get the BSP you need to have ‘repo’ installed and use it as:
Install the ‘repo’ utility:
$ mkdir ~/bin
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
$ export PATH=~/bin:$PATH
Download the BSP Yocto Project Environment.
$ mkdir ~/mickledore-release
$ cd ~/mickledore-release
$ repo init -u https://github.com/nxp-imx/imx-manifest -b imx-linux-mickledore -m imx-6.1.55-2.2.0.xml
$ repo sync
Download the Embedian Yocto build script and meta layer.
$ wget ftp://ftp.embedian.com/public/dev/minfs/mickledore/emb-imx-setup-release.sh
$ chmod 444 emb-imx-setup-release.sh
$ cd sources
$ git clone https://github.com/embedian/meta-embedian.git -b mickledore-6.1.55_2.2.0
$ cd ~/mickledore-release
$ DISTRO=fsl-imx-fb MACHINE=smarcfimx6q2g source emb-imx-setup-release.sh -b build-fb
Choose “y” to accept EULA.
This script will create and bring you to ~/mickledore-release/build-xwayland directory.
Notes
The last line of the above script
$ DISTRO=<distro name> MACHINE=<machine name> source emb-imx-setup-release.sh -b <build dir>
1.
<distro name>
– fsl-imx-wayland - Pure wayland weston graphics
– fsl-imx-xwayland - Wayland graphics and X11. X11 applications using EGL are not supported
– fsl-imx-fb - Frame Buffer graphics - no X11 or Wayland. Frame Buffer is not supported on i.MX8 and i.MX9.
2.
<machine name>
– smarcfimx6solo - if your board is solo core i.MX6 and 512MB DDR3L.
– smarcfimx6dl1g - if your board is dual lite core i.MX6 and 1GB DDR3L.
– smarcfimx6q1g - if your board is dual core or quad core i.MX6 and 1GB DDR3L.
– smarcfimx6q2g - if your board is dual core or quad core i.MX6 and 2GB DDR3L.
– smarcfimx6qp1g - if your board is quadplus core i.MX6 and 1GB DDR3L.
– smarcfimx6qp2g - if your board is quadplus core i.MX6 and 2GB DDR3L.
The default console debug port is
SER3.
In this document, we will use smarcfimx6q2g as the example of machine name. Users need to change different machine name if you have different SMARC card variants.
Building the Target Platforms
To build Embedian/Freescale Yocto BSP, use the following commands:
$ MACHINE=smarcfimx6q2g bitbake -k fsl-image-qt6-validation-imx
or
$ MACHINE=smarcfimx6q2g bitbake -k fsl-image-validation-imx
Notes
fsl-image-validation-imx provides a gui image without QT6.
fsl-image-qt6-validation-imx provides a QT6 image for x11, wayland or FB backends depending on your distro name.
If your machine name is smarcfimx6q2g and your gui image is without QT6, the following command gives you as an example,
$ MACHINE=smarcfimx6q2g bitbake -k fsl-image-validation-imx
The first build takes time.
Once it done, you can find all required images under ~/mickledore-release/<build directory>/tmp/deploy/images/<machine name>/
You may want to build programs that aren’t installed into a root file system so you can make them available via a feed site (described below.) To do this you can build the package directly and then build the package named package-index to add the new package to the feed site.
The following example builds the tcpdump program and makes it available on the feed site:
$ MACHINE=smarcfimx6q2g bitbake tcpdump
$ MACHINE=smarcfimx6q2g bitbake package-index
Once the build(s) are completed, you will find the resulting images, rpm and licenses in folder ~/mickledore-release/<build directory>/tmp/deploy
.
deploy/images/<machine name>/*
This folder contains the binary images for the root file system and the Embedian SMARC-FiMX6 specific version of the boot file, Image and device tree file. Specifically the images are:
deploy/images/<machine name>/u-boot.imx
This is u-boot binary file for SMARC-FiMX6.
deploy/images/<machine name>/zImage
The kernel Image for SMARC-FiMX6.
deploy/images/<machine name>/<device tee file>
Selecting display configuration is a matter of selecting an appropriate DTB file under deploy/images/<machine name>/<device tee file>
All available DTB files are listed in the table below.
DTB FILENAME | DESCRIPTION |
imx6dl-smarc.dtb | Device tree blob i.mx6 solo and dual lite core with HDMI or parallel RGB display configuration. |
imx6dl-smarc-wvga.dtb | Device tree blob i.mx6 solo and dual lite core with wvga resolutions LVDS display configuration. |
imx6dl-smarc-wxga.dtb | Device tree blob i.mx6 solo and dual lite core with wxga resolutions LVDS display configuration. |
imx6dl-smarc-xga.dtb | Device tree blob i.mx6 solo and dual lite core with xga resolutions LVDS display configuration. |
imx6dl-smarc-1080p.dtb | Device tree blob i.mx6 solo and dual lite core with 1080p resolutions LVDS display configuration. |
imx6q-smarc.dtb | Device tree blob i.mx6 dual and quad core with HDMI or parallel RGB display configuration. |
imx6q-smac-wvga.dtb | Device tree blob i.mx6 dual and quad core with wvga resolutions LVDS display configuration. |
imx6q-smac-wxga.dtb | Device tree blob i.mx6 dual and quad core with wxga resolutions LVDS display configuration. |
imx6q-smac-xga.dtb | Device tree blob i.mx6 dual and quad core with xga resolutions LVDS display configuration. |
imx6q-smac-1080p.dtb | Device tree blob i.mx6 dual and quad core with 1080p resolutions LVDS display configuration. |
imx6qp-smarc.dtb | Device tree blob i.mx6 quadplus core with HDMI or parallel RGB display configuration. |
imx6qp-smarc-wvga.dtb | Device tree blob i.mx6 quadplus core with wvga resolutions LVDS display configuration. |
imx6qp-smarc-wxga.dtb | Device tree blob i.mx6 quadplus core with wxga resolutions LVDS display configuration. |
imx6qp-smarc-xga.dtb | Device tree blob i.mx6 quadplus core with xga resolutions LVDS display configuration. |
imx6qp-smarc-1080p.dtb | Device tree blob i.mx6 quadplus core with 1080p resolutions LVDS display configuration. |
deploy/images/<machine name>/fsl-image-validation-imx-<machine name>.*
Embedian root file system images for software development on Embedian’s SMARC-FiMX6 platforms without QT6.
deploy/images/<machine name>/fsl-image-qt6-validation-imx-<machine name>.*
Embedian root file system images for software development on Embedian’s SMARC-FiMX6 with QT6.
deploy/deb/*
This folder contains all the packages used to construct the root file system images. They are in deb format (similar format to Debian packages) and can be dynamically installed on the target platform via a properly constructed feed file. Here is an example of the feed file (named base- feeds.conf) that is used internally at Embedian to install upgrades onto a SMARC-FiMX6 platform without reflashing the file system:
src/gz all http://<ip address>/all
src/gz cortexa9hf-neon http://<ip address>/cortexa9hf-neon
src/gz cortexa9t2hf-neon http://<ip addresss>/cortexa9t2hf-neon
src/gz cortexa9t2hf-neon-mx6qdl http://<ip addresss>/cortexa9t2hf-neon-mx6qdl
src/gz smarcfimx6q2g http://<ip addresss>/smarcfimx6q2g
deploy/licenses/*
A database of all licenses used in all packages built for the system.
Setup SD Card Manually
For these instruction, we are assuming: DISK=/dev/mmcblk0, “lsblk” is very useful for determining the device id.
$ export DISK=/dev/mmcblk0
Erase SD card:
$ sudo dd if=/dev/zero of=${DISK} bs=1M count=160
Create Partition Layout: Leave 1MB offset for boot file. With util-linux v2.26, sfdisk was rewritten and is now based on libfdisk.
(sfdisk)
$ sudo sfdisk --version
sfdisk from util-linux 2.34
Create Partitions:
(sfdisk >=2.26.x)
$ sudo sfdisk ${DISK} <<-__EOF__
1M,48M,0x83,*
,,,-
__EOF__
Format Partitions:
for: DISK=/dev/mmcblk0$ sudo mkfs.vfat -F 16 ${DISK}p1 -n boot
$ sudo mkfs.ext4 ${DISK}p2 -L rootfs
for: DISK=/dev/sdX$ sudo mkfs.vfat -F 16 ${DISK}1 -n boot
$ sudo mkfs.ext4 ${DISK}2 -L rootfs
Mount Partitions:
On some systems, these partitions may be auto-mounted…
$ sudo mkdir -p /media/boot/
$ sudo mkdir -p /media/rootfs/
for: DISK=/dev/mmcblk0$ sudo mount ${DISK}p1 /media/boot/
$ sudo mount ${DISK}p2 /media/rootfs/
for: DISK=/dev/sdX$ sudo mount ${DISK}1 /media/boot/
$ sudo mount ${DISK}2 /media/rootfs/
Boot file is factory default flashed at on-module SPI NOR flash.
Install Bootloader
The u-boot.imx is pre-installed in SPI NOR flash at factory default. SMARC-FiMX6 is designed to always boot up from SPI NOR flash and to load zImage, device tree blob and root file systems based on the setting of BOOT_SEL. If users need to write their own u-boot or perform u-boot upgrade. This section will instruct you how to do that.
Copy u-boot.imx to the first boot partition of your SD card.
~/mickledore-release/<build dir>/tmp/deploy/images/<machine name>/
$ sudo cp -v u-boot.imx /media/boot/u-boot.imx
Write u-boot.imx to the SPI NOR flash.
Stop at U-Boot command prompt (Press any key when booting up). Copy and Paste the following script under u-boot command prompt.
U-Boot Command Prompt
U-Boot# mmc rescan; mmc dev; load mmc 1:1 0x10800000 u-boot.imx; sf probe; sleep 2; sf erase 0 0xc0000; sf write 0x10800000 0x400 a0000
In some cases, when SPI NOR flash is erased or the u-boot is under development, we need a way to boot from SD card first. Users need to shunt cross the TEST# pin to ground. In this way, SMARC-FiMX6 will always boot up from SD card.
Write u-boot.imx to the SD card
~/mickledore-release/<build dir>/tmp/deploy/images/<machine name>/
$ sudo dd if=u-boot.imx of=${DISK} bs=512 seek=2
Notes
1. If your u-boot hasn’t been finalized and still under development, it is recommended to shunt cross the test pin and boot directly from SD card first (shunt cross TEST# to GND). Once your u-boot is fully tested and finalized, you can write your u-boot to SPI NOR flash.
2. When TEST# pin of SMARC-FiMX6 is not shunt crossed, it will always boot up from on-module SPI NOR flash. U-boot will read the BOOT_SEL configuration and determine where it should load Image and device tree blob. When TEST# is shunt crossed (pull low), it will always boot up from SD card.
Install uEnv.txt based bootscript
Create “uEnv.txt” boot script: ($ vim uEnv.txt)
~/uEnv.txt
#####HDMI######
optargs="video=mxcfb0:dev=hdmi,1280x720M@60,if=RGB24,bpp=32 consoleblank=0"
#####LVDS#####
#optargs="video=mxcfb0:dev=ldb,if=RGB24,bpp=32 consoleblank=0 fbmem=24M vmalloc=400M"
#####Parallel LCD Setting#####
#optargs="video=mxcfb0:dev=lcd,CLAA-WVGA,if=RGB24,bpp=32 consoleblank=0 fbmem=24M vmalloc=400M"
#####Parallel LCD to CH7055A (VESA Timing Format) Setting #####
#optargs="video=mxcfb0:dev=lcd,768x576M@75,if=RGB24,bpp=32 consoleblank=0"
#optargs="video=mxcfb0:dev=lcd,1280x1024M@60,if=RGB24,bpp=32 consoleblank=0"
#optargs="video=mxcfb0:dev=lcd,640x480M@60,if=RGB24,bpp=32 consoleblank=0"
console=ttymxc4,115200
mmcdev=1
mmcpart=1
image=zImage
loadaddr=0x12000000
fdt_addr=0x18000000
mmcroot=/dev/mmcblk1p2 ro
mmcrootfstype=ext4 rootwait fixrtc
netdev=eth0
ethact=FEC0
ipaddr=192.168.1.150
serverip=192.168.1.53
gatewayip=192.168.1.254
mmcargs=setenv bootargs console=${console} root=${mmcroot} rootfstype=${mmcrootfstype} ${optargs}
uenvcmd=run loadzimage; run loadfdt; run mmcboot
Copy uEnv.txt to the boot partition:
~/
$
sudo cp -v ~/uEnv.txt /media/boot/
Install Linux Kernel zImage
Copy Image to the boot partition:
~/mickledore-release/<build dir>/tmp/deploy/images/<machine name>/
$ sudo cp -v zImage /media/boot/
Install Linux Kernel Device Tree Binary
~/mickledore-release/<build dir>/tmp/deploy/images/<machine name>/
$ sudo mkdir -p /media/boot/dtbs
$ sudo cp -v imx6q-smarc.dtb /media/boot/dtbs/imx6q-smarc.dtb
$ sudo cp -v imx6qp-smarc.dtb /media/boot/dtbs/imx6qp-smarc.dtb
$ sudo cp -v imx6dl-smarc.dtb /media/boot/dtbs/imx6dl-smarc.dtb
All available DTB binary files are listed in the table below.
DTB FILENAME | DESCRIPTION |
imx6dl-smarc.dtb | Device tree blob i.mx6 solo and dual lite core with HDMI or parallel RGB display configuration. |
imx6dl-smarc-wvga.dtb | Device tree blob i.mx6 solo and dual lite core with wvga resolutions LVDS display configuration. |
imx6dl-smarc-wxga.dtb | Device tree blob i.mx6 solo and dual lite core with wxga resolutions LVDS display configuration. |
imx6dl-smarc-xga.dtb | Device tree blob i.mx6 solo and dual lite core with xga resolutions LVDS display configuration. |
imx6dl-smarc-1080p.dtb | Device tree blob i.mx6 solo and dual lite core with 1080p resolutions LVDS display configuration. |
imx6q-smarc.dtb | Device tree blob i.mx6 dual and quad core with HDMI or parallel RGB display configuration. |
imx6q-smac-wvga.dtb | Device tree blob i.mx6 dual and quad core with wvga resolutions LVDS display configuration. |
imx6q-smac-wxga.dtb | Device tree blob i.mx6 dual and quad core with wxga resolutions LVDS display configuration. |
imx6q-smac-xga.dtb | Device tree blob i.mx6 dual and quad core with xga resolutions LVDS display configuration. |
imx6q-smac-1080p.dtb | Device tree blob i.mx6 dual and quad core with 1080p resolutions LVDS display configuration. |
imx6qp-smarc.dtb | Device tree blob i.mx6 quadplus core with HDMI or parallel RGB display configuration. |
imx6qp-smarc-wvga.dtb | Device tree blob i.mx6 quadplus core with wvga resolutions LVDS display configuration. |
imx6qp-smarc-wxga.dtb | Device tree blob i.mx6 quadplus core with wxga resolutions LVDS display configuration. |
imx6qp-smarc-xga.dtb | Device tree blob i.mx6 quadplus core with xga resolutions LVDS display configuration. |
imx6qp-smarc-1080p.dtb | Device tree blob i.mx6 quadplus core with 1080p resolutions LVDS display configuration. |
~/mickledore-release/<build dir>/tmp/deploy/images/<machine name>
1. If you are using LVDS panel, copy the corresponding device tree blob into SD card as follows.
For WVGA (800×480) LVDS display:
$ sudo cp -v imx6q-smarc-wvga.dtb /media/boot/dtbs/imx6q-smarc.dtb
$ sudo cp -v imx6dl-smarc-wvga.dtb /media/boot/dtbs/imx6dl-smarc.dtb
$ sudo cp -v imx6qp-smarc-wvga.dtb /media/boot/dtbs/imx6qp-smarc.dtb
For XGA (1024×768) LVDS display:
$ sudo cp -v imx6q-smarc-xga.dtb /media/boot/dtbs/imx6q-smarc.dtb
$ sudo cp -v imx6dl-smarc-xga.dtb /media/boot/dtbs/imx6dl-smarc.dtb
$ sudo cp -v imx6qp-smarc-xga.dtb /media/boot/dtbs/imx6qp-smarc.dtb
For WXGA (1366×768) LVDS display:
$ sudo cp -v imx6q-smarc-wxga.dtb /media/boot/dtbs/imx6q-smarc.dtb
$ sudo cp -v imx6dl-smarc-wxga.dtb /media/boot/dtbs/imx6dl-smarc.dtb
$ sudo cp -v imx6qp-smarc-wxga.dtb /media/boot/dtbs/imx6qp-smarc.dtb
For 1080p (1920×1080) LVDS display:
$ sudo cp -v imx6q-smarc-1080p.dtb /media/boot/dtbs/imx6q-smarc.dtb
$ sudo cp -v imx6dl-smarc-1080p.dtb /media/boot/dtbs/imx6dl-smarc.dtb
$ sudo cp -v imx6qp-smarc-1080p.dtb /media/boot/dtbs/imx6qp-smarc.dtb
Install Root Filesystem
Extract the Yocto built root filesystem to your SD card
~/mickledore-release/<build dir>/tmp/deploy/images/<machine name>/
$ sudo tar jxvf <filename.tar.bz2> -C /media/rootfs
Notes
1. SMARC-FiMX6 always boots up from on-module SPI NOR flash first. The bootloader file in SPI NOR flash is factory pre-installed from Embedian. It will read the BOOT_SEL configuration that defined by SMARC specification on your carrier board and load Image and device tree blob from the partition one of the device (could be SD card, eMMC, GBE,..etc) that you selected.
2. MAC address is factory pre-installed at on board I2C EEPROM at offset 60 bytes. It starts with Embedian’s vendor code 10:0D:32. u-boot will read it and pass this parameter to kernel.
3. The kernel modules is included in the Yocto rootfs.
Remove SD card:
$ sync
$ sudo umount /media/boot
$ sudo umount /media/rootfs
Setup SD Card Automatically
This section tells you how to set up an SD card automatically. It mainly uses a script to do all the steps in the above section.
$ cd ~/mickledore-release
$ sudo MACHINE=smarcfimx6q2g sources/meta-embedian/scripts/emb_mk_yocto_sdcard/emb-create-yocto-sdcard.sh /dev/sdX
Shunt cross TEST# pin to ground and set the BOOT_SEL to ON OFF OFF. The module will boot up from SD card.
Feed Packages
You need to setup Apache2 web server on your development host machine first.
The Apache server default web page directory is /var/www/html .We need to populate it with a link pointing to our deb package repository.
$ sudo ln -s /path/to/build-yocto/tmp/deploy/deb /var/www/html/deb
The following procedure can be used on a Embedian SMARC-FiMX6 device to download and utilize the feed file show above to install the tcpdump terminal emulation program:
# vim /etc/apt/sources.list.d/yocto.list
Only keep the following four lines.
deb https://<ip address>/all ./
deb http://<ip address>/cortexa9hf-neon ./
deb http://<ip address>/cortexa9t2hf-neon ./
deb http://<ip address>/cortexa9t2hf-neon-mx6qdl ./
deb http://<ip address>/smarcfimx6q2g ./
# apt-get update
# apt-get upgrade
# apt-get install tcpdump
Writing Bitbake Recipes
In order to package your application and include it in the root filesystem image, you must write a BitBake recipe for it.
When starting from scratch, it is easiest to learn by example from existing recipes.
Example HelloWorld recipe using autotools
For software that uses autotools (./configure; make; make install), writing recipes can be very simple:
DESCRIPTION = "Hello World Recipe using autotools"
HOMEPAGE = "http://www.embedian.com/"
SECTION = "console/utils"
PRIORITY = "optional"
LICENSE = "GPL"
PR = "r0"
SRC_URI = "git://github.com/embedian/helloworld-autotools.git;protocol=https"
S = "${WORKDIR}/git"
inherit autotools
SRC_URI
specifies the location to download the source from. It can take the form of any standard URL using http://, ftp://, etc. It can also fetch from SCM systems, such as git in the example above.
PR
is the package revision variable. Any time a recipe is updated that should require the package to be rebuilt, this variable should be incremented.
inherit autotools
brings in support for the package to be built using autotools, and thus no other instructions on how to compile and install the software are needed unless something needs to be customized.
S
is the source directory variable. This specifies where the source code will exist after it is fetched from SRC_URI and unpacked. The default value is ${WORKDIR}/${PN}-${PV}
, where PN
is the package name and PV
is the package version. Both PN
and PV
are set by default using the filename of the recipe, where the filename has the format PN_PV.bb
.
Example HelloWorld recipe using a single source file
This example shows a simple case of building a helloworld.c file directly using the default compiler (gcc). Since it isn’t using autotools or make, we have to tell BitBake how to build it explicitly.
DESCRIPTION = "HelloWorld"
SECTION = "examples"
LICENSE = "GPL"
SRC_URI = "file://helloworld.c"
S = "${WORKDIR}"
do_compile() {
${CC} ${CFLAGS} ${LDFLAGS} helloworld.c -o helloworld
}
do_install() {
install -d ${D}${bindir}
install -m 0755 helloworld ${D}${bindir}
}
In this case, SRC_URI
specifies a file that must exist locally with the recipe. Since there is no code to download and unpack, we set S
to WORKDIR
since that is where helloworld.c will be copied to before it is built.
WORKDIR
is located at ${OETREE}/<build directory>/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/<package name and version>
for most packages. If the package is machine-specific (rather than generic for the armv8a architecture), it may be located in the cortexa9hf-neon-poky-linux-gnueabi
subdirectory depending on your hardware (this applies to kernel packages, images, etc).
do_compile
defines how to compile the source. In this case, we just call gcc directly. If it isn’t defined, do_compile
runs make
in the source directory by default.
do_install
defines how to install the application. This example runs install
to create a bin directory where the application will be copied to and then copies the application there with permissions set to 755.
D
is the destination directory where the application is installed to before it is packaged.
${bindir}
is the directory where most binary applications are installed, typically /usr/bin
.
For a more in-depth explanation of BitBake recipes, syntax, and variables, see the Recipe Chapter of the OpenEmbedded User Manual.
Setup eMMC Manually
Setting up eMMC usually is the last step at development stage after the development work is done at your SD card or NFS environments. From software point of view, eMMC is nothing but a non-removable SD card on board. For SMARC-FiMX6, the SD card is always emulated as /dev/mmcblk1
and on-module eMMC is always emulated as /dev/mmcblk3
. Setting up eMMC now is nothing but changing the device descriptor.
This section gives a step-by-step procedure to setup eMMC flash. Users can write a shell script your own at production to simplify the steps.
First, we need to backup the final firmware from your SD card or NFS.
Prepare for eMMC binaries from SD card (or NFS):
Insert SD card into your Linux PC. For these instructions, we are assuming: DISK=/dev/mmcblk0, “lsblk” is very useful for determining the device id.
For these instruction, we are assuming: DISK=/dev/mmcblk0
, “lsblk
” is very useful for determining the device id.
$ export DISK=/dev/mmcblk0
Mount Partitions:
On some systems, these partitions may be auto-mounted…
$ sudo mkdir -p /media/boot/
$ sudo mkdir -p /media/rootfs/
for: DISK=/dev/mmcblk0
$ sudo mount ${DISK}p1 /media/boot/
$ sudo mount ${DISK}p2 /media/rootfs/
for: DISK=/dev/sdX
$ sudo mount ${DISK}1 /media/boot/
$ sudo mount ${DISK}2 /media/rootfs/
Copy zImage to rootfs partition
~/mickledore-release/<build dir>/tmp/deploy/images/<machine name>/
$ sudo cp -v zImage /media/rootfs/home/root
Copy uEnv.txt to rootfs partition
Copy and paste the following contents to /media/rootfs/home/root ($ sudo vim /media/rootfs/home/root/uEnv.txt)
~/uEnv.txt
#####HDMI######
optargs="video=mxcfb0:dev=hdmi,1280x720M@60,if=RGB24,bpp=32 consoleblank=0"
#####LVDS#####
#optargs="video=mxcfb0:dev=ldb,if=RGB24,bpp=32 consoleblank=0 fbmem=24M vmalloc=400M"
#####Parallel LCD Setting#####
#optargs="video=mxcfb0:dev=lcd,CLAA-WVGA,if=RGB24,bpp=32 consoleblank=0 fbmem=24M vmalloc=400M"
#####Parallel LCD to CH7055A (VESA Timing Format) Setting #####
#optargs="video=mxcfb0:dev=lcd,768x576M@75,if=RGB24,bpp=32 consoleblank=0"
#optargs="video=mxcfb0:dev=lcd,1280x1024M@60,if=RGB24,bpp=32 consoleblank=0"
#optargs="video=mxcfb0:dev=lcd,640x480M@60,if=RGB24,bpp=32 consoleblank=0"
console=ttymxc4,115200
mmcdev=3
mmcpart=1
image=zImage
loadaddr=0x12000000
fdt_addr=0x18000000
mmcroot=/dev/mmcblk3p2 ro
mmcrootfstype=ext4 rootwait fixrtc
netdev=eth0
ethact=FEC0
ipaddr=192.168.1.150
serverip=192.168.1.53
gatewayip=192.168.1.254
mmcargs=setenv bootargs console=${console} root=${mmcroot} rootfstype=${mmcrootfstype} ${optargs}
uenvcmd=run loadzimage; run loadfdt; run mmcboot
Copy device tree binary to rootfs partition
~/mickledore-release/<build dir>/tmp/deploy/images/<machine name>/
$ sudo cp -v imx6q-smarc.dtb /media/rootfs/home/root/imx6q-smarc.dtb
$ sudo cp -v imx6dl-smarc.dtb /media/rootfs/home/root/imx6dl-smarc.dtb
$ sudo cp -v imx6qp-smarc.dtb /media/rootfs/home/root/imx6qp-smarc.dtb
Copy final root file system to rootfs partition
~/mickledore-release/<build dir>/tmp/deploy/images/<machine name>/
$ pushd /media/rootfs
$ sudo tar cvfz ~/smarcfimx6-emmc-rootfs.tar.gz .
$ sudo mv ~/smarcfimx6-emmc-rootfs.tar.gz /media/rootfs/home/root
$ popd
Remove SD card:
$ sync
$ sudo umount /media/boot
rootfs$ sudo umount /media/
Copy Binaries to eMMC from SD card
Insert this SD card into your SMARC-FiMX6 device.
Now it will be almost the same as you did when setup your SD card, but the eMMC device descriptor is /dev/mmcblk3 now. Booting up the device from SD card (shunt cross TEST#).
$ export DISK=/dev/mmcblk3
Erase eMMC:
$ sudo dd if=/dev/zero of=${DISK} bs=1M count=160
Create Partition Layout:
$ sudo sfdisk ${DISK} <<-__EOF__
1M,48M,0x83,*
,,,-
__EOF__
Format Partitions:
$ sudo mkfs.vfat -F 16 ${DISK}p1 -n boot
$ sudo mkfs.ext4 ${DISK}p2 -L rootfs
Mount Partitions:
$ sudo mkdir -p /media/boot/
$ sudo mkdir -p /media/rootfs/
$ sudo mount ${DISK}p1 /media/boot/
$ sudo mount ${DISK}p2 /media/rootfs/
Copy binaries to boot partition
Copy uEnv.txt/Image/*.dtb to the boot partition
$ sudo cp -v Image uEnv.txt /media/boot/
Copy Linux kernel device tree binary
$ sudo mkdir -p /media/boot/dtbs
$ sudo cp -v imx6q-smarc.dtb imx6dl-smarc.dtb imx6qp-smarc.dtb /media/boot/dtbs/
Copy root file system to rootfs partition
$ sudo tar -zxvf smarcfimx6-emmc-rootfs.tar.gz -C /media/rootfs
Unmount eMMC:
$ sync
$ sudo umount /media/boot
$ sudo umount /media/rootfs
Switch your Boot Select to eMMC (OFF ON ON) and you will be able to boot up from eMMC now.
Setup eMMC Automatically
Boot up the module from SD card and run the following script. The Yocto images will be written into on-module eMMC.
$ smarc-fimx6-create-yocto-emmc.sh /dev/mmcblk3 >/dev/null 2>&1
version 1.0a, 10/28/2024
Last updated 2024-10-28