DART-6UL Yocto Morty Build Yocto release

From Variscite Wiki
DART-6UL - Yocto Morty 2.2.1 based on FSL Community BSP 2.2 with L4.1.15_2.0.0-ga Linux release

Installing required packages

Follow the link below and install all required packages on your machine.

www.yoctoproject.org/docs/latest/yocto-project-qs/yocto-project-qs.html

Please make sure you host PC is running Ubuntu 16.04 64-bit and install the following packages:

sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat libsdl1.2-dev
sudo apt-get install autoconf libtool libglib2.0-dev libarchive-dev
sudo apt-get install python-git xterm sed cvs subversion coreutils texi2html
sudo apt-get install docbook-utils python-pysqlite2 help2man make gcc g++ desktop-file-utils libgl1-mesa-dev
sudo apt-get install libglu1-mesa-dev mercurial automake groff curl lzop asciidoc u-boot-tools dos2unix mtd-utils
sudo apt-get install pv

Documentation

  • Yocto Project Core - Morty 2.2.1 (released on 02/24/2017)

Documentation is available from www.yoctoproject.org

  • FSL Community BSP Release Notes 2.2 documentation

Documentation is available from http://freescale.github.io

  • Kernel documentation from fsl-yocto-L4.1.15_2.0.0-ga release

Documentation is available for download from fsl-yocto-imx-4.1.15_2.0.0-docs

Download Yocto Morty based on Freescale Community BSP

$ git config --global user.name "Your Name"
$ git config --global user.email "Your Email"

$ mkdir ~/bin (this step may not be needed if the bin folder already exists)
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
$ export PATH=~/bin:$PATH

$ mkdir ~/var-fslc-yocto
$ cd ~/var-fslc-yocto
$ repo init -u https://github.com/varigit/variscite-bsp-platform.git -b morty
$ repo sync -j4

Setup and build Yocto

Supported images

The following images are provided by Variscite for evaluation purpose

  • fsl-image-gui: Default Variscite demo image with a GUI without any QT content. This image recipe works on all backends for X11,DirectFB, Frame Buffer and Wayland and the content is limited to fit 512MB NAND.
  • fsl-image-qt5: Extends fsl-image-gui image with QT5.7.1 support and various QT samples for X11, Frame Buffer and Wayland backends

The following images are provided by FSL Community BSP:

  • fsl-image-machine-test: A console-only image that includes gstreamer packages, Freescale’s multimedia packages (VPU and GPU), and test and benchmark applications.
  • fsl-image-mfgtool-initramfs: Small image to be used with Manufacturing Tool (mfg-tool) in a production environment.
  • fsl-image-multimedia/fsl-image-multimedia-full: A console-only image that includes gstreamer packages and Freescale’s multimedia packages (VPU and GPU)

See the list of Yocto Project’s reference images in Yocto Project Reference Manual

Supported distros

The following distros can be used:

  • fslc-x11: Distro for X11 without wayland. This distro include x11 feature and doesn’ has wayland support.
  • fslc-framebuffer: Distro for Framebuffer graphical backend. This distro doesn’t include x11 and wayland features.
  • fslc-wayland: Distro for Wayland without X11. This distro include wayland feature but doesn’t has x11 support.
  • fslc-xwayland: Distro for Wayland with X11. This distro include both wayland and x11 features.

Note: Also standard Poky distros can be used

GStreamer support

FSL community BSP comes with gstreamer-imx, a set of GStreamer1.0 plugins for i.MX platform, which make use of the i.MX multimedia capabilities.
Some of the multimedia plugins do not work well with X11 and Wayland backends.
To get the most from gstreamer-imx, it is recommended to use fslc-framebufer distro with one of the demo images

Build X11 GUI demo image

$ cd ~/var-fslc-yocto
$ MACHINE=imx6ul-var-dart DISTRO=fslc-x11 . setup-environment build_x11

Optional steps: local.conf customization

launch bitbake:

Without Qt content:
$ bitbake fsl-image-gui

Or with Qt content:
$ bitbake fsl-image-qt5

NOTE: Some of the blitter-based I.MX GStreamer plugins do not work with X11 and Wayland backends. To get the most of the I.MX GPU/VPU acceleration use the fslc-framebuffer backend

Build console-only demo image with Freescale’s multimedia packages (VPU and GPU)

$ cd ~/var-fslc-yocto
$ MACHINE=imx6ul-var-dart DISTRO=fslc-framebuffer . setup-environment build_fb

Optional steps: local.conf customization

Without Qt content:
$ bitbake fsl-image-gui

