0% found this document useful (0 votes)
51 views47 pages

AMF-AUT-T3891-Yocto Project 101 - Rev

Yocto Project

Uploaded by

Ric
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views47 pages

AMF-AUT-T3891-Yocto Project 101 - Rev

Yocto Project

Uploaded by

Ric
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 47

Introduction: Yocto Project 101

Bryan Thomas
Field Applications Engineer

October 2019 | Session #AMF-AUT-T3891

Company Public – NXP, the NXP logo, and NXP secure connections for a smarter world are trademarks of NXP
B.V. All other product or service names are the property of their respective owners. © 2019 NXP B.V.
Agenda
• i.MX8 Reference Boards
• Linux Introduction
• Yocto Introduction
• NXP Yocto BSP Release
• Host Machine Setup
• Yocto Setup
• Running a Yocto Build
• Using the Results
• Finding Help

COMPANY PUBLIC 1
i.MX8 Reference Boards

• i.MX 8QuadMax MEK


• i.MX 8QuadXPlus MEK

• i.MX 8M Evaluation Kit


(consumer/industrial)

COMPANY PUBLIC 2
Linux Introduction
What is Linux?
Obtaining and Installing a Linux Distribution
The Terminal

COMPANY PUBLIC 3
Yocto Project: What is Linux?
• Linux is an operating system
• GNU/Linux is a collection of programs and the Linux kernel that
forms the Operating System
• Many of the components of are licensed under an open source
license such as the General Public License (GPL)
• The open source nature of Linux allows you to view the source code
of many of the components of the system

COMPANY PUBLIC 4
Yocto Project: Obtaining and Installing a Linux Distribution
• Select a distribution that others within your company are using.
• If you are completely new to Linux then pick a distribution like
Debian, Fedora, or Ubuntu
• Distributions are distributed as iso files that can be written to a
CD/DVD or USB flash Drive

COMPANY PUBLIC 5
Yocto Project: Obtaining and Installing a Linux Distribution
• Use https://rufus.ie/ to flash an iso to a USB flash drive

COMPANY PUBLIC 6
Yocto Project: Obtaining and Installing a Linux Distribution
• Set the computer to boot from USB and insert the flash drive into one
of the USB ports
• Some distributions have LIVE preview modes that run out of RAM
and allow you to try out the distribution before installing
• Follow the installation guides available on the distribution’s
homepage to install
• 500 GB is a good size for an install hard disk

