Knowing the local.conf file
When we initialize a build environment, it creates a file called build/conf/local.conf
, which is a powerful tool that can configure almost every aspect of the build process. We can set the machine we are building for, choose the toolchain host architecture to be used for a custom cross-toolchain, optimize options for maximum build time reduction, and so on. The comments inside the build/conf/local.conf
file are a very good documentation and reference of possible variables, and their defaults. The minimal set of variables we probably want to change from the default is the following:
BB_NUMBER_THREADS ?= "${@oe.utils.cpu_count()}" PARALLEL_MAKE ?= "-j ${@oe.utils.cpu_count()}" MACHINE ??= "qemux86"
Tip
BB_NUMBER_THREADS
and PARALLEL_MAKE
should be set to twice the host processor's number of cores.
The MACHINE
variable is where we determine the target machine we wish to build for. At the time of writing this book, Poky supports the following machines in its reference Board Support Package (BSP):
beaglebone
: This is BeagleBonegenericx86
: This is a generic support for 32-bit x86-based machinesgenericx86-64
: This is a generic support for 64-bit x86-based machinesmpc8315e-rdb
: This is a freescale MPC8315 PowerPC reference platformedgerouter
: This is Edgerouter Lite
The machines are made available by a layer called meta-yocto-bsp
. Besides these machines, OpenEmbedded-Core also provides support for the following:
qemuarm
: This is the QEMU ARM emulationqemumips
: This is the QEMU MIPS emulationqemumips64
: This is the QEMU MIPS64 emulationqemuppc
: This is the QEMU PowerPC emulationqemux86-64
: This is the QEMU x86-64 emulationqemux86
: This is the QEMU x86 emulation
Other machines are supported through extra BSP layers and these are available from a number of vendors. The process of using an extra BSP layer is shown in Chapter 10, Exploring External Layers.
Note
The local.conf
file is a very convenient way to override several default configurations over all the Yocto Project's tools. Essentially, we can change or set any variable, for example, add additional packages to an image file.
Though it is convenient, it should be considered as a temporary change as the build/conf/local.conf
file is not usually tracked by any source code management system.