Or with Qt content:
$ bitbake fsl-image-qt5

local.conf customization

Change the downloads directory

Create a /opt/yocto_downloads directory and set its permissions:

$ sudo mkdir /opt/yocto_downloads
$ sudo chmod 777 /opt/yocto_downloads/

Direct downloads to it, by replacing 'DL_DIR ?= "${BSPDIR}/downloads/"' with 'DL_DIR = "/opt/yocto_downloads/"' in conf/local.conf:

$ sed -i 's/DL_DIR ?= "${BSPDIR}\/downloads/DL_DIR = "\/opt\/yocto_downloads/g' conf/local.conf

Add Eclipse debug and Qt creator support to your images

Append the following to the conf/local.conf file in your Yocto build directory, to add Eclipse debug and Qt creator support to your images:

EXTRA_IMAGE_FEATURES = " \
    debug-tweaks \
    tools-debug \
    eclipse-debug \
    "

IMAGE_INSTALL_append = " \
    tcf-agent \
    openssh-sftp-server \
    "

Use systemd instead of SysV init

Append the following to the conf/local.conf file in your Yocto build directory, to use systemd instead of SysV init in your images:

DISTRO_FEATURES_append = " systemd"
VIRTUAL-RUNTIME_init_manager = "systemd"
DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit"
VIRTUAL-RUNTIME_initscripts = ""
IMX_DEFAULT_DISTRO_FEATURES_append = " systemd"

Build Results

The resulted images are located at tmp/deploy/images/imx6ul-var-dart:

File Name Description
fsl-image-gui-imx6ul-var-dart.sdcard This image is for SD card boot.
It can be flashed as-is on an SD card that can then be used to boot your system.
For detailed information refer to the Create a bootable SD card section below.
fsl-image-gui-imx6ul-var-dart.tar.bz2 Tarball with rootfs files.
Can be used to create an NFS root file system on the host.
See the Setup TFTP/NFS Yocto system section for more info.
Also used to create our extended SD card.
See the Create a bootable SD card section below.
fsl-image-gui-imx6ul-var-dart.ubi A complete UBI image containing a UBIFS volume, for writing to NAND flash.
zImage Linux kernel image, same binary for SD card/eMMC/NAND flash.
SPL-nand SPL built for NAND flash. The SPL is a pre-U-Boot SW component, used for DDR initialization
SPL-sd SPL built for SD card boot. The SPL is pre-U-Boot SW component, used for DDR initialization
u-boot.img-sd U-Boot built for SD card/eMMC.
u-boot.img-nand U-Boot built for NAND flash.
zImage-imx6ul-var-dart-emmc_wifi.dtb Device tree blob for DART-6UL with eMMC & WI-FI enabled. (SD card & NAND disabled)
zImage-imx6ul-var-dart-nand_wifi.dtb Device tree blob for DART-6UL with NAND flash & WI-FI enabled. (SD card & eMMC disabled)
zImage-imx6ul-var-dart-sd_emmc.dtb Device tree blob for DART-6UL with SD card & eMMC enabled (WIFI & NAND disabled)
zImage-imx6ul-var-dart-sd_nand.dtb Device tree blob for DART-6UL with SD card & NAND flash enabled (WIFI & eMMC disabled)
zImage-imx6ull-var-dart-emmc_wifi.dtb Device tree blob for DART-6ULL with eMMC & WI-FI enabled. (SD card & NAND disabled)
zImage-imx6ull-var-dart-nand_wifi.dtb Device tree blob for DART-6ULL with NAND flash & WI-FI enabled. (SD card & eMMC disabled)
zImage-imx6ull-var-dart-sd_emmc.dtb Device tree blob for DART-6ULL with SD card & eMMC enabled (WIFI & NAND disabled)
zImage-imx6ull-var-dart-sd_nand.dtb Device tree blob for DART-6ULL with SD card & NAND flash enabled (WIFI & eMMC disabled)

Create a bootable SD card

SD card structure

