Build the Yocto Linux - noritake-itron/itron-bsp-manual GitHub Wiki

Build the Yocto Linux

Index

Setting a development environment

Supported Linux distributions

The full list of the Linux distributions that is suitable for lates Yocto Project development is referenced here.

Yocto Project Quick Start

Yocto Project Reference Manual

For Yocto Warrior we recommend using Ubuntu 16.04 64-bit on a physical PC or inside a Virtual Machine:

Click here to set up Ubuntu Linux OS on a virtual machine for Windows

Installation recommendations

  • Set the number of CPUs to maximum possible
  • Set the memory size to at least 4GB.
  • Set the disk size to be at least 200GB. 300GB is better.
  • Use Bridge for networking.
  • Install the VMWare tools.
  • If you have an extra hard drive you can use it as a physical partition and set your home directory to it.
  • Update Ubuntu right after the first login.

Required packages

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

Yocto Project Quick Start

Yocto Project Reference Manual

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

sudo apt-get install gawk wget git diffstat unzip texinfo gcc-multilib \
build-essential chrpath socat cpio python python3 python3-pip python3-pexpect \
xz-utils debianutils iputils-ping libsdl1.2-dev xterm
sudo apt-get install autoconf libtool libglib2.0-dev libarchive-dev python-git \
sed cvs subversion coreutils texi2html docbook-utils python-pysqlite2 \
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

Itron BSP platform

Repo installation

To get the BSP (Board Support Package) you need to have repo - the multiple git repository tool - installed.

Repo is a tool built on top of Git. Repo helps manage many Git repositories, does the uploads to revision control systems, and automates parts of the development workflow.

Install the repo utility:

mkdir ~/bin
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo

Download Yocto Warrior BSP

Download the BSP source:

PATH=${PATH}:~/bin
mkdir ~/itron-fslc-yocto
cd ~/itron-fslc-yocto
repo init -u https://github.com/noritake-itron/itron-bsp-platform.git -b fsl-warrior
repo sync -j4

At the end of the commands, you have every metadata you need to start work with. You can use any directory to host your build. The source code is checked out at itron-fslc-yocto/sources.

Update Yocto Warrior BSP

To update BSP sources please use the following command:

repo sync -j4

Supported Yocto features and options

Supported machines

The following machines are provided by Noritake-Itron:

  • tx10: The i.MX8Mini board with the 10.1-inch TFT display (LVDS 1280x800).

Supported images

The following images are provided by Noritake-Itron for evaluation purpose:

  • fsl-image-gui: Default Itron demo image with a GUI without any QT content. This image recipe works on all backends for X11, DirectFB, Frame Buffer and Wayland.

  • fsl-image-qt5: Extends fsl-image-gui image with QT5.X support and various QT samples for X11, Frame Buffer and Wayland backends.

Supported distros

The following distros are supported by Noritake-Itron:

  • fsl-imx-wayland: Distro for Wayland without X11. This distro includes Wayland feature but doesn't have X11 support.

  • fsl-imx-xwayland: Distro for Wayland with X11. This distro includes both Wayland and X11 features.

Setup and build Yocto

Setting Yocto environment

You can use the command below to setup environment.

MACHINE=<tx10> DISTRO=<fsl-imx-wayland/fsl-imx-xwayland> . setup-environment <build_directory_name>
Note: - please choose the proper machine
Note: <fsl-imx-wayland/fsl-imx-xwayland> - please choose the proper distro name*
Note: <build_directory_name> - please select the directory name

Examples

  • XWayland GUI demo image - fsl-imx-xwayland - for the TX10:
cd ~/itron-fslc-yocto
MACHINE=tx10 DISTRO=fsl-imx-xwayland . setup-environment build_xwayland

Configure Yocto

Download directory

That is optional but you can change the download 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

Performance

By default, the build system uses simple controls to try and maximize build efficiency. Depending on your host machine you can modify some setting to decrease a time build or increase a machine performance.

  • BB_NUMBER_THREADS: The maximum number of threads BitBake simultaneously executes.

  • PARALLEL_MAKE: Extra options passed to the make command during the do_compile task in order to specify parallel compilation on the local build host.

