Build the Yocto Linux - noritake-itron/itron-bsp-manual GitHub Wiki
- Setting a development environment
- Itron BSP platform
- Supported Yocto features and options
- Setup and build Yocto
- Deploy an image to a bootable SD card
- The Yocto toolchain
The full list of the Linux distributions that is suitable for lates Yocto Project development is referenced here.
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
- 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.
Follow the links below and install all required packages on your machine.
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
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 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
.
To update BSP sources please use the following command:
repo sync -j4
The following machines are provided by Noritake-Itron:
- tx10: The i.MX8Mini board with the 10.1-inch TFT display (LVDS 1280x800).
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.
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.
You can use the command below to setup environment.
MACHINE=<tx10> DISTRO=<fsl-imx-wayland/fsl-imx-xwayland> . setup-environment <build_directory_name>
- XWayland GUI demo image - fsl-imx-xwayland - for the TX10:
cd ~/itron-fslc-yocto
MACHINE=tx10 DISTRO=fsl-imx-xwayland . setup-environment build_xwayland
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
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
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 \
"
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>"
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"
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"
Launch the bitbake command:
- Without Qt content:
bitbake fsl-image-gui
- With Qt content:
bitbake fsl-image-qt5
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.
To deploy the image you can use the Itron SD card creation script.
sudo MACHINE=<tx10> ./create-yocto-sdcard.sh [options] /dev/sdX
example:
sudo MACHINE=tx10 ./create-yocto-sdcard.sh -b build_xwayland -i fsl-image-qt5 -a /dev/sdd
-
-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.
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
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 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'
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=