1517393d9SAndrew Geissler.. SPDX-License-Identifier: CC-BY-SA-2.0-UK 2517393d9SAndrew Geissler 3517393d9SAndrew GeisslerAdding a New Machine 4517393d9SAndrew Geissler******************** 5517393d9SAndrew Geissler 6517393d9SAndrew GeisslerAdding a new machine to the Yocto Project is a straightforward process. 7517393d9SAndrew GeisslerThis section describes how to add machines that are similar to those 8517393d9SAndrew Geisslerthat the Yocto Project already supports. 9517393d9SAndrew Geissler 10517393d9SAndrew Geissler.. note:: 11517393d9SAndrew Geissler 12517393d9SAndrew Geissler Although well within the capabilities of the Yocto Project, adding a 13517393d9SAndrew Geissler totally new architecture might require changes to ``gcc``/``glibc`` 14517393d9SAndrew Geissler and to the site information, which is beyond the scope of this 15517393d9SAndrew Geissler manual. 16517393d9SAndrew Geissler 17517393d9SAndrew GeisslerFor a complete example that shows how to add a new machine, see the 18517393d9SAndrew Geissler":ref:`bsp-guide/bsp:creating a new bsp layer using the \`\`bitbake-layers\`\` script`" 19517393d9SAndrew Geisslersection in the Yocto Project Board Support Package (BSP) Developer's 20517393d9SAndrew GeisslerGuide. 21517393d9SAndrew Geissler 22517393d9SAndrew GeisslerAdding the Machine Configuration File 23517393d9SAndrew Geissler===================================== 24517393d9SAndrew Geissler 25517393d9SAndrew GeisslerTo add a new machine, you need to add a new machine configuration file 26517393d9SAndrew Geisslerto the layer's ``conf/machine`` directory. This configuration file 27517393d9SAndrew Geisslerprovides details about the device you are adding. 28517393d9SAndrew Geissler 29517393d9SAndrew GeisslerThe OpenEmbedded build system uses the root name of the machine 30517393d9SAndrew Geisslerconfiguration file to reference the new machine. For example, given a 31517393d9SAndrew Geisslermachine configuration file named ``crownbay.conf``, the build system 32517393d9SAndrew Geisslerrecognizes the machine as "crownbay". 33517393d9SAndrew Geissler 34517393d9SAndrew GeisslerThe most important variables you must set in your machine configuration 35517393d9SAndrew Geisslerfile or include from a lower-level configuration file are as follows: 36517393d9SAndrew Geissler 37517393d9SAndrew Geissler- :term:`TARGET_ARCH` (e.g. "arm") 38517393d9SAndrew Geissler 39517393d9SAndrew Geissler- ``PREFERRED_PROVIDER_virtual/kernel`` 40517393d9SAndrew Geissler 41ac13d5f3SPatrick Williams- :term:`MACHINE_FEATURES` (e.g. "screen wifi") 42517393d9SAndrew Geissler 43517393d9SAndrew GeisslerYou might also need these variables: 44517393d9SAndrew Geissler 45517393d9SAndrew Geissler- :term:`SERIAL_CONSOLES` (e.g. "115200;ttyS0 115200;ttyS1") 46517393d9SAndrew Geissler 47517393d9SAndrew Geissler- :term:`KERNEL_IMAGETYPE` (e.g. "zImage") 48517393d9SAndrew Geissler 49517393d9SAndrew Geissler- :term:`IMAGE_FSTYPES` (e.g. "tar.gz jffs2") 50517393d9SAndrew Geissler 51517393d9SAndrew GeisslerYou can find full details on these variables in the reference section. 52517393d9SAndrew GeisslerYou can leverage existing machine ``.conf`` files from 53517393d9SAndrew Geissler``meta-yocto-bsp/conf/machine/``. 54517393d9SAndrew Geissler 55517393d9SAndrew GeisslerAdding a Kernel for the Machine 56517393d9SAndrew Geissler=============================== 57517393d9SAndrew Geissler 58517393d9SAndrew GeisslerThe OpenEmbedded build system needs to be able to build a kernel for the 59517393d9SAndrew Geisslermachine. You need to either create a new kernel recipe for this machine, 60517393d9SAndrew Geissleror extend an existing kernel recipe. You can find several kernel recipe 61517393d9SAndrew Geisslerexamples in the Source Directory at ``meta/recipes-kernel/linux`` that 62517393d9SAndrew Geissleryou can use as references. 63517393d9SAndrew Geissler 64517393d9SAndrew GeisslerIf you are creating a new kernel recipe, normal recipe-writing rules 65517393d9SAndrew Geisslerapply for setting up a :term:`SRC_URI`. Thus, you need to specify any 66517393d9SAndrew Geisslernecessary patches and set :term:`S` to point at the source code. You need to 67517393d9SAndrew Geisslercreate a :ref:`ref-tasks-configure` task that configures the unpacked kernel with 68517393d9SAndrew Geisslera ``defconfig`` file. You can do this by using a ``make defconfig`` 69517393d9SAndrew Geisslercommand or, more commonly, by copying in a suitable ``defconfig`` file 70517393d9SAndrew Geisslerand then running ``make oldconfig``. By making use of ``inherit kernel`` 71517393d9SAndrew Geisslerand potentially some of the ``linux-*.inc`` files, most other 72517393d9SAndrew Geisslerfunctionality is centralized and the defaults of the class normally work 73517393d9SAndrew Geisslerwell. 74517393d9SAndrew Geissler 75517393d9SAndrew GeisslerIf you are extending an existing kernel recipe, it is usually a matter 76517393d9SAndrew Geisslerof adding a suitable ``defconfig`` file. The file needs to be added into 77517393d9SAndrew Geisslera location similar to ``defconfig`` files used for other machines in a 78517393d9SAndrew Geisslergiven kernel recipe. A possible way to do this is by listing the file in 79517393d9SAndrew Geisslerthe :term:`SRC_URI` and adding the machine to the expression in 80517393d9SAndrew Geissler:term:`COMPATIBLE_MACHINE`:: 81517393d9SAndrew Geissler 82517393d9SAndrew Geissler COMPATIBLE_MACHINE = '(qemux86|qemumips)' 83517393d9SAndrew Geissler 84517393d9SAndrew GeisslerFor more information on ``defconfig`` files, see the 85517393d9SAndrew Geissler":ref:`kernel-dev/common:changing the configuration`" 86517393d9SAndrew Geisslersection in the Yocto Project Linux Kernel Development Manual. 87517393d9SAndrew Geissler 88517393d9SAndrew GeisslerAdding a Formfactor Configuration File 89517393d9SAndrew Geissler====================================== 90517393d9SAndrew Geissler 91517393d9SAndrew GeisslerA formfactor configuration file provides information about the target 92517393d9SAndrew Geisslerhardware for which the image is being built and information that the 93517393d9SAndrew Geisslerbuild system cannot obtain from other sources such as the kernel. Some 94517393d9SAndrew Geisslerexamples of information contained in a formfactor configuration file 95517393d9SAndrew Geisslerinclude framebuffer orientation, whether or not the system has a 96517393d9SAndrew Geisslerkeyboard, the positioning of the keyboard in relation to the screen, and 97517393d9SAndrew Geisslerthe screen resolution. 98517393d9SAndrew Geissler 99517393d9SAndrew GeisslerThe build system uses reasonable defaults in most cases. However, if 100517393d9SAndrew Geisslercustomization is necessary, you need to create a ``machconfig`` file in 101517393d9SAndrew Geisslerthe ``meta/recipes-bsp/formfactor/files`` directory. This directory 102517393d9SAndrew Geisslercontains directories for specific machines such as ``qemuarm`` and 103517393d9SAndrew Geissler``qemux86``. For information about the settings available and the 104517393d9SAndrew Geisslerdefaults, see the ``meta/recipes-bsp/formfactor/files/config`` file 105517393d9SAndrew Geisslerfound in the same area. 106517393d9SAndrew Geissler 107*39653566SPatrick WilliamsHere is an example for "qemuarm" machine:: 108517393d9SAndrew Geissler 109517393d9SAndrew Geissler HAVE_TOUCHSCREEN=1 110517393d9SAndrew Geissler HAVE_KEYBOARD=1 111517393d9SAndrew Geissler DISPLAY_CAN_ROTATE=0 112517393d9SAndrew Geissler DISPLAY_ORIENTATION=0 113517393d9SAndrew Geissler #DISPLAY_WIDTH_PIXELS=640 114517393d9SAndrew Geissler #DISPLAY_HEIGHT_PIXELS=480 115517393d9SAndrew Geissler #DISPLAY_BPP=16 116517393d9SAndrew Geissler DISPLAY_DPI=150 117517393d9SAndrew Geissler DISPLAY_SUBPIXEL_ORDER=vrgb 118517393d9SAndrew Geissler 119