How to use the Yocto Project to develop Embedded Linux
What is the Yocto Project™
The Yocto Project™ is an open source collaboration project that provides templates, tools and methods to help you create custom Linux-based systems for embedded products regardless of the hardware architecture. Taken directly from the Yocto Project website:
Yocto Project™ it's not an embedded Linux distribution – it creates a custom one for you
The Yocto Project™ is an umbrella project covering a fairly wide swath of embedded Linux technologies an distributions. For example, the Angstrom Distribution is declared as a Yocto Project Participant
Much of this How-To is extracted from different sources. If you would like to read some of the original articles or resources, please visit them and thank the authors:
- The Yocto project website ( http://www.yoctoproject.org )
- The Yocto project documentation ( http://www.yoctoproject.org/documentation )
- The Openembedded website ( http://www.openembedded.org/ )
Why use the Yocto Project™
Because it's a complete embedded Linux development environment with tools, metadata, and documentation - everything you need. The free tools are easy to get started with, powerful to work with (including emulation environments, debuggers, an Application Toolkit Generator, etc.) and they allow projects to be carried forward over time without causing you to lose optimizations and investments made during the project’s prototype phase. The Yocto Project fosters community adoption of this open source technology allowing its users to focus on their specific product features and development
How to build Poky custom Poky Linux distribution
Yocto will be built on a host machine targeting and igep board. It will use Poky software to generate the custom linux distribution Linux distribution. Before starting with yocto, you need to set up the host machine.
Yocto is expecting the host system to have preinstalled packages. Depending on the type of development, the host system will need more or less packages. On Ubuntu / Debian here is a table depending on the type of development.
|If you don't know what type of development it suits better to your needs we recommend you to start with Essential type|
|Type of Development||Description||Package List|
|Essential||For building images on a headless system||gawk wget git-core diffstat unzip texinfo gcc-multilib \|
build-essential chrpath socat cpio python python3 python3-pip python3-pexpect \
xz-utils debianutils iputils-ping
|Graphical + Eclipse Plugins||For building images on a graphical host and if using Eclipse IDE||libsdl1.2-dev xterm|
|Documentation||For building the Yocto Project documentation manuals||make xsltproc docbook-utils fop dblatex xmlto|
|OpenEmbedded Self Test||Packages needed if you are going to run oe-selftest||python-git|
If your build system has the oss4-dev package installed, you might experience QEMU build failures due to the package installing its own custom /usr/include/linux/soundcard.h on the Debian system. If you run into this situation, either of the following solutions exist:
sudo apt-get build-dep qemu
sudo apt-get remove oss4-dev
Yocto Project Setup
In order to create a custom linux distribution; we will download the yocto project.
git clone <a href="git://git.yoctoproject.org/poky" rel="nofollow">git://git.yoctoproject.org/poky</a>
Enter poky folder.
Switch to pyro branch.
git checkout pyro
Download meta-openembedded layer and switch to pyro branch.
git clone https://github.com/openembedded/meta-openembedded.git -b pyro
Download meta-qt5 layer and switch to pyro branch.
git clone https://github.com/qt/qt5.git -b pyro
Download meta-isee layer and switch to pyro branch.
git clone email@example.com:poky-yocto/meta-isee.git -b pyro
Source the environment using:
You should be now inside poky/build folder.
Add all the layers into build/conf/bblayers.conf.
BBLAYERS ?= " \
from poky/build folder Create your own custom Linux distribution with the following command.
MACHINE=machine-name DISTRO=distro-name bitbake igep-minimal-image
The following table provides you the information about the commercial names of igep product and the MACHINE= machine-name you need to select when creating the Linux distribution using Yocto.
|IGEP COM MODULE||igep0030|
|IGEP COM AQUILA AM335x||igep0033|
|IGEP SMARC AM335x||igep0034|
|IGEP SMARC AM3352||igep0035|
|IGEP SMARC (Marvell PXA212)||igep0040|
|IGEP SMARC (Zynq)||igep0045|
|IGEP SMARC i.MX6 (Solo)||igep0046sx|
|IGEP SMARC i.MX6 (Dual Lite)||igep0046dl|
|IGEP SMARC i.MX6 (Quad)||igep0046q|
|IGEP SMARC i.MX8||igep0060|
|IGEP SMARC i.MX6 (Ultra Lite)||igep0146|
The following table provides you the information about the different igep distributions. It is provided the DISTRO=distro-name and the description of it.
|isee-release||Rootfs with sysV suite and x11|
|isee-release-no-x11||Rootfs with sysV suite and without x11|
|isee-systemd||Rootfs with systemd suite and x11|
|isee-systemd-no-x11||Rootfs with systemd suite and without x11|
As a final example using this command
MACHINE=igep0034 DISTRO=isee-release-no-x11 bitbake igep-minimal-image
Produces a minimal rootfs (sysV suite, withuot X11), u-boot, Kernel image and DTB for ISEE AM335x products.
Types of custom Poky Linux Distributions
Meta-isee is the layer that provides you the support to build your own custom poky linux distribution. In fact it provides you a set of predefined images that will build some components, like focusing on building the minimal set of components required to boot an igep board or building more complicated distributions with X support or even build an image with a Sato or LXDE Desktop.
The following table explains the types of images, the description and the approximated size to give you a hint of what you are building.
|When you are bitbaking an image with X support you MUST set DISTRO=distro-name compatible with X environment.|
|Image Name||Description||Aproximated Size|
|igep-mrskeltal-image||Only the bare minimum required for a board to boot. This means you will only find poky minimal set of rootfs and kernel modules.|
|igep-minimal-image||The minimum required for a board to boot plus set of configured tools and utilities aplications to provide user easy access to board capabilities.|
|igep-basic-image||Based on igep-minimal-image plus Qt5 framework (demos included), Gstreamer1.0, and Pulseaudio.|
|igep-basicX-image||Based on igep-minimal-image plus X environment.|
|igep-full-image||Based on igep-basic-image and igep-basicX-image. Provides Qt5 framework (demos included), Gstreamer1.0, Pulseaudio, and X environment.|
|igep-sato-image||Based on igep-full-image plus a Sato Desktop.|
|igep-lxde-image||Based on igep-full-image plus LXDE Desktop|
|igep-custom-image||An empty template image based on igep-mrskeltal-image for users to add anything required to fill their needs||20MB to X MB|
Not all images are compatibles with all the igep machine product. Here is the compatibility chart to guide you what you can/can't build depending on your igep board.
|IGEP PRODUCT||Image Key Name|
How to develop with Yocto Project SDK
In order for developers to use Yocto Project SDK, Yocto Project must be set up, all needed meta-layers downloaded and configured in bblayers.conf. Also target image should be built correctly.
What is Yocto Project SDK
Yocto Project offers a set of tools for developers to create applications (that will run in Yocto created Linux Distributions ) from powerful Host machines. This is also called cross compiling. Yocto Project SDK allows developers to cross compile, debug, and test applications. In fact Yocto Project SDK provides:
- Cross-Development Toolchain: This toolchain contains a compiler, debugger, and various miscellaneous tools.
- Libraries, Headers, and Symbols: The libraries, headers, and symbols are specific to the image (i.e. they match the image).
- Environment Setup Script: This
*.shfile, once run, sets up the cross-development environment by defining variables and preparing for SDK use.
The SDK is installed on any machine and can be used to develop applications, images, and kernels. An SDK can even be used by a QA Engineer or Release Engineer. The fundamental concept is that the machine that has the SDK installed does not have to be associated with the machine that has the Yocto Project installed.
A developer can independently compile and test an object on their machine and then, when the object is ready for integration into an image, they can simply make it available to the machine that has the Yocto Project. Once the object is available, the image can be rebuilt using the Yocto Project to produce the modified image.
Why use Yocto Project SDK
Normally Target systems specifications are quite restricted, specifically in embedded target systems. It is convenient for the developer, in order to save time, to develop, compile and test their applications on their host platform which is usually a powerful machine. This is the basic of the cross compiling process. Later an emulator is used to test the application.
How to build ISEE Yocto Project SDK
Developers can build ISEE Yocto Project SDK in order to use it at their convenience. First of all a SDK installed will be produced and then developers will user the SDK installer in their Host machines to install all ISEE Yocto Project SDK components.
To produce the SDK installer run this command after sourcing Yocto environment (source oe-init-build-env).
bitbake -c populate_sdk igep-image-name
It is also posible to build an extensible SDK with
bitbake -c populate_sdk_ext igep-image-name
The resulting SDK installer script can be found in yocto project build folder ./tmp/deploy/sdk/*.sh
How to use ISEE Yocto Project SDK
In order to use the ISEE Yocto Project SDK first of all the Installer script must be run in the Host machine where it is intended to develop the software:
Once it is installed the environment must be set up with the source script in
After the environment is set up developers can already compile and debug aplications. It can also be used qemu emulator available in folder to emulate target applications.