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