COMPANY PUBLIC 7
Yocto Project: The Terminal
• The terminal will be your new home!
• Cheat sheet (http://overapi.com/linux/)

COMPANY PUBLIC 8
Yocto Introduction
What is the Yocto Project?
Yocto Project Development Environment
Yocto Project Components
Yocto Project Documentation

COMPANY PUBLIC 9
Yocto Project: What is the Yocto Project?
• Open-source collaborative project focused on embedded Linux
development
• Currently provides a build system that is referred to as OpenEmbedded
build system in the Yocto Project Documentation
• Helps developers create custom Linux-based systems for embedded
products

• Source: http://www.yoctoproject.org/docs/current/yocto-project-qs/yocto-
project-qs.html

COMPANY PUBLIC 10
Yocto Project: Yocto Project Development Environment

COMPANY PUBLIC 11
Yocto Project: Yocto Project Components
Poky
• Poky is a reference system of the Yocto Project - a collection of Yocto
Project tools and metadata that serves as a set of working examples. To
use the Yocto Project tools, you can download Poky and use it to bootstrap
your own distribution.
• Poky is the platform-independent, cross-compiling integration layer that
utilizes OpenEmbedded Core. It provides the mechanism to build and
combine thousands of distributed open source projects together to form a
fully customizable, complete, coherent Linux software stack.
• Poky's objective is to provide all the features and functionalities an
embedded developer needs from one solution.
Source: https://www.yoctoproject.org/tools-resources/projects/poky

COMPANY PUBLIC 12
Yocto Project: Yocto Project Components
• BitBake is a build engine that follows recipes in a specific format in
order to perform sets of tasks. BitBake is a core component of the
Yocto Project.

COMPANY PUBLIC 13
Yocto Project: Yocto Project Documentation
The Yocto Project documentation is available on the Yocto Project
website: (https://www.yoctoproject.org/documentation)

Recommended Reading:
1. Yocto Project Quick Start (Link)
2. BitBake User Manual (Link)
3. Yocto Project Reference Manual (Link)

COMPANY PUBLIC 14
NXP Yocto Release
Introduction to the NXP Yocto BSP Release
Obtaining the NXP Yocto Release

COMPANY PUBLIC 15
Yocto Project: NXP Yocto BSP Release
The NXP Yocto BSP Release is an extension
of OpenEmbedded and Poky that supports
NXP reference boards

• NXP i.MX6Q SABRE Smart Device


• NXP i.MX6Q SABRE Auto
• NXP i.MX6DL SABRE Smart Device
• NXP i.MX6DL SABRE Auto
• NXP i.MX6SOLO SABRE Smart Device
• NXP i.MX6SOLO SABRE Auto
• NXP i.MX6 Solo Lite EVK
• NXP i.MX8 Family

COMPANY PUBLIC 16
Yocto Project: Obtaining the NXP Yocto BSP Release
The NXP Yocto BSP Release is available from our website under
Software & Tools Section (Link)

• Contains pre-built images for NXP reference boards


• Contains a README file that explains the procedure to download the
BSP using REPO
• Currently based on Yocto version 2.5 (Sumo)
• Next release based on Yocto version 2.6 (Thud)

COMPANY PUBLIC 17
i.MX Linux Roadmap
Yocto Project 2.2 – “Morty” Yocto Project 2.4 – “Rocko” Yocto Project 2.5 – “Sumo”

GA – Support for 1 year , Pro-Support


available past one year L4.14.62_1.0.0, L4.14.78_1.x.0
Alpha & Beta – Availability until next
release
www.NXP.com/prosupport
Beta GA GA
L4.9.88_2.x.x L4.9.123_2.x.x

L4.9.51_1.x.x GA Alpha Beta2 GA

GA

J F M A M J J A S O N D J F M A M J J A S O N D J F M

1Q 2Q 3Q 4Q 1Q 2Q 3Q 4Q 1Q

2018 2019 2020

GA

Shiping (currently shipping i.MX 6 and i.MX 7 devices)


Release Planning Linux 4.9.x
Execution Production
Schedule Kernel 4.14.x
Alpha COMPANY PUBLIC 18
Host Machine Setup
Suitable Host Machines
Supported Linux Distributions
Required Host Packages
Repo

COMPANY PUBLIC 19
Yocto Project: A Suitable Host Machine
• Depending on the number of processors and cores, the amount of
RAM, the speed of your Internet connection and other factors, the
build process could take several hours the first time you run it.
Subsequent builds run much faster since parts of the build are
cached.
• Multiple build directories can consume large amounts of hard drive
space
• Virtual Machines are not recommended for daily development

COMPANY PUBLIC 20
Yocto Project: Supported Linux Distributions
Each Yocto release adds additional supported distributions. Other distributions can also work but are not specifically tested by
the Yocto Project.
These are supported by Sumo:

• Ubuntu 14.10
• Ubuntu 15.04
• Ubuntu 15.10
• Ubuntu 16.04 (LTS)
• Fedora release 22
• Fedora release 23
• CentOS release 7.x
• Debian GNU/Linux 8.x (Jessie)
• Debian GNU/Linux 9.x (Stretch)
• openSUSE 13.2
• openSUSE 42.1

COMPANY PUBLIC 21
Yocto Project: Required Host Packages
The list of packages you need on the host development system can be large when
covering all build scenarios using the Yocto Project

Debian based distributions:


Essential packages
$ sudo apt-get install 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 extras (host)
$ sudo apt-get install libsdl1.2-dev xterm
Documentation packages
$ sudo apt-get install make xsltproc docbook-utils fop dblatex xmlto
OpenEmbedded Self-Test:
$ sudo apt-get install python-git

COMPANY PUBLIC 22
Yocto Project: Required Host Packages
Fedora based distributions:

Essential packages
$ sudo dnf install gawk make wget tar bzip2 gzip python3 unzip perl patch \
diffutils diffstat git cpp gcc gcc-c++ glibc-devel texinfo chrpath \
ccache perl-Data-Dumper perl-Text-ParseWords perl-Thread-Queue perl-bignum socat \
python3-pexpect findutils which file cpio python python3-pip xz

Graphical extras (host)


$ sudo dnf install SDL-devel xterm

Documentation packages
$ sudo dnf install make docbook-style-dsssl docbook-style-xsl docbook-dtds docbook-utils fop
libxslt dblatex xmlto

OpenEmbedded Self-Test
$ sudo dnf install python3-GitPython

COMPANY PUBLIC 23
Yocto Project: Repo
What is Repo?
• Repo is a tool that Google built on top of Git
• Repo helps manage many Git repositories
• Repo is not meant to replace Git
• The repo command is an executable Python script that you can put
anywhere in your path

• Repo repository and cheat sheet: Link

COMPANY PUBLIC 24
Yocto Project: Repo
Installing Repo

1. Add a bin directory to your home directory:


$ mkdir ~/bin

2. Download the script file to the bin directory:


$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo

3. Add execute permissions:


$ chmod a+x ~/bin/repo

Source (Link)

COMPANY PUBLIC 25
Yocto Project: Repo
Adding ~/bin directory to your path
• Debian with BASH, other distributions will vary slightly

Temporary:
$ export PATH=/home/YOURUSERNAME/bin:$PATH
$ source .bashrc

Permanent:
$ vim .profile
+ if [ -d "$HOME/bin" ] ; then
+ PATH="$HOME/bin:$PATH"
+ fi
* NOTE: most distros include ~/bin in your default path, the
directory just doesn’t exist!

COMPANY PUBLIC 26
Yocto Setup
Repo Initialization
Repo Sync
Sourcing a Build

COMPANY PUBLIC 27
Yocto Project: Repo Initialization
• We will use repo to pull our Yocto sources from multiple Git trees based on the
manifest for the particular branch we are using. In this case we will use the
current GA release based on the previous Yocto Project release
• Git.freescale.com (Link)

• $ repo init -u https://source.codeaurora.org/external/imx/imx-manifest -b imx-linux-sumo -m


• imx-4.14.98-2.0.0_ga.xml

-u is the manifest url of our new code repo at codeaurora


–m is the manifest of the yocto build that you will be using
-b is branch or revision in this case Sumo 2.5

• If we look in the directory we only see that a hidden directory has been created
called .repo. This directory contains information that tells repo what Git
repositories and commits to pull into our directory. Repo doesn’t pull the source
until we run the sync command.

COMPANY PUBLIC 28
Yocto Project: Repo Initialization

COMPANY PUBLIC 29
Yocto Project: Repo Initialization

COMPANY PUBLIC 30
Yocto Project: Repo Sync

Some output
omitted for clarity

COMPANY PUBLIC 31
Yocto Project: Repo Sync
• After the sync command completes the source directory will contain a setup script and a
sources directory.

├── fsl-setup-release.sh
├── README
├── README-IMXBSP
├── setup-environment
└── sources

1 directory, 4 files

COMPANY PUBLIC 32
Yocto Project: Sourcing a Build
• Now you need to pick a machine type that you want to set up to build. These machines are available in the specific
<layer>/conf/machine/*.conf files
• You can find available machines with the following command in your yocto top directory
$ ls sources/meta-fsl-*/imx/meta-bsp/conf/machine/*.conf
sources/meta-fsl-arm/conf/machine/imx23evk.conf
sources/meta-fsl-arm/conf/machine/imx28evk.conf
sources/meta-fsl-arm/conf/machine/imx31pdk.conf
sources/meta-fsl-arm/conf/machine/imx35pdk.conf
sources/meta-fsl-arm/conf/machine/imx51evk.conf New Machines!!
sources/meta-fsl-arm/conf/machine/imx53ard.conf
sources/meta-fsl-arm/conf/machine/imx53qsb.conf
imx8qxpmek
sources/meta-fsl-arm/conf/machine/imx6dlsabreauto.conf
sources/meta-fsl-arm/conf/machine/imx6dlsabresd.conf
imx8qmmek
sources/meta-fsl-arm/conf/machine/imx6qsabreauto.conf
sources/meta-fsl-arm/conf/machine/imx6qsabresd.conf
sources/meta-fsl-arm/conf/machine/imx6slevk.conf
sources/meta-fsl-arm/conf/machine/imx6solosabreauto.conf
sources/meta-fsl-arm/conf/machine/imx6solosabresd.conf
sources/meta-fsl-arm/conf/machine/twr-vf65gs10.conf
COMPANY PUBLIC 33
Yocto Project: Sourcing a Build
• The machine name tells setup script which board you will be using for
development

$ DISTRO=<distro-name> MACHINE=<machine-name> source


fsl-setup-release.sh –b <build-directory> –e
<backend fb, dfb, wayland, x11>

• Example using NXP i.MX8QXP with xwayland

$ DISTRO=fsl-imx-xwayland MACHINE=imx8qxpmek source \


fsl-setup-release.sh -b build-xwayland

COMPANY PUBLIC 34
Yocto Project: Sourcing a Build

COMPANY PUBLIC 35
Yocto Project: Sourcing a Build
• The setup script will create the conf directory and copy some files that are
needed to create the build. When the script is completed you will be placed into
the build directory that you specified. We will use bitbake to spawn off the build
from inside this directory

user@machine:~/projects/nxp/imx/linux-bsp/imx-yocto-bsp/build-xwayland$ tree
.
└── conf
├── bblayers.conf
├── bblayers.conf.org
├── local.conf
├── local.conf.org
├── local.conf.sample
└── templateconf.cfg

COMPANY PUBLIC 36
Yocto Project: Optimizing Host Machine
• <build>/conf/local.conf has a few options that you can change in order to speed up building on your host machine
MACHINE ??= ‘imx8qxpmek'
DISTRO ?= ‘fsl-imx-xwayland'
PACKAGE_CLASSES ?= "package_rpm"
EXTRA_IMAGE_FEATURES = "debug-tweaks"
USER_CLASSES ?= "buildstats image-mklibs image-prelink"
PATCHRESOLVE = "noop"
BB_DISKMON_DIRS = "\
STOPTASKS,${TMPDIR},1G,100K \
STOPTASKS,${DL_DIR},1G,100K \
STOPTASKS,${SSTATE_DIR},1G,100K \
ABORT,${TMPDIR},100M,1K \
ABORT,${DL_DIR},100M,1K \
ABORT,${SSTATE_DIR},100M,1K“
PACKAGECONFIG_append_pn-qemu-native = “ sdl”
PACKAGECONFIG_append_pn-nativesdk-qemu = “ sdl”
CONF_VERSION = "1"

BB_NUMBER_THREADS = ‘8’ <- increase to reflect the number of cores


PARALLEL_MAKE = '-j 8’ <- increase to reflect the number of cores

DL_DIR ?= "${BSPDIR}/downloads/” <- make a common directory if you have several builds
SSTATE_DIR ?= "/share/sstate-cache“ <- make a common directory to speed builds

ACCEPT_FSL_EULA = ””

COMPANY PUBLIC 37
Running a Yocto Build
Using BitBake
First Build Time

COMPANY PUBLIC 38
Yocto Project: Using BitBake
• Now we use bitbake to spawn off the build

build-xwayland$ bitbake <image-name>

• <image-name> are images that are provided from the release. We can find them with find . –name
fsl-image* from the yocto top directory

b35938@b35938-13:~/projects/fsl/yocto$ find . -name fsl-image*


./sources/meta-fsl-arm/recipes-fsl/images/fsl-image-mfgtool-initramfs.bb
./sources/meta-fsl-demos/recipes-fsl/images/fsl-image-multimedia.bb
./sources/meta-fsl-demos/recipes-fsl/images/fsl-image-machine-test.bb
./sources/meta-fsl-demos/recipes-fsl/images/fsl-image-multimedia-full.bb
./sources/meta-fsl-bsp-release/imx/meta-fsl-demos/recipes-fsl/images/fsl-
image-qt5.bb
./sources/meta-fsl-bsp-release/imx/meta-fsl-demos/recipes-fsl/images/fsl-
image-gui.bb

COMPANY PUBLIC 39
Yocto Project: Using BitBake

COMPANY PUBLIC 40
Yocto Project: First Build Time
• The first build can take up to several hours depending on the speed
of your machine
• Subsequent builds will take much less time because the built
packages are cached to improved build times
• Only modified or added recipes will be built and deployed in the
subsequent builds

COMPANY PUBLIC 41
Using the Results
Location of the Build Output
Flashing SD Card Image

COMPANY PUBLIC 42
Yocto Project: Location of the Build Output
• The build output is inside the ../tmp/deploy/images directory in the build directory
you created:

user@machine:~/projects/nxp/imx/linux-bsp/imx-yocto-
bsp/yocto/build-xwayland/tmp/deploy/images/imx8qxpmek$ ls

*** More file are in the directory but here is a sample ***
fsl-image-gui-imx8qxpmek-20190921000528.rootfs.tar.bz2
fsl-image-gui-imx8qxpmek-20190921000528.rootfs.sdcard
uImage
u-boot.imx
fsl-image-gui-imx8qxpmek.sdcard

COMPANY PUBLIC 43
Yocto Project: Flashing SD Card Image
• Inside the images directory there is a .sdcar image file that is a
complete SD card image that can be flashed and used on the
reference board.
• Use dmesg or lsblk to find the name of your disk (sdX)

$ sudo dd if=fsl-image-imx8qxpmek.sdcard of=/dev/sdX bs=1M


516+0 records in
516+0 records out
541065216 bytes (541 MB) copied, 45.932 s, 11.8 MB/s

• Card can now be used to boot the reference platform

COMPANY PUBLIC 44
Yocto Project: Finding Help
• Community.NXP.com
• Meta-NXP mailing list
• Yocto Project Documentation

COMPANY PUBLIC 45
NXP and the NXP logo are trademarks of NXP B.V. All other product or service names are the property of their respective owners. © 2019 NXP B.V.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy