Yocto FAQ

From Crashcourse Wiki

Jump to: navigation, search

Contents

OVERVIEW

Work in progress, feel free to check back regularly. If there's a question listed here for which I still haven't posted an answer and you know what it is, e-mail me the answer at rpjday@crashcourse.ca and I'll add it.

Toolchains

Where can I just get some toolchains?

If you just want some working cross toolchains, the Yocto Project supplies them here. These toolchains must be installed in the root directory, and they install under the directory /opt/poky/.

They all come with an environment setup file with a name like environment-setup-armv5te-poky-linux-gnueabi which, when you source it, adds the appropriate cross-compile command directories to your search path.

NOTE: As far as I can tell, you're free to install multiple toolchains all at that same location, and they will play nicely together.

How can I tell my builds to use an external toolchain to save time?

Coming as soon as I verify the answer ...

How can I get Yocto to just build a toolchain for me?

Coming as soon as I verify the answer ...

Configuration

Where does all my build configuration come from?

The main configuration file for the bitbake command is meta/conf/bitbake.conf, which contains further includes of configuration files as follows (at least at the moment):

require conf/abi_version.conf
include conf/site.conf
include conf/auto.conf
include conf/local.conf
include conf/build/${BUILD_SYS}.conf
include conf/target/${TARGET_SYS}.conf
include conf/machine/${MACHINE}.conf
include conf/machine-sdk/${SDKMACHINE}.conf
include conf/distro/${DISTRO}.conf
include conf/distro/defaultsetup.conf
include conf/documentation.conf
require conf/sanity.conf
so you can see the possible wealth of configuration that might apply to your build.

How can I have some common, personal configuration applied to all of my local builds?

If you want to add some personal customization to a new project, you can always add it manually to the local.conf file, or you can add a file named site.conf to that same directory, whose contents will be processed as additional configuration. That new site.conf file can be either a regular file, or a symlink to a more global file that you can share among builds.

Your site.conf file should include the following line, based on whatever the current version is in the file meta-yocto/conf/site.conf.sample:

SCONF_VERSION = "1"

How can I dump information with bitbake?

There are a number of options to the bitbake command that let you just examine the current build environment without doing any building.

bitbake -s: show current and preferred versions of packages

Use one of:

$ bitbake -s
$ bitbake --show-versions

bitbake -e: show global or per-package environment

Use some variation of any of the following:

$ bitbake -e
$ bitbake --environment <package name>

Downloading and fetching

How can I ask bitbake to just fetch all the source I need if I want to build off-line later?

$ bitbake -c fetchall <target-image>

How can I set up a local mirror of tarballs to save download time?

If you have a local directory of Yocto-compatible source tarballs, you can take advantage of them by adding a variation of the following to the end of your builds's local.conf file:

SOURCE_MIRROR_URL ?= "file:///home/rpjday/dl/"   [my tarball directory]
INHERIT += "own-mirrors"
BB_GENERATE_MIRROR_TARBALLS = "1"
# BB_NO_NETWORK = "1"
The above has the following effect.

When you do a fetch, your source mirror directory is examined for each appropriate source tarball. If it's there, your build's downloads directory will simply create a symlink to it, so you'll see something like this:

lrwxrwxrwx 1 rpjday rpjday       32 Jun 26 06:41 bison-2.5.tar.gz -> /home/rpjday/dl/bison-2.5.tar.gz

On the other hand, if the proper tarball isn't available locally, it will be fetched and will show up as a regular file in that same downloads directory as, for example:

-rw-rw-r-- 1 rpjday rpjday   562616 Mar 24 15:19 expat-2.1.0.tar.gz
In this second case, just copy that tarball to your local mirror directory to prevent it being downloaded again during subsequent builds. Note that, as time goes by and recipes are upgraded, you should expect to update packages in your local mirror on a regular basis.

Finally, that last line in your local.conf:

# BB_NO_NETWORK = "1"
can be uncommented to verify that your build requires no fetching from the Internet.

Customizing your image

How can I add a single package to an existing target image?

The simple answer for now is to add to your local.conf file a line of the form:

IMAGE_INSTALL_append = " sysfsutils"   [note the leading space]
That should bundle the sysfsutils package into your final image.

Cleaning

How can I remove all of the build output so I can start over?

You can always remove the entire build directory, of course, which means you would have to start from scratch getting the source, applying the patches and so on.

If you want to remove only the build output, remove the tmp directory. That deletes all of the generated output of the build, while leaving all of the source in place in the downloads directory where it can be reused.

Personal tools