The first unallocated 4MiB are saved for U-Boot. It can be replaced using the dd command as described in the [[DART-6UL_Yocto_Krogoth_Build_U-Boot_out_of_tree|Build U-Boot from source code] section.
The first partition is formatted with FAT16 and contains the Linux image and device tree blobs. You can copy them as described in the Build the Linux kernel from source code section.
The second partition is formatted with ext4 and contains the file system (including the kernel modules).

Yocto pre-built bootable SD card

The Yocto build products contains many files as explained in Build Results section above including a ".sdcard" file. For example, fsl-image-gui-imx6ul-var-dart.sdcard, depending on your build.
This is a complete image to be flashed directly to an SD card.
Example usage:

$ cd ~/var-fslc-yocto/build_x11
$ sudo umount /dev/sdX*
$ sudo dd if=tmp/deploy/images/imx6ul-var-dart/fsl-image-gui-imx6ul-var-dart.sdcard of=/dev/sdX bs=1M && sync
Replace sdX with the right device name.

Drawbacks of the native .sdcard yocto-built image:

  • The second partition size doesn't use the entire SD card.
  • The second partition is not labeled as rootfs.
  • The NAND and eMMC flashing scripts are not included.

Create an extended SD card

Variscite provides the var-create-yocto-sdcard.sh script which creates our NAND/eMMC recovery SD card - an SD card based on the fsl-image-gui filesystem, which copies the NAND flash burning scripts and relevant binaries for your convenience.
Later, you will be able to follow either the more automatic DART-6UL Yocto Recovery SD card guide or the more manual Flashing the internal storage device guide to burn your images to NAND flash or eMMC.

Note:
This is essentially the same as our pre-built Recovery SD image, with the following main difference:
The pre-built image's rootfs partition size is 3700MiB, which is also the default size when using the script, but the script also has an option to set the rootfs partition size to fill the whole free space of the used SD card. Anyway, you can always resize the partition later with an external tool such as gparted.
Naturally, the pre-built image is more straight forward and easier to use, while the script method is easier to customize.

Usage:

  • Follow the Setup and build Yocto guide, and bitbake fsl-image-gui.
  • Plug-in the SD card to your Linux HOST PC, run dmesg and see which device is added (i.e. /dev/sdX or /dev/mmcblkX)
$ sudo MACHINE=imx6ul-var-dart ~/var-fslc-yocto/sources/meta-variscite-fslc/scripts/var_mk_yocto_sdcard/var-create-yocto-sdcard.sh <options> /dev/sdX
(Replace /dev/sdX with your actual device)
options:
  -h            Display help message
  -s            Only show partition sizes to be written, without actually write them
  -a            Automatically set the rootfs partition size to fill the SD card
  -r            Select alternative rootfs for recovery images (default: build_x11/tmp/deploy/images/imx6ul-var-dart/fsl-image-gui-imx6ul-var-dart.*)

If you don't use the '-a' option, a default rootfs size of 3700MiB will be used.
The '-r' option allows you to create a bootable SD card with an alternative image for the installation to NAND flash or eMMC.
Example: "-r tmp/deploy/images/imx6ul-var-dart/fsl-image-qt5-imx6ul-var-dart" -- selects the "Qt5 image with X11" recovery image

Boot board with a bootable SD card

Note: Boot from SD card eliminates Wifi as the Wifi and SD card are using same SDIO interface.
A typical use-case, is to boot from SD card, flash eMMC or NAND flash, and re-boot form eMMC/NAND to have Wi-Fi operational.

Setting the Boot DIP switches

Booting your system from an SD card requires switching the Boot DIP switches. See picture below.

Boot switch 6ul1.jpg
  • "00" The current position in the picture will set the system to boot from SD card.
  • "01" Moving the right switch will set the system to boot from eMMC
  • "10" Moving the left switch will set the system to boot from NAND flash
  • "11" is illegal.

Be aware that your system has eMMC or NAND but never both.

Automatic device Tree selection in U-Boot

Upon reset you will see the U-Boot SPL printouts. It will print also the SOM configuration:
On-SOM storage: SD only, eMMC, NAND.
WIFI if chip exits.
For example:

U-Boot SPL 2015.10-00532-g482dc88 (Jan 03 2016 - 10:05:42)
i.MX6UL SOC 
Part number: DART-6U-A01
Assembly: AS11
Date of production: 2015 Dec 31
DART-6UL configuration: eMMC WIFI
Ram size: 512
Boot Device: SD

As explained in the above Build Results table we have 4 optional configurations.
We implemented in U-Boot and automatic device tree selection, so when kernel boots, the U-Boot will load the corresponding device tree according to On-SOM configuration.

SOM Type
Boot From
SOM Internal FLASH
SOM has WIFI/BT
Device Tree selected
DART-6UL SD eMMC Don't Care imx6ul-var-dart-sd_emmc.dtb
DART-6UL SD NAND Don't Care imx6ul-var-dart-sd_nand.dtb
DART-6UL eMMC eMMC Yes imx6ul-var-dart-emmc_wifi.dtb
DART-6UL eMMC eMMC NO imx6ul-var-dart-sd_emmc.dtb
DART-6UL NAND NAND YES imx6ul-var-dart-nand_wifi.dtb
DART-6UL NAND NAND NO imx6ul-var-dart-sd_nand.dtb
DART-6ULL SD eMMC Don't Care imx6ull-var-dart-sd_emmc.dtb
DART-6ULL SD NAND Don't Care imx6ull-var-dart-sd_nand.dtb
DART-6ULL eMMC eMMC Yes imx6ull-var-dart-emmc_wifi.dtb
DART-6ULL eMMC eMMC NO imx6ull-var-dart-sd_emmc.dtb
DART-6ULL NAND NAND YES imx6ull-var-dart-nand_wifi.dtb
DART-6ULL NAND NAND NO imx6ull-var-dart-sd_nand.dtb

Note: Boot from SD card eliminates Wifi as the Wifi and SD card are using same SDIO interface.
A typical use-case, is to boot from SD card, flash eMMC or NAND flash, and re-boot form eMMC/NAND to have Wi-Fi operational.

Disable Automatic Device Tree selection

To disable the automatic device tree selection in U-Boot:

$ setenv var_auto_fdt_file=N
$ saveenv

Now you can set the device tree to meet your requirements. For example:

$ setenv fdt_file=imx6ul-var-dart-sd_emmc.dtb
$ saveenv

Will select device tree that has SD and eMMC regardless if the SOM has WIFI.

$ setenv fdt_file=imx6ul-var-dart-sd_nand.dtb
$ saveenv

Will select device tree that has SD and NAND regardless if the SOM has WIFI.

Comment:
Make sure you don't set am illegal value like "imx6ul-var-dart-sd_nand.dtb" in a SOM that has eMMC flash.

Flash images to NAND/eMMC

Please refer to DART-6UL NAND Flash Burning

Yocto Image Customization

Update Yocto Morty to Latest HEAD

From time to time we will post updates to meta-variscite that will include new features and bug fixes.
Follow the instructions below to update your tree:

$ cd {{#var:BUILD_FOLDER}}
$ repo init -b morty
$ repo sync

Update Yocto Morty to Release Tag

See the tag list at https://github.com/varigit

$ cd {{#var:BUILD_FOLDER}}
$ repo init -b refs/tags/"tag name"
$ repo sync

Forcing Clean Build

In order to update the kernel, U-Boot and rootfs:
$ bitbake -c cleanall u-boot-variscite linux-variscite kernel-module-imx-gpu-viv ti-compat-wireless-wl18xx wl18xx-firmware cryptodev-module

for GUI image
$ bitbake -c clean fsl-image-gui
for Qt5 image
$ bitbake -c clean fsl-image-qt5

QT5/Embedded environment variables

The QT5/Embedded require environment variables to run correctly. You need to have them avilable on the target. For example /etc/profile.d/tslib.sh can be edited.

export TSLIB_TSDEVICE=/dev/input/touchscreen0
export TSLIB_CALIBFILE=/etc/pointercal
export TSLIB_CONFFILE=/etc/ts.conf
export QT_QPA_GENERIC_PLUGINS=tslib:/dev/input/event0
export QT_QPA_EGLFS_PHYSICAL_HEIGHT=480
export QT_QPA_EGLFS_PHYSICAL_WIDTH=800
export QT_QPA_EGLFS_HEIGHT=480
export QT_QPA_EGLFS_WIDTH=800
export QT_EGLFS_IMX6_NO_FB_MULTI_BUFFER=1
export QT_QPA_EGLFS_DEPTH=24
export QT_QPA_PLATFORM=eglfs

UBIFS

By default we create ubifs image for 512MB NAND-flash size. You can change the size by editing ~/var-fslc-yocto/sources/meta-variscite-fslc/conf/machine/var-som-mx6.conf
and comment / uncomment the relevant section based on size.

DDR size and Contiguous Memory Allocator

By default Freescale allocates 256MB of RAM to the Contiguous Memory allocator. This is for proper operation of the IPU VPU, X11 etc. On VAR-SOM-SOLO with 256MB DDR RAM size, it will cause a kernel freeze during boot. Adding cma=32MB to the bootargs parameters is required to fix.

Running Application

$ cd /usr/share/qt5/examples/
$ touch/dials/dials --platform linuxfb
$ gui/rasterwindow/rasterwindow --platform linuxfb
$ touch/fingerpaint/fingerpaint  --platform linuxfb
$ widgets/mainwindows/mainwindow/mainwindow --platform linuxfb

Useful Bitbake commands

Bitbake Cheat Sheet

Useful bitbake commands

i.MX Yocto Project: ltib versus bitbake