6 Adding a New Machine

Adding a new machine to the Yocto Project is a straightforward process. This section describes how to add machines that are similar to those that the Yocto Project already supports.

Note

Although well within the capabilities of the Yocto Project, adding a totally new architecture might require changes to gcc/glibc and to the site information, which is beyond the scope of this manual.

For a complete example that shows how to add a new machine, see the “Creating a new BSP Layer Using the bitbake-layers Script” section in the Yocto Project Board Support Package (BSP) Developer’s Guide.

6.1 Adding the Machine Configuration File

To add a new machine, you need to add a new machine configuration file to the layer’s conf/machine directory. This configuration file provides details about the device you are adding.

The OpenEmbedded build system uses the root name of the machine configuration file to reference the new machine. For example, given a machine configuration file named crownbay.conf, the build system recognizes the machine as “crownbay”.

The most important variables you must set in your machine configuration file or include from a lower-level configuration file are as follows:

You might also need these variables:

You can find full details on these variables in the reference section. You can leverage existing machine .conf files from meta-yocto-bsp/conf/machine/.

6.2 Adding a Kernel for the Machine

The OpenEmbedded build system needs to be able to build a kernel for the machine. You need to either create a new kernel recipe for this machine, or extend an existing kernel recipe. You can find several kernel recipe examples in the Source Directory at meta/recipes-kernel/linux that you can use as references.

If you are creating a new kernel recipe, normal recipe-writing rules apply for setting up a SRC_URI. Thus, you need to specify any necessary patches and set S to point at the source code. You need to create a do_configure task that configures the unpacked kernel with a defconfig file. You can do this by using a make defconfig command or, more commonly, by copying in a suitable defconfig file and then running make oldconfig. By making use of inherit kernel and potentially some of the linux-*.inc files, most other functionality is centralized and the defaults of the class normally work well.

If you are extending an existing kernel recipe, it is usually a matter of adding a suitable defconfig file. The file needs to be added into a location similar to defconfig files used for other machines in a given kernel recipe. A possible way to do this is by listing the file in the SRC_URI and adding the machine to the expression in COMPATIBLE_MACHINE:

COMPATIBLE_MACHINE = '(qemux86|qemumips)'

For more information on defconfig files, see the “Changing the Configuration” section in the Yocto Project Linux Kernel Development Manual.

6.3 Adding a Formfactor Configuration File

A formfactor configuration file provides information about the target hardware for which the image is being built and information that the build system cannot obtain from other sources such as the kernel. Some examples of information contained in a formfactor configuration file include framebuffer orientation, whether or not the system has a keyboard, the positioning of the keyboard in relation to the screen, and the screen resolution.

The build system uses reasonable defaults in most cases. However, if customization is necessary, you need to create a machconfig file in the meta/recipes-bsp/formfactor/files directory. This directory contains directories for specific machines such as qemuarm and qemux86. For information about the settings available and the defaults, see the meta/recipes-bsp/formfactor/files/config file found in the same area.

Following is an example for “qemuarm” machine:

HAVE_TOUCHSCREEN=1
HAVE_KEYBOARD=1
DISPLAY_CAN_ROTATE=0
DISPLAY_ORIENTATION=0
#DISPLAY_WIDTH_PIXELS=640
#DISPLAY_HEIGHT_PIXELS=480
#DISPLAY_BPP=16
DISPLAY_DPI=150
DISPLAY_SUBPIXEL_ORDER=vrgb