As mentioned earlier in this section, the existence of a machine configuration file is what makes a layer a BSP layer as compared to a general or kernel layer.
Machine configuration files exist in the
bsp_layer
/conf/machine/
directory of the layer:
bsp_layer
/conf/machine/
machine
.conf
For example, the machine configuration file for the
BeagleBone and BeagleBone Black development boards
is located in the container layer
poky/meta-yocto-bsp/conf/machine
and is named beaglebone-yocto.conf
:
#@TYPE: Machine #@NAME: Beaglebone-yocto machine #@DESCRIPTION: Reference machine configuration for http://beagleboard.org/bone and http://beagleboard.org/black boards PREFERRED_PROVIDER_virtual/xserver ?= "xserver-xorg" XSERVER ?= "xserver-xorg \ xf86-video-modesetting \ " MACHINE_EXTRA_RRECOMMENDS = "kernel-modules kernel-devicetree" EXTRA_IMAGEDEPENDS += "u-boot" DEFAULTTUNE ?= "cortexa8hf-neon" include conf/machine/include/tune-cortexa8.inc IMAGE_FSTYPES += "tar.bz2 jffs2 wic wic.bmap" EXTRA_IMAGECMD_jffs2 = "-lnp " WKS_FILE ?= "beaglebone-yocto.wks" IMAGE_INSTALL_append = " kernel-devicetree kernel-image-zimage" do_image_wic[depends] += "mtools-native:do_populate_sysroot dosfstools-native:do_populate_sysroot" SERIAL_CONSOLES = "115200;ttyO0" PREFERRED_PROVIDER_virtual/kernel ?= "linux-yocto" PREFERRED_VERSION_linux-yocto ?= "4.12%" KERNEL_IMAGETYPE = "zImage" KERNEL_DEVICETREE = "am335x-bone.dtb am335x-boneblack.dtb am335x-bonegreen.dtb" KERNEL_EXTRA_ARGS += "LOADADDR=${UBOOT_ENTRYPOINT}" SPL_BINARY = "MLO" UBOOT_SUFFIX = "img" UBOOT_MACHINE = "am335x_boneblack_config" UBOOT_ENTRYPOINT = "0x80008000" UBOOT_LOADADDRESS = "0x80008000" MACHINE_FEATURES = "usbgadget usbhost vfat alsa" IMAGE_BOOT_FILES ?= "u-boot.${UBOOT_SUFFIX} MLO"
The variables used to configure the machine define machine-specific properties. For example, machine-dependent packages, machine tunings, the type of kernel to build, and U-Boot configurations.
The following list provides some explanation for the statements found in the example reference machine configuration file for the BeagleBone development boards. Realize that much more can be defined as part of a machines configuration file. In general, you can learn about related variables that this example does not have by locating the variables in the "Yocto Project Variables Glossary" in the Yocto Project Reference Manual.
PREFERRED_PROVIDER_virtual/xserver
:
The recipe that provides "virtual/xserver" when
more than one provider is found.
In this case, the recipe that provides
"virtual/xserver" is "xserver-xorg", which
exists in
poky/meta/recipes-graphics/xserver-xorg
.
XSERVER
:
The packages that should be installed to provide
an X server and drivers for the machine.
In this example, the "xserver-xorg" and
"xf86-video-modesetting" are installed.
MACHINE_EXTRA_RRECOMMENDS
:
A list of machine-dependent packages
not essential for booting the image.
Thus, the build does not fail if the packages
do not exist.
However, the packages are required for a
fully-featured image.
MACHINE*
variables
exist that help you configure a particular
piece of hardware.
EXTRA_IMAGEDEPENDS
:
Recipes to build that do not provide packages
for installing into the root filesystem
but building the image depends on the
recipes.
Sometimes a recipe is required to build
the final image but is not needed in the
root filesystem.
In this case, the U-Boot recipe must be
built for the image.
DEFAULTTUNE
:
Machines use tunings to optimize machine,
CPU, and application performance.
These features, which are collectively known
as "tuning features", exist in the
OpenEmbedded-Core (OE-Core)
layer (e.g.
poky/meta/conf/machine/include
).
In this example, the default tunning file is
"cortexa8hf-neon".
include
statement
that pulls in the
conf/machine/include/tune-cortexa8.inc
file provides many tuning possibilities.
IMAGE_FSTYPES
:
The formats the OpenEmbedded build system
uses during the build when creating the
root filesystem.
In this example, four types of images are
supported.
EXTRA_IMAGECMD
:
Specifies additional options for image
creation commands.
In this example, the "-lnp " option is used
when creating the
JFFS2
image.
WKS_FILE
:
The location of the
Wic kickstart
file used by the OpenEmbedded build system to
create a partitioned image (image.wic).
IMAGE_INSTALL
:
Specifies packages to install into an image
through the
image
class.
Recipes use the IMAGE_INSTALL
variable.
do_image_wic[depends]
:
A task that is constructed during the build.
In this example, the task depends on specific tools
in order to create the sysroot when buiding a Wic
image.
SERIAL_CONSOLES
:
Defines a serial console (TTY) to enable using
getty.
In this case, the baud rate is "115200" and the
device name is "ttyO0".
PREFERRED_PROVIDER_virtual/kernel
:
Specifies the recipe that provides
"virtual/kernel" when more than one provider
is found.
In this case, the recipe that provides
"virtual/kernel" is "linux-yocto", which
exists in the layer's
recipes-kernel/linux
directory.
PREFERRED_VERSION_linux-yocto
:
Defines the version of the recipe used
to build the kernel, which is "4.12" in this
case.
KERNEL_IMAGETYPE
:
The type of kernel to build for the device.
In this case, the OpenEmbedded build system
creates a "zImage" image type.
KERNEL_DEVICETREE
:
The name of the generated Linux kernel device
tree (i.e. the .dtb
) file.
All the device trees for the various BeagleBone
devices are included.
KERNEL_EXTRA_ARGS
:
Additional make
command-line arguments the OpenEmbedded build
system passes on when compiling the kernel.
In this example, "LOADADDR=${UBOOT_ENTRYPOINT}"
is passed as a command-line argument.
SPL_BINARY
:
Defines the Secondary Program Loader (SPL) binary
type.
In this case, the SPL binary is set to
"MLO", which stands for Multimedia card LOader.
The BeagleBone development board requires an
SPL to boot and that SPL file type must be MLO.
Consequently, the machine configuration needs to
define SPL_BINARY
as "MLO".
u-boot.inc
include file.
UBOOT_*
:
Defines various U-Boot configurations needed
to build a U-Boot image.
In this example, a U-Boot image is required
to boot the BeagleBone device.
See the following variables for more information:
UBOOT_SUFFIX
:
Points to the generated U-Boot extension.
UBOOT_MACHINE
:
Specifies the value passed on the make command line when building a U-Boot image.
UBOOT_ENTRYPOINT
:
Specifies the entry point for the U-Boot image.
UBOOT_LOADADDRESS
:
Specifies the load address for the U-Boot image.
MACHINE_FEATURES
:
Specifies the list of hardware features the
BeagleBone device is capable of supporting.
In this case, the device supports
"usbgadget usbhost vfat alsa".
IMAGE_BOOT_FILES
:
Files installed into the device's boot partition
when preparing the image using the Wic tool
with the bootimg-partition
source plugin.
In this case, the "u-boot.${UBOOT_SUFFIX}" and
"MLO" files are installed.