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