Skip to content
holzkohlengrill edited this page Dec 15, 2023 · 2 revisions

[WIP] Yocto

Installation

Supported Linux Host Distros

Required Packages

Reference Distribution: Poky

Download from website

Configure the Build Environment

Inside the unpacked poky folder run

source oe-init-build-env <opt-path-for-build-folder_-_default-is./build>

to setup the build environment. Some files were generated:

...
├── build
│   └── conf
│       ├── bblayers.conf
│       ├── local.conf          --> Variables that influence the BitBake build (can override settings from other files)
│       └── templateconf.cfg
...

local.conf

  • To share source downloads between build environments place the DL_DIR directory outside the build environment like DL_DIR ?= "${TOPDIR}/../poky-src-dl"
  • Same for SSTATE_DIR (holds shared state cache) -> SSTATE_DIR ?= "${TOPDIR}/../sstate-cache"
  • TMP_DIR (contains build output and intermediate results) can be very big (gigabytes of data)
    • To save disk space you can add INHERIT += rm_work to your config. This deletes the files after building.

Start building

Just run:

# bitbake <build-target>
bitbake core-image-sato

from the top level directory of your build environment.

  • Use -c fetchall to download all sources first without building (-> bitbake -c fetchall core-image-sato)
  • -k lets you continue the build if it led into an error if there are tasks left and are not dependent to the error

===============

Quick Start

Definitions

  • Bitbake target: TODO
  • ...

Install 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 python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev pylint3 xterm

git clone poky

git clone git://git.yoctoproject.org/poky

Check out and branch a specific release:

cd poky
git fetch --tags
git tag
git checkout tags/yocto-3.0.1 -b my-yocto-3.0.1

Init the build env

Inside the poky folder run source oe-init-build-env (the location of the build folder depends on your current working directory). Only in terminals in which source oe-init-build-env was executed some commands get available.

The script:

  • creates a build directory
  • poky/build/conf/local.confgot created which holds local configuration options

Speed-up the download for the build using mirrors:

You can significantly speed up your build and guard against fetcher failures by using mirrors. To use mirrors, add these lines to your local.conf file in the Build directory:

SSTATE_MIRRORS = "\
file://.* http://sstate.yoctoproject.org/dev/PATH;downloadfilename=PATH \n \
file://.* http://sstate.yoctoproject.org/2.7.2/PATH;downloadfilename=PATH \n \
file://.* http://sstate.yoctoproject.org/3.0.1/PATH;downloadfilename=PATH \n \
"

See also http://sstate.yoctoproject.org/ for all versions.

Start the build

bitbake core-image-sato
#       ^^^^^^^^^^^^^^^---- target

Simulate your image using QEMU

runqemu qemux86

Yocto layers

In general, layers are repositories that contain related sets of instructions and configurations that tell the Yocto Project what to do.

From: https://www.yoctoproject.org/docs/current/brief-yoctoprojectqs/brief-yoctoprojectqs.html

By convention start layer names with meta-.

For instance:

$ tree -L 1
.
├── bitbake
├── build
├── contrib
├── documentation
├── LICENSE
├── LICENSE.GPL-2.0-only
├── LICENSE.MIT
├── meta
├── meta-poky
├── meta-selftest
├── meta-skeleton
├── meta-yocto-bsp
├── oe-init-build-env
├── poky-src-dl
├── README.hardware -> meta-yocto-bsp/README.hardware
├── README.OE-Core
├── README.poky -> meta-poky/README.poky
├── README.qemu
├── scripts
└── sstate-cache

Clone a layer

...into the poky directory.

Add the layer to be included

Add the new layer:

bitbake-layers add-layer ../meta-altera

->poky/build/conf/bblayers.conf (variable BBLAYERS) gets modified (possibly other files as well).

Create new layers with:

bitbake-layers create-layer

References

Clone this wiki locally