You can add those settings in conf/local.conf:

BB_NUMBER_THREADS="2"
PARALLEL_MAKE="-j 2"

or

sed -i '/DL_DIR =/i \
BB_NUMBER_THREADS="2" \
PARALLEL_MAKE="-j 2" \
' conf/local.conf

You will find more information here:

Yocto Project Reference Manual

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 \
    "

Add a package to the local build

Search for the corresponding recipe and which layer the recipe is in.

You can use the link below:

http://layers.openembedded.org/layerindex/branch/rocko/layers/

If the package is in the meta-openembedded layer, the recipe is already available in your build tree.

Add the following line to the conf/local.conf file in your Yocto build directory:

IMAGE_INSTALL_append = " <package>"

Note: The leading white-space between the " and the package name is necessary for the append command.

If you need to add a layer to the BSP, clone or extract it to the $YOCTO_DIR/sources/ directory. Then, modify $YOCTO_DIR/build/conf/bblayers.conf to include this new layer in BBLAYERS:

BBLAYERS += "${BSPDIR}/sources/<new_layer>"

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"

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 Yocto

Launch the bitbake command:

  • Without Qt content:
bitbake fsl-image-gui
  • With Qt content:
bitbake fsl-image-qt5

Build errors

Some bitbake processes quit unexpectedly due to low memory.

To fix that you can decrease the number of working threads in conf/local.conf.

Please look at Performance

Sometimes after a crash, you have to clean up your tmp dir for the given package.

You can use following bitbake commands to do that:

bitbake -c clean recipe

That command remove tmp dir.

bitbake -c cleanall recipe

Remove tmp dir and sstate-cache.

bitbake -c cleansstate recipe

Remove tmp dir and sstate-cache and downloads.

Deploy an image to a bootable SD card

To deploy the image you can use the Itron SD card creation script.

Script usage

sudo MACHINE=<tx10> ./create-yocto-sdcard.sh [options] /dev/sdX
Note: /dev/sdX - change /dev/sdX to your device name
Note: - please choose the proper machine
Note: [options] - please add chosen options
Note: to run the script you have to be in the Yocto build directory

example:

sudo MACHINE=tx10 ./create-yocto-sdcard.sh -b build_xwayland -i fsl-image-qt5 -a /dev/sdd

Script 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

  • -i Select an alternative image name. Choose between fsl-image-gui or fsl-image-qt5.

  • -r Create recovery card. You can use that card to install Yocto on the eMMC.

  • -rb Select an alternative building directory for recovery (eMMC) image.

  • -ri Select an alternative image name for recovery (eMMC) image. Choose between fsl-image-gui or fsl-image-qt5.

  • -rm Select an alternative machine name for recovery (eMMC) image.

  • -n Add a release Notes text file.

If you don't use the '-a' option, a default rootfs size of 7400MiB will be used.

The Yocto toolchain

Build the toolchain

You can build the standard toolchain or the toolchain the support for Qt5

To build the toolchain without the Qt support please use the following command:

bitbake meta-ide-support
bitbake meta-toolchain

To build the toolchain with the Qt support please use the following command:

bitbake meta-ide-support
bitbake meta-toolchain-qt

Build the complete SDK

To compile applications that require libraries other than glibc you should build an SDK which contains development versions of all libraries in the rootfs image, and not just the basic toolchain.

When using the fsl-image-gui image:

bitbake -c populate_sdk fsl-image-gui

When using the fsl-image-qt5 image:

bitbake -c populate_sdk fsl-image-qt5

Install the toolchain

Install the tools by running it:

tmp/deploy/sdk/fsl-imx-xwayland-glibc-x86_64-fsl-image-gui-aarch64-toolchain-4.19-warrior.sh

Reply to all defaults 'y'

Use the toolchain

Each time you wish to use the toolchain in a new shell session, you need to source the environment setup script:

source /opt/fsl-imx-xwayland/4.19-warrior/environment-setup-aarch64-poky-linux
export LDFLAGS=

⚠️ **GitHub.com Fallback** ⚠️