Skip to content

Latest commit

 

History

History
312 lines (260 loc) · 9.8 KB

1-overview-concepts.org

File metadata and controls

312 lines (260 loc) · 9.8 KB

Yocto Project Training

1 Basic Terms

1.1 Official Documentation

1.2 Configuration Files

Files that hold global definitions of variables, user-defined variables, and hardware configuration information.

1.3 Layer

A collection of related recipes. Layers allow you to consolidate related metadata to customize your build.

1.4 Metadata

A key element of the Yocto Project is the Metadata that is used to construct a Linux distribution and is contained in the files that the OpenEmbedded build system parses when building an image.

1.5 OpenEmbedded Build System

The terms “BitBake” and “build system” are sometimes used for the OpenEmbedded Build System.

1.6 BitBake

Is a generic task execution engine that allows shell and Python tasks to be run efficiently and in parallel while working within complex inter-task dependency constraints

1.7 OpenEmbedded-Core (OE-Core)

OE-Core is metadata comprised of foundation recipes, classes, and associated files that are meant to be common among many different OpenEmbedded-derived systems, including the Yocto Project.

1.8 Packages

In the context of the Yocto Project, this term refers to a recipe’s packaged output produced by BitBake (i.e. a “baked recipe”). A package is generally the compiled binaries produced from the recipe’s sources. You “bake” something by running it through BitBake.

1.9 Recipe

The most common form of metadata.

2 BitBake

2.1 Bitbake

2.1.1 A generic task executor

  • User manual
  • Interprets metadata, decides what tasks are required to run, and executes those tasks.
  • Controls how software is built.
  • GNU Make achieves its control through “makefiles”, while BitBake uses “recipes”.
  • Includes a fetcher library for obtaining source code from various places.

2.2 Bitbake: Usage and syntax

2.2.1 Build a recipe

bitbake recipe

2.2.2 See help

bitbake -h

2.2.3 Most used options:

  • -c CMD Specify the task to execute
  • -k Continue as much as possible after an error
  • -f Force the specified targets/task

2.3 Bitbake

2.3.1 See all recipe related tasks

bitbake <recipe> -c listtasks

3 Recipes - Metadata

3.1 Recipes are stored in .bb files

  • Information about the package (author, homepage, license…)
  • Version of the recipe
  • Existing dependencies (both build and runtime dependencies)
  • Where the source code resides and how to fetch it
  • Whether the source code requires any patches, where to find them, and how to apply them
  • How to configure and compile the source code
  • How to assemble the generated artifacts into one or more installable packages
  • Where on the target machine to install the package or packages created

3.2 Recipe append are stored in .bbappend files

  • Extend or override information in an existing recipe file

3.3 Recipe Style Guide:

3.4 Configuration (.conf) and underlying include (.inc) files - conf directory

  • Define various configuration variables that govern the project’s build process.
  • Machine configuration
  • Distribution configuration
  • Compiler tuning
  • User configuration

3.5 And classes (.bbclass) files - classes directory

  • Contain information that is useful to share between metadata files
  • A class usually contains definitions for standard basic tasks such as:
  • Fetch, unpack, configure, compile, install, package

3.6 The OpenEmbedded Build System Workflow

./images/build_system_workflow.png

4 Yocto Explorer (ye)

4.1 Yocto Explorer (ye)

4.1.1 Documentation

The online documentation can be found here

4.2 Yocto Explorer (ye)

4.2.1 Most used commands

  • See documentation: ye d var
  • View package content: ye pv recipe
  • Expand variable: ye x recipe var
  • Get workdir location: ye wd recipe
  • See logs: ye l recipe

5 Overrides

5.1 Overrides: Important variables

5.1.1 OVERRIDES

5.1.2 FILESOVERRIDES

5.1.3 FILESPATH

6 Yocto Recipes

6.1 Recipe Overview: Online Image

./images/recipe-workflow.png

6.2 Name convention

6.2.1 All recipe need to follow this pattern

<packagename>_<version>.bb
${PN}_${PV}.bb

6.3 How to create a recipe from start?

6.3.1 The basic parts of a recipe

  • Summary and Description
  • Package information - Homepage, sections
  • License - License checksum
  • Package dependency
  • Where to fetch source code
  • Where unpacked recipe source code resides
  • Classes that I need to inherit
  • Tasks
  • Runtime dependencies
  • etc …

6.4 Simple recipe template

DESCRIPTION = ""
LICENSE = ""
LIC_FILES_CHKSUM = ""
DEPENDS = ""

SRC_URI = ""

do_configure() {
    :
}
do_compile() {
    :
}
do_install() {
    :
}

RDEPENDS_${PN} += ""

6.5 Summary and Description

6.5.1 Information about recipe

SUMMARY = "Short summary of package"
DESCRIPTION = "A piece of more detailed information about the package"

6.6 License: Documentation

6.6.1 Recipe license information

LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

6.7 Package dependency: Documentation

6.7.1 Usage

Lists a recipe’s build-time dependencies

6.7.2 Examples:

DEPENDS = "foo"
DEPENDS = "foo-native bar-native"
DEPENDS += "foo bar"
DEPENDS_append = "bar"

6.7.3 TIP

Use ye to get final variable value

6.8 Fetching: Documentation

6.8.1 Fetchers

  • Local file fetcher
  • HTTP/FTP wget fetcher
  • Git Fetcher

6.8.2 Examples:

SRC_URI = "file://relativefile.patch"
SRC_URI = "http://oe.handhelds.org/not_there.aac"
SRC_URI = "git://git.oe.handhelds.org/git/vip.git;protocol=http"

6.8.3 TIP

Use ye to get final variable value

6.9 Unpacking: Documentation

6.9.1 Examples

S = "{WORKDIR}/${PN}-${PV}"
S = "${WORKDIR}/git"

6.9.2 TIP

Use ye to get final variable value

6.10 Unpacking (cont.):

./images/fetching.png

6.11 Patching: Documentation

6.11.1 Examples:

SRC_URI += "file://foo.patch"
SRC_URI_append = " file://foo.patch"

6.12 Patching (cont.):

./images/patching.png

6.13 Classes

6.13.1 bbclass files

  • Why do I need to inherit classes?
  • How do I know what classes I need?

6.14 Configure, compile, and install

6.14.1 Documentation

6.15 Workflow: Configure, compile, and install…

./images/configuration-compile-autoreconf.png

6.16 Runtime dependencies

6.16.1 RDEPENDS

  • Lists runtime dependencies of a package
  • These dependencies are other packages that must be installed in order for the package to function correctly

6.16.2 TIP:

Use ye to get final variable value

6.17 Glossary

6.17.1 Documetation

Online Glossary

6.17.2 Using ye

ye d variable

7 Build history

7.1 Build history

7.1.1 Maintaining Build Output Quality

  • Documentation
  • Is a class that exists to help you maintain the quality of your build output
  • It records information about the contents of each package and image
  • Highlight unexpected and possibly unwanted changes in the build output

7.1.2 Enabling and Build History

INHERIT += "buildhistory"
BUILDHISTORY_COMMIT = "1"

7.2 Build History (cont.)

7.2.1 Image Information

  • image-files: A directory containing selected files from the root filesystem
  • files-in-image.txt: A list of files in the image
  • installed-package-names.txt: A list of installed packages by name only
  • installed-package-sizes.txt: A list of installed packages ordered by size
  • installed-packages.txt: A list of installed packages with full package filenames

7.3 Understanding What the Build History Contain

./images/buildhistory.png

8 References

8.1 References

8.1.1 All this presentation was based on