Yocto Build Release: Difference between revisions

From Variscite Wiki
(Add Debian_Platform_Customization for Yocto Debian)
 
(252 intermediate revisions by 8 users not shown)
Line 1: Line 1:
<!-- Set release according to "release" parameter in URL and use MORTY_BETA_DART-6UL as default
<!-- Set release according to "release" parameter in URL and use RELEASE_MORTY_V1.0_DART-6UL as default
--> {{#vardefine:RELEASE_PARAM|{{#urlget:release}}}} <!--
--> {{INIT_RELEASE_PARAM|RELEASE_MORTY_V1.0_DART-6UL}}<!--
--> {{#lst:Yocto_Platform_Customization|{{#var:RELEASE_PARAM|RELEASE_MORTY_BETA_DART-6UL}}}} <!--
--> {{#lst:Yocto_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!--
--> {{PageHeader|{{#var:HARDWARE_NAME}} - Yocto {{#var:YOCTO_NAME}} {{#var:YOCTO_VERSION}} based on FSL Community BSP {{#var:FSLC_BSP_VERSION}} with {{#var:FSL_BSP_VERSION}} Linux release}} {{DocImage|category1={{#var:HARDWARE_NAME}}|category2=Yocto}} __toc__
--> {{#lst:B2QT_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!--
= Installing required packages<br/> =
--> {{#lst:Debian_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!--
 
--> {{COMMON_YOCTO_VARS}}<!--
Follow the link below and install all required packages on your machine.
-->{{#switch:{{#var:SOC_FAMILY}}
 
|am6
[http://www.yoctoproject.org/docs/latest/yocto-project-qs/yocto-project-qs.html www.yoctoproject.org/docs/latest/yocto-project-qs/yocto-project-qs.html]
|am3={{Yocto_Build_Release_TI}} <!-- https://variwiki.com/index.php?title=Template:Yocto_Build_Release_TI -->
 
|#default={{Yocto_Build_Release_IMX}} <!-- https://variwiki.com/index.php?title=Template:Yocto_Build_Release_IMX -->
Please make sure you host PC is running Ubuntu 16.04 64-bit and install the following packages:
}}
<pre>
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
</pre>
 
= Documentation =
  {{#lst:Yocto_Platform_Customization|YOCTO_DOC_{{#var:YOCTO_VERSION}}}} <!--
-->{{#if:{{#var:FSLC_BSP_VERSION}}|{{#lst:Yocto_Platform_Customization|YOCTO_DOC_FSLC_BSP_{{#var:FSLC_BSP_VERSION}}}}|}} <!--
-->{{#lst:Yocto_Platform_Customization|YOCTO_DOC_FSL_BSP_{{#var:FSL_BSP_VERSION}}}}
 
= Download Yocto Morty based on Freescale Community BSP =
<pre>
$ 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
</pre>
 
$ mkdir {{#var:BUILD_FOLDER}}
$ cd {{#var:BUILD_FOLDER}}
$ repo init -u {{#var:YOCTO_GIT}} -b {{#var:YOCTO_BRANCH}}
$ 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 [http://www.yoctoproject.org/docs/current/ref-manual/ref-manual.html#ref-images 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 [http://www.informit.com/articles/article.aspx?p=2514911&seqNum=4 standard Poky distros] can be used
 
{{#if:{{#var:GSTREAMER_SUPPORT}}|
== GStreamer support ==
FSL community BSP comes with [https://github.com/Freescale/gstreamer-imx/blob/master/README.md gstreamer-imx], a set of GStreamer1.0 plugins for i.MX platform, which make use of the i.MX multimedia capabilities.<br>
Some of the multimedia plugins do not work well with X11 and Wayland backends.<br>
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:BUILD_FOLDER}}
$ MACHINE={{#var:MACHINE_NAME}} DISTRO={{#var:BUILD_DISTRO}} {{#var:BUILD_SCRIPT}} {{#var:BUILD_FOLDER_X11}}
 
<br>
Optional steps: [[#local.conf customization|local.conf customization]]
 
launch bitbake:
<pre>
Without Qt content:
$ bitbake fsl-image-gui
 
Or with Qt content:
$ bitbake fsl-image-qt5
</pre>
 
{{#if:{{#var:GSTREAMER_SUPPORT}}|
NOTE: Some of the [https://github.com/Freescale/gstreamer-imx/blob/master/docs/blitter-architecture.md 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 {{#if:{{#var:GSTREAMER_SUPPORT}}|with Freescale’s multimedia packages (VPU and GPU)|}} ==
$ cd {{#var:BUILD_FOLDER}}
$ MACHINE={{#var:MACHINE_NAME}} DISTRO={{#var:BUILD_DISTRO_FB}} {{#var:BUILD_SCRIPT}} {{#var:BUILD_FOLDER_FB}}
 
<br>
Optional steps: [[#local.conf customization|local.conf customization]]
 
<pre>
Without Qt content:
$ bitbake fsl-image-gui
 
Or with Qt content:
$ bitbake fsl-image-qt5
</pre>
 
== local.conf customization ==
=== Change the downloads directory ===
 
Create a /opt/yocto_downloads directory and set its permissions:
<pre>
$ sudo mkdir /opt/yocto_downloads
$ sudo chmod 777 /opt/yocto_downloads/
</pre>
 
Direct downloads to it, by replacing 'DL_DIR ?= "${BSPDIR}/downloads/"' with 'DL_DIR = "/opt/yocto_downloads/"' in conf/local.conf:
<pre>
$ sed -i 's/DL_DIR ?= "${BSPDIR}\/downloads/DL_DIR = "\/opt\/yocto_downloads/g' conf/local.conf
</pre>
 
=== 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:
<pre>
EXTRA_IMAGE_FEATURES = " \
    debug-tweaks \
    tools-debug \
    eclipse-debug \
    "
 
IMAGE_INSTALL_append = " \
    tcf-agent \
    openssh-sftp-server \
    "
</pre>
 
=== 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:
<pre>
DISTRO_FEATURES_append = " systemd"
VIRTUAL-RUNTIME_init_manager = "systemd"
DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit"
VIRTUAL-RUNTIME_initscripts = ""
IMX_DEFAULT_DISTRO_FEATURES_append = " systemd"
</pre>
 
{{#if:{{#var:READ_ONLY_ROOTFS}}|
=== Create a read-only root file system ===
Append the following to the conf/local.conf file in your Yocto build directory, to create a read-only rootfs:
<pre>
EXTRA_IMAGE_FEATURES += "read-only-rootfs"
</pre>
|}}
 
== Build Results ==
The resulted images are located in tmp/deploy/images/{{#var:MACHINE_NAME}}.
<section begin=YOCTO_BUILD_RESULTS/>
{| class="wikitable"
|-
! scope="col" | Image Name<br/>
! scope="col" | How to use<br/>
|-
| style="padding: 5px;"| fsl-image-gui-{{#var:MACHINE_NAME}}.sdcard
| style="padding: 5px;"| This image is for SD card boot.<br> It can be flashed as-is on an SD card that can then be used to boot your system,<br> according to the relevant startup-guide of your product<br> (usually requires to press the boot select button, or toggle a DIP switch).<br> For detailed information refer to the [[Yocto_Build_Release#Create_a_bootable_SD_card | Create a bootable SD card]] section below.
|-
| style="padding: 5px;"| fsl-image-gui-{{#var:MACHINE_NAME}}.tar.bz2
| style="padding: 5px;"| Tarball with rootfs files.<br>Can be used to create an NFS root file system on the host.<br> See the  {{Varlink2|Yocto Setup TFTP/NFS|{{#var:RELEASE_LINK}}}} section for more info.<br>Also used to create our extended SD card.<br>See the [[Yocto_Build_Release#Create_a_bootable_SD_card | Create a bootable SD card]] section below.
|-
| style="padding: 5px;"| fsl-image-gui-{{#var:MACHINE_NAME}}.ubi
| style="padding: 5px;"| A complete UBI image containing a UBIFS volume, for writing to NAND Flash.
|-
| style="padding: 5px;"| {{#var:KERNEL_IMAGE}}
| style="padding: 5px;"| Linux kernel image, same binary for SD card or NAND Flash.
|-
| style="padding: 5px;"| {{#var:U-BOOT_NAND_IMAGE_NAME}}
| style="padding: 5px;"| U-Boot built for NAND Flash.
|-
| style="padding: 5px;"| {{#var:U-BOOT_SD_IMAGE_NAME}}
| style="padding: 5px;"| U-Boot built for SD card boot or eMMC boot.
|-
| style="padding: 5px;"| {{#var:SPL_SD_IMAGE_NAME}}
| style="padding: 5px;"| SPL built for SD card boot or eMMC boot.
|-
| style="padding: 5px;"| {{#var:SPL_NAND_IMAGE_NAME}}
| style="padding: 5px;"| SPL built for NAND Flash.
|-
|}
<section end=YOCTO_BUILD_RESULTS/>
{{#lst:Yocto_Platform_Customization|{{#var:YOCTO_BUILD_RESULTS_SECTION}}}}
 
= Create a bootable SD card =
 
== SD card structure ==
{{#ifeq:{{#var:MACHINE_NAME}}|var-som-mx6|
This is the structure of our Recovery/Extended SD card:<br>
[[File:SD_card_part_v50.png]]<br><br>
|}}
 
The SD card is divided into 3 sections as shown in the picture above:<br>
* The first unallocated 4MiB are saved space for {{#ifeq:{{#var:U-SPL_SD_IMAGE_NAME}}SPL and|}} u-boot.img. They can be replaced with a dd command described in the {{Varlink2|Yocto Build U-Boot|{{#var:RELEASE_LINK}}}} section.<br>
* The first partition is a fat16 partition used for the device tree files and Linux uImage file. You can copy them as described in the {{Varlink2|Yocto Build Linux|{{#var:RELEASE_LINK}}}} section.<br>
* The second partition is an ext4 partition that contains the complete file system and modules.<br><br>
 
Note:<br>
The last unallocated area is not used. It is there so that the rootfs will fit on any 4GB SD card, as not all 4GB SD cards are really the same size. If you want, you can use a program such as GParted to resize the roofs partition and make it end at the end of your specific SD card (of course, you can also use SD cards with much bigger capacity than 4GB, and then it makes more sense to resize the partition).<br>
Also, if you create the extended SD card yourself by following the [[#Create_an_extended_SD_card | Create an extended SD card]] section below, and you use the '-a' option, the rootfs partition will end at the end of your specific SD card automatically.<br>
 
==Yocto pre-built bootable SD card==
The Yocto build products contains many files as explained in the [[#Build_Results | Build Results section]]. For example, fsl-image-gui-{{#var:MACHINE_NAME}}.sdcard, depending on your build. This is a complete image to be flashed directly to an SD card.<br>
 
Example usage:
 
$ sudo umount /dev/sdX*
# For GUI-X11 & QT5-X11
$ cd {{#var:BUILD_FOLDER}}/{{#var:BUILD_FOLDER_X11}}
Or
# For QT5-FB
$ cd {{#var:BUILD_FOLDER}}/{{#var:BUILD_FOLDER_FB}}
# For fsl-image-gui image (GUI-X11)
$ sudo dd if=tmp/deploy/images/{{#var:MACHINE_NAME}}/fsl-image-gui-{{#var:MACHINE_NAME}}.sdcard of=/dev/sdX bs=1M && sync
Or
# For fsl-image-qt5 image (QT5-X11 & QT5-FB)
$ sudo dd if=tmp/deploy/images/{{#var:MACHINE_NAME}}/fsl-image-qt5-{{#var:MACHINE_NAME}}.sdcard of=/dev/sdX bs=1M && sync
Replace sdX with the right device name. This can be obtained by "dmesg" command on your host Linux PC, after the SD card reader is inserted.
 
 
* <span style="color:red">Note:</span> Booting your system from an SD card requires pressing the boot-select button, or switching the relevant DIP switch to "Boot from SD card", according to the relevant start-up guide of your system"<br><br>
 
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.<br>
Later, you will be able to follow either the more automatic {{Varlink2|Yocto Recovery SD card|{{#var:RELEASE_LINK}}}} guide or the more manual [[VAR-SOM-MX6 NAND Flash Burning| VAR-SOM-MX6 NAND flash burning]] guide to burn your images to NAND flash or eMMC.<br><br>
 
Note:<br>
This is essentially the same as our pre-built Recovery SD image, with the following main differences:<br>
* The Android recovery (Android-eMMC) is only present on the pre-built SD image, and not on the SD card built from the Yocto script.<br>
* 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.<br>
Naturally, the pre-built image is more straight forward and easier to use, while the script method is easier to customize.<br><br>
 
Usage:<br>
* Follow the [[#Setup and build Yocto|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={{#var:MACHINE_NAME}} {{#var:BUILD_FOLDER}}/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/{{#var:MACHINE_NAME}}/fsl-image-gui-{{#var:MACHINE_NAME}}.*)
 
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/{{#var:MACHINE_NAME}}/fsl-image-qt5-{{#var:MACHINE_NAME}}" -- selected the "Qt5 image with X11" recovery image
 
= Boot the board with a bootable SD card =
{{#lst:Yocto_Platform_Customization|{{#var:YOCTO_BOOT_BOARD_SECTION}}}}
 
 
= Flash images to NAND/eMMC =
Please refer to {{Varlink2|Nand Flash Burning|{{#var:RELEASE_LINK}}}} guide.
 
= 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.<br>
Follow the instructions below to update your tree:
 
$ cd {{#var:BUILD_FOLDER}}
$ repo init -b {{#var:YOCTO_BRANCH}}
$ repo sync
 
== Update Yocto Morty to Release Tag ==
See the tag list at [https://github.com/varigit/variscite-bsp-platform/tags https://github.com/varigit]
 
$ cd {{#var:BUILD_FOLDER}}
$ repo init -b refs/tags/"tag name"
$ repo sync
 
 
== Forcing Clean Build ==
<pre>
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
</pre>
 
== 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<br>
export TSLIB_CALIBFILE=/etc/pointercal<br>
export TSLIB_CONFFILE=/etc/ts.conf<br>
export QT_QPA_GENERIC_PLUGINS=tslib:/dev/input/event0<br>
export QT_QPA_EGLFS_PHYSICAL_HEIGHT=480<br>
export QT_QPA_EGLFS_PHYSICAL_WIDTH=800<br>
export QT_QPA_EGLFS_HEIGHT=480<br>
export QT_QPA_EGLFS_WIDTH=800<br>
export QT_EGLFS_IMX6_NO_FB_MULTI_BUFFER=1<br>
export QT_QPA_EGLFS_DEPTH=24<br>
export QT_QPA_PLATFORM=eglfs<br>
 
== UBIFS ==
By default we create ubifs image for 512MB NAND-flash size.
You can change the size by editing {{#var:BUILD_FOLDER}}/sources/meta-variscite-fslc/conf/machine/{{#var:MACHINE_NAME}}.conf <br>and comment / uncomment the relevant section based on size.
 
{{#if:{{#var:GSTREAMER_SUPPORT}}|
== 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.
|}}
 
= Useful Bitbake commands =
 
[http://elinux.org/Bitbake_Cheat_Sheet Bitbake Cheat Sheet]
 
[https://community.freescale.com/docs/DOC-94953 Useful bitbake commands]
 
[https://community.freescale.com/docs/DOC-94874 i.MX Yocto Project: ltib versus bitbake]

Latest revision as of 16:08, 11 April 2024

Warning: This page is designed to be used with a 'release' URL parameter.

This page is using the default release RELEASE_MORTY_V1.0_DART-6UL.
To view this page for a specific Variscite SoM and software release, please follow these steps:

  1. Visit variwiki.com
  2. Select your SoM
  3. Select the software release
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

Please make sure your host PC is running Ubuntu 14.04/16.04 64-bit and is up to date:

 $ sudo apt-get update && sudo apt-get dist-upgrade

Then, install the following packages:

 $ sudo apt-get install gawk wget git diffstat unzip texinfo gcc-multilib \
 build-essential chrpath socat cpio python3 python3-pip python3-pexpect \
 xz-utils debianutils iputils-ping libsdl1.2-dev xterm libyaml-dev libssl-dev
 
 $ sudo apt-get install autoconf libtool libglib2.0-dev libarchive-dev \
 sed cvs subversion coreutils texi2html docbook-utils \
 help2man make gcc g++ desktop-file-utils libgl1-mesa-dev libglu1-mesa-dev \
 mercurial automake groff curl lzop asciidoc u-boot-tools dos2unix mtd-utils pv \
 libncurses5 libncurses5-dev libncursesw5-dev libelf-dev zlib1g-dev bc rename \
 zstd libgnutls28-dev
 
 $ sudo apt-get install python-git

For Ubuntu 20.04 and earlier, install python2:

$ sudo apt-get install python python-pysqlite2

For Ubuntu 14.04 and 16.04, the repo tool requires you to upgrade to Python 3.6:

sudo apt-get install build-essential checkinstall libreadline-gplv2-dev libncursesw5-dev libssl-dev \
    libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev && \
    wget https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tar.xz && \
    tar xvf Python-3.6.9.tar.xz && \
    cd Python-3.6.9/ && \
    ./configure && \
    sudo make altinstall -j 16


Note: Variscite provides Docker containers that can be used for a development environment as an alternative to using a virtual machine or a dedicated computer. To learn more, please see Variscite's Docker Build Environment guide.

Reference 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 2.2

Configure git user and email:

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

Fetch and install the Google git-repo tool:

$ mkdir -p ~/bin

# For Ubuntu 20.04 and older, install repo 2.32 according to https://gerrit.googlesource.com/git-repo/+/HEAD/docs/python-support.md:
$ curl https://commondatastorage.googleapis.com/git-repo-downloads/repo-2.32 > ~/bin/repo

# For Ubuntu 22.04 and newer, install the latest repo tool:
$ curl https://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo

# Give repo execute permissions and add it to the path:
$ chmod a+x ~/bin/repo
$ export PATH=~/bin:$PATH

Create a build directory:

$ mkdir ~/var-fslc-yocto
$ cd ~/var-fslc-yocto

Now, choose between downloading a release tag, and downloading the latest revision (recommended) and follow only one of the next two bullet sections, accordingly:

  • Download the latest revision (recommended)
$ repo init -u https://github.com/varigit/variscite-bsp-platform.git -b morty
$ repo sync -j$(nproc)


or

  • Download a release tag

Each release in https://github.com/varigit/variscite-bsp-platform/releases corresponds to a tag.
The tags are also listed in https://github.com/varigit/variscite-bsp-platform/tags
To specify a specific release/tag, run the following:

$ repo init -u https://github.com/varigit/variscite-bsp-platform.git -b refs/tags/TAG_NAME

For example:
$ repo init -u https://github.com/varigit/variscite-bsp-platform.git -b refs/tags/morty-fslc-4.1.15-mx6ul-v1.0
$ repo sync -j$(nproc)


Setup and build Yocto

Supported images

The following images are provided by Variscite for evaluation purpose

  • fsl-image-gui: Default Variscite demo image with GUI and without any Qt5 content. This image recipe works on all backends for X11, Frame Buffer, Wayland and XWayland and the content is optimized to fit 512MB NAND flash.
  • fsl-image-qt5: Extends fsl-image-gui image with Qt5 support and various Qt samples for X11, Frame Buffer, Wayland and XWayland backends.
Will result in image size greater than 512 MB, which will not fit into NAND flash. Use SD card or eMMC to test.

The following images are provided by FSL Community BSP:

  • fsl-image-machine-test: A console-only image that includes gstreamer packages and test and benchmark applications.
  • fsl-image-mfgtool-initramfs: Small image to be used with Manufacturing Tool (mfg-tool) in a production environment.

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 includes wayland feature but doesn’t have x11 support.
  • fslc-xwayland: Distro for Wayland with X11. This distro includes both wayland and X11 emulation features.

Note: Also standard Poky distros can be used


Build X11 GUI demo image

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

The above command is only mandatory for the very first build setup: whenever restarting a newer build session (from a different terminal or in a different time), you can skip the full setup and just run

$ cd ~/var-fslc-yocto
$ source setup-environment build_x11


Warning: Due to a GitHub policy change, it is necessary to add HTTPS mirrors to local.conf for Yocto Morty and older. Please refer to Yocto Common Errors.


Optional steps: local.conf customization

launch bitbake:

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 under your build directory:

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

Add Qt creator and Eclipse debug 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"
DISTRO_FEATURES_BACKFILL_CONSIDERED_append = " sysvinit"
VIRTUAL-RUNTIME_init_manager = "systemd"
VIRTUAL-RUNTIME_initscripts = ""
IMX_DEFAULT_DISTRO_FEATURES_append = " systemd"

Create a read-only root file system

Append the following to the conf/local.conf file in your Yocto build directory, to create a read-only rootfs:

EXTRA_IMAGE_FEATURES += "read-only-rootfs"

Build Results

The resulting images are located in tmp/deploy/images/imx6ul-var-dart.


Image Name
How to use
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,
according to the relevant startup-guide of your product
(usually requires to press the boot select button, or toggle a DIP switch).
For detailed information refer to the Create a bootable SD card section below.
fsl-image-gui-imx6ul-var-dart.tar.gz Tarball with rootfs files.
Can be used to create an NFS root file system on the host.
See the Yocto Setup TFTP/NFS 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 or NAND flash.
SPL-sd SPL built for SD card boot or eMMC boot.
SPL-nand SPL built for NAND flash.
u-boot.img-sd U-Boot built for SD card boot or eMMC boot.
u-boot.img-nand U-Boot built for NAND flash.
File Name Description
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

This is the structure of our Recovery/Extended SD card:
SD card partitions


The SD card is divided into 3 sections as shown in the picture above:

  • The first unallocated 4MiB are saved space for U-Boot. It can be replaced using the dd command as described in the Yocto Build U-Boot section.
  • The first partition is a fat16 partition used for the device tree files and the kernel image file. You can copy them as described in the Yocto Build Linux section.
  • The second partition is an ext4 partition that contains the complete root filesystem (including the kernel modules).

Note:
The last unallocated area is not used. It is there so that the rootfs will fit on any 4GB SD card, as not all 4GB SD cards are really the same size. If you want, you can use a program such as GParted to resize the roofs partition and make it end at the end of your specific SD card (of course, you can also use SD cards with much bigger capacity than 4GB, and then it makes more sense to resize the partition).
Also, if you create the extended SD card yourself by following the Create an extended SD card section below, and you use the '-a' option, the rootfs partition will end at the end of your specific SD card automatically.

Yocto pre-built bootable SD card

The Yocto build products contains many files as explained in the Build Results section. 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:

$ sudo umount /dev/sdX*
# For GUI-X11 & Qt5-X11
$ cd ~/var-fslc-yocto/build_x11
Or
# For Qt5-FB
$ cd ~/var-fslc-yocto/build_fb

# For fsl-image-gui image (GUI-X11)
$ sudo dd if=tmp/deploy/images/imx6ul-var-dart/fsl-image-gui-imx6ul-var-dart.sdcard of=/dev/sdX bs=1M && sync
Or
# For fsl-image-qt5 image (Qt5-X11 & Qt5-FB)
$ sudo dd if=tmp/deploy/images/imx6ul-var-dart/fsl-image-qt5-imx6ul-var-dart.sdcard of=/dev/sdX bs=1M && sync

Replace sdX with the right device name. This can be obtained by "dmesg" command on your host Linux PC, after the SD card reader is inserted.

  • Note: Booting your system from an SD card requires pressing the boot-select button, or switching the relevant DIP switch to "Boot from SD card", according to the relevant start-up guide of your system


Drawbacks of the native .sdcard yocto-built image, (relative to the Recovery/Extended SD card):

  • The rootfs partition doesn't use the entire SD card.
  • The rootfs partition is not labeled as rootfs.
  • The NAND flash and eMMC installation scripts and images are not included.

Create an extended SD card

Variscite provides the var-create-yocto-sdcard.sh script which creates our recovery SD card - an SD card based on the fsl-image-gui filesystem, which also contain the scripts and relevant binaries for installation to the internal storage of the SOM.
Later, you will be able to follow either the more automatic Yocto Recovery SD card guide or the more manual Installing Yocto to the SOM's internal storage guide.

Note:
This is essentially the same as our pre-built Recovery SD image, with the following main differences:

  • 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)
$ cd ~/var-fslc-yocto
$ sudo MACHINE=imx6ul-var-dart 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" -- selected the "Qt5 image with X11" recovery image

Create an extended SD card image using a loop device

It is also possible to use the var-create-yocto-sdcard.sh script to create an extended SD card image, while using a loop device instead of attaching a real SD card.

Create an empty file using the following command:

$ dd if=/dev/zero of=imx6ul-var-dart-extended-sd.img bs=1M count=7420

The above command creates a 7420MiB file representing the SD card.

Attach the first available loop device to this file:

$ sudo losetup -Pf imx6ul-var-dart-extended-sd.img

To find the actual loop device being used, run:

$ losetup -a | grep imx6ul-var-dart-extended-sd.img

Write the content to the loop device to generate the SD card image:

$ sudo MACHINE=imx6ul-var-dart sources/meta-variscite-fslc/scripts/var_mk_yocto_sdcard/var-create-yocto-sdcard.sh <options> /dev/loopX

(Replace /dev/loopX with your actual loop device, e.g. /dev/loop0)

Detach the loop device from the file:

$ sudo losetup -d /dev/loopX

To compress the SD card image file use the following command:

$ gzip -9 imx6ul-var-dart-extended-sd.img

To write the SD card image to a real SD card device use the following command:

$ zcat imx6ul-var-dart-extended-sd.img.gz | sudo dd of=/dev/sdX bs=1M && sync

(Replace /dev/sdX with your actual SD device, e.g. /dev/sdb)

Boot the board with a bootable SD card

Note: The WiFi is not operational when booting from SD card, as the WiFi and SD card are using the same SDIO interface.
A typical use-case is to boot from an SD card, flash the eMMC/NAND flash, and re-boot from the eMMC/NAND flash to have the WiFi operational.

Setting the Boot Mode

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

As shown in the Build Results table above, we have different kernel device trees, corresponding to our different H/W configurations.
We implemented a script in U-Boot's environment, which sets the fdt_file environment variable based on the detected hardware.

Enable/Disable automatic device tree selection

To enable the automatic device tree selection in U-Boot (already enabled by default):

$ setenv fdt_file undefined
$ saveenv

To disable the automatic device tree selection in U-Boot, set the device tree file manually:

$ setenv fdt_file YOUR_DTB_FILE
$ saveenv

Useful example: To list all files in the boot partition (where the dtb files are by default) of an SD card:

$ ls mmc 0:1
Comment:
Make sure you don't set an inappropriate dtb file, like a dtb with nand on a SOM that has eMMC, or a dtb for mx6ull on a SOM with an mx6ul SOC.

Flash images to NAND/eMMC

Please refer to Yocto NAND Flash Burning guide.

Yocto Image Customization

Update Yocto Morty to latest revision

From time to time we update the Yocto sources (especially meta-variscite) with new features and bug fixes.
Follow the Download the latest revision (recommended) bullet section of the Download Yocto Morty based on Freescale Community BSP step again to update your tree to the latest revision, and rebuild your image.

Update Yocto Morty to a release tag

Follow the Download a release tag bullet section of the Download Yocto Morty based on Freescale Community BSP step to update your tree to a release tag, and rebuild your image.

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 for Embedded Linux

To run Qt5 applications without X11 backend the platform specific plugins (e.g. EGLFS or LinuxFB) should be configured with QT_QPA_PLATFORM environment variable or with -platform command-line.

See more information on Qt5 customization for Embedded Linux here

Configure LinuxFB Plugin

DART-6UL supports only LinuxFB plugin

export QT_QPA_PLATFORM=linuxfb:fb=/dev/fb0:size=800x480:mmSize=160x95

LinuxFB plugin is optimized for not accelerated platforms, but do not provide rotation capabilities.

If required you may be interested in reading this article, providing a dedicate patch and usage instructions.

To integrate the patch in yocto BSP, you are supposed to:

  • copy the plane patch in the folder
  ~/var-fslc-yocto/sources/meta-variscite-fslc/dynamic-layers/qt5-layer/recipes-qt/qt5/qtbase
  • add the reference patch in the SRC_URI_append section of file
  ~/var-fslc-yocto/sources/meta-variscite-fslc/dynamic-layers/qt5-layer/recipes-qt/qt5/qtbase_%.bbappend

Configure Touch Input

When no windowing system is present, the mouse, keyboard, and touch input are read directly via evdev or tslib.

Evdev

By default, the Qt5 uses automatic device discovery based on libudev. In case you want to override the default touchscreen configuration the following parameters can be used:

  • /dev/input/... - Specifies the name of the input device. When not given, Qt looks for a suitable device either via libudev or by walking through the available nodes.
  • rotate - On some touch screens the coordinates must be rotated, which is done by setting rotate to 90, 180, or 270.
  • invertx and inverty - To invert the X or Y coordinates in the input events, pass invertx or inverty.
export QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS='/dev/input/touchscreen0'

Tslib

Tslib is used for resistive single-touch touchscreens and should be pre-configured with:

export TSLIB_TSEVENTTYPE='INPUT'
export TSLIB_TSDEVICE='/dev/input/touchscreen0'
export TSLIB_CALIBFILE='/etc/pointercal'
export TSLIB_CONFFILE='/etc/ts.conf'
export TSLIB_CONSOLEDEVICE='none'
export TSLIB_FBDEVICE='/dev/fb0'
export TSLIB_PLUGINDIR='/usr/lib/ts'
export QT_QPA_EGLFS_TSLIB=1 
export QT_QPA_FB_TSLIB=1 

It is recommended to put the above setup inside /etc/profile.d/tslib.sh.

Running Qt5 Applications

$ cd /usr/share/cinematicexperience-1.0; ./Qt5_CinematicExperience --platform linuxfb
$ cd /usr/share/qt5everywheredemo-1.0; ./QtDemo --platform linuxfb
$ cd /usr/share/qtsmarthome-1.0; ./smarthome --platform linuxfb

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/include/variscite.inc
and comment / uncomment the relevant section based on size.


Make changes to the rootfs

The following is usually not the recommended way to work with Yocto.
You should usually create new specific recipes (.bb files) and/or append to specific present recipes by using .bbappend files.
However, if you are not yet experienced enough with Yocto, and you just want to quickly add your files to the resultant file system (or make any other change to it), you can do it in a general way, by using the following variable:

ROOTFS_POSTPROCESS_COMMAND

    Specifies a list of functions to call once the OpenEmbedded build system has created the root filesystem.
    You can specify functions separated by semicolons:

         ROOTFS_POSTPROCESS_COMMAND += "function; ... "                  

    If you need to pass the root filesystem path to a command within a function, you can use ${IMAGE_ROOTFS},
    which points to the directory that becomes the root filesystem image. See the IMAGE_ROOTFS variable for more information. 

The functions will be called right after the root filesystem is created and right before it is packed to images (.sdcard, .ubi, .tar.gz, etc.).

Example

Let's say you have your files that you want to put in the filesystem arranged on your host under a directory called /my_rootfs_additions, like the following:

my_rootfs_additions/
├── data
│   ├── example.m4v
│   └── example.bin
├── etc
│   └── example.conf
└── home
    └── root
        └── .example

And let's say you want to build the fsl-image-gui image.

Create a file called ~/var-fslc-yocto/sources/meta-variscite-fslc/recipes-images/images/fsl-image-gui.bbappend
with the following content:

add_my_files() {
    cp -r /my_rootfs_additions/*  ${IMAGE_ROOTFS}/
}

ROOTFS_POSTPROCESS_COMMAND += "add_my_files;"

Now, when you bitbake fsl-image-gui, the files in /my_rootfs_additions will be added to the rootfs (be careful when overwriting files).

Useful Bitbake commands

Bitbake Cheat Sheet

Useful bitbake commands

i.MX Yocto Project: ltib versus bitbake