1.. SPDX-License-Identifier: CC-BY-SA-2.0-UK
2
3**************************************************
4Board Support Packages (BSP) --- Developer's Guide
5**************************************************
6
7A Board Support Package (BSP) is a collection of information that
8defines how to support a particular hardware device, set of devices, or
9hardware platform. The BSP includes information about the hardware
10features present on the device and kernel configuration information
11along with any additional hardware drivers required. The BSP also lists
12any additional software components required in addition to a generic
13Linux software stack for both essential and optional platform features.
14
15This guide presents information about BSP layers, defines a structure
16for components so that BSPs follow a commonly understood layout,
17discusses how to customize a recipe for a BSP, addresses BSP licensing,
18and provides information that shows you how to create a BSP
19Layer using the :ref:`bitbake-layers <bsp-guide/bsp:Creating a new BSP Layer Using the \`\`bitbake-layers\`\` Script>`
20tool.
21
22BSP Layers
23==========
24
25A BSP consists of a file structure inside a base directory.
26Collectively, you can think of the base directory, its file structure,
27and the contents as a BSP layer. Although not a strict requirement, BSP
28layers in the Yocto Project use the following well-established naming
29convention::
30
31   meta-bsp_root_name
32
33The string "meta-" is prepended to the
34machine or platform name, which is "bsp_root_name" in the above form.
35
36.. note::
37
38   Because the BSP layer naming convention is well-established, it is
39   advisable to follow it when creating layers. Technically speaking, a
40   BSP layer name does not need to start with ``meta-``.
41   However, various scripts and tools in the Yocto Project development
42   environment assume this convention.
43
44To help understand the BSP layer concept, consider the BSPs that the
45Yocto Project supports and provides with each release. You can see the
46layers in the
47:ref:`overview-manual/development-environment:yocto project source repositories`
48through
49a web interface at :yocto_git:`/`. If you go to that interface,
50you will find a list of repositories under "Yocto Metadata Layers".
51
52.. note::
53
54   Layers that are no longer actively supported as part of the Yocto
55   Project appear under the heading "Yocto Metadata Layer Archive."
56
57Each repository is a BSP layer supported by the Yocto Project (e.g.
58``meta-raspberrypi`` and ``meta-intel``). Each of these layers is a
59repository unto itself and clicking on the layer name displays two URLs
60from which you can clone the layer's repository to your local system.
61Here is an example that clones the Raspberry Pi BSP layer::
62
63   $ git clone git://git.yoctoproject.org/meta-raspberrypi
64
65In addition to BSP layers, the ``meta-yocto-bsp`` layer is part of the
66shipped ``poky`` repository. The ``meta-yocto-bsp`` layer maintains
67several "reference" BSPs including the ARM-based Beaglebone and generic
68versions of both 32-bit and 64-bit IA machines.
69
70For information on typical BSP development workflow, see the
71:ref:`bsp-guide/bsp:developing a board support package (bsp)`
72section. For more
73information on how to set up a local copy of source files from a Git
74repository, see the
75:ref:`dev-manual/start:locating yocto project source files`
76section in the Yocto Project Development Tasks Manual.
77
78The BSP layer's base directory (``meta-bsp_root_name``) is the root
79directory of that Layer. This directory is what you add to the
80:term:`BBLAYERS` variable in the
81``conf/bblayers.conf`` file found in your
82:term:`Build Directory`, which is
83established after you run the OpenEmbedded build environment setup
84script (i.e. :ref:`ref-manual/structure:\`\`oe-init-build-env\`\``).
85Adding the root directory allows the :term:`OpenEmbedded Build System`
86to recognize the BSP
87layer and from it build an image. Here is an example::
88
89   BBLAYERS ?= " \
90      /usr/local/src/yocto/meta \
91      /usr/local/src/yocto/meta-poky \
92      /usr/local/src/yocto/meta-yocto-bsp \
93      /usr/local/src/yocto/meta-mylayer \
94      "
95
96.. note::
97
98   Ordering and :term:`BBFILE_PRIORITY` for the layers listed in :term:`BBLAYERS`
99   matter. For example, if multiple layers define a machine configuration, the
100   OpenEmbedded build system uses the last layer searched given similar layer
101   priorities. The build system works from the top-down through the layers
102   listed in :term:`BBLAYERS`.
103
104Some BSPs require or depend on additional layers beyond the BSP's root
105layer in order to be functional. In this case, you need to specify these
106layers in the ``README`` "Dependencies" section of the BSP's root layer.
107Additionally, if any build instructions exist for the BSP, you must add
108them to the "Dependencies" section.
109
110Some layers function as a layer to hold other BSP layers. These layers
111are known as ":term:`container layers <Container Layer>`". An example of
112this type of layer is OpenEmbedded's :oe_git:`meta-openembedded </meta-openembedded>`
113layer. The ``meta-openembedded`` layer contains many ``meta-*`` layers.
114In cases like this, you need to include the names of the actual layers
115you want to work with, such as::
116
117   BBLAYERS ?= " \
118     /usr/local/src/yocto/meta \
119     /usr/local/src/yocto/meta-poky \
120     /usr/local/src/yocto/meta-yocto-bsp \
121     /usr/local/src/yocto/meta-mylayer \
122     .../meta-openembedded/meta-oe \
123     .../meta-openembedded/meta-perl \
124     .../meta-openembedded/meta-networking \
125     "
126
127and so on.
128
129For more information on layers, see the
130":ref:`dev-manual/layers:understanding and creating layers`"
131section of the Yocto Project Development Tasks Manual.
132
133Preparing Your Build Host to Work With BSP Layers
134=================================================
135
136This section describes how to get your build host ready to work with BSP
137layers. Once you have the host set up, you can create the layer as
138described in the
139":ref:`bsp-guide/bsp:creating a new bsp layer using the \`\`bitbake-layers\`\` script`"
140section.
141
142.. note::
143
144   For structural information on BSPs, see the
145   :ref:`bsp-guide/bsp:example filesystem layout` section.
146
147#. *Set Up the Build Environment:* Be sure you are set up to use BitBake
148   in a shell. See the ":ref:`dev-manual/start:preparing the build host`"
149   section in the Yocto Project Development Tasks Manual for information on how
150   to get a build host ready that is either a native Linux machine or a machine
151   that uses CROPS.
152
153#. *Clone the poky Repository:* You need to have a local copy of the
154   Yocto Project :term:`Source Directory` (i.e. a local
155   ``poky`` repository). See the
156   ":ref:`dev-manual/start:cloning the \`\`poky\`\` repository`" and
157   possibly the
158   ":ref:`dev-manual/start:checking out by branch in poky`" or
159   ":ref:`dev-manual/start:checking out by tag in poky`"
160   sections
161   all in the Yocto Project Development Tasks Manual for information on
162   how to clone the ``poky`` repository and check out the appropriate
163   branch for your work.
164
165#. *Determine the BSP Layer You Want:* The Yocto Project supports many
166   BSPs, which are maintained in their own layers or in layers designed
167   to contain several BSPs. To get an idea of machine support through
168   BSP layers, you can look at the
169   :yocto_dl:`index of machines </releases/yocto/yocto-&DISTRO;/machines>`
170   for the release.
171
172#. *Optionally Clone the meta-intel BSP Layer:* If your hardware is
173   based on current Intel CPUs and devices, you can leverage this BSP
174   layer. For details on the ``meta-intel`` BSP layer, see the layer's
175   :yocto_git:`README </meta-intel/tree/README>` file.
176
177   #. *Navigate to Your Source Directory:* Typically, you set up the
178      ``meta-intel`` Git repository inside the :term:`Source Directory` (e.g.
179      ``poky``). ::
180
181         $ cd /home/you/poky
182
183   #. *Clone the Layer:* ::
184
185         $ git clone git://git.yoctoproject.org/meta-intel.git
186         Cloning into 'meta-intel'...
187         remote: Counting objects: 15585, done.
188         remote: Compressing objects: 100% (5056/5056), done.
189         remote: Total 15585 (delta 9123), reused 15329 (delta 8867)
190         Receiving objects: 100% (15585/15585), 4.51 MiB | 3.19 MiB/s, done.
191         Resolving deltas: 100% (9123/9123), done.
192         Checking connectivity... done.
193
194   #. *Check Out the Proper Branch:* The branch you check out for
195      ``meta-intel`` must match the same branch you are using for the
196      Yocto Project release (e.g. ``&DISTRO_NAME_NO_CAP;``)::
197
198         $ cd meta-intel
199         $ git checkout -b &DISTRO_NAME_NO_CAP; remotes/origin/&DISTRO_NAME_NO_CAP;
200         Branch &DISTRO_NAME_NO_CAP; set up to track remote branch
201         &DISTRO_NAME_NO_CAP; from origin.
202         Switched to a new branch '&DISTRO_NAME_NO_CAP;'
203
204      .. note::
205
206         To see the available branch names in a cloned repository, use the ``git
207         branch -al`` command. See the
208         ":ref:`dev-manual/start:checking out by branch in poky`"
209         section in the Yocto Project Development Tasks Manual for more
210         information.
211
212#. *Optionally Set Up an Alternative BSP Layer:* If your hardware can be
213   more closely leveraged to an existing BSP not within the
214   ``meta-intel`` BSP layer, you can clone that BSP layer.
215
216   The process is identical to the process used for the ``meta-intel``
217   layer except for the layer's name. For example, if you determine that
218   your hardware most closely matches the ``meta-raspberrypi``, clone
219   that layer::
220
221      $ git clone git://git.yoctoproject.org/meta-raspberrypi
222      Cloning into 'meta-raspberrypi'...
223      remote: Counting objects: 4743, done.
224      remote: Compressing objects: 100% (2185/2185), done.
225      remote: Total 4743 (delta 2447), reused 4496 (delta 2258)
226      Receiving objects: 100% (4743/4743), 1.18 MiB | 0 bytes/s, done.
227      Resolving deltas: 100% (2447/2447), done.
228      Checking connectivity... done.
229
230#. *Initialize the Build Environment:* While in the root directory of
231   the Source Directory (i.e. ``poky``), run the
232   :ref:`ref-manual/structure:\`\`oe-init-build-env\`\`` environment
233   setup script to define the OpenEmbedded build environment on your
234   build host. ::
235
236      $ source oe-init-build-env
237
238   Among other things, the script creates the :term:`Build Directory`, which is
239   ``build`` in this case and is located in the :term:`Source Directory`.  After
240   the script runs, your current working directory is set to the ``build``
241   directory.
242
243Example Filesystem Layout
244=========================
245
246Defining a common BSP directory structure allows end-users to understand
247and become familiar with that standard. A common format also encourages
248standardization of software support for hardware.
249
250The proposed form described in this section does have elements that are
251specific to the OpenEmbedded build system. It is intended that
252developers can use this structure with other build systems besides the
253OpenEmbedded build system. It is also intended that it will be simple
254to extract information and convert it to other formats if required. The
255OpenEmbedded build system, through its standard :ref:`layers mechanism
256<overview-manual/yp-intro:the yocto project layer model>`, can
257directly accept the format described as a layer. The BSP layer captures
258all the hardware-specific details in one place using a standard format,
259which is useful for any person wishing to use the hardware platform
260regardless of the build system they are using.
261
262The BSP specification does not include a build system or other tools -
263the specification is concerned with the hardware-specific components
264only. At the end-distribution point, you can ship the BSP layer combined
265with a build system and other tools. Realize that it is important to
266maintain the distinction that the BSP layer, a build system, and tools
267are separate components that could be combined in certain end products.
268
269Before looking at the recommended form for the directory structure
270inside a BSP layer, you should be aware that there are some requirements
271in order for a BSP layer to be considered compliant with the Yocto
272Project. For that list of requirements, see the
273":ref:`bsp-guide/bsp:released bsp requirements`" section.
274
275Below is the typical directory structure for a BSP layer. While this
276basic form represents the standard, realize that the actual layout for
277individual BSPs could differ. ::
278
279   meta-bsp_root_name/
280   meta-bsp_root_name/bsp_license_file
281   meta-bsp_root_name/README
282   meta-bsp_root_name/README.sources
283   meta-bsp_root_name/binary/bootable_images
284   meta-bsp_root_name/conf/layer.conf
285   meta-bsp_root_name/conf/machine/*.conf
286   meta-bsp_root_name/recipes-bsp/*
287   meta-bsp_root_name/recipes-core/*
288   meta-bsp_root_name/recipes-graphics/*
289   meta-bsp_root_name/recipes-kernel/linux/linux-yocto_kernel_rev.bbappend
290
291Below is an example of the Raspberry Pi BSP layer that is available from
292the :yocto_git:`Source Repositories <>`:
293
294.. code-block:: none
295
296   meta-raspberrypi/COPYING.MIT
297   meta-raspberrypi/README.md
298   meta-raspberrypi/classes
299   meta-raspberrypi/classes/sdcard_image-rpi.bbclass
300   meta-raspberrypi/conf/
301   meta-raspberrypi/conf/layer.conf
302   meta-raspberrypi/conf/machine/
303   meta-raspberrypi/conf/machine/raspberrypi-cm.conf
304   meta-raspberrypi/conf/machine/raspberrypi-cm3.conf
305   meta-raspberrypi/conf/machine/raspberrypi.conf
306   meta-raspberrypi/conf/machine/raspberrypi0-wifi.conf
307   meta-raspberrypi/conf/machine/raspberrypi0.conf
308   meta-raspberrypi/conf/machine/raspberrypi2.conf
309   meta-raspberrypi/conf/machine/raspberrypi3-64.conf
310   meta-raspberrypi/conf/machine/raspberrypi3.conf
311   meta-raspberrypi/conf/machine/include
312   meta-raspberrypi/conf/machine/include/rpi-base.inc
313   meta-raspberrypi/conf/machine/include/rpi-default-providers.inc
314   meta-raspberrypi/conf/machine/include/rpi-default-settings.inc
315   meta-raspberrypi/conf/machine/include/rpi-default-versions.inc
316   meta-raspberrypi/conf/machine/include/tune-arm1176jzf-s.inc
317   meta-raspberrypi/docs
318   meta-raspberrypi/docs/Makefile
319   meta-raspberrypi/docs/conf.py
320   meta-raspberrypi/docs/contributing.md
321   meta-raspberrypi/docs/extra-apps.md
322   meta-raspberrypi/docs/extra-build-config.md
323   meta-raspberrypi/docs/index.rst
324   meta-raspberrypi/docs/layer-contents.md
325   meta-raspberrypi/docs/readme.md
326   meta-raspberrypi/files
327   meta-raspberrypi/files/custom-licenses
328   meta-raspberrypi/files/custom-licenses/Broadcom
329   meta-raspberrypi/recipes-bsp
330   meta-raspberrypi/recipes-bsp/bootfiles
331   meta-raspberrypi/recipes-bsp/bootfiles/bcm2835-bootfiles.bb
332   meta-raspberrypi/recipes-bsp/bootfiles/rpi-config_git.bb
333   meta-raspberrypi/recipes-bsp/common
334   meta-raspberrypi/recipes-bsp/common/firmware.inc
335   meta-raspberrypi/recipes-bsp/formfactor
336   meta-raspberrypi/recipes-bsp/formfactor/formfactor
337   meta-raspberrypi/recipes-bsp/formfactor/formfactor/raspberrypi
338   meta-raspberrypi/recipes-bsp/formfactor/formfactor/raspberrypi/machconfig
339   meta-raspberrypi/recipes-bsp/formfactor/formfactor_%.bbappend
340   meta-raspberrypi/recipes-bsp/rpi-u-boot-src
341   meta-raspberrypi/recipes-bsp/rpi-u-boot-src/files
342   meta-raspberrypi/recipes-bsp/rpi-u-boot-src/files/boot.cmd.in
343   meta-raspberrypi/recipes-bsp/rpi-u-boot-src/rpi-u-boot-scr.bb
344   meta-raspberrypi/recipes-bsp/u-boot
345   meta-raspberrypi/recipes-bsp/u-boot/u-boot
346   meta-raspberrypi/recipes-bsp/u-boot/u-boot/*.patch
347   meta-raspberrypi/recipes-bsp/u-boot/u-boot_%.bbappend
348   meta-raspberrypi/recipes-connectivity
349   meta-raspberrypi/recipes-connectivity/bluez5
350   meta-raspberrypi/recipes-connectivity/bluez5/bluez5
351   meta-raspberrypi/recipes-connectivity/bluez5/bluez5/*.patch
352   meta-raspberrypi/recipes-connectivity/bluez5/bluez5/BCM43430A1.hcd
353   meta-raspberrypi/recipes-connectivity/bluez5/bluez5brcm43438.service
354   meta-raspberrypi/recipes-connectivity/bluez5/bluez5_%.bbappend
355   meta-raspberrypi/recipes-core
356   meta-raspberrypi/recipes-core/images
357   meta-raspberrypi/recipes-core/images/rpi-basic-image.bb
358   meta-raspberrypi/recipes-core/images/rpi-hwup-image.bb
359   meta-raspberrypi/recipes-core/images/rpi-test-image.bb
360   meta-raspberrypi/recipes-core/packagegroups
361   meta-raspberrypi/recipes-core/packagegroups/packagegroup-rpi-test.bb
362   meta-raspberrypi/recipes-core/psplash
363   meta-raspberrypi/recipes-core/psplash/files
364   meta-raspberrypi/recipes-core/psplash/files/psplash-raspberrypi-img.h
365   meta-raspberrypi/recipes-core/psplash/psplash_git.bbappend
366   meta-raspberrypi/recipes-core/udev
367   meta-raspberrypi/recipes-core/udev/udev-rules-rpi
368   meta-raspberrypi/recipes-core/udev/udev-rules-rpi/99-com.rules
369   meta-raspberrypi/recipes-core/udev/udev-rules-rpi.bb
370   meta-raspberrypi/recipes-devtools
371   meta-raspberrypi/recipes-devtools/bcm2835
372   meta-raspberrypi/recipes-devtools/bcm2835/bcm2835_1.52.bb
373   meta-raspberrypi/recipes-devtools/pi-blaster
374   meta-raspberrypi/recipes-devtools/pi-blaster/files
375   meta-raspberrypi/recipes-devtools/pi-blaster/files/*.patch
376   meta-raspberrypi/recipes-devtools/pi-blaster/pi-blaster_git.bb
377   meta-raspberrypi/recipes-devtools/python
378   meta-raspberrypi/recipes-devtools/python/python-rtimu
379   meta-raspberrypi/recipes-devtools/python/python-rtimu/*.patch
380   meta-raspberrypi/recipes-devtools/python/python-rtimu_git.bb
381   meta-raspberrypi/recipes-devtools/python/python-sense-hat_2.2.0.bb
382   meta-raspberrypi/recipes-devtools/python/rpi-gpio
383   meta-raspberrypi/recipes-devtools/python/rpi-gpio/*.patch
384   meta-raspberrypi/recipes-devtools/python/rpi-gpio_0.6.3.bb
385   meta-raspberrypi/recipes-devtools/python/rpio
386   meta-raspberrypi/recipes-devtools/python/rpio/*.patch
387   meta-raspberrypi/recipes-devtools/python/rpio_0.10.0.bb
388   meta-raspberrypi/recipes-devtools/wiringPi
389   meta-raspberrypi/recipes-devtools/wiringPi/files
390   meta-raspberrypi/recipes-devtools/wiringPi/files/*.patch
391   meta-raspberrypi/recipes-devtools/wiringPi/wiringpi_git.bb
392   meta-raspberrypi/recipes-graphics
393   meta-raspberrypi/recipes-graphics/eglinfo
394   meta-raspberrypi/recipes-graphics/eglinfo/eglinfo-fb_%.bbappend
395   meta-raspberrypi/recipes-graphics/eglinfo/eglinfo-x11_%.bbappend
396   meta-raspberrypi/recipes-graphics/mesa
397   meta-raspberrypi/recipes-graphics/mesa/mesa-gl_%.bbappend
398   meta-raspberrypi/recipes-graphics/mesa/mesa_%.bbappend
399   meta-raspberrypi/recipes-graphics/userland
400   meta-raspberrypi/recipes-graphics/userland/userland
401   meta-raspberrypi/recipes-graphics/userland/userland/*.patch
402   meta-raspberrypi/recipes-graphics/userland/userland_git.bb
403   meta-raspberrypi/recipes-graphics/vc-graphics
404   meta-raspberrypi/recipes-graphics/vc-graphics/files
405   meta-raspberrypi/recipes-graphics/vc-graphics/files/egl.pc
406   meta-raspberrypi/recipes-graphics/vc-graphics/files/vchiq.sh
407   meta-raspberrypi/recipes-graphics/vc-graphics/vc-graphics-hardfp.bb
408   meta-raspberrypi/recipes-graphics/vc-graphics/vc-graphics.bb
409   meta-raspberrypi/recipes-graphics/vc-graphics/vc-graphics.inc
410   meta-raspberrypi/recipes-graphics/wayland
411   meta-raspberrypi/recipes-graphics/wayland/weston_%.bbappend
412   meta-raspberrypi/recipes-graphics/xorg-xserver
413   meta-raspberrypi/recipes-graphics/xorg-xserver/xserver-xf86-config
414   meta-raspberrypi/recipes-graphics/xorg-xserver/xserver-xf86-config/rpi
415   meta-raspberrypi/recipes-graphics/xorg-xserver/xserver-xf86-config/rpi/xorg.conf
416   meta-raspberrypi/recipes-graphics/xorg-xserver/xserver-xf86-config/rpi/xorg.conf.d
417   meta-raspberrypi/recipes-graphics/xorg-xserver/xserver-xf86-config/rpi/xorg.conf.d/10-evdev.conf
418   meta-raspberrypi/recipes-graphics/xorg-xserver/xserver-xf86-config/rpi/xorg.conf.d/98-pitft.conf
419   meta-raspberrypi/recipes-graphics/xorg-xserver/xserver-xf86-config/rpi/xorg.conf.d/99-calibration.conf
420   meta-raspberrypi/recipes-graphics/xorg-xserver/xserver-xf86-config_0.1.bbappend
421   meta-raspberrypi/recipes-graphics/xorg-xserver/xserver-xorg_%.bbappend
422   meta-raspberrypi/recipes-kernel
423   meta-raspberrypi/recipes-kernel/linux-firmware
424   meta-raspberrypi/recipes-kernel/linux-firmware/files
425   meta-raspberrypi/recipes-kernel/linux-firmware/files/brcmfmac43430-sdio.bin
426   meta-raspberrypi/recipes-kernel/linux-firmware/files/brcfmac43430-sdio.txt
427   meta-raspberrypi/recipes-kernel/linux-firmware/linux-firmware_%.bbappend
428   meta-raspberrypi/recipes-kernel/linux
429   meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi-dev.bb
430   meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi.inc
431   meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi_4.14.bb
432   meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi_4.9.bb
433   meta-raspberrypi/recipes-multimedia
434   meta-raspberrypi/recipes-multimedia/gstreamer
435   meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx
436   meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx/*.patch
437   meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx_%.bbappend
438   meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_%.bbappend
439   meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12
440   meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12/*.patch
441   meta-raspberrypi/recipes-multimedia/omxplayer
442   meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer
443   meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/*.patch
444   meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer_git.bb
445   meta-raspberrypi/recipes-multimedia/x264
446   meta-raspberrypi/recipes-multimedia/x264/x264_git.bbappend
447   meta-raspberrypi/wic meta-raspberrypi/wic/sdimage-raspberrypi.wks
448
449The following sections describe each part of the proposed BSP format.
450
451License Files
452-------------
453
454You can find these files in the BSP Layer at::
455
456   meta-bsp_root_name/bsp_license_file
457
458These optional files satisfy licensing requirements for the BSP. The
459type or types of files here can vary depending on the licensing
460requirements. For example, in the Raspberry Pi BSP, all licensing
461requirements are handled with the ``COPYING.MIT`` file.
462
463Licensing files can be MIT, BSD, GPLv*, and so forth. These files are
464recommended for the BSP but are optional and totally up to the BSP
465developer. For information on how to maintain license compliance, see
466the ":ref:`dev-manual/licenses:maintaining open source license compliance during your product's lifecycle`"
467section in the Yocto Project Development Tasks Manual.
468
469README File
470-----------
471
472You can find this file in the BSP Layer at::
473
474   meta-bsp_root_name/README
475
476This file provides information on how to boot the live images that are
477optionally included in the ``binary/`` directory. The ``README`` file
478also provides information needed for building the image.
479
480At a minimum, the ``README`` file must contain a list of dependencies,
481such as the names of any other layers on which the BSP depends and the
482name of the BSP maintainer with his or her contact information.
483
484README.sources File
485-------------------
486
487You can find this file in the BSP Layer at::
488
489   meta-bsp_root_name/README.sources
490
491This file provides information on where to locate the BSP source files
492used to build the images (if any) that reside in
493``meta-bsp_root_name/binary``. Images in the ``binary`` would be images
494released with the BSP. The information in the ``README.sources`` file
495also helps you find the :term:`Metadata`
496used to generate the images that ship with the BSP.
497
498.. note::
499
500   If the BSP's ``binary`` directory is missing or the directory has no images, an
501   existing ``README.sources`` file is meaningless and usually does not exist.
502
503Pre-built User Binaries
504-----------------------
505
506You can find these files in the BSP Layer at::
507
508   meta-bsp_root_name/binary/bootable_images
509
510This optional area contains useful pre-built kernels and user-space
511filesystem images released with the BSP that are appropriate to the
512target system. This directory typically contains graphical (e.g. Sato)
513and minimal live images when the BSP tarball has been created and made
514available in the :yocto_home:`Yocto Project <>` website. You can
515use these kernels and images to get a system running and quickly get
516started on development tasks.
517
518The exact types of binaries present are highly hardware-dependent. The
519:ref:`README <bsp-guide/bsp:readme file>` file should be present in the
520BSP Layer and it explains how to use the images with the target
521hardware. Additionally, the
522:ref:`README.sources <bsp-guide/bsp:readme.sources file>` file should be
523present to locate the sources used to build the images and provide
524information on the Metadata.
525
526Layer Configuration File
527------------------------
528
529You can find this file in the BSP Layer at::
530
531   meta-bsp_root_name/conf/layer.conf
532
533The ``conf/layer.conf`` file identifies the file structure as a layer,
534identifies the contents of the layer, and contains information about how
535the build system should use it. Generally, a standard boilerplate file
536such as the following works. In the following example, you would replace
537"bsp" with the actual name of the BSP (i.e. "bsp_root_name" from the example
538template). ::
539
540   # We have a conf and classes directory, add to BBPATH
541   BBPATH .= ":${LAYERDIR}"
542
543   # We have a recipes directory containing .bb and .bbappend files, add to BBFILES
544   BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
545               ${LAYERDIR}/recipes-*/*/*.bbappend"
546
547   BBFILE_COLLECTIONS += "bsp"
548   BBFILE_PATTERN_bsp = "^${LAYERDIR}/"
549   BBFILE_PRIORITY_bsp = "6"
550   LAYERDEPENDS_bsp = "intel"
551
552To illustrate the string substitutions, here are the corresponding
553statements from the Raspberry Pi ``conf/layer.conf`` file::
554
555   # We have a conf and classes directory, append to BBPATH
556   BBPATH .= ":${LAYERDIR}"
557
558   # We have a recipes directory containing .bb and .bbappend files, add to BBFILES
559   BBFILES += "${LAYERDIR}/recipes*/*/*.bb \
560               ${LAYERDIR}/recipes*/*/*.bbappend"
561
562   BBFILE_COLLECTIONS += "raspberrypi"
563   BBFILE_PATTERN_raspberrypi := "^${LAYERDIR}/"
564   BBFILE_PRIORITY_raspberrypi = "9"
565
566   # Additional license directories.
567   LICENSE_PATH += "${LAYERDIR}/files/custom-licenses"
568   .
569   .
570   .
571
572This file simply makes :term:`BitBake` aware of the recipes and configuration
573directories. The file must exist so that the OpenEmbedded build system can
574recognize the BSP.
575
576Hardware Configuration Options
577------------------------------
578
579You can find these files in the BSP Layer at::
580
581   meta-bsp_root_name/conf/machine/*.conf
582
583The machine files bind together all the information contained elsewhere
584in the BSP into a format that the build system can understand. Each BSP
585Layer requires at least one machine file. If the BSP supports multiple
586machines, multiple machine configuration files can exist. These
587filenames correspond to the values to which users have set the
588:term:`MACHINE` variable.
589
590These files define things such as the kernel package to use
591(:term:`PREFERRED_PROVIDER` of
592:ref:`virtual/kernel <dev-manual/new-recipe:using virtual providers>`),
593the hardware drivers to include in different types of images, any
594special software components that are needed, any bootloader information,
595and also any special image format requirements.
596
597This configuration file could also include a hardware "tuning" file that
598is commonly used to define the package architecture and specify
599optimization flags, which are carefully chosen to give best performance
600on a given processor.
601
602Tuning files are found in the ``meta/conf/machine/include`` directory
603within the :term:`Source Directory`.
604For example, many ``tune-*`` files (e.g. ``tune-arm1136jf-s.inc``,
605``tune-1586-nlp.inc``, and so forth) reside in the
606``poky/meta/conf/machine/include`` directory.
607
608To use an include file, you simply include them in the machine
609configuration file. For example, the Raspberry Pi BSP
610``raspberrypi3.conf`` contains the following statement::
611
612   include conf/machine/include/rpi-base.inc
613
614Miscellaneous BSP-Specific Recipe Files
615---------------------------------------
616
617You can find these files in the BSP Layer at::
618
619   meta-bsp_root_name/recipes-bsp/*
620
621This optional directory contains miscellaneous recipe files for the BSP.
622Most notably would be the formfactor files. For example, in the
623Raspberry Pi BSP, there is the ``formfactor_%.bbappend`` file, which
624is an append file used to augment the recipe that starts the build.
625Furthermore, there are machine-specific settings used during the build
626that are defined by the ``machconfig`` file further down in the
627directory. Here is the ``machconfig`` file for the Raspberry Pi BSP::
628
629   HAVE_TOUCHSCREEN=0
630   HAVE_KEYBOARD=1
631
632   DISPLAY_CAN_ROTATE=0
633   DISPLAY_ORIENTATION=0
634   DISPLAY_DPI=133
635
636.. note::
637
638   If a BSP does not have a formfactor entry, defaults are established
639   according to the formfactor configuration file that is installed by
640   the main formfactor recipe
641   ``meta/recipes-bsp/formfactor/formfactor_0.0.bb``, which is found in
642   the :term:`Source Directory`.
643
644Display Support Files
645---------------------
646
647You can find these files in the BSP Layer at::
648
649   meta-bsp_root_name/recipes-graphics/*
650
651This optional directory contains recipes for the BSP if it has special
652requirements for graphics support. All files that are needed for the BSP
653to support a display are kept here.
654
655Linux Kernel Configuration
656--------------------------
657
658You can find these files in the BSP Layer at::
659
660   meta-bsp_root_name/recipes-kernel/linux/linux*.bbappend
661   meta-bsp_root_name/recipes-kernel/linux/*.bb
662
663Append files (``*.bbappend``) modify the main kernel recipe being used
664to build the image. The ``*.bb`` files would be a developer-supplied
665kernel recipe. This area of the BSP hierarchy can contain both these
666types of files although, in practice, it is likely that you would have
667one or the other.
668
669For your BSP, you typically want to use an existing Yocto Project kernel
670recipe found in the :term:`Source Directory`
671at
672``meta/recipes-kernel/linux``. You can append machine-specific changes
673to the kernel recipe by using a similarly named append file, which is
674located in the BSP Layer for your target device (e.g. the
675``meta-bsp_root_name/recipes-kernel/linux`` directory).
676
677Suppose you are using the ``linux-yocto_4.4.bb`` recipe to build the
678kernel. In other words, you have selected the kernel in your
679``"bsp_root_name".conf`` file by adding
680:term:`PREFERRED_PROVIDER` and :term:`PREFERRED_VERSION`
681statements as follows::
682
683   PREFERRED_PROVIDER_virtual/kernel ?= "linux-yocto"
684   PREFERRED_VERSION_linux-yocto ?= "4.4%"
685
686.. note::
687
688   When the preferred provider is assumed by default, the :term:`PREFERRED_PROVIDER`
689   statement does not appear in the ``"bsp_root_name".conf`` file.
690
691You would use the ``linux-yocto_4.4.bbappend`` file to append specific
692BSP settings to the kernel, thus configuring the kernel for your
693particular BSP.
694
695You can find more information on what your append file should contain in
696the ":ref:`kernel-dev/common:creating the append file`" section
697in the Yocto Project Linux Kernel Development Manual.
698
699An alternate scenario is when you create your own kernel recipe for the
700BSP. A good example of this is the Raspberry Pi BSP. If you examine the
701``recipes-kernel/linux`` directory you see the following::
702
703   linux-raspberrypi-dev.bb
704   linux-raspberrypi.inc
705   linux-raspberrypi_4.14.bb
706   linux-raspberrypi_4.9.bb
707
708The directory contains three kernel recipes and a common include file.
709
710Developing a Board Support Package (BSP)
711========================================
712
713This section describes the high-level procedure you can follow to create
714a BSP. Although not required for BSP creation, the ``meta-intel``
715repository, which contains many BSPs supported by the Yocto Project, is
716part of the example.
717
718For an example that shows how to create a new layer using the tools, see
719the ":ref:`bsp-guide/bsp:creating a new bsp layer using the \`\`bitbake-layers\`\` script`"
720section.
721
722The following illustration and list summarize the BSP creation general
723workflow.
724
725.. image:: figures/bsp-dev-flow.png
726   :align: center
727   :width: 70%
728
729#. *Set up Your Host Development System to Support Development Using the
730   Yocto Project*: See the ":ref:`dev-manual/start:preparing the build host`"
731   section in the Yocto Project Development Tasks Manual for options on how to
732   get a system ready to use the Yocto Project.
733
734#. *Establish the meta-intel Repository on Your System:* Having
735   local copies of these supported BSP layers on your system gives you
736   access to layers you might be able to leverage when creating your
737   BSP. For information on how to get these files, see the
738   ":ref:`bsp-guide/bsp:preparing your build host to work with bsp layers`"
739   section.
740
741#. *Create Your Own BSP Layer Using the bitbake-layers Script:*
742   Layers are ideal for isolating and storing work for a given piece of
743   hardware. A layer is really just a location or area in which you
744   place the recipes and configurations for your BSP. In fact, a BSP is,
745   in itself, a special type of layer. The simplest way to create a new
746   BSP layer that is compliant with the Yocto Project is to use the
747   ``bitbake-layers`` script. For information about that script, see the
748   ":ref:`bsp-guide/bsp:creating a new bsp layer using the \`\`bitbake-layers\`\` script`"
749   section.
750
751   Another example that illustrates a layer is an application. Suppose
752   you are creating an application that has library or other
753   dependencies in order for it to compile and run. The layer, in this
754   case, would be where all the recipes that define those dependencies
755   are kept. The key point for a layer is that it is an isolated area
756   that contains all the relevant information for the project that the
757   OpenEmbedded build system knows about. For more information on
758   layers, see the ":ref:`overview-manual/yp-intro:the yocto project layer model`"
759   section in the Yocto Project Overview and Concepts Manual. You can also
760   reference the ":ref:`dev-manual/layers:understanding and creating layers`"
761   section in the Yocto Project Development Tasks Manual. For more
762   information on BSP layers, see the ":ref:`bsp-guide/bsp:bsp layers`"
763   section.
764
765   .. note::
766
767      -  There are three hardware reference BSPs in the Yocto
768         Project release, located in the ``poky/meta-yocto-bsp``
769         BSP layer:
770
771         -  Texas Instruments Beaglebone (``beaglebone-yocto``)
772
773         -  Two generic IA platforms (``genericx86`` and ``genericx86-64``)
774
775   When you set up a layer for a new BSP, you should follow a standard
776   layout. This layout is described in the ":ref:`bsp-guide/bsp:example filesystem layout`"
777   section. In the standard layout, notice
778   the suggested structure for recipes and configuration information.
779   You can see the standard layout for a BSP by examining any supported
780   BSP found in the ``meta-intel`` layer inside the Source Directory.
781
782#. *Make Configuration Changes to Your New BSP Layer:* The standard BSP
783   layer structure organizes the files you need to edit in ``conf`` and
784   several ``recipes-*`` directories within the BSP layer. Configuration
785   changes identify where your new layer is on the local system and
786   identifies the kernel you are going to use. When you run the
787   ``bitbake-layers`` script, you are able to interactively configure
788   many things for the BSP (e.g. keyboard, touchscreen, and so forth).
789
790#. *Make Recipe Changes to Your New BSP Layer:* Recipe changes include
791   altering recipes (``*.bb`` files), removing recipes you do not use,
792   and adding new recipes or append files (``.bbappend``) that support
793   your hardware.
794
795#. *Prepare for the Build:* Once you have made all the changes to your
796   BSP layer, there remains a few things you need to do for the
797   OpenEmbedded build system in order for it to create your image. You
798   need to get the build environment ready by sourcing an environment
799   setup script (i.e. ``oe-init-build-env``) and you need to be sure two
800   key configuration files are configured appropriately: the
801   ``conf/local.conf`` and the ``conf/bblayers.conf`` file. You must
802   make the OpenEmbedded build system aware of your new layer. See the
803   ":ref:`dev-manual/layers:enabling your layer`"
804   section in the Yocto Project Development Tasks Manual for information
805   on how to let the build system know about your new layer.
806
807#. *Build the Image:* The OpenEmbedded build system uses the BitBake
808   tool to build images based on the type of image you want to create.
809   You can find more information about BitBake in the
810   :doc:`BitBake User Manual <bitbake:index>`.
811
812   The build process supports several types of images to satisfy
813   different needs. See the
814   ":ref:`ref-manual/images:Images`" chapter in the Yocto
815   Project Reference Manual for information on supported images.
816
817Requirements and Recommendations for Released BSPs
818==================================================
819
820This section describes requirements and recommendations for a released
821BSP to be considered compliant with the Yocto Project.
822
823Released BSP Requirements
824-------------------------
825
826Before looking at BSP requirements, you should consider the following:
827
828-  The requirements here assume the BSP layer is a well-formed, "legal"
829   layer that can be added to the Yocto Project. For guidelines on
830   creating a layer that meets these base requirements, see the
831   ":ref:`bsp-guide/bsp:bsp layers`" section in this manual and the
832   ":ref:`dev-manual/layers:understanding and creating layers`"
833   section in the Yocto Project Development Tasks Manual.
834
835-  The requirements in this section apply regardless of how you package
836   a BSP. You should consult the packaging and distribution guidelines
837   for your specific release process. For an example of packaging and
838   distribution requirements, see the ":yocto_wiki:`Third Party BSP Release
839   Process </Third_Party_BSP_Release_Process>`"
840   wiki page.
841
842-  The requirements for the BSP as it is made available to a developer
843   are completely independent of the released form of the BSP. For
844   example, the BSP Metadata can be contained within a Git repository
845   and could have a directory structure completely different from what
846   appears in the officially released BSP layer.
847
848-  It is not required that specific packages or package modifications
849   exist in the BSP layer, beyond the requirements for general
850   compliance with the Yocto Project. For example, there is no requirement
851   dictating that a specific kernel or kernel version be used in a given
852   BSP.
853
854The requirements for a released BSP that conform to the Yocto Project are:
855
856-  *Layer Name:* The BSP must have a layer name that follows the Yocto
857   Project standards. For information on BSP layer names, see the
858   ":ref:`bsp-guide/bsp:bsp layers`" section.
859
860-  *File System Layout:* When possible, use the same directory names in
861   your BSP layer as listed in the ``recipes.txt`` file, which is found
862   in ``poky/meta`` directory of the :term:`Source Directory`
863   or in the OpenEmbedded-Core Layer (``openembedded-core``) at
864   :oe_git:`/openembedded-core/tree/meta`.
865
866   You should place recipes (``*.bb`` files) and recipe modifications
867   (``*.bbappend`` files) into ``recipes-*`` subdirectories by
868   functional area as outlined in ``recipes.txt``. If you cannot find a
869   category in ``recipes.txt`` to fit a particular recipe, you can make
870   up your own ``recipes-*`` subdirectory.
871
872   Within any particular ``recipes-*`` category, the layout should match
873   what is found in the OpenEmbedded-Core Git repository
874   (``openembedded-core``) or the Source Directory (``poky``). In other
875   words, make sure you place related files in appropriately-related
876   ``recipes-*`` subdirectories specific to the recipe's function, or
877   within a subdirectory containing a set of closely-related recipes.
878   The recipes themselves should follow the general guidelines for
879   recipes found in the ":doc:`../contributor-guide/recipe-style-guide`"
880   in the Yocto Project and OpenEmbedded Contributor Guide.
881
882-  *License File:* You must include a license file in the
883   ``meta-bsp_root_name`` directory. This license covers the BSP
884   Metadata as a whole. You must specify which license to use since no
885   default license exists. See the
886   :yocto_git:`COPYING.MIT </meta-raspberrypi/tree/COPYING.MIT>`
887   file for the Raspberry Pi BSP in the ``meta-raspberrypi`` BSP layer
888   as an example.
889
890-  *README File:* You must include a ``README`` file in the
891   ``meta-bsp_root_name`` directory. See the
892   :yocto_git:`README.md </meta-raspberrypi/tree/README.md>`
893   file for the Raspberry Pi BSP in the ``meta-raspberrypi`` BSP layer
894   as an example.
895
896   At a minimum, the ``README`` file should contain the following:
897
898   -  A brief description of the target hardware.
899
900   -  A list of all the dependencies of the BSP. These dependencies are
901      typically a list of required layers needed to build the BSP.
902      However, the dependencies should also contain information
903      regarding any other dependencies the BSP might have.
904
905   -  Any required special licensing information. For example, this
906      information includes information on special variables needed to
907      satisfy a EULA, or instructions on information needed to build or
908      distribute binaries built from the BSP Metadata.
909
910   -  The name and contact information for the BSP layer maintainer.
911      This is the person to whom patches and questions should be sent.
912      For information on how to find the right person, see the
913      :doc:`../contributor-guide/submit-changes` section in the Yocto Project and
914      OpenEmbedded Contributor Guide.
915
916   -  Instructions on how to build the BSP using the BSP layer.
917
918   -  Instructions on how to boot the BSP build from the BSP layer.
919
920   -  Instructions on how to boot the binary images contained in the
921      ``binary`` directory, if present.
922
923   -  Information on any known bugs or issues that users should know
924      about when either building or booting the BSP binaries.
925
926-  *README.sources File:* If your BSP contains binary images in the
927   ``binary`` directory, you must include a ``README.sources`` file in
928   the ``meta-bsp_root_name`` directory. This file specifies exactly
929   where you can find the sources used to generate the binary images.
930
931-  *Layer Configuration File:* You must include a ``conf/layer.conf``
932   file in the ``meta-bsp_root_name`` directory. This file identifies
933   the ``meta-bsp_root_name`` BSP layer as a layer to the build
934   system.
935
936-  *Machine Configuration File:* You must include one or more
937   ``conf/machine/bsp_root_name.conf`` files in the
938   ``meta-bsp_root_name`` directory. These configuration files define
939   machine targets that can be built using the BSP layer. Multiple
940   machine configuration files define variations of machine
941   configurations that the BSP supports. If a BSP supports multiple
942   machine variations, you need to adequately describe each variation in
943   the BSP ``README`` file. Do not use multiple machine configuration
944   files to describe disparate hardware. If you do have very different
945   targets, you should create separate BSP layers for each target.
946
947   .. note::
948
949      It is completely possible for a developer to structure the working
950      repository as a conglomeration of unrelated BSP files, and to possibly
951      generate BSPs targeted for release from that directory using scripts or
952      some other mechanism (e.g.  ``meta-yocto-bsp`` layer). Such considerations
953      are outside the scope of this document.
954
955Released BSP Recommendations
956----------------------------
957
958Here are recommendations for released BSPs that conform to the
959Yocto Project:
960
961-  *Bootable Images:* Released BSPs can contain one or more bootable
962   images. Including bootable images allows users to easily try out the
963   BSP using their own hardware.
964
965   In some cases, it might not be convenient to include a bootable
966   image. If so, you might want to make two versions of the BSP
967   available: one that contains binary images, and one that does not.
968   The version that does not contain bootable images avoids unnecessary
969   download times for users not interested in the images.
970
971   If you need to distribute a BSP and include bootable images or build
972   kernel and filesystems meant to allow users to boot the BSP for
973   evaluation purposes, you should put the images and artifacts within a
974   ``binary/`` subdirectory located in the ``meta-bsp_root_name``
975   directory.
976
977   .. note::
978
979      If you do include a bootable image as part of the BSP and the
980      image was built by software covered by the GPL or other open
981      source licenses, it is your responsibility to understand and meet
982      all licensing requirements, which could include distribution of
983      source files.
984
985-  *Use a Yocto Linux Kernel:* Kernel recipes in the BSP should be based
986   on a Yocto Linux kernel. Basing your recipes on these kernels reduces
987   the costs for maintaining the BSP and increases its scalability. See
988   the ``Yocto Linux Kernel`` category in the
989   :yocto_git:`Source Repositories <>` for these kernels.
990
991Customizing a Recipe for a BSP
992==============================
993
994If you plan on customizing a recipe for a particular BSP, you need to do
995the following:
996
997-  Create a ``*.bbappend`` file for the modified recipe. For information on using
998   append files, see the
999   ":ref:`dev-manual/layers:appending other layers metadata with your layer`"
1000   section in the Yocto Project Development Tasks Manual.
1001
1002-  Ensure your directory structure in the BSP layer that supports your
1003   machine is such that the OpenEmbedded build system can find it. See
1004   the example later in this section for more information.
1005
1006-  Put the append file in a directory whose name matches the machine's
1007   name and is located in an appropriate sub-directory inside the BSP
1008   layer (i.e. ``recipes-bsp``, ``recipes-graphics``, ``recipes-core``,
1009   and so forth).
1010
1011-  Place the BSP-specific files in the proper directory inside the BSP
1012   layer. How expansive the layer is affects where you must place these
1013   files. For example, if your layer supports several different machine
1014   types, you need to be sure your layer's directory structure includes
1015   hierarchy that separates the files according to machine. If your
1016   layer does not support multiple machines, the layer would not have
1017   that additional hierarchy and the files would obviously not be able
1018   to reside in a machine-specific directory.
1019
1020Here is a specific example to help you better understand the
1021process. This example customizes a recipe by adding a
1022BSP-specific configuration file named ``interfaces`` to the
1023``init-ifupdown_1.0.bb`` recipe for machine "xyz" where the BSP layer
1024also supports several other machines:
1025
1026#. Edit the ``init-ifupdown_1.0.bbappend`` file so that it contains the
1027   following::
1028
1029      FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
1030
1031   The append file needs to be in the ``meta-xyz/recipes-core/init-ifupdown``
1032   directory.
1033
1034#. Create and place the new ``interfaces`` configuration file in the
1035   BSP's layer here::
1036
1037      meta-xyz/recipes-core/init-ifupdown/files/xyz-machine-one/interfaces
1038
1039   .. note::
1040
1041      If the ``meta-xyz`` layer did not support multiple machines, you would place
1042      the interfaces configuration file in the layer here::
1043
1044         meta-xyz/recipes-core/init-ifupdown/files/interfaces
1045
1046   The :term:`FILESEXTRAPATHS` variable in the append files extends the search
1047   path the build system uses to find files during the build. Consequently, for
1048   this example you need to have the ``files`` directory in the same location as
1049   your append file.
1050
1051BSP Licensing Considerations
1052============================
1053
1054In some cases, a BSP contains separately-licensed Intellectual Property
1055(IP) for a component or components. For these cases, you are required to
1056accept the terms of a commercial or other type of license that requires
1057some kind of explicit End User License Agreement (EULA). Once you accept
1058the license, the OpenEmbedded build system can then build and include
1059the corresponding component in the final BSP image. If the BSP is
1060available as a pre-built image, you can download the image after
1061agreeing to the license or EULA.
1062
1063You could find that some separately-licensed components that are
1064essential for normal operation of the system might not have an
1065unencumbered (or free) substitute. Without these essential components,
1066the system would be non-functional. Then again, you might find that
1067other licensed components that are simply 'good-to-have' or purely
1068elective do have an unencumbered, free replacement component that you
1069can use rather than agreeing to the separately-licensed component. Even
1070for components essential to the system, you might find an unencumbered
1071component that is not identical but will work as a less-capable version
1072of the licensed version in the BSP recipe.
1073
1074For cases where you can substitute a free component and still maintain
1075the system's functionality, the "DOWNLOADS" selection from the
1076"SOFTWARE" tab on the :yocto_home:`Yocto Project Website <>` makes
1077available de-featured BSPs that are completely free of any IP
1078encumbrances. For these cases, you can use the substitution directly and
1079without any further licensing requirements. If present, these fully
1080de-featured BSPs are named appropriately different as compared to the
1081names of their respective encumbered BSPs. If available, these
1082substitutions are your simplest and most preferred options. Obviously,
1083use of these substitutions assumes the resulting functionality meets
1084system requirements.
1085
1086.. note::
1087
1088   If however, a non-encumbered version is unavailable or it provides
1089   unsuitable functionality or quality, you can use an encumbered
1090   version.
1091
1092There are two different methods within the OpenEmbedded build system to
1093satisfy the licensing requirements for an encumbered BSP. The following
1094list describes them in order of preference:
1095
1096#. *Use the LICENSE_FLAGS Variable to Define the Recipes that Have Commercial or
1097   Other Types of Specially-Licensed Packages:* For each of those recipes, you can
1098   specify a matching license string in a ``local.conf`` variable named
1099   :term:`LICENSE_FLAGS_ACCEPTED`.
1100   Specifying the matching license string signifies that you agree to
1101   the license. Thus, the build system can build the corresponding
1102   recipe and include the component in the image. See the
1103   ":ref:`dev-manual/licenses:enabling commercially licensed recipes`"
1104   section in the Yocto Project Development Tasks Manual for details on
1105   how to use these variables.
1106
1107   If you build as you normally would, without specifying any recipes in
1108   the :term:`LICENSE_FLAGS_ACCEPTED` variable, the build stops and provides
1109   you with the list of recipes that you have tried to include in the image
1110   that need entries in the :term:`LICENSE_FLAGS_ACCEPTED` variable. Once you
1111   enter the appropriate license flags into it, restart the build to continue
1112   where it left off. During the build, the prompt will not appear again since
1113   you have satisfied the requirement.
1114
1115   Once the appropriate license flags are on the white list in the
1116   :term:`LICENSE_FLAGS_ACCEPTED` variable, you can build the encumbered
1117   image with no change at all to the normal build process.
1118
1119#. *Get a Pre-Built Version of the BSP:* You can get this type of BSP by
1120   selecting the "DOWNLOADS" item from the "SOFTWARE" tab on the
1121   :yocto_home:`Yocto Project website <>`. You can download BSP tarballs
1122   that contain proprietary components after agreeing to the licensing
1123   requirements of each of the individually encumbered packages as part
1124   of the download process. Obtaining the BSP this way allows you to
1125   access an encumbered image immediately after agreeing to the
1126   click-through license agreements presented by the website. If you
1127   want to build the image yourself using the recipes contained within
1128   the BSP tarball, you will still need to create an appropriate
1129   :term:`LICENSE_FLAGS_ACCEPTED` to match the encumbered recipes in the
1130   BSP.
1131
1132.. note::
1133
1134   Pre-compiled images are bundled with a time-limited kernel that runs
1135   for a predetermined amount of time (10 days) before it forces the
1136   system to reboot. This limitation is meant to discourage direct
1137   redistribution of the image. You must eventually rebuild the image if
1138   you want to remove this restriction.
1139
1140Creating a new BSP Layer Using the ``bitbake-layers`` Script
1141============================================================
1142
1143The ``bitbake-layers create-layer`` script automates creating a BSP
1144layer. What makes a layer a "BSP layer" is the presence of at least one
1145machine configuration file. Additionally, a BSP layer usually has a
1146kernel recipe or an append file that leverages off an existing kernel
1147recipe. The primary requirement, however, is the machine configuration.
1148
1149Use these steps to create a BSP layer:
1150
1151-  *Create a General Layer:* Use the ``bitbake-layers`` script with the
1152   ``create-layer`` subcommand to create a new general layer. For
1153   instructions on how to create a general layer using the
1154   ``bitbake-layers`` script, see the
1155   ":ref:`dev-manual/layers:creating a general layer using the \`\`bitbake-layers\`\` script`"
1156   section in the Yocto Project Development Tasks Manual.
1157
1158-  *Create a Layer Configuration File:* Every layer needs a layer
1159   configuration file. This configuration file establishes locations for
1160   the layer's recipes, priorities for the layer, and so forth. You can
1161   find examples of ``layer.conf`` files in the Yocto Project
1162   :yocto_git:`Source Repositories <>`. To get examples of what you need
1163   in your configuration file, locate a layer (e.g. "meta-ti") and
1164   examine the
1165   :yocto_git:`local.conf </meta-ti/tree/meta-ti-bsp/conf/layer.conf>`
1166   file.
1167
1168-  *Create a Machine Configuration File:* Create a
1169   ``conf/machine/bsp_root_name.conf`` file. See
1170   :yocto_git:`meta-yocto-bsp/conf/machine </poky/tree/meta-yocto-bsp/conf/machine>`
1171   for sample ``bsp_root_name.conf`` files. There are other samples such as
1172   :yocto_git:`meta-ti </meta-ti/tree/meta-ti-bsp/conf/machine>`
1173   and
1174   :yocto_git:`meta-freescale </meta-freescale/tree/conf/machine>`
1175   from other vendors that have more specific machine and tuning
1176   examples.
1177
1178-  *Create a Kernel Recipe:* Create a kernel recipe in
1179   ``recipes-kernel/linux`` by either using a kernel append file or a
1180   new custom kernel recipe file (e.g. ``linux-yocto_4.12.bb``). The BSP
1181   layers mentioned in the previous step also contain different kernel
1182   examples. See the ":ref:`kernel-dev/common:modifying an existing recipe`"
1183   section in the Yocto Project Linux Kernel Development Manual for
1184   information on how to create a custom kernel.
1185
1186The remainder of this section provides a description of the Yocto
1187Project reference BSP for Beaglebone, which resides in the
1188:yocto_git:`meta-yocto-bsp </poky/tree/meta-yocto-bsp>`
1189layer.
1190
1191BSP Layer Configuration Example
1192-------------------------------
1193
1194The layer's ``conf`` directory contains the ``layer.conf`` configuration
1195file. In this example, the ``conf/layer.conf`` file is the following::
1196
1197   # We have a conf and classes directory, add to BBPATH
1198   BBPATH .= ":${LAYERDIR}"
1199
1200   # We have a recipes directory containing .bb and .bbappend files, add to BBFILES
1201   BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
1202               ${LAYERDIR}/recipes-*/*/*.bbappend"
1203
1204   BBFILE_COLLECTIONS += "yoctobsp"
1205   BBFILE_PATTERN_yoctobsp = "^${LAYERDIR}/"
1206   BBFILE_PRIORITY_yoctobsp = "5"
1207   LAYERVERSION_yoctobsp = "4"
1208   LAYERSERIES_COMPAT_yoctobsp = "&DISTRO_NAME_NO_CAP;"
1209
1210The variables used in this file configure the layer. A good way to learn about layer
1211configuration files is to examine various files for BSP from the
1212:yocto_git:`Source Repositories <>`.
1213
1214For a detailed description of this particular layer configuration file,
1215see ":ref:`step 3 <dev-manual/layers:creating your own layer>`"
1216in the discussion that describes how to create layers in the Yocto
1217Project Development Tasks Manual.
1218
1219BSP Machine Configuration Example
1220---------------------------------
1221
1222As mentioned earlier in this section, the existence of a machine
1223configuration file is what makes a layer a BSP layer as compared to a
1224general or kernel layer.
1225
1226There are one or more machine configuration files in the
1227``bsp_layer/conf/machine/`` directory of the layer::
1228
1229   bsp_layer/conf/machine/machine1\.conf
1230   bsp_layer/conf/machine/machine2\.conf
1231   bsp_layer/conf/machine/machine3\.conf
1232   ... more ...
1233
1234For example, the machine configuration file for the `BeagleBone and
1235BeagleBone Black development boards <https://beagleboard.org/bone>`__ is
1236located in :yocto_git:`poky/meta-yocto-bsp/conf/machine/beaglebone-yocto.conf
1237</poky/tree/meta-yocto-bsp/conf/machine/beaglebone-yocto.conf>`::
1238
1239   #@TYPE: Machine
1240   #@NAME: Beaglebone-yocto machine
1241   #@DESCRIPTION: Reference machine configuration for http://beagleboard.org/bone and http://beagleboard.org/black boards
1242
1243   PREFERRED_PROVIDER_virtual/xserver ?= "xserver-xorg"
1244
1245   MACHINE_EXTRA_RRECOMMENDS = "kernel-modules kernel-devicetree"
1246
1247   EXTRA_IMAGEDEPENDS += "virtual/bootloader"
1248
1249   DEFAULTTUNE ?= "cortexa8hf-neon"
1250   include conf/machine/include/arm/armv7a/tune-cortexa8.inc
1251
1252   IMAGE_FSTYPES += "tar.bz2 jffs2 wic wic.bmap"
1253   EXTRA_IMAGECMD:jffs2 = "-lnp "
1254   WKS_FILE ?= "beaglebone-yocto.wks"
1255   MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "kernel-image kernel-devicetree"
1256   do_image_wic[depends] += "mtools-native:do_populate_sysroot dosfstools-native:do_populate_sysroot virtual/bootloader:do_deploy"
1257
1258   SERIAL_CONSOLES ?= "115200;ttyS0 115200;ttyO0 115200;ttyAMA0"
1259
1260   PREFERRED_PROVIDER_virtual/kernel ?= "linux-yocto"
1261   PREFERRED_VERSION_linux-yocto ?= "6.1%"
1262
1263   KERNEL_IMAGETYPE = "zImage"
1264   KERNEL_DEVICETREE = "am335x-bone.dtb am335x-boneblack.dtb am335x-bonegreen.dtb"
1265   KERNEL_EXTRA_ARGS += "LOADADDR=${UBOOT_ENTRYPOINT}"
1266
1267   PREFERRED_PROVIDER_virtual/bootloader ?= "u-boot"
1268
1269   SPL_BINARY = "MLO"
1270   UBOOT_SUFFIX = "img"
1271   UBOOT_MACHINE = "am335x_evm_defconfig"
1272   UBOOT_ENTRYPOINT = "0x80008000"
1273   UBOOT_LOADADDRESS = "0x80008000"
1274
1275   MACHINE_FEATURES = "usbgadget usbhost vfat alsa"
1276
1277   IMAGE_BOOT_FILES ?= "u-boot.${UBOOT_SUFFIX} ${SPL_BINARY} ${KERNEL_IMAGETYPE} ${KERNEL_DEVICETREE}"
1278
1279   # support runqemu
1280   EXTRA_IMAGEDEPENDS += "qemu-native qemu-helper-native"
1281   IMAGE_CLASSES += "qemuboot"
1282   QB_DEFAULT_FSTYPE = "wic"
1283   QB_FSINFO = "wic:no-kernel-in-fs"
1284   QB_KERNEL_ROOT = "/dev/vda2"
1285   QB_SYSTEM_NAME = "qemu-system-arm"
1286   QB_MACHINE = "-machine virt"
1287   QB_CPU = "-cpu cortex-a15"
1288   QB_KERNEL_CMDLINE_APPEND = "console=ttyAMA0 systemd.mask=systemd-networkd"
1289   QB_OPT_APPEND = "-device virtio-rng-device"
1290   QB_TAP_OPT = "-netdev tap,id=net0,ifname=@TAP@,script=no,downscript=no"
1291   QB_NETWORK_DEVICE = "-device virtio-net-device,netdev=net0,mac=@MAC@"
1292   QB_ROOTFS_OPT = "-drive id=disk0,file=@ROOTFS@,if=none,format=raw -device virtio-blk-device,drive=disk0"
1293   QB_SERIAL_OPT = ""
1294   QB_TCPSERIAL_OPT = "-device virtio-serial-device -chardev socket,id=virtcon,port=@PORT@,host=127.0.0.1 -device virtconsole,chardev=virtcon"
1295
1296The variables used to configure the machine define machine-specific properties; for
1297example, machine-dependent packages, machine tunings, the type of kernel
1298to build, and U-Boot configurations.
1299
1300The following list provides some explanation for the statements found in
1301the example reference machine configuration file for the BeagleBone
1302development boards. Realize that much more can be defined as part of a
1303machine's configuration file. In general, you can learn about related
1304variables that this example does not have by locating the variables in
1305the ":ref:`ref-manual/variables:variables glossary`" in the Yocto
1306Project Reference Manual.
1307
1308-  :term:`PREFERRED_PROVIDER_virtual/xserver <PREFERRED_PROVIDER>`:
1309   The recipe that provides "virtual/xserver" when more than one
1310   provider is found. In this case, the recipe that provides
1311   "virtual/xserver" is "xserver-xorg", available in
1312   ``poky/meta/recipes-graphics/xorg-xserver``.
1313
1314-  :term:`MACHINE_EXTRA_RRECOMMENDS`:
1315   A list of machine-dependent packages not essential for booting the
1316   image. Thus, the build does not fail if the packages do not exist.
1317   However, the packages are required for a fully-featured image.
1318
1319   .. tip::
1320
1321      There are many ``MACHINE*`` variables that help you configure a particular piece
1322      of hardware.
1323
1324-  :term:`EXTRA_IMAGEDEPENDS`:
1325   Recipes to build that do not provide packages for installing into the
1326   root filesystem but building the image depends on the recipes.
1327   Sometimes a recipe is required to build the final image but is not
1328   needed in the root filesystem. In this case, the U-Boot recipe must
1329   be built for the image.
1330
1331   At the end of the file, we also use this setings to implement
1332   ``runqemu`` support on the host machine.
1333
1334-  :term:`DEFAULTTUNE`: Machines
1335   use tunings to optimize machine, CPU, and application performance.
1336   These features, which are collectively known as "tuning features",
1337   are set in the :term:`OpenEmbedded-Core (OE-Core)` layer. In this
1338   example, the default tuning file is :oe_git:`tune-cortexa8
1339   </openembedded-core/tree/meta/conf/machine/include/arm/armv7a/tune-cortexa8.inc>`.
1340
1341   .. note::
1342
1343      The include statement that pulls in the
1344      ``conf/machine/include/arm/tune-cortexa8.inc`` file provides many tuning
1345      possibilities.
1346
1347-  :term:`IMAGE_FSTYPES`: The
1348   formats the OpenEmbedded build system uses during the build when
1349   creating the root filesystem. In this example, four types of images
1350   are supported.
1351
1352-  :term:`EXTRA_IMAGECMD`:
1353   Specifies additional options for image creation commands. In this
1354   example, the "-lnp " option is used when creating the
1355   :wikipedia:`JFFS2 <JFFS2>` image.
1356
1357-  :term:`WKS_FILE`: The location of
1358   the :ref:`Wic kickstart <ref-manual/kickstart:openembedded kickstart (\`\`.wks\`\`) reference>` file used
1359   by the OpenEmbedded build system to create a partitioned image.
1360
1361-  ``do_image_wic[depends]``: A task that is constructed during the
1362   build. In this example, the task depends on specific tools in order
1363   to create the sysroot when building a Wic image.
1364
1365-  :term:`SERIAL_CONSOLES`:
1366   Defines a serial console (TTY) to enable using getty. In this case,
1367   the baud rate is "115200" and the device name is "ttyO0".
1368
1369-  :term:`PREFERRED_PROVIDER_virtual/kernel <PREFERRED_PROVIDER>`:
1370   Specifies the recipe that provides "virtual/kernel" when more than
1371   one provider is found. In this case, the recipe that provides
1372   "virtual/kernel" is "linux-yocto", which exists in the layer's
1373   ``recipes-kernel/linux`` directory.
1374
1375-  :term:`PREFERRED_VERSION_linux-yocto <PREFERRED_VERSION>`:
1376   Defines the version of the recipe used to build the kernel, which is
1377   "6.1" in this case.
1378
1379-  :term:`KERNEL_IMAGETYPE`:
1380   The type of kernel to build for the device. In this case, the
1381   OpenEmbedded build system creates a "zImage" image type.
1382
1383-  :term:`KERNEL_DEVICETREE`:
1384   The names of the generated Linux kernel device trees (i.e. the
1385   ``*.dtb``) files. All the device trees for the various BeagleBone
1386   devices are included.
1387
1388-  :term:`KERNEL_EXTRA_ARGS`:
1389   Additional ``make`` command-line arguments the OpenEmbedded build
1390   system passes on when compiling the kernel. In this example,
1391   ``LOADADDR=${UBOOT_ENTRYPOINT}`` is passed as a command-line argument.
1392
1393-  :term:`SPL_BINARY`: Defines the
1394   Secondary Program Loader (SPL) binary type. In this case, the SPL
1395   binary is set to "MLO", which stands for Multimedia card LOader.
1396
1397   The BeagleBone development board requires an SPL to boot and that SPL
1398   file type must be MLO. Consequently, the machine configuration needs
1399   to define :term:`SPL_BINARY` as ``MLO``.
1400
1401   .. note::
1402
1403      For more information on how the SPL variables are used, see the
1404      :yocto_git:`u-boot.inc </poky/tree/meta/recipes-bsp/u-boot/u-boot.inc>`
1405      include file.
1406
1407-  :term:`UBOOT_* <UBOOT_ENTRYPOINT>`: Defines
1408   various U-Boot configurations needed to build a U-Boot image. In this
1409   example, a U-Boot image is required to boot the BeagleBone device.
1410   See the following variables for more information:
1411
1412   -  :term:`UBOOT_SUFFIX`:
1413      Points to the generated U-Boot extension.
1414
1415   -  :term:`UBOOT_MACHINE`:
1416      Specifies the value passed on the make command line when building
1417      a U-Boot image.
1418
1419   -  :term:`UBOOT_ENTRYPOINT`:
1420      Specifies the entry point for the U-Boot image.
1421
1422   -  :term:`UBOOT_LOADADDRESS`:
1423      Specifies the load address for the U-Boot image.
1424
1425-  :term:`MACHINE_FEATURES`:
1426   Specifies the list of hardware features the BeagleBone device is
1427   capable of supporting. In this case, the device supports "usbgadget
1428   usbhost vfat alsa".
1429
1430-  :term:`IMAGE_BOOT_FILES`:
1431   Files installed into the device's boot partition when preparing the
1432   image using the Wic tool with the ``bootimg-partition`` or
1433   ``bootimg-efi`` source plugin.
1434
1435BSP Kernel Recipe Example
1436-------------------------
1437
1438The kernel recipe used to build the kernel image for the BeagleBone
1439device was established in the machine configuration::
1440
1441   PREFERRED_PROVIDER_virtual/kernel ?= "linux-yocto"
1442   PREFERRED_VERSION_linux-yocto ?= "6.1%"
1443
1444The ``meta-yocto-bsp/recipes-kernel/linux`` directory in the layer contains
1445metadata used to build the kernel. In this case, a kernel append file
1446(i.e. ``linux-yocto_6.1.bbappend``) is used to override an established
1447kernel recipe (i.e. ``linux-yocto_6.1.bb``), which is located in
1448:yocto_git:`/poky/tree/meta/recipes-kernel/linux`.
1449
1450The contents of the append file are::
1451
1452   KBRANCH:genericx86  = "v6.1/standard/base"
1453   KBRANCH:genericx86-64  = "v6.1/standard/base"
1454   KBRANCH:beaglebone-yocto = "v6.1/standard/beaglebone"
1455
1456   KMACHINE:genericx86 ?= "common-pc"
1457   KMACHINE:genericx86-64 ?= "common-pc-64"
1458   KMACHINE:beaglebone-yocto ?= "beaglebone"
1459
1460   SRCREV_machine:genericx86 ?= "6ec439b4b456ce929c4c07fe457b5d6a4b468e86"
1461   SRCREV_machine:genericx86-64 ?= "6ec439b4b456ce929c4c07fe457b5d6a4b468e86"
1462   SRCREV_machine:beaglebone-yocto ?= "423e1996694b61fbfc8ec3bf062fc6461d64fde1"
1463
1464   COMPATIBLE_MACHINE:genericx86 = "genericx86"
1465   COMPATIBLE_MACHINE:genericx86-64 = "genericx86-64"
1466   COMPATIBLE_MACHINE:beaglebone-yocto = "beaglebone-yocto"
1467
1468   LINUX_VERSION:genericx86 = "6.1.30"
1469   LINUX_VERSION:genericx86-64 = "6.1.30"
1470   LINUX_VERSION:beaglebone-yocto = "6.1.20"
1471
1472This particular append file works for all the machines that are
1473part of the ``meta-yocto-bsp`` layer. The relevant statements are
1474appended with the "beaglebone-yocto" string. The OpenEmbedded build
1475system uses these statements to override similar statements in the
1476kernel recipe:
1477
1478-  :term:`KBRANCH`: Identifies the
1479   kernel branch that is validated, patched, and configured during the
1480   build.
1481
1482-  :term:`KMACHINE`: Identifies the
1483   machine name as known by the kernel, which is sometimes a different
1484   name than what is known by the OpenEmbedded build system.
1485
1486-  :term:`SRCREV`: Identifies the
1487   revision of the source code used to build the image.
1488
1489-  :term:`COMPATIBLE_MACHINE`:
1490   A regular expression that resolves to one or more target machines
1491   with which the recipe is compatible.
1492
1493-  :term:`LINUX_VERSION`: The
1494   Linux version from kernel.org used by the OpenEmbedded build system
1495   to build the kernel image.
1496