blob: a1d91031e4b990bb7add7441267b5f1ca883394b [file] [log] [blame]
rjw1f884582022-01-06 17:20:42 +08001<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
2"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
3[<!ENTITY % poky SYSTEM "../poky.ent"> %poky; ] >
4
5<chapter id='bsp'>
6
7<title>Board Support Packages (BSP) - Developer's Guide</title>
8
9<para>
10 A Board Support Package (BSP) is a collection of information that
11 defines how to support a particular hardware device, set of devices, or
12 hardware platform.
13 The BSP includes information about the hardware features
14 present on the device and kernel configuration information along with any
15 additional hardware drivers required.
16 The BSP also lists any additional software
17 components required in addition to a generic Linux software stack for both
18 essential and optional platform features.
19</para>
20
21<para>
22 This guide presents information about BSP Layers, defines a structure for components
23 so that BSPs follow a commonly understood layout, discusses how to customize
24 a recipe for a BSP, addresses BSP licensing, and provides information that
25 shows you how to create a
26 <link linkend='bsp-layers'>BSP Layer</link> using the
27 <link linkend='creating-a-new-bsp-layer-using-the-bitbake-layers-script'><filename>bitbake-layers</filename></link>
28 tool.
29</para>
30
31<section id='bsp-layers'>
32 <title>BSP Layers</title>
33
34 <para>
35 A BSP consists of a file structure inside a base directory.
36 Collectively, you can think of the base directory, its file structure,
37 and the contents as a BSP Layer.
38 Although not a strict requirement, BSP layers in the Yocto Project
39 use the following well-established naming convention:
40 <literallayout class='monospaced'>
41 meta-<replaceable>bsp_root_name</replaceable>
42 </literallayout>
43 The string "meta-" is prepended to the machine or platform name, which is
44 <replaceable>bsp_root_name</replaceable> in the above form.
45 <note><title>Tip</title>
46 Because the BSP layer naming convention is well-established,
47 it is advisable to follow it when creating layers.
48 Technically speaking, a BSP layer name does not need to
49 start with <filename>meta-</filename>.
50 However, various scripts and tools in the Yocto Project
51 development environment assume this convention.
52 </note>
53 </para>
54
55 <para>
56 To help understand the BSP layer concept, consider the BSPs that the
57 Yocto Project supports and provides with each release.
58 You can see the layers in the
59 <ulink url='&YOCTO_DOCS_OM_URL;#yocto-project-repositories'>Yocto Project Source Repositories</ulink>
60 through a web interface at
61 <ulink url='&YOCTO_GIT_URL;'></ulink>.
62 If you go to that interface, you will find a list of repositories
63 under "Yocto Metadata Layers".
64 <note>
65 Layers that are no longer actively supported as part of the
66 Yocto Project appear under the heading "Yocto Metadata Layer
67 Archive."
68 </note>
69 Each repository is a BSP layer supported by the Yocto Project
70 (e.g. <filename>meta-raspberrypi</filename> and
71 <filename>meta-intel</filename>).
72 Each of these layers is a repository unto itself and clicking on a
73 layer reveals information that includes two links from which you can choose
74 to set up a clone of the layer's repository on your local host system.
75 Here is an example that clones the Raspberry Pi BSP layer:
76 <literallayout class='monospaced'>
77 $ git clone git://git.yoctoproject.org/meta-raspberrypi
78 </literallayout>
79 </para>
80
81 <para>
82 In addition to BSP layers, the
83 <filename>meta-yocto-bsp</filename> layer is part of the
84 shipped <filename>poky</filename> repository.
85 The <filename>meta-yocto-bsp</filename> layer maintains several
86 BSPs such as the Beaglebone, EdgeRouter, and generic versions of
87 both 32-bit and 64-bit IA machines.
88 </para>
89
90 <para>
91 For information on the BSP development workflow, see the
92 "<link linkend='developing-a-board-support-package-bsp'>Developing a Board Support Package (BSP)</link>"
93 section.
94 For more information on how to set up a local copy of source files
95 from a Git repository, see the
96 "<ulink url='&YOCTO_DOCS_DEV_URL;#locating-yocto-project-source-files'>Locating Yocto Project Source Files</ulink>"
97 section in the Yocto Project Development Tasks Manual.
98 </para>
99
100 <para>
101 The layer's base directory
102 (<filename>meta-<replaceable>bsp_root_name</replaceable></filename>)
103 is the root directory of the BSP Layer.
104 This directory is what you add to the
105 <ulink url='&YOCTO_DOCS_REF_URL;#var-BBLAYERS'><filename>BBLAYERS</filename></ulink>
106 variable in the <filename>conf/bblayers.conf</filename> file found in the
107 <ulink url='&YOCTO_DOCS_REF_URL;#build-directory'>Build Directory</ulink>,
108 which is established after you run the OpenEmbedded build environment
109 setup script (i.e.
110 <ulink url='&YOCTO_DOCS_REF_URL;#structure-core-script'><filename>&OE_INIT_FILE;</filename></ulink>).
111 Adding the root directory allows the
112 <ulink url='&YOCTO_DOCS_REF_URL;#build-system-term'>OpenEmbedded build system</ulink>
113 to recognize the BSP layer and from it build an image.
114 Here is an example:
115 <literallayout class='monospaced'>
116 BBLAYERS ?= " \
117 /usr/local/src/yocto/meta \
118 /usr/local/src/yocto/meta-poky \
119 /usr/local/src/yocto/meta-yocto-bsp \
120 /usr/local/src/yocto/meta-mylayer \
121 "
122 </literallayout>
123 <note><title>Tip</title>
124 Ordering and
125 <ulink url='&YOCTO_DOCS_REF_URL;#var-BBFILE_PRIORITY'><filename>BBFILE_PRIORITY</filename></ulink>
126 for the layers listed in <filename>BBLAYERS</filename>
127 matter.
128 For example, if multiple layers define a machine
129 configuration, the OpenEmbedded build system uses
130 the last layer searched given similar layer
131 priorities.
132 The build system works from the top-down through
133 the layers listed in <filename>BBLAYERS</filename>.
134 </note>
135 </para>
136
137 <para>
138 Some BSPs require or depend on additional layers
139 beyond the BSP's root layer in order to be functional.
140 In this case, you need to specify these layers in the
141 <filename>README</filename> "Dependencies" section of the
142 BSP's root layer.
143 Additionally, if any build instructions exist for the
144 BSP, you must add them to the "Dependencies" section.
145 </para>
146
147 <para>
148 Some layers function as a layer to hold other BSP layers.
149 These layers are knows as
150 "<ulink url='&YOCTO_DOCS_REF_URL;#term-container-layer'>container layers</ulink>".
151 An example of this type of layer is the
152 <filename>meta-intel</filename> layer.
153 This layer contains BSP layers for the Intel-core2-32
154 <trademark class='registered'>Intel</trademark> Common Core
155 (Intel-core2-32) and the Intel-corei7-64
156 <trademark class='registered'>Intel</trademark> Common Core
157 (Intel-corei7-64).
158 the <filename>meta-intel</filename> layer also contains
159 the <filename>common/</filename> directory, which contains
160 common content across those layers.
161 </para>
162
163 <para>
164 For more information on layers, see the
165 "<ulink url='&YOCTO_DOCS_DEV_URL;#understanding-and-creating-layers'>Understanding and Creating Layers</ulink>"
166 section of the Yocto Project Development Tasks Manual.
167 </para>
168</section>
169
170<section id='preparing-your-build-host-to-work-with-bsp-layers'>
171 <title>Preparing Your Build Host to Work With BSP Layers</title>
172
173 <para>
174 This section describes how to get your build host ready
175 to work with BSP layers.
176 Once you have the host set up, you can create the layer
177 as described in the
178 "<link linkend='creating-a-new-bsp-layer-using-the-bitbake-layers-script'>Creating a new BSP Layer Using the <filename>bitbake-layers</filename> Script</link>"
179 section.
180 <note>
181 For structural information on BSPs, see the
182 <link linkend='bsp-filelayout'>Example Filesystem Layout</link>
183 section.
184 </note>
185 <orderedlist>
186 <listitem><para>
187 <emphasis>Set Up the Build Environment:</emphasis>
188 Be sure you are set up to use BitBake in a shell.
189 See the
190 "<ulink url='&YOCTO_DOCS_DEV_URL;#dev-preparing-the-build-host'>Preparing the Build Host</ulink>"
191 section in the Yocto Project Development Tasks Manual for information
192 on how to get a build host ready that is either a native
193 Linux machine or a machine that uses CROPS.
194 </para></listitem>
195 <listitem><para>
196 <emphasis>Clone the <filename>poky</filename> Repository:</emphasis>
197 You need to have a local copy of the Yocto Project
198 <ulink url='&YOCTO_DOCS_REF_URL;#source-directory'>Source Directory</ulink>
199 (i.e. a local <filename>poky</filename> repository).
200 See the
201 "<ulink url='&YOCTO_DOCS_DEV_URL;#cloning-the-poky-repository'>Cloning the <filename>poky</filename> Repository</ulink>"
202 and possibly the
203 "<ulink url='&YOCTO_DOCS_DEV_URL;#checking-out-by-branch-in-poky'>Checking Out by Branch in Poky</ulink>"
204 or
205 "<ulink url='&YOCTO_DOCS_DEV_URL;#checkout-out-by-tag-in-poky'>Checking Out by Tag in Poky</ulink>"
206 sections all in the Yocto Project Development Tasks Manual for
207 information on how to clone the <filename>poky</filename>
208 repository and check out the appropriate branch for your work.
209 </para></listitem>
210 <listitem><para>
211 <emphasis>Determine the BSP Layer You Want:</emphasis>
212 The Yocto Project supports many BSPs, which are maintained in
213 their own layers or in layers designed to contain several
214 BSPs.
215 To get an idea of machine support through BSP layers, you can
216 look at the
217 <ulink url='&YOCTO_RELEASE_DL_URL;/machines'>index of machines</ulink>
218 for the release.
219 </para></listitem>
220 <listitem><para>
221 <emphasis>Optionally Clone the
222 <filename>meta-intel</filename> BSP Layer:</emphasis>
223 If your hardware is based on current Intel CPUs and devices,
224 you can leverage this BSP layer.
225 For details on the <filename>meta-intel</filename> BSP layer,
226 see the layer's
227 <ulink url='http://git.yoctoproject.org/cgit/cgit.cgi/meta-intel/tree/README'><filename>README</filename></ulink>
228 file.
229 <orderedlist>
230 <listitem><para>
231 <emphasis>Navigate to Your Source Directory:</emphasis>
232 Typically, you set up the
233 <filename>meta-intel</filename> Git repository
234 inside the
235 <ulink url='&YOCTO_DOCS_REF_URL;#source-directory'>Source Directory</ulink>
236 (e.g. <filename>poky</filename>).
237 <literallayout class='monospaced'>
238 $ cd /home/<replaceable>you</replaceable>/poky
239 </literallayout>
240 </para></listitem>
241 <listitem><para>
242 <emphasis>Clone the Layer:</emphasis>
243 <literallayout class='monospaced'>
244 $ git clone git://git.yoctoproject.org/meta-intel.git
245 Cloning into 'meta-intel'...
246 remote: Counting objects: 17179, done.
247 remote: Compressing objects: 100% (5307/5307), done.
248 remote: Total 17179 (delta 10209), reused 17139 (delta 10169)
249 Receiving objects: 100% (17179/17179), 4.76 MiB | 4.39 MiB/s, done.
250 Resolving deltas: 100% (10209/10209), done.
251 Checking connectivity... done.
252 </literallayout>
253 </para></listitem>
254 <listitem><para>
255 <emphasis>Check Out the Proper Branch:</emphasis>
256 The branch you check out for
257 <filename>meta-intel</filename> must match the same
258 branch you are using for the Yocto Project release
259 (e.g. &DISTRO_NAME_NO_CAP;):
260 <literallayout class='monospaced'>
261 $ cd meta-intel
262 $ git checkout -b &DISTRO_NAME_NO_CAP; remotes/origin/&DISTRO_NAME_NO_CAP;
263 Branch &DISTRO_NAME_NO_CAP; set up to track remote branch &DISTRO_NAME_NO_CAP; from origin.
264 Switched to a new branch '&DISTRO_NAME_NO_CAP;'
265 </literallayout>
266 <note>
267 To see the available branch names in a cloned repository,
268 use the <filename>git branch -al</filename> command.
269 See the
270 "<ulink url='&YOCTO_DOCS_DEV_URL;#checking-out-by-branch-in-poky'>Checking Out By Branch in Poky</ulink>"
271 section in the Yocto Project Development Tasks
272 Manual for more information.
273 </note>
274 </para></listitem>
275 </orderedlist>
276 </para></listitem>
277 <listitem><para>
278 <emphasis>Optionally Set Up an Alternative BSP Layer:</emphasis>
279 If your hardware can be more closely leveraged to an
280 existing BSP not within the <filename>meta-intel</filename>
281 BSP layer, you can clone that BSP layer.</para>
282
283 <para>The process is identical to the process used for the
284 <filename>meta-intel</filename> layer except for the layer's
285 name.
286 For example, if you determine that your hardware most
287 closely matches the <filename>meta-raspberrypi</filename>,
288 clone that layer:
289 <literallayout class='monospaced'>
290 $ git clone git://git.yoctoproject.org/meta-raspberrypi
291 Cloning into 'meta-raspberrypi'...
292 remote: Counting objects: 6205, done.
293 remote: Compressing objects: 100% (2700/2700), done.
294 remote: Total 6205 (delta 3342), reused 5916 (delta 3146)
295 Receiving objects: 100% (6205/6205), 1.43 MiB | 0 bytes/s, done.
296 Resolving deltas: 100% (3342/3342), done.
297 Checking connectivity... done. </literallayout>
298 </para></listitem>
299 <listitem><para>
300 <emphasis>Initialize the Build Environment:</emphasis>
301 While in the root directory of the Source Directory (i.e.
302 <filename>poky</filename>), run the
303 <ulink url='&YOCTO_DOCS_REF_URL;#structure-core-script'><filename>&OE_INIT_FILE;</filename></ulink>
304 environment setup script to define the OpenEmbedded
305 build environment on your build host.
306 <literallayout class='monospaced'>
307 $ source &OE_INIT_FILE;
308 </literallayout>
309 Among other things, the script creates the
310 <ulink url='&YOCTO_DOCS_REF_URL;#build-directory'>Build Directory</ulink>,
311 which is <filename>build</filename> in this case
312 and is located in the
313 <ulink url='&YOCTO_DOCS_REF_URL;#source-directory'>Source Directory</ulink>.
314 After the script runs, your current working directory
315 is set to the <filename>build</filename> directory.
316 </para></listitem>
317 </orderedlist>
318 </para>
319</section>
320
321<section id="bsp-filelayout">
322 <title>Example Filesystem Layout</title>
323
324 <para>
325 Defining a common BSP directory structure allows
326 end-users to understand and become familiar with
327 that standard.
328 A common format also encourages standardization
329 of software support for hardware.
330 </para>
331
332 <para>
333 The proposed form described in this section does
334 have elements that are specific to the OpenEmbedded
335 build system.
336 It is intended that developers can use this structure
337 with other build systems besides the OpenEmbedded build
338 system.
339 It is also intended that it will be be simple to extract
340 information and convert it to other formats if required.
341 The OpenEmbedded build system, through its standard
342 <ulink url='&YOCTO_DOCS_OM_URL;#the-yocto-project-layer-model'>layers mechanism</ulink>,
343 can directly accept the format described as a layer.
344 The BSP layer captures all the hardware-specific details
345 in one place using a standard format, which is useful
346 for any person wishing to use the hardware platform
347 regardless of the build system they are using.
348 </para>
349
350 <para>
351 The BSP specification does not include a build system
352 or other tools - the specification is concerned with
353 the hardware-specific components only.
354 At the end-distribution point, you can ship the BSP
355 layer combined with a build system and other tools.
356 Realize that it is important to maintain the distinction
357 that the BSP layer, a build system, and tools are
358 separate components that could to be combined in
359 certain end products.
360 </para>
361
362 <para>
363 Before looking at the common form for the file structure
364 inside a BSP Layer, you should be aware that some
365 requirements do exist in order for a BSP layer to
366 be considered compliant with the Yocto Project.
367 For that list of requirements, see the
368 "<link linkend='released-bsp-requirements'>Released BSP Requirements</link>"
369 section.
370 </para>
371
372 <para>
373 Below is the common form for the file structure
374 inside a BSP Layer.
375 While this basic form represents the standard,
376 realize that the actual file structures for specific
377 BSPs could differ.
378 <literallayout class='monospaced'>
379 meta-<replaceable>bsp_root_name</replaceable>/
380 meta-<replaceable>bsp_root_name</replaceable>/<replaceable>bsp_license_file</replaceable>
381 meta-<replaceable>bsp_root_name</replaceable>/README
382 meta-<replaceable>bsp_root_name</replaceable>/README.sources
383 meta-<replaceable>bsp_root_name</replaceable>/binary/<replaceable>bootable_images</replaceable>
384 meta-<replaceable>bsp_root_name</replaceable>/conf/layer.conf
385 meta-<replaceable>bsp_root_name</replaceable>/conf/machine/*.conf
386 meta-<replaceable>bsp_root_name</replaceable>/recipes-bsp/*
387 meta-<replaceable>bsp_root_name</replaceable>/recipes-core/*
388 meta-<replaceable>bsp_root_name</replaceable>/recipes-graphics/*
389 meta-<replaceable>bsp_root_name</replaceable>/recipes-kernel/linux/linux-yocto_<replaceable>kernel_rev</replaceable>.bbappend
390 </literallayout>
391 </para>
392
393 <para>
394 You can examine the Raspberry Pi BSP
395 layer that is available from the
396 <ulink url='&YOCTO_GIT_URL;'>Source Repositories</ulink> by
397 following this link:
398 <ulink url='https://git.yoctoproject.org/cgit/cgit.cgi/meta-raspberrypi/tree/?h=&DISTRO_NAME_NO_CAP;'></ulink>.
399 Following the link puts you in the Source Repositories and the
400 Raspberry Pi BSP layer for the "&DISTRO_NAME_NO_CAP;" release.
401 You can use the interface to explore the configuration, docs, and
402 recipe files.
403 </para>
404
405 <para>
406 The following sections describe each part of the proposed
407 BSP format.
408 </para>
409
410 <section id="bsp-filelayout-license">
411 <title>License Files</title>
412
413 <para>
414 You can find these files in the BSP Layer at:
415 <literallayout class='monospaced'>
416 meta-<replaceable>bsp_root_name</replaceable>/<replaceable>bsp_license_file</replaceable>
417 </literallayout>
418 </para>
419
420 <para>
421 These optional files satisfy licensing requirements
422 for the BSP.
423 The type or types of files here can vary depending
424 on the licensing requirements.
425 For example, in the Raspberry Pi BSP all licensing
426 requirements are handled with the
427 <filename>COPYING.MIT</filename> file.
428 </para>
429
430 <para>
431 Licensing files can be MIT, BSD, GPLv*, and so forth.
432 These files are recommended for the BSP but are
433 optional and totally up to the BSP developer.
434 For information on how to maintain license
435 compliance, see the
436 "<ulink url='&YOCTO_DOCS_DEV_URL;#maintaining-open-source-license-compliance-during-your-products-lifecycle'>Maintaining Open Source License Compliance During Your Product's Lifecycle</ulink>"
437 section in the Yocto Project Development Tasks
438 Manual.
439 </para>
440 </section>
441
442 <section id="bsp-filelayout-readme">
443 <title>README File</title>
444
445 <para>
446 You can find this file in the BSP Layer at:
447 <literallayout class='monospaced'>
448 meta-<replaceable>bsp_root_name</replaceable>/README
449 </literallayout>
450 </para>
451
452 <para>
453 This file provides information on how to boot the live
454 images that are optionally included in the
455 <filename>binary/</filename> directory.
456 The <filename>README</filename> file also provides
457 information needed for building the image.
458 </para>
459
460 <para>
461 At a minimum, the <filename>README</filename> file must
462 contain a list of dependencies, such as the names of
463 any other layers on which the BSP depends and the name of
464 the BSP maintainer with his or her contact information.
465 </para>
466 </section>
467
468 <section id="bsp-filelayout-readme-sources">
469 <title>README.sources File</title>
470
471 <para>
472 You can find this file in the BSP Layer at:
473 <literallayout class='monospaced'>
474 meta-<replaceable>bsp_root_name</replaceable>/README.sources
475 </literallayout>
476 </para>
477
478 <para>
479 This file provides information on where to locate the BSP
480 source files used to build the images (if any) that
481 reside in
482 <filename>meta-<replaceable>bsp_root_name</replaceable>/binary</filename>.
483 Images in the <filename>binary</filename> would be images
484 released with the BSP.
485 The information in the <filename>README.sources</filename>
486 file also helps you find the
487 <ulink url='&YOCTO_DOCS_REF_URL;#metadata'>Metadata</ulink>
488 used to generate the images that ship with the BSP.
489 <note>
490 If the BSP's <filename>binary</filename> directory is
491 missing or the directory has no images, an existing
492 <filename>README.sources</filename> file is
493 meaningless and usually does not exist.
494 </note>
495 </para>
496 </section>
497
498 <section id="bsp-filelayout-binary">
499 <title>Pre-built User Binaries</title>
500
501 <para>
502 You can find these files in the BSP Layer at:
503 <literallayout class='monospaced'>
504 meta-<replaceable>bsp_root_name</replaceable>/binary/<replaceable>bootable_images</replaceable>
505 </literallayout>
506 </para>
507
508 <para>
509 This optional area contains useful pre-built kernels
510 and user-space filesystem images released with the
511 BSP that are appropriate to the target system.
512 This directory typically contains graphical (e.g. Sato)
513 and minimal live images when the BSP tarball has been
514 created and made available in the
515 <ulink url='&YOCTO_HOME_URL;'>Yocto Project</ulink>
516 website.
517 You can use these kernels and images to get a system
518 running and quickly get started on development tasks.
519 </para>
520
521 <para>
522 The exact types of binaries present are highly
523 hardware-dependent.
524 The
525 <link linkend='bsp-filelayout-readme'><filename>README</filename></link>
526 file should be present in the BSP Layer and it
527 explains how to use the images with the target hardware.
528 Additionally, the
529 <link linkend='bsp-filelayout-readme-sources'><filename>README.sources</filename></link>
530 file should be present to locate the sources used to
531 build the images and provide information on the
532 Metadata.
533 </para>
534 </section>
535
536 <section id='bsp-filelayout-layer'>
537 <title>Layer Configuration File</title>
538
539 <para>
540 You can find this file in the BSP Layer at:
541 <literallayout class='monospaced'>
542 meta-<replaceable>bsp_root_name</replaceable>/conf/layer.conf
543 </literallayout>
544 </para>
545
546 <para>
547 The <filename>conf/layer.conf</filename> file
548 identifies the file structure as a layer,
549 identifies the contents of the layer, and
550 contains information about how the build system should
551 use it.
552 Generally, a standard boilerplate file such as the
553 following works.
554 In the following example, you would replace
555 <replaceable>bsp</replaceable> with the actual
556 name of the BSP (i.e.
557 <replaceable>bsp_root_name</replaceable> from the example
558 template).
559 </para>
560
561 <para>
562 <literallayout class='monospaced'>
563 # We have a conf and classes directory, add to BBPATH
564 BBPATH .= ":${LAYERDIR}"
565
566 # We have a recipes directory, add to BBFILES
567 BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
568 ${LAYERDIR}/recipes-*/*/*.bbappend"
569
570 BBFILE_COLLECTIONS += "<replaceable>bsp</replaceable>"
571 BBFILE_PATTERN_<replaceable>bsp</replaceable> = "^${LAYERDIR}/"
572 BBFILE_PRIORITY_<replaceable>bsp</replaceable> = "6"
573
574 LAYERDEPENDS_<replaceable>bsp</replaceable> = "intel"
575 </literallayout>
576 </para>
577
578 <para>
579 To illustrate the string substitutions, here are
580 the corresponding statements from the Raspberry
581 Pi <filename>conf/layer.conf</filename> file:
582 <literallayout class='monospaced'>
583 # We have a conf and classes directory, append to BBPATH
584 BBPATH .= ":${LAYERDIR}"
585
586 # We have a recipes directory containing .bb and .bbappend files, add to BBFILES
587 BBFILES += "${LAYERDIR}/recipes*/*/*.bb \
588 ${LAYERDIR}/recipes*/*/*.bbappend"
589
590 BBFILE_COLLECTIONS += "raspberrypi"
591 BBFILE_PATTERN_raspberrypi := "^${LAYERDIR}/"
592 BBFILE_PRIORITY_raspberrypi = "9"
593
594 # Additional license directories.
595 LICENSE_PATH += "${LAYERDIR}/files/custom-licenses"
596 .
597 .
598 .
599 </literallayout>
600 </para>
601
602 <para>
603 This file simply makes
604 <ulink url='&YOCTO_DOCS_REF_URL;#bitbake-term'>BitBake</ulink>
605 aware of the recipes and configuration directories.
606 The file must exist so that the OpenEmbedded build system
607 can recognize the BSP.
608 </para>
609 </section>
610
611 <section id="bsp-filelayout-machine">
612 <title>Hardware Configuration Options</title>
613
614 <para>
615 You can find these files in the BSP Layer at:
616 <literallayout class='monospaced'>
617 meta-<replaceable>bsp_root_name</replaceable>/conf/machine/*.conf
618 </literallayout>
619 </para>
620
621 <para>
622 The machine files bind together all the information
623 contained elsewhere in the BSP into a format that
624 the build system can understand.
625 Each BSP Layer requires at least one machine file.
626 If the BSP supports multiple machines, multiple
627 machine configuration files can exist.
628 These filenames correspond to the values to which
629 users have set the
630 <ulink url='&YOCTO_DOCS_REF_URL;#var-MACHINE'><filename>MACHINE</filename></ulink> variable.
631 </para>
632
633 <para>
634 These files define things such as the kernel package
635 to use
636 (<ulink url='&YOCTO_DOCS_REF_URL;#var-PREFERRED_PROVIDER'><filename>PREFERRED_PROVIDER</filename></ulink>
637 of
638 <ulink url='&YOCTO_DOCS_DEV_URL;#metadata-virtual-providers'>virtual/kernel</ulink>),
639 the hardware drivers to include in different types
640 of images, any special software components that are
641 needed, any bootloader information, and also any
642 special image format requirements.
643 </para>
644
645 <para>
646 This configuration file could also include a hardware
647 "tuning" file that is commonly used to define the
648 package architecture and specify optimization flags,
649 which are carefully chosen to give best performance
650 on a given processor.
651 </para>
652
653 <para>
654 Tuning files are found in the
655 <filename>meta/conf/machine/include</filename>
656 directory within the
657 <ulink url='&YOCTO_DOCS_REF_URL;#source-directory'>Source Directory</ulink>.
658 For example, many <filename>tune-*</filename> files
659 (e.g. <filename>tune-arm1136jf-s.inc</filename>,
660 <filename>tun-1586-nlp.inc</filename>, and so forth)
661 reside in the
662 <filename>poky/meta/conf/machine/include</filename>
663 directory.
664 </para>
665
666 <para>
667 To use an include file, you simply include them in the
668 machine configuration file.
669 For example, the Raspberry Pi BSP
670 <filename>raspberrypi3.conf</filename> contains the
671 following statement:
672 <literallayout class='monospaced'>
673 include conf/machine/include/rpi-base.inc
674 </literallayout>
675 </para>
676 </section>
677
678 <section id='bsp-filelayout-misc-recipes'>
679 <title>Miscellaneous BSP-Specific Recipe Files</title>
680
681 <para>
682 You can find these files in the BSP Layer at:
683 <literallayout class='monospaced'>
684 meta-<replaceable>bsp_root_name</replaceable>/recipes-bsp/*
685 </literallayout>
686 </para>
687
688 <para>
689 This optional directory contains miscellaneous recipe
690 files for the BSP.
691 Most notably would be the formfactor files.
692 For example, in the Raspberry Pi BSP there is the
693 <filename>formfactor_%.bbappend</filename> file,
694 which is an append file used to augment the recipe
695 that starts the build.
696 Furthermore, there are machine-specific settings used
697 during the build that are defined by the
698 <filename>machconfig</filename> file further down in
699 the directory (i.e. <filename>formfactor/rpi/</filename>).
700 Here is the <filename>machconfig</filename> file for
701 the Raspberry Pi BSP:
702 <literallayout class='monospaced'>
703 HAVE_TOUCHSCREEN=0
704 HAVE_KEYBOARD=1
705
706 DISPLAY_CAN_ROTATE=0
707 DISPLAY_ORIENTATION=0
708 DISPLAY_DPI=133
709 </literallayout>
710 </para>
711
712 <note><para>
713 If a BSP does not have a formfactor entry, defaults
714 are established according to the formfactor
715 configuration file that is installed by the main
716 formfactor recipe
717 <filename>meta/recipes-bsp/formfactor/formfactor_0.0.bb</filename>,
718 which is found in the
719 <ulink url='&YOCTO_DOCS_REF_URL;#source-directory'>Source Directory</ulink>
720 (i.e. <filename>poky</filename>).
721 </para></note>
722 </section>
723
724 <section id='bsp-filelayout-recipes-graphics'>
725 <title>Display Support Files</title>
726
727 <para>
728 You can find these files in the BSP Layer at:
729 <literallayout class='monospaced'>
730 meta-<replaceable>bsp_root_name</replaceable>/recipes-graphics/*
731 </literallayout>
732 </para>
733
734 <para>
735 This optional directory contains recipes for the
736 BSP if it has special requirements for graphics
737 support.
738 All files that are needed for the BSP to support
739 a display are kept here.
740 </para>
741 </section>
742
743 <section id='bsp-filelayout-kernel'>
744 <title>Linux Kernel Configuration</title>
745
746 <para>
747 You can find these files in the BSP Layer at:
748 <literallayout class='monospaced'>
749 meta-<replaceable>bsp_root_name</replaceable>/recipes-kernel/linux/linux*.bbappend
750 meta-<replaceable>bsp_root_name</replaceable>/recipes-kernel/linux/*.bb
751 </literallayout>
752 </para>
753
754 <para>
755 Append files (<filename>*.bbappend</filename>) modify
756 the main kernel recipe being used to build the image.
757 The <filename>*.bb</filename> files would be a
758 developer-supplied kernel recipe.
759 This area of the BSP hierarchy can contain both these
760 types of files, although in practice, it is likely that
761 you would have one or the other.
762 </para>
763
764 <para>
765 For your BSP, you typically want to use an existing Yocto
766 Project kernel recipe found in the
767 <ulink url='&YOCTO_DOCS_REF_URL;#source-directory'>Source Directory</ulink>
768 at <filename>meta/recipes-kernel/linux</filename>.
769 You can append machine-specific changes to the
770 kernel recipe by using a similarly named append
771 file, which is located in the BSP Layer for your
772 target device (e.g. the
773 <filename>meta-<replaceable>bsp_root_name</replaceable>/recipes-kernel/linux</filename> directory).
774 </para>
775
776 <para>
777 Suppose you are using the
778 <filename>linux-yocto_4.4.bb</filename> recipe to
779 build the kernel.
780 In other words, you have selected the kernel in your
781 <replaceable>bsp_root_name</replaceable><filename>.conf</filename>
782 file by adding
783 <ulink url='&YOCTO_DOCS_REF_URL;#var-PREFERRED_PROVIDER'><filename>PREFERRED_PROVIDER</filename></ulink>
784 and
785 <ulink url='&YOCTO_DOCS_REF_URL;#var-PREFERRED_VERSION'><filename>PREFERRED_VERSION</filename></ulink>
786 statements as follows:
787 <literallayout class='monospaced'>
788 PREFERRED_PROVIDER_virtual/kernel ?= "linux-yocto"
789 PREFERRED_VERSION_linux-yocto ?= "4.4%"
790 </literallayout>
791 <note>
792 When the preferred provider is assumed by
793 default, the
794 <filename>PREFERRED_PROVIDER</filename>
795 statement does not appear in the
796 <replaceable>bsp_root_name</replaceable><filename>.conf</filename> file.
797 </note>
798 You would use the
799 <filename>linux-yocto_4.4.bbappend</filename>
800 file to append specific BSP settings to the kernel,
801 thus configuring the kernel for your particular BSP.
802 </para>
803
804 <para>
805 You can find more information on what your append file
806 should contain in the
807 "<ulink url='&YOCTO_DOCS_KERNEL_DEV_URL;#creating-the-append-file'>Creating the Append File</ulink>"
808 section in the Yocto Project Linux Kernel Development
809 Manual.
810 </para>
811
812 <para>
813 An alternate scenario is when you create your own
814 kernel recipe for the BSP.
815 A good example of this is the Raspberry Pi BSP.
816 If you examine the
817 <filename>recipes-kernel/linux</filename> directory
818 you see the following:
819 <literallayout class='monospaced'>
820 linux-raspberrypi-dev.bb
821 linux-raspberrypi.inc
822 linux-raspberrypi_4.14.bb
823 linux-raspberrypi_4.9.bb
824 </literallayout>
825 The directory contains three kernel recipes and a
826 common include file.
827 </para>
828 </section>
829</section>
830
831<section id='developing-a-board-support-package-bsp'>
832 <title>Developing a Board Support Package (BSP)</title>
833
834 <para>
835 This section contains the high-level procedure you can
836 follow to create a BSP.
837 Although not required for BSP creation, the
838 <filename>meta-intel</filename> repository, which
839 contains many BSPs supported by the Yocto Project,
840 is part of the example.
841 </para>
842
843 <para>
844 For an example that shows how to create a new
845 layer using the tools, see the
846 "<link linkend='creating-a-new-bsp-layer-using-the-bitbake-layers-script'>Creating a New BSP Layer Using the <filename>bitbake-layers</filename> Script</link>"
847 section.
848 </para>
849
850 <para>
851 The following illustration and list summarize the BSP
852 creation general workflow.
853 </para>
854
855 <para>
856 <imagedata fileref="figures/bsp-dev-flow.png" width="7in" depth="5in" align="center" scalefit="1" />
857 </para>
858
859 <para>
860 <orderedlist>
861 <listitem><para>
862 <emphasis>Set up Your Host Development System
863 to Support Development Using the Yocto
864 Project</emphasis>:
865 See the
866 "<ulink url='&YOCTO_DOCS_DEV_URL;#dev-preparing-the-build-host'>Preparing the Build Host</ulink>"
867 section in the Yocto Project Development Tasks
868 Manual for options on how to get a system ready
869 to use the Yocto Project.
870 </para></listitem>
871 <listitem><para>
872 <emphasis>Establish the
873 <filename>meta-intel</filename>
874 Repository on Your System:</emphasis>
875 Having local copies of these supported BSP layers
876 on your system gives you access to layers you
877 might be able to leverage when creating your BSP.
878 For information on how to get these files, see the
879 "<link linkend='preparing-your-build-host-to-work-with-bsp-layers'>Preparing Your Build Host to Work with BSP Layers</link>"
880 section.
881 </para></listitem>
882 <listitem><para>
883 <emphasis>Create Your Own BSP Layer Using the
884 <filename>bitbake-layers</filename>
885 Script:</emphasis>
886 Layers are ideal for isolating and storing work
887 for a given piece of hardware.
888 A layer is really just a location or area in which you
889 place the recipes and configurations for your BSP.
890 In fact, a BSP is, in itself, a special type of layer.
891 The simplest way to create a new BSP layer that is
892 compliant with the Yocto Project is to use the
893 <filename>bitbake-layers</filename> script.
894 For information about that script, see the
895 "<link linkend='creating-a-new-bsp-layer-using-the-bitbake-layers-script'>Creating a New BSP Layer Using the <filename>bitbake-layers</filename> Script</link>"
896 section.</para>
897
898 <para>Another example that illustrates a layer
899 is an application.
900 Suppose you are creating an application that has
901 library or other dependencies in order for it to
902 compile and run.
903 The layer, in this case, would be where all the
904 recipes that define those dependencies are kept.
905 The key point for a layer is that it is an
906 isolated area that contains all the relevant
907 information for the project that the
908 OpenEmbedded build system knows about.
909 For more information on layers, see the
910 "<ulink url='&YOCTO_DOCS_OM_URL;#the-yocto-project-layer-model'>The Yocto Project Layer Model</ulink>"
911 section in the Yocto Project Overview and Concepts
912 Manual.
913 You can also reference the
914 "<ulink url='&YOCTO_DOCS_DEV_URL;#understanding-and-creating-layers'>Understanding and Creating Layers</ulink>"
915 section in the Yocto Project Development Tasks
916 Manual.
917 For more information on BSP layers, see the
918 "<link linkend='bsp-layers'>BSP Layers</link>"
919 section.
920 <note><title>Notes</title>
921 <itemizedlist>
922 <listitem><para>
923 Five hardware reference BSPs exist
924 that are part of the Yocto Project release
925 and are located in the
926 <filename>poky/meta-yocto-bsp</filename> BSP
927 layer:
928 <itemizedlist>
929 <listitem><para>
930 Texas Instruments Beaglebone
931 (<filename>beaglebone-yocto</filename>)
932 </para></listitem>
933 <listitem><para>
934 Freescale MPC8315E-RDB
935 (<filename>mpc8315e-rdb</filename>)
936 </para></listitem>
937 <listitem><para>
938 Ubiquiti Networks EdgeRouter Lite
939 (<filename>edgerouter</filename>)
940 </para></listitem>
941 <listitem><para>
942 Two general IA platforms
943 (<filename>genericx86</filename> and
944 <filename>genericx86-64</filename>)
945 </para></listitem>
946 </itemizedlist>
947 </para></listitem>
948 <listitem><para>
949 Three core Intel BSPs exist as part of
950 the Yocto Project release in the
951 <filename>meta-intel</filename> layer:
952 <itemizedlist>
953 <listitem><para>
954 <filename>intel-core2-32</filename>,
955 which is a BSP optimized for the Core2
956 family of CPUs as well as all CPUs
957 prior to the Silvermont core.
958 </para></listitem>
959 <listitem><para>
960 <filename>intel-corei7-64</filename>,
961 which is a BSP optimized for Nehalem
962 and later Core and Xeon CPUs as well
963 as Silvermont and later Atom CPUs,
964 such as the Baytrail SoCs.
965 </para></listitem>
966 <listitem><para>
967 <filename>intel-quark</filename>,
968 which is a BSP optimized for the
969 Intel Galileo gen1 &amp; gen2
970 development boards.
971 </para></listitem>
972 </itemizedlist>
973 </para></listitem>
974 </itemizedlist>
975 </note></para>
976
977 <para>When you set up a layer for a new BSP,
978 you should follow a standard layout.
979 This layout is described in the
980 "<link linkend='bsp-filelayout'>Example Filesystem Layout</link>"
981 section.
982 In the standard layout, notice the suggested
983 structure for recipes and configuration
984 information.
985 You can see the standard layout for a BSP
986 by examining any supported BSP found in the
987 <filename>meta-intel</filename> layer inside
988 the Source Directory.
989 </para></listitem>
990 <listitem><para>
991 <emphasis>Make Configuration Changes to Your New
992 BSP Layer:</emphasis>
993 The standard BSP layer structure organizes the
994 files you need to edit in
995 <filename>conf</filename> and several
996 <filename>recipes-*</filename> directories
997 within the BSP layer.
998 Configuration changes identify where your new
999 layer is on the local system and identifies the
1000 kernel you are going to use.
1001 When you run the
1002 <filename>bitbake-layers</filename> script,
1003 you are able to interactively configure many
1004 things for the BSP (e.g. keyboard, touchscreen,
1005 and so forth).
1006 </para></listitem>
1007 <listitem><para>
1008 <emphasis>Make Recipe Changes to Your New BSP
1009 Layer:</emphasis>
1010 Recipe changes include altering recipes
1011 (<filename>*.bb</filename> files), removing
1012 recipes you do not use, and adding new recipes
1013 or append files (<filename>.bbappend</filename>)
1014 that support your hardware.
1015 </para></listitem>
1016 <listitem><para>
1017 <emphasis>Prepare for the Build:</emphasis>
1018 Once you have made all the changes to your BSP
1019 layer, there remains a few things you need to
1020 do for the OpenEmbedded build system in order
1021 for it to create your image.
1022 You need to get the build environment ready by
1023 sourcing an environment setup script
1024 (i.e. <filename>oe-init-build-env</filename>)
1025 and you need to be sure two key configuration
1026 files are configured appropriately: the
1027 <filename>conf/local.conf</filename> and the
1028 <filename>conf/bblayers.conf</filename> file.
1029 You must make the OpenEmbedded build system aware
1030 of your new layer.
1031 See the
1032 "<ulink url='&YOCTO_DOCS_DEV_URL;#enabling-your-layer'>Enabling Your Layer</ulink>"
1033 section in the Yocto Project Development Tasks Manual
1034 for information on how to let the build system
1035 know about your new layer.
1036 </para></listitem>
1037 <listitem><para>
1038 <emphasis>Build the Image:</emphasis>
1039 The OpenEmbedded build system uses the BitBake tool
1040 to build images based on the type of image you want to
1041 create.
1042 You can find more information about BitBake in the
1043 <ulink url='&YOCTO_DOCS_BB_URL;'>BitBake User Manual</ulink>.
1044 </para>
1045
1046 <para>The build process supports several types of
1047 images to satisfy different needs.
1048 See the
1049 "<ulink url='&YOCTO_DOCS_REF_URL;#ref-images'>Images</ulink>"
1050 chapter in the Yocto Project Reference Manual for
1051 information on supported images.
1052 </para></listitem>
1053 </orderedlist>
1054 </para>
1055</section>
1056
1057<section id='requirements-and-recommendations-for-released-bsps'>
1058 <title>Requirements and Recommendations for Released BSPs</title>
1059
1060 <para>
1061 Certain requirements exist for a released BSP to be
1062 considered compliant with the Yocto Project.
1063 Additionally, recommendations also exist.
1064 This section describes the requirements and
1065 recommendations for released BSPs.
1066 </para>
1067
1068 <section id='released-bsp-requirements'>
1069 <title>Released BSP Requirements</title>
1070
1071 <para>
1072 Before looking at BSP requirements, you should consider
1073 the following:
1074 <itemizedlist>
1075 <listitem><para>
1076 The requirements here assume the BSP layer
1077 is a well-formed, "legal" layer that can be
1078 added to the Yocto Project.
1079 For guidelines on creating a layer that meets
1080 these base requirements, see the
1081 "<link linkend='bsp-layers'>BSP Layers</link>"
1082 section in this manual and the
1083 "<ulink url='&YOCTO_DOCS_DEV_URL;#understanding-and-creating-layers'>Understanding and Creating Layers"</ulink>"
1084 section in the Yocto Project Development Tasks
1085 Manual.
1086 </para></listitem>
1087 <listitem><para>
1088 The requirements in this section apply
1089 regardless of how you package a BSP.
1090 You should consult the packaging and distribution
1091 guidelines for your specific release process.
1092 For an example of packaging and distribution
1093 requirements, see the
1094 "<ulink url='https://wiki.yoctoproject.org/wiki/Third_Party_BSP_Release_Process'>Third Party BSP Release Process</ulink>"
1095 wiki page.
1096 </para></listitem>
1097 <listitem><para>
1098 The requirements for the BSP as it is made
1099 available to a developer are completely
1100 independent of the released form of the BSP.
1101 For example, the BSP Metadata can be contained
1102 within a Git repository and could have a directory
1103 structure completely different from what appears
1104 in the officially released BSP layer.
1105 </para></listitem>
1106 <listitem><para>
1107 It is not required that specific packages or
1108 package modifications exist in the BSP layer,
1109 beyond the requirements for general
1110 compliance with the Yocto Project.
1111 For example, no requirement exists dictating
1112 that a specific kernel or kernel version be
1113 used in a given BSP.
1114 </para></listitem>
1115 </itemizedlist>
1116 </para>
1117
1118 <para>
1119 Following are the requirements for a released BSP
1120 that conform to the Yocto Project:
1121 <itemizedlist>
1122 <listitem><para>
1123 <emphasis>Layer Name:</emphasis>
1124 The BSP must have a layer name that follows
1125 the Yocto Project standards.
1126 For information on BSP layer names, see the
1127 "<link linkend='bsp-layers'>BSP Layers</link>" section.
1128 </para></listitem>
1129 <listitem><para>
1130 <emphasis>File System Layout:</emphasis>
1131 When possible, use the same directory names
1132 in your BSP layer as listed in the
1133 <filename>recipes.txt</filename> file, which
1134 is found in <filename>poky/meta</filename>
1135 directory of the
1136 <ulink url='&YOCTO_DOCS_REF_URL;#source-directory'>Source Directory</ulink>
1137 or in the OpenEmbedded-Core Layer
1138 (<filename>openembedded-core</filename>) at
1139 <ulink url='http://git.openembedded.org/openembedded-core/tree/meta'></ulink>.
1140 </para>
1141
1142 <para>You should place recipes
1143 (<filename>*.bb</filename> files) and recipe
1144 modifications (<filename>*.bbappend</filename>
1145 files) into <filename>recipes-*</filename>
1146 subdirectories by functional area as outlined
1147 in <filename>recipes.txt</filename>.
1148 If you cannot find a category in
1149 <filename>recipes.txt</filename> to fit a
1150 particular recipe, you can make up your own
1151 <filename>recipes-*</filename> subdirectory.
1152 </para>
1153
1154 <para>Within any particular
1155 <filename>recipes-*</filename> category, the
1156 layout should match what is found in the
1157 OpenEmbedded-Core Git repository
1158 (<filename>openembedded-core</filename>)
1159 or the Source Directory (<filename>poky</filename>).
1160 In other words, make sure you place related
1161 files in appropriately related
1162 <filename>recipes-*</filename> subdirectories
1163 specific to the recipe's function, or within
1164 a subdirectory containing a set of closely-related
1165 recipes.
1166 The recipes themselves should follow the general
1167 guidelines for recipes used in the Yocto Project
1168 found in the
1169 "<ulink url='http://openembedded.org/wiki/Styleguide'>OpenEmbedded Style Guide</ulink>".
1170 </para></listitem>
1171 <listitem><para>
1172 <emphasis>License File:</emphasis>
1173 You must include a license file in the
1174 <filename>meta-</filename><replaceable>bsp_root_name</replaceable>
1175 directory.
1176 This license covers the BSP Metadata as a whole.
1177 You must specify which license to use since no
1178 default license exists when one not specified.
1179 See the
1180 <ulink url='&YOCTO_GIT_URL;/cgit.cgi/meta-raspberrypi/tree/COPYING.MIT'><filename>COPYING.MIT</filename></ulink>
1181 file for the Raspberry Pi BSP in the
1182 <filename>meta-raspberrypi</filename> BSP layer
1183 as an example.
1184 </para></listitem>
1185 <listitem><para>
1186 <emphasis>README File:</emphasis>
1187 You must include a <filename>README</filename>
1188 file in the
1189 <filename>meta-</filename><replaceable>bsp_root_name</replaceable>
1190 directory.
1191 See the
1192 <ulink url='&YOCTO_GIT_URL;/cgit.cgi/meta-raspberrypi/tree/README.md'><filename>README.md</filename></ulink>
1193 file for the Raspberry Pi BSP in the
1194 <filename>meta-raspberrypi</filename> BSP layer
1195 as an example.</para>
1196
1197 <para>At a minimum, the <filename>README</filename>
1198 file should contain the following:
1199 <itemizedlist>
1200 <listitem><para>
1201 A brief description about the hardware the BSP
1202 targets.
1203 </para></listitem>
1204 <listitem><para>
1205 A list of all the dependencies
1206 on which a BSP layer depends.
1207 These dependencies are typically a list
1208 of required layers needed to build the
1209 BSP.
1210 However, the dependencies should also
1211 contain information regarding any other
1212 dependencies the BSP might have.
1213 </para></listitem>
1214 <listitem><para>
1215 Any required special licensing information.
1216 For example, this information includes
1217 information on special variables needed
1218 to satisfy a EULA, or instructions on
1219 information needed to build or distribute
1220 binaries built from the BSP Metadata.
1221 </para></listitem>
1222 <listitem><para>
1223 The name and contact information for the
1224 BSP layer maintainer.
1225 This is the person to whom patches and
1226 questions should be sent.
1227 For information on how to find the right
1228 person, see the
1229 "<ulink url='&YOCTO_DOCS_DEV_URL;#how-to-submit-a-change'>Submitting a Change to the Yocto Project</ulink>"
1230 section in the Yocto Project Development
1231 Tasks Manual.
1232 </para></listitem>
1233 <listitem><para>
1234 Instructions on how to build the BSP using
1235 the BSP layer.
1236 </para></listitem>
1237 <listitem><para>
1238 Instructions on how to boot the BSP build
1239 from the BSP layer.
1240 </para></listitem>
1241 <listitem><para>
1242 Instructions on how to boot the binary
1243 images contained in the
1244 <filename>binary</filename> directory,
1245 if present.
1246 </para></listitem>
1247 <listitem><para>
1248 Information on any known bugs or issues
1249 that users should know about when either
1250 building or booting the BSP binaries.
1251 </para></listitem>
1252 </itemizedlist>
1253 </para></listitem>
1254 <listitem><para>
1255 <emphasis>README.sources File:</emphasis>
1256 If you BSP contains binary images in the
1257 <filename>binary</filename> directory, you must
1258 include a <filename>README.sources</filename>
1259 file in the
1260 <filename>meta-</filename><replaceable>bsp_root_name</replaceable>
1261 directory.
1262 This file specifies exactly where you can find
1263 the sources used to generate the binary images.
1264 </para></listitem>
1265 <listitem><para>
1266 <emphasis>Layer Configuration File:</emphasis>
1267 You must include a
1268 <filename>conf/layer.conf</filename> file in
1269 the
1270 <filename>meta-</filename><replaceable>bsp_root_name</replaceable>
1271 directory.
1272 This file identifies the
1273 <filename>meta-</filename><replaceable>bsp_root_name</replaceable>
1274 BSP layer as a layer to the build system.
1275 </para></listitem>
1276 <listitem><para>
1277 <emphasis>Machine Configuration File:</emphasis>
1278 You must include one or more
1279 <filename>conf/machine/</filename><replaceable>bsp_root_name</replaceable><filename>.conf</filename>
1280 files in the
1281 <filename>meta-</filename><replaceable>bsp_root_name</replaceable>
1282 directory.
1283 These configuration files define machine targets
1284 that can be built using the BSP layer.
1285 Multiple machine configuration files define
1286 variations of machine configurations that the
1287 BSP supports.
1288 If a BSP supports multiple machine variations,
1289 you need to adequately describe each variation
1290 in the BSP <filename>README</filename> file.
1291 Do not use multiple machine configuration files
1292 to describe disparate hardware.
1293 If you do have very different targets, you should
1294 create separate BSP layers for each target.
1295 <note>
1296 It is completely possible for a developer to
1297 structure the working repository as a
1298 conglomeration of unrelated BSP files, and to
1299 possibly generate BSPs targeted for release
1300 from that directory using scripts or some
1301 other mechanism
1302 (e.g. <filename>meta-yocto-bsp</filename> layer).
1303 Such considerations are outside the scope of
1304 this document.
1305 </note>
1306 </para></listitem>
1307 </itemizedlist>
1308 </para>
1309 </section>
1310
1311 <section id='released-bsp-recommendations'>
1312 <title>Released BSP Recommendations</title>
1313
1314 <para>
1315 Following are recommendations for released BSPs that
1316 conform to the Yocto Project:
1317 <itemizedlist>
1318 <listitem><para>
1319 <emphasis>Bootable Images:</emphasis>
1320 Released BSPs can contain one or more bootable
1321 images.
1322 Including bootable images allows users to easily
1323 try out the BSP using their own hardware.</para>
1324
1325 <para>In some cases, it might not be convenient
1326 to include a bootable image.
1327 If so, you might want to make two versions of the
1328 BSP available: one that contains binary images, and
1329 one that does not.
1330 The version that does not contain bootable images
1331 avoids unnecessary download times for users not
1332 interested in the images.</para>
1333
1334 <para>If you need to distribute a BSP and include
1335 bootable images or build kernel and filesystems
1336 meant to allow users to boot the BSP for evaluation
1337 purposes, you should put the images and artifacts
1338 within a
1339 <filename>binary/</filename> subdirectory located
1340 in the
1341 <filename>meta-</filename><replaceable>bsp_root_name</replaceable>
1342 directory.
1343 <note>
1344 If you do include a bootable image as part
1345 of the BSP and the image was built by software
1346 covered by the GPL or other open source licenses,
1347 it is your responsibility to understand
1348 and meet all licensing requirements, which could
1349 include distribution of source files.
1350 </note>
1351 </para></listitem>
1352 <listitem><para>
1353 <emphasis>Use a Yocto Linux Kernel:</emphasis>
1354 Kernel recipes in the BSP should be based on a
1355 Yocto Linux kernel.
1356 Basing your recipes on these kernels reduces
1357 the costs for maintaining the BSP and increases
1358 its scalability.
1359 See the <filename>Yocto Linux Kernel</filename>
1360 category in the
1361 <ulink url='&YOCTO_GIT_URL;'>Source Repositories</ulink>
1362 for these kernels.
1363 </para></listitem>
1364 </itemizedlist>
1365 </para>
1366 </section>
1367</section>
1368
1369<section id='customizing-a-recipe-for-a-bsp'>
1370 <title>Customizing a Recipe for a BSP</title>
1371
1372 <para>
1373 If you plan on customizing a recipe for a particular BSP,
1374 you need to do the following:
1375 <itemizedlist>
1376 <listitem><para>
1377 Create a <filename>*.bbappend</filename> file for
1378 the modified recipe.
1379 For information on using append files, see the
1380 "<ulink url='&YOCTO_DOCS_DEV_URL;#using-bbappend-files'>Using .bbappend Files in Your Layer</ulink>"
1381 section in the Yocto Project Development Tasks
1382 Manual.
1383 </para></listitem>
1384 <listitem><para>
1385 Ensure your directory structure in the BSP layer
1386 that supports your machine is such that the
1387 OpenEmbedded build system can find it.
1388 See the example later in this section for more
1389 information.
1390 </para></listitem>
1391 <listitem><para>
1392 Put the append file in a directory whose name matches
1393 the machine's name and is located in an appropriate
1394 sub-directory inside the BSP layer (i.e.
1395 <filename>recipes-bsp</filename>,
1396 <filename>recipes-graphics</filename>,
1397 <filename>recipes-core</filename>, and so forth).
1398 </para></listitem>
1399 <listitem><para>
1400 Place the BSP-specific files in the proper
1401 directory inside the BSP layer.
1402 How expansive the layer is affects where you must
1403 place these files.
1404 For example, if your layer supports several
1405 different machine types, you need to be sure your
1406 layer's directory structure includes hierarchy
1407 that separates the files according to machine.
1408 If your layer does not support multiple machines,
1409 the layer would not have that additional hierarchy
1410 and the files would obviously not be able to reside
1411 in a machine-specific directory.
1412 </para></listitem>
1413 </itemizedlist>
1414 </para>
1415
1416 <para>
1417 Following is a specific example to help you better understand
1418 the process.
1419 This example customizes customizes a recipe by adding a
1420 BSP-specific configuration file named
1421 <filename>interfaces</filename> to the
1422 <filename>init-ifupdown_1.0.bb</filename> recipe for machine
1423 "xyz" where the BSP layer also supports several other
1424 machines:
1425 <orderedlist>
1426 <listitem><para>
1427 Edit the
1428 <filename>init-ifupdown_1.0.bbappend</filename> file
1429 so that it contains the following:
1430 <literallayout class='monospaced'>
1431 FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
1432 </literallayout>
1433 The append file needs to be in the
1434 <filename>meta-xyz/recipes-core/init-ifupdown</filename>
1435 directory.
1436 </para></listitem>
1437 <listitem><para>
1438 Create and place the new
1439 <filename>interfaces</filename> configuration file in
1440 the BSP's layer here:
1441 <literallayout class='monospaced'>
1442 meta-xyz/recipes-core/init-ifupdown/files/xyz-machine-one/interfaces
1443 </literallayout>
1444 <note>
1445 If the <filename>meta-xyz</filename> layer did
1446 not support multiple machines, you would place
1447 the <filename>interfaces</filename> configuration
1448 file in the layer here:
1449 <literallayout class='monospaced'>
1450 meta-xyz/recipes-core/init-ifupdown/files/interfaces
1451 </literallayout>
1452 </note>
1453 The
1454 <ulink url='&YOCTO_DOCS_REF_URL;#var-FILESEXTRAPATHS'><filename>FILESEXTRAPATHS</filename></ulink>
1455 variable in the append files extends the search path
1456 the build system uses to find files during the build.
1457 Consequently, for this example you need to have the
1458 <filename>files</filename> directory in the same
1459 location as your append file.
1460 </para></listitem>
1461 </orderedlist>
1462 </para>
1463</section>
1464
1465<section id='bsp-licensing-considerations'>
1466 <title>BSP Licensing Considerations</title>
1467
1468 <para>
1469 In some cases, a BSP contains separately licensed
1470 Intellectual Property (IP) for a component or components.
1471 For these cases, you are required to accept the terms
1472 of a commercial or other type of license that requires
1473 some kind of explicit End User License Agreement (EULA).
1474 Once you accept the license, the OpenEmbedded build system
1475 can then build and include the corresponding component
1476 in the final BSP image.
1477 If the BSP is available as a pre-built image, you can
1478 download the image after agreeing to the license or EULA.
1479 </para>
1480
1481 <para>
1482 You could find that some separately licensed components
1483 that are essential for normal operation of the system might
1484 not have an unencumbered (or free) substitute.
1485 Without these essential components, the system would be
1486 non-functional.
1487 Then again, you might find that other licensed components
1488 that are simply 'good-to-have' or purely elective do have
1489 an unencumbered, free replacement component that you can
1490 use rather than agreeing to the separately licensed
1491 component.
1492 Even for components essential to the system, you might
1493 find an unencumbered component that is not identical but
1494 will work as a less-capable version of the licensed version
1495 in the BSP recipe.
1496 </para>
1497
1498 <para>
1499 For cases where you can substitute a free component and
1500 still maintain the system's functionality, the "DOWNLOADS"
1501 selection from the "SOFTWARE" tab on the
1502 <ulink url='&YOCTO_HOME_URL;'>Yocto Project website</ulink>
1503 makes available de-featured BSPs that are completely free
1504 of any IP encumbrances.
1505 For these cases, you can use the substitution directly and
1506 without any further licensing requirements.
1507 If present, these fully de-featured BSPs are named
1508 appropriately different as compared to the names of their
1509 respective encumbered BSPs.
1510 If available, these substitutions are your simplest and
1511 most preferred options.
1512 Obviously, use of these substitutions assumes the resulting
1513 functionality meets system requirements.
1514 <note>
1515 If however, a non-encumbered version is unavailable or
1516 it provides unsuitable functionality or quality, you can
1517 use an encumbered version.
1518 </note>
1519 </para>
1520
1521 <para>
1522 A couple different methods exist within the OpenEmbedded
1523 build system to satisfy the licensing requirements for an
1524 encumbered BSP.
1525 The following list describes them in order of preference:
1526 <orderedlist>
1527 <listitem><para>
1528 <emphasis>Use the
1529 <ulink url='&YOCTO_DOCS_REF_URL;#var-LICENSE_FLAGS'><filename>LICENSE_FLAGS</filename></ulink>
1530 Variable to Define the Recipes that Have Commercial
1531 or Other Types of Specially-Licensed Packages:</emphasis>
1532 For each of those recipes, you can specify a
1533 matching license string in a
1534 <filename>local.conf</filename> variable named
1535 <ulink url='&YOCTO_DOCS_REF_URL;#var-LICENSE_FLAGS_WHITELIST'><filename>LICENSE_FLAGS_WHITELIST</filename></ulink>.
1536 Specifying the matching license string signifies
1537 that you agree to the license.
1538 Thus, the build system can build the corresponding
1539 recipe and include the component in the image.
1540 See the
1541 "<ulink url='&YOCTO_DOCS_DEV_URL;#enabling-commercially-licensed-recipes'>Enabling Commercially Licensed Recipes</ulink>"
1542 section in the Yocto Project Development Tasks
1543 Manual for details on how to use these variables.
1544 </para>
1545
1546 <para>If you build as you normally would, without
1547 specifying any recipes in the
1548 <filename>LICENSE_FLAGS_WHITELIST</filename>, the
1549 build stops and provides you with the list of recipes
1550 that you have tried to include in the image that
1551 need entries in the
1552 <filename>LICENSE_FLAGS_WHITELIST</filename>.
1553 Once you enter the appropriate license flags into
1554 the whitelist, restart the build to continue where
1555 it left off.
1556 During the build, the prompt will not appear again
1557 since you have satisfied the requirement.</para>
1558
1559 <para>Once the appropriate license flags are on the
1560 white list in the
1561 <filename>LICENSE_FLAGS_WHITELIST</filename> variable,
1562 you can build the encumbered image with no change
1563 at all to the normal build process.
1564 </para></listitem>
1565 <listitem><para>
1566 <emphasis>Get a Pre-Built Version of the BSP:</emphasis>
1567 You can get this type of BSP by selecting the
1568 "DOWNLOADS" item from the "SOFTWARE" tab on the
1569 <ulink url='&YOCTO_HOME_URL;'>Yocto Project website</ulink>.
1570 You can download BSP tarballs that contain
1571 proprietary components after agreeing to the
1572 licensing requirements of each of the individually
1573 encumbered packages as part of the download process.
1574 Obtaining the BSP this way allows you to access an
1575 encumbered image immediately after agreeing to the
1576 click-through license agreements presented by the
1577 website.
1578 If you want to build the image yourself using
1579 the recipes contained within the BSP tarball,
1580 you will still need to create an appropriate
1581 <filename>LICENSE_FLAGS_WHITELIST</filename>
1582 to match the encumbered recipes in the BSP.
1583 </para></listitem>
1584 </orderedlist>
1585 <note>
1586 Pre-compiled images are bundled with a time-limited
1587 kernel that runs for a predetermined amount of time
1588 (10 days) before it forces the system to reboot.
1589 This limitation is meant to discourage direct
1590 redistribution of the image.
1591 You must eventually rebuild the image if you want
1592 to remove this restriction.
1593 </note>
1594 </para>
1595</section>
1596
1597<section id='creating-a-new-bsp-layer-using-the-bitbake-layers-script'>
1598 <title>Creating a new BSP Layer Using the <filename>bitbake-layers</filename> Script</title>
1599
1600 <para>
1601 The <filename>bitbake-layers create-layer</filename> script
1602 automates creating a BSP layer.
1603 What makes a layer a "BSP layer", is the presence of a machine
1604 configuration file.
1605 Additionally, a BSP layer usually has a kernel recipe
1606 or an append file that leverages off an existing kernel recipe.
1607 The primary requirement, however, is the machine configuration.
1608 </para>
1609
1610 <para>
1611 Use these steps to create a BSP layer:
1612 <itemizedlist>
1613 <listitem><para>
1614 <emphasis>Create a General Layer:</emphasis>
1615 Use the <filename>bitbake-layers</filename> script with the
1616 <filename>create-layer</filename> subcommand to create a
1617 new general layer.
1618 For instructions on how to create a general layer using the
1619 <filename>bitbake-layers</filename> script, see the
1620 "<ulink url='&YOCTO_DOCS_DEV_URL;#creating-a-general-layer-using-the-bitbake-layers-script'>Creating a General Layer Using the <filename>bitbake-layers</filename> Script</ulink>"
1621 section in the Yocto Project Development Tasks Manual.
1622 </para></listitem>
1623 <listitem><para>
1624 <emphasis>Create a Layer Configuration File:</emphasis>
1625 Every layer needs a layer configuration file.
1626 This configuration file establishes locations for the
1627 layer's recipes, priorities for the layer, and so forth.
1628 You can find examples of <filename>layer.conf</filename>
1629 files in the Yocto Project
1630 <ulink url='&YOCTO_GIT_URL;'>Source Repositories</ulink>.
1631 To get examples of what you need in your configuration
1632 file, locate a layer (e.g. "meta-ti") and examine the
1633 <ulink url='&YOCTO_GIT_URL;/cgit/cgit.cgi/meta-ti/tree/conf/layer.conf'></ulink>
1634 file.
1635 </para></listitem>
1636 <listitem><para>
1637 <emphasis>Create a Machine Configuration File:</emphasis>
1638 Create a <filename>conf/machine/</filename><replaceable>bsp_root_name</replaceable><filename>.conf</filename>
1639 file.
1640 See
1641 <ulink url='&YOCTO_GIT_URL;/cgit/cgit.cgi/poky/tree/meta-yocto-bsp/conf/machine'><filename>meta-yocto-bsp/conf/machine</filename></ulink>
1642 for sample
1643 <replaceable>bsp_root_name</replaceable><filename>.conf</filename>
1644 files.
1645 Other samples such as
1646 <ulink url='&YOCTO_GIT_URL;/cgit/cgit.cgi/meta-ti/tree/conf/machine'><filename>meta-ti</filename></ulink>
1647 and
1648 <ulink url='&YOCTO_GIT_URL;/cgit/cgit.cgi/meta-freescale/tree/conf/machine'><filename>meta-freescale</filename></ulink>
1649 exist from other vendors that have more specific machine
1650 and tuning examples.
1651 </para></listitem>
1652 <listitem><para>
1653 <emphasis>Create a Kernel Recipe:</emphasis>
1654 Create a kernel recipe in <filename>recipes-kernel/linux</filename>
1655 by either using a kernel append file or a new custom kernel
1656 recipe file (e.g. <filename>yocto-linux_4.12.bb</filename>).
1657 The BSP layers mentioned in the previous step also contain different
1658 kernel examples.
1659 See the
1660 "<ulink url='&YOCTO_DOCS_KERNEL_DEV_URL;#modifying-an-existing-recipe'>Modifying an Existing Recipe</ulink>"
1661 section in the Yocto Project Linux Kernel Development Manual
1662 for information on how to create a custom kernel.
1663 </para></listitem>
1664 </itemizedlist>
1665 </para>
1666
1667 <para>
1668 The remainder of this section provides a description of
1669 the Yocto Project reference BSP for Beaglebone, which
1670 resides in the
1671 <ulink url='&YOCTO_DOCS_REF_URL;#term-container-layer'>Container Layer</ulink>
1672 (i.e.
1673 <ulink url='&YOCTO_GIT_URL;/cgit/cgit.cgi/poky/tree/meta-yocto-bsp'><filename>meta-yocto-bsp</filename></ulink>).
1674 </para>
1675
1676 <section id='bsp-layer-configuration-example'>
1677 <title>BSP Layer Configuration Example</title>
1678
1679 <para>
1680 The layer's <filename>conf</filename> directory
1681 contains the <filename>layer.conf</filename>
1682 configuration file.
1683 In this example, the
1684 <filename>conf/layer.conf</filename> is the
1685 following:
1686 <literallayout class='monospaced'>
1687 # We have a conf and classes directory, add to BBPATH
1688 BBPATH .= ":${LAYERDIR}"
1689
1690 # We have recipes-* directories, add to BBFILES
1691 BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
1692 ${LAYERDIR}/recipes-*/*/*.bbappend"
1693
1694 BBFILE_COLLECTIONS += "yoctobsp"
1695 BBFILE_PATTERN_yoctobsp = "^${LAYERDIR}/"
1696 BBFILE_PRIORITY_yoctobsp = "5"
1697 LAYERVERSION_yoctobsp = "4"
1698 LAYERSERIES_COMPAT_yoctobsp = "&DISTRO_NAME_NO_CAP;"
1699 </literallayout>
1700 The variables used in this file configure the
1701 layer.
1702 A good way to learn about layer configuration
1703 files is to examine various files for BSP from
1704 the
1705 <ulink url='&YOCTO_GIT_URL;'>Source Repositories</ulink>.
1706 </para>
1707
1708 <para>
1709 For a detailed description of this particular
1710 layer configuration file, see
1711 "<ulink url='&YOCTO_DOCS_DEV_URL;#dev-layer-config-file-description'>step 3</ulink>
1712 in the discussion that describes how to create
1713 layers in the Yocto Project Development Tasks Manual.
1714 </para>
1715 </section>
1716
1717 <section id='bsp-machine-configuration-example'>
1718 <title>BSP Machine Configuration Example</title>
1719
1720 <para>
1721 As mentioned earlier in this section, the existence
1722 of a machine configuration file is what makes a
1723 layer a BSP layer as compared to a general or
1724 kernel layer.
1725 </para>
1726
1727 <para>
1728 Machine configuration files exist in the
1729 <replaceable>bsp_layer</replaceable><filename>/conf/machine/</filename>
1730 directory of the layer:
1731 <literallayout class='monospaced'>
1732 <replaceable>bsp_layer</replaceable><filename>/conf/machine/</filename><replaceable>machine</replaceable><filename>.conf</filename>
1733 </literallayout>
1734 For example, the machine configuration file for the
1735 <ulink url='http://beagleboard.org/bone'>BeagleBone and BeagleBone Black development boards</ulink>
1736 is located in the container layer
1737 <filename>poky/meta-yocto-bsp/conf/machine</filename>
1738 and is named <filename>beaglebone-yocto.conf</filename>:
1739 <literallayout class='monospaced'>
1740 #@TYPE: Machine
1741 #@NAME: Beaglebone-yocto machine
1742 #@DESCRIPTION: Reference machine configuration for http://beagleboard.org/bone and http://beagleboard.org/black boards
1743
1744 PREFERRED_PROVIDER_virtual/xserver ?= "xserver-xorg"
1745 XSERVER ?= "xserver-xorg \
1746 xf86-video-modesetting \
1747 "
1748
1749 MACHINE_EXTRA_RRECOMMENDS = "kernel-modules kernel-devicetree"
1750
1751 EXTRA_IMAGEDEPENDS += "u-boot"
1752
1753 DEFAULTTUNE ?= "cortexa8hf-neon"
1754 include conf/machine/include/tune-cortexa8.inc
1755
1756 IMAGE_FSTYPES += "tar.bz2 jffs2 wic wic.bmap"
1757 EXTRA_IMAGECMD_jffs2 = "-lnp "
1758 WKS_FILE ?= "beaglebone-yocto.wks"
1759 IMAGE_INSTALL_append = " kernel-devicetree kernel-image-zimage"
1760 do_image_wic[depends] += "mtools-native:do_populate_sysroot dosfstools-native:do_populate_sysroot"
1761
1762 SERIAL_CONSOLES = "115200;ttyO0"
1763
1764 PREFERRED_PROVIDER_virtual/kernel ?= "linux-yocto"
1765 PREFERRED_VERSION_linux-yocto ?= "4.12%"
1766
1767 KERNEL_IMAGETYPE = "zImage"
1768 KERNEL_DEVICETREE = "am335x-bone.dtb am335x-boneblack.dtb am335x-bonegreen.dtb"
1769 KERNEL_EXTRA_ARGS += "LOADADDR=${UBOOT_ENTRYPOINT}"
1770
1771 SPL_BINARY = "MLO"
1772 UBOOT_SUFFIX = "img"
1773 UBOOT_MACHINE = "am335x_boneblack_config"
1774 UBOOT_ENTRYPOINT = "0x80008000"
1775 UBOOT_LOADADDRESS = "0x80008000"
1776
1777 MACHINE_FEATURES = "usbgadget usbhost vfat alsa"
1778
1779 IMAGE_BOOT_FILES ?= "u-boot.${UBOOT_SUFFIX} MLO"
1780 </literallayout>
1781 The variables used to configure the machine define
1782 machine-specific properties.
1783 For example, machine-dependent packages, machine
1784 tunings, the type of kernel to build, and
1785 U-Boot configurations.
1786 </para>
1787
1788 <para>
1789 The following list provides some explanation
1790 for the statements found in the example reference
1791 machine configuration file for the BeagleBone
1792 development boards.
1793 Realize that much more can be defined as part of
1794 a machines configuration file.
1795 In general, you can learn about related variables
1796 that this example does not have by locating the
1797 variables in the
1798 "<ulink url='&YOCTO_DOCS_REF_URL;#ref-variables-glos'>Yocto Project Variables Glossary</ulink>"
1799 in the Yocto Project Reference Manual.
1800 <itemizedlist>
1801 <listitem><para>
1802 <ulink url='&YOCTO_DOCS_REF_URL;#var-PREFERRED_PROVIDER'><filename>PREFERRED_PROVIDER_virtual/xserver</filename></ulink>:
1803 The recipe that provides "virtual/xserver" when
1804 more than one provider is found.
1805 In this case, the recipe that provides
1806 "virtual/xserver" is "xserver-xorg", which
1807 exists in
1808 <filename>poky/meta/recipes-graphics/xserver-xorg</filename>.
1809 </para></listitem>
1810 <listitem><para>
1811 <ulink url='&YOCTO_DOCS_REF_URL;#var-XSERVER'><filename>XSERVER</filename></ulink>:
1812 The packages that should be installed to provide
1813 an X server and drivers for the machine.
1814 In this example, the "xserver-xorg" and
1815 "xf86-video-modesetting" are installed.
1816 </para></listitem>
1817 <listitem><para>
1818 <ulink url='&YOCTO_DOCS_REF_URL;#var-MACHINE_EXTRA_RRECOMMENDS'><filename>MACHINE_EXTRA_RRECOMMENDS</filename></ulink>:
1819 A list of machine-dependent packages
1820 not essential for booting the image.
1821 Thus, the build does not fail if the packages
1822 do not exist.
1823 However, the packages are required for a
1824 fully-featured image.
1825 <note><title>Tip</title>
1826 Many <filename>MACHINE*</filename> variables
1827 exist that help you configure a particular
1828 piece of hardware.
1829 </note>
1830 </para></listitem>
1831 <listitem><para>
1832 <ulink url='&YOCTO_DOCS_REF_URL;#var-EXTRA_IMAGEDEPENDS'><filename>EXTRA_IMAGEDEPENDS</filename></ulink>:
1833 Recipes to build that do not provide packages
1834 for installing into the root filesystem
1835 but building the image depends on the
1836 recipes.
1837 Sometimes a recipe is required to build
1838 the final image but is not needed in the
1839 root filesystem.
1840 In this case, the U-Boot recipe must be
1841 built for the image.
1842 </para></listitem>
1843 <listitem><para>
1844 <ulink url='&YOCTO_DOCS_REF_URL;#var-DEFAULTTUNE'><filename>DEFAULTTUNE</filename></ulink>:
1845 Machines use tunings to optimize machine,
1846 CPU, and application performance.
1847 These features, which are collectively known
1848 as "tuning features", exist in the
1849 <ulink url='&YOCTO_DOCS_REF_URL;#oe-core'>OpenEmbedded-Core (OE-Core)</ulink>
1850 layer (e.g.
1851 <filename>poky/meta/conf/machine/include</filename>).
1852 In this example, the default tunning file is
1853 "cortexa8hf-neon".
1854 <note>
1855 The <filename>include</filename> statement
1856 that pulls in the
1857 <filename>conf/machine/include/tune-cortexa8.inc</filename>
1858 file provides many tuning possibilities.
1859 </note>
1860 </para></listitem>
1861 <listitem><para>
1862 <ulink url='&YOCTO_DOCS_REF_URL;#var-IMAGE_FSTYPES'><filename>IMAGE_FSTYPES</filename></ulink>:
1863 The formats the OpenEmbedded build system
1864 uses during the build when creating the
1865 root filesystem.
1866 In this example, four types of images are
1867 supported.
1868 </para></listitem>
1869 <listitem><para>
1870 <ulink url='&YOCTO_DOCS_REF_URL;#var-EXTRA_IMAGECMD'><filename>EXTRA_IMAGECMD</filename></ulink>:
1871 Specifies additional options for image
1872 creation commands.
1873 In this example, the "-lnp " option is used
1874 when creating the
1875 <ulink url='https://en.wikipedia.org/wiki/JFFS2'>JFFS2</ulink>
1876 image.
1877 </para></listitem>
1878 <listitem><para>
1879 <ulink url='&YOCTO_DOCS_REF_URL;#var-WKS_FILE'><filename>WKS_FILE</filename></ulink>:
1880 The location of the
1881 <ulink url='&YOCTO_DOCS_REF_URL;#ref-kickstart'>Wic kickstart</ulink>
1882 file used by the OpenEmbedded build system to
1883 create a partitioned image (image.wic).
1884 </para></listitem>
1885 <listitem><para>
1886 <ulink url='&YOCTO_DOCS_REF_URL;#var-IMAGE_INSTALL'><filename>IMAGE_INSTALL</filename></ulink>:
1887 Specifies packages to install into an image
1888 through the
1889 <ulink url='&YOCTO_DOCS_REF_URL;#ref-classes-image'><filename>image</filename></ulink>
1890 class.
1891 Recipes use the <filename>IMAGE_INSTALL</filename>
1892 variable.
1893 </para></listitem>
1894 <listitem><para>
1895 <filename>do_image_wic[depends]</filename>:
1896 A task that is constructed during the build.
1897 In this example, the task depends on specific tools
1898 in order to create the sysroot when buiding a Wic
1899 image.
1900 </para></listitem>
1901 <listitem><para>
1902 <ulink url='&YOCTO_DOCS_REF_URL;#var-SERIAL_CONSOLES'><filename>SERIAL_CONSOLES</filename></ulink>:
1903 Defines a serial console (TTY) to enable using
1904 getty.
1905 In this case, the baud rate is "115200" and the
1906 device name is "ttyO0".
1907 </para></listitem>
1908 <listitem><para>
1909 <ulink url='&YOCTO_DOCS_REF_URL;#var-PREFERRED_PROVIDER'><filename>PREFERRED_PROVIDER_virtual/kernel</filename></ulink>:
1910 Specifies the recipe that provides
1911 "virtual/kernel" when more than one provider
1912 is found.
1913 In this case, the recipe that provides
1914 "virtual/kernel" is "linux-yocto", which
1915 exists in the layer's
1916 <filename>recipes-kernel/linux</filename> directory.
1917 </para></listitem>
1918 <listitem><para>
1919 <ulink url='&YOCTO_DOCS_REF_URL;#var-PREFERRED_VERSION'><filename>PREFERRED_VERSION_linux-yocto</filename></ulink>:
1920 Defines the version of the recipe used
1921 to build the kernel, which is "4.12" in this
1922 case.
1923 </para></listitem>
1924 <listitem><para>
1925 <ulink url='&YOCTO_DOCS_REF_URL;#var-KERNEL_IMAGETYPE'><filename>KERNEL_IMAGETYPE</filename></ulink>:
1926 The type of kernel to build for the device.
1927 In this case, the OpenEmbedded build system
1928 creates a "zImage" image type.
1929 </para></listitem>
1930 <listitem><para>
1931 <ulink url='&YOCTO_DOCS_REF_URL;#var-KERNEL_DEVICETREE'><filename>KERNEL_DEVICETREE</filename></ulink>:
1932 The name of the generated Linux kernel device
1933 tree (i.e. the <filename>.dtb</filename>) file.
1934 All the device trees for the various BeagleBone
1935 devices are included.
1936<!--
1937 You have to include some *.inc files according to the definition of KERNEL_DEVICETREE.
1938 I don't see where these are being provided.
1939-->
1940 </para></listitem>
1941 <listitem><para>
1942 <ulink url='&YOCTO_DOCS_REF_URL;#var-KERNEL_EXTRA_ARGS'><filename>KERNEL_EXTRA_ARGS</filename></ulink>:
1943 Additional <filename>make</filename>
1944 command-line arguments the OpenEmbedded build
1945 system passes on when compiling the kernel.
1946 In this example, "LOADADDR=${UBOOT_ENTRYPOINT}"
1947 is passed as a command-line argument.
1948 </para></listitem>
1949 <listitem><para>
1950 <ulink url='&YOCTO_DOCS_REF_URL;#var-SPL_BINARY'><filename>SPL_BINARY</filename></ulink>:
1951 Defines the Secondary Program Loader (SPL) binary
1952 type.
1953 In this case, the SPL binary is set to
1954 "MLO", which stands for Multimedia card LOader.
1955 </para>
1956
1957 <para>The BeagleBone development board requires an
1958 SPL to boot and that SPL file type must be MLO.
1959 Consequently, the machine configuration needs to
1960 define <filename>SPL_BINARY</filename> as "MLO".
1961 <note>
1962 For more information on how the SPL variables
1963 are used, see the
1964 <ulink url='&YOCTO_GIT_URL;/cgit/cgit.cgi/poky/tree/meta/recipes-bsp/u-boot/u-boot.inc'><filename>u-boot.inc</filename></ulink>
1965 include file.
1966 </note>
1967 </para></listitem>
1968 <listitem><para>
1969 <ulink url='&YOCTO_DOCS_REF_URL;#var-UBOOT_ENTRYPOINT'><filename>UBOOT_*</filename></ulink>:
1970 Defines various U-Boot configurations needed
1971 to build a U-Boot image.
1972 In this example, a U-Boot image is required
1973 to boot the BeagleBone device.
1974 See the following variables for more information:
1975 <itemizedlist>
1976 <listitem><para>
1977 <ulink url='&YOCTO_DOCS_REF_URL;#var-UBOOT_SUFFIX'><filename>UBOOT_SUFFIX</filename></ulink>:
1978 Points to the generated U-Boot extension.
1979 </para></listitem>
1980 <listitem><para>
1981 <ulink url='&YOCTO_DOCS_REF_URL;#var-UBOOT_MACHINE'><filename>UBOOT_MACHINE</filename></ulink>:
1982 Specifies the value passed on the make command line when building a U-Boot image.
1983 </para></listitem>
1984 <listitem><para>
1985 <ulink url='&YOCTO_DOCS_REF_URL;#var-UBOOT_ENTRYPOINT'><filename>UBOOT_ENTRYPOINT</filename></ulink>:
1986 Specifies the entry point for the U-Boot image.
1987 </para></listitem>
1988 <listitem><para>
1989 <ulink url='&YOCTO_DOCS_REF_URL;#var-UBOOT_LOADADDRESS'><filename>UBOOT_LOADADDRESS</filename></ulink>:
1990 Specifies the load address for the U-Boot image.
1991 </para></listitem>
1992 </itemizedlist>
1993 </para></listitem>
1994 <listitem><para>
1995 <ulink url='&YOCTO_DOCS_REF_URL;#var-MACHINE_FEATURES'><filename>MACHINE_FEATURES</filename></ulink>:
1996 Specifies the list of hardware features the
1997 BeagleBone device is capable of supporting.
1998 In this case, the device supports
1999 "usbgadget usbhost vfat alsa".
2000 </para></listitem>
2001 <listitem><para>
2002 <ulink url='&YOCTO_DOCS_REF_URL;#var-IMAGE_BOOT_FILES'><filename>IMAGE_BOOT_FILES</filename></ulink>:
2003 Files installed into the device's boot partition
2004 when preparing the image using the Wic tool
2005 with the <filename>bootimg-partition</filename>
2006 source plugin.
2007 In this case, the "u-boot.${UBOOT_SUFFIX}" and
2008 "MLO" files are installed.
2009 </para></listitem>
2010 </itemizedlist>
2011 </para>
2012 </section>
2013
2014 <section id='bsp-kernel-recipe-example'>
2015 <title>BSP Kernel Recipe Example</title>
2016
2017 <para>
2018 The kernel recipe used to build the kernel image
2019 for the BeagleBone device was established in the
2020 machine configuration:
2021 <literallayout class='monospaced'>
2022 PREFERRED_PROVIDER_virtual/kernel ?= "linux-yocto"
2023 PREFERRED_VERSION_linux-yocto ?= "4.12%"
2024 </literallayout>
2025 The <filename>meta-yocto-bsp/recipes-kernel/linux</filename>
2026 directory in the layer contains metadata used
2027 to build the kernel.
2028 In this case, a kernel append file is used to
2029 override an established kernel recipe, which is
2030 located in
2031 <ulink url='&YOCTO_GIT_URL;/cgit/cgit.cgi/poky/tree/meta/recipes-kernel/linux'></ulink>
2032 and named
2033 <filename>linux-yocto_4.12.bb</filename>.
2034 </para>
2035
2036 <para>
2037 Following is the contents of the append file:
2038 <literallayout class='monospaced'>
2039 KBRANCH_genericx86 = "standard/base"
2040 KBRANCH_genericx86-64 = "standard/base"
2041
2042 KMACHINE_genericx86 ?= "common-pc"
2043 KMACHINE_genericx86-64 ?= "common-pc-64"
2044 KBRANCH_edgerouter = "standard/edgerouter"
2045 KBRANCH_beaglebone-yocto = "standard/beaglebone"
2046 KMACHINE_beaglebone-yocto = "beaglebone"
2047 KBRANCH_mpc8315e-rdb = "standard/fsl-mpc8315e-rdb"
2048
2049 SRCREV_machine_genericx86 ?= "1c4ad569af3e23a77994235435040e322908687f"
2050 SRCREV_machine_genericx86-64 ?= "1c4ad569af3e23a77994235435040e322908687f"
2051 SRCREV_machine_edgerouter ?= "257f843ea367744620f1d92910afd2f454e31483"
2052 SRCREV_machine_beaglebone-yocto ?= "257f843ea367744620f1d92910afd2f454e31483"
2053 SRCREV_machine_mpc8315e-rdb ?= "014560874f9eb2a86138c9cc35046ff1720485e1"
2054
2055
2056 COMPATIBLE_MACHINE_genericx86 = "genericx86"
2057 COMPATIBLE_MACHINE_genericx86-64 = "genericx86-64"
2058 COMPATIBLE_MACHINE_edgerouter = "edgerouter"
2059 COMPATIBLE_MACHINE_beaglebone-yocto = "beaglebone-yocto"
2060 COMPATIBLE_MACHINE_mpc8315e-rdb = "mpc8315e-rdb"
2061
2062 LINUX_VERSION_genericx86 = "4.12.20"
2063 LINUX_VERSION_genericx86-64 = "4.12.20"
2064 LINUX_VERSION_edgerouter = "4.12.19"
2065 LINUX_VERSION_beaglebone-yocto = "4.12.19"
2066 LINUX_VERSION_mpc8315e-rdb = "4.12.19"
2067 </literallayout>
2068 This particular append file works for all the
2069 machines that are part of the
2070 <filename>meta-yocto-bsp</filename> container
2071 layer.
2072 The relevant statements are appended with
2073 the "beaglebone-yocto" string.
2074 The OpenEmbedded build system uses these
2075 statements to override similar statements
2076 in the kernel recipe:
2077 <itemizedlist>
2078 <listitem><para>
2079 <ulink url='&YOCTO_DOCS_REF_URL;#var-KBRANCH'><filename>KBRANCH</filename></ulink>:
2080 Identifies the kernel branch that is validated,
2081 patched, and configured during the build.
2082 </para></listitem>
2083 <listitem><para>
2084 <ulink url='&YOCTO_DOCS_REF_URL;#var-KMACHINE'><filename>KMACHINE</filename></ulink>:
2085 Identifies the machine name as known by the
2086 kernel, which is sometimes a different name
2087 than what is known by the OpenEmbedded build
2088 system.
2089 </para></listitem>
2090 <listitem><para>
2091 <ulink url='&YOCTO_DOCS_REF_URL;#var-SRCREV'><filename>SRCREV</filename></ulink>:
2092 Identifies the revision of the source code used
2093 to build the image.
2094<!--
2095 You find out about that point in the kernel source tree by
2096 doing the following command:
2097
2098 git log &dash;&dash;decorate 257f843ea367744620f1d92910afd2f454e31483
2099
2100 Returns information about the commit, which is usually
2101 that it is a merge point for a stable kernel release.
2102-->
2103 </para></listitem>
2104 <listitem><para>
2105 <ulink url='&YOCTO_DOCS_REF_URL;#var-COMPATIBLE_MACHINE'><filename>COMPATIBLE_MACHINE</filename></ulink>:
2106 A regular expression that resolves to one or
2107 more target machines with which the recipe
2108 is compatible.
2109 </para></listitem>
2110 <listitem><para>
2111 <ulink url='&YOCTO_DOCS_REF_URL;#var-LINUX_VERSION'><filename>LINUX_VERSION</filename></ulink>:
2112 The Linux version from kernel.org used by
2113 the OpenEmbedded build system to build the
2114 kernel image.
2115 </para></listitem>
2116 </itemizedlist>
2117 </para>
2118 </section>
2119</section>
2120</chapter>