summaryrefslogtreecommitdiffstats
path: root/documentation/overview-manual/concepts.rst
diff options
context:
space:
mode:
Diffstat (limited to 'documentation/overview-manual/concepts.rst')
-rw-r--r--documentation/overview-manual/concepts.rst118
1 files changed, 82 insertions, 36 deletions
diff --git a/documentation/overview-manual/concepts.rst b/documentation/overview-manual/concepts.rst
index 62f2327a7e..b34de4d361 100644
--- a/documentation/overview-manual/concepts.rst
+++ b/documentation/overview-manual/concepts.rst
@@ -98,7 +98,7 @@ files, and how to package the compiled output.
98 98
99The term "package" is sometimes used to refer to recipes. However, since 99The term "package" is sometimes used to refer to recipes. However, since
100the word "package" is used for the packaged output from the OpenEmbedded 100the word "package" is used for the packaged output from the OpenEmbedded
101build system (i.e. ``.ipk`` or ``.deb`` files), this document avoids 101build system (i.e. ``.ipk``, ``.deb`` or ``.rpm`` files), this document avoids
102using the term "package" when referring to recipes. 102using the term "package" when referring to recipes.
103 103
104Classes 104Classes
@@ -256,7 +256,7 @@ development environment.
256.. note:: 256.. note::
257 257
258 The 258 The
259 scripts/oe-setup-builddir 259 ``scripts/oe-setup-builddir``
260 script uses the 260 script uses the
261 ``$TEMPLATECONF`` 261 ``$TEMPLATECONF``
262 variable to determine which sample configuration files to locate. 262 variable to determine which sample configuration files to locate.
@@ -352,7 +352,7 @@ layers the build system uses to further control the build. These layers
352provide Metadata for the software, machine, and policies. 352provide Metadata for the software, machine, and policies.
353 353
354In general, there are three types of layer input. You can see them below 354In general, there are three types of layer input. You can see them below
355the "User Configuration" box in the `general workflow 355the "User Configuration" box in the :ref:`general workflow
356figure <overview-manual/concepts:openembedded build system concepts>`: 356figure <overview-manual/concepts:openembedded build system concepts>`:
357 357
358- *Metadata (.bb + Patches):* Software layers containing 358- *Metadata (.bb + Patches):* Software layers containing
@@ -420,14 +420,14 @@ build.
420Distro Layer 420Distro Layer
421~~~~~~~~~~~~ 421~~~~~~~~~~~~
422 422
423The distribution layer provides policy configurations for your 423A distribution layer provides policy configurations for your
424distribution. Best practices dictate that you isolate these types of 424distribution. Best practices dictate that you isolate these types of
425configurations into their own layer. Settings you provide in 425configurations into their own layer. Settings you provide in
426``conf/distro/distro.conf`` override similar settings that BitBake finds 426``conf/distro/distro.conf`` override similar settings that BitBake finds
427in your ``conf/local.conf`` file in the :term:`Build Directory`. 427in your ``conf/local.conf`` file in the :term:`Build Directory`.
428 428
429The following list provides some explanation and references for what you 429The following list provides some explanation and references for what you
430typically find in the distribution layer: 430typically find in a distribution layer:
431 431
432- *classes:* Class files (``.bbclass``) hold common functionality that 432- *classes:* Class files (``.bbclass``) hold common functionality that
433 can be shared among recipes in the distribution. When your recipes 433 can be shared among recipes in the distribution. When your recipes
@@ -454,7 +454,7 @@ typically find in the distribution layer:
454BSP Layer 454BSP Layer
455~~~~~~~~~ 455~~~~~~~~~
456 456
457The BSP Layer provides machine configurations that target specific 457A BSP layer provides machine configurations that target specific
458hardware. Everything in this layer is specific to the machine for which 458hardware. Everything in this layer is specific to the machine for which
459you are building the image or the SDK. A common structure or form is 459you are building the image or the SDK. A common structure or form is
460defined for BSP layers. You can learn more about this structure in the 460defined for BSP layers. You can learn more about this structure in the
@@ -465,7 +465,7 @@ defined for BSP layers. You can learn more about this structure in the
465 In order for a BSP layer to be considered compliant with the Yocto 465 In order for a BSP layer to be considered compliant with the Yocto
466 Project, it must meet some structural requirements. 466 Project, it must meet some structural requirements.
467 467
468The BSP Layer's configuration directory contains configuration files for 468A BSP layer's configuration directory contains configuration files for
469the machine (``conf/machine/machine.conf``) and, of course, the layer 469the machine (``conf/machine/machine.conf``) and, of course, the layer
470(``conf/layer.conf``). 470(``conf/layer.conf``).
471 471
@@ -477,18 +477,18 @@ formfactors, graphics support systems, and so forth.
477.. note:: 477.. note::
478 478
479 While the figure shows several 479 While the figure shows several
480 recipes-\* 480 ``recipes-*``
481 directories, not all these directories appear in all BSP layers. 481 directories, not all these directories appear in all BSP layers.
482 482
483Software Layer 483Software Layer
484~~~~~~~~~~~~~~ 484~~~~~~~~~~~~~~
485 485
486The software layer provides the Metadata for additional software 486A software layer provides the Metadata for additional software
487packages used during the build. This layer does not include Metadata 487packages used during the build. This layer does not include Metadata
488that is specific to the distribution or the machine, which are found in 488that is specific to the distribution or the machine, which are found in
489their respective layers. 489their respective layers.
490 490
491This layer contains any recipes, append files, and patches, that your 491This layer contains any recipes, append files, and patches that your
492project needs. 492project needs.
493 493
494Sources 494Sources
@@ -560,9 +560,8 @@ source tree used by the group).
560 560
561The canonical method through which to include a local project is to use the 561The canonical method through which to include a local project is to use the
562:ref:`ref-classes-externalsrc` class to include that local project. You use 562:ref:`ref-classes-externalsrc` class to include that local project. You use
563either the ``local.conf`` or a recipe's append file to override or set the 563either ``local.conf`` or a recipe's append file to override or set the
564recipe to point to the local directory on your disk to pull in the whole 564recipe to point to the local directory from which to fetch the source.
565source tree.
566 565
567Source Control Managers (Optional) 566Source Control Managers (Optional)
568~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 567~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -683,7 +682,7 @@ Source Fetching
683The first stages of building a recipe are to fetch and unpack the source 682The first stages of building a recipe are to fetch and unpack the source
684code: 683code:
685 684
686.. image:: figures/source-fetching.png 685.. image:: svg/source-fetching.*
687 :width: 100% 686 :width: 100%
688 687
689The :ref:`ref-tasks-fetch` and :ref:`ref-tasks-unpack` tasks fetch 688The :ref:`ref-tasks-fetch` and :ref:`ref-tasks-unpack` tasks fetch
@@ -704,10 +703,10 @@ a defined structure. For additional general information on the
704the Yocto Project Reference Manual. 703the Yocto Project Reference Manual.
705 704
706Each recipe has an area in the :term:`Build Directory` where the unpacked 705Each recipe has an area in the :term:`Build Directory` where the unpacked
707source code resides. The :term:`S` variable points to this area for a recipe's 706source code resides. The :term:`UNPACKDIR` variable points to this area for a
708unpacked source code. The name of that directory for any given recipe is 707recipe's unpacked source code, and has the default ``sources`` name. The
709defined from several different variables. The preceding figure and the 708preceding figure and the following list describe the :term:`Build Directory`'s
710following list describe the :term:`Build Directory`'s hierarchy: 709hierarchy:
711 710
712- :term:`TMPDIR`: The base directory 711- :term:`TMPDIR`: The base directory
713 where the OpenEmbedded build system performs all its work during the 712 where the OpenEmbedded build system performs all its work during the
@@ -736,11 +735,11 @@ following list describe the :term:`Build Directory`'s hierarchy:
736 - :term:`PV`: The version of the 735 - :term:`PV`: The version of the
737 recipe used to build the package. 736 recipe used to build the package.
738 737
739 - :term:`PR`: The revision of the 738- :term:`UNPACKDIR`: Contains the unpacked source files for a given recipe.
740 recipe used to build the package. 739
740- :term:`S`: Contains the final location of the source code.
741 741
742- :term:`S`: Contains the unpacked source 742 The default value for :term:`BP` is ``${BPN}-${PV}`` where:
743 files for a given recipe.
744 743
745 - :term:`BPN`: The name of the recipe 744 - :term:`BPN`: The name of the recipe
746 used to build the package. The :term:`BPN` variable is a version of 745 used to build the package. The :term:`BPN` variable is a version of
@@ -764,7 +763,7 @@ Patching
764Once source code is fetched and unpacked, BitBake locates patch files 763Once source code is fetched and unpacked, BitBake locates patch files
765and applies them to the source files: 764and applies them to the source files:
766 765
767.. image:: figures/patching.png 766.. image:: svg/patching.*
768 :width: 100% 767 :width: 100%
769 768
770The :ref:`ref-tasks-patch` task uses a 769The :ref:`ref-tasks-patch` task uses a
@@ -792,7 +791,7 @@ processes patches, see the
792":ref:`dev-manual/new-recipe:patching code`" 791":ref:`dev-manual/new-recipe:patching code`"
793section in the 792section in the
794Yocto Project Development Tasks Manual. You can also see the 793Yocto Project Development Tasks Manual. You can also see the
795":ref:`sdk-manual/extensible:use \`\`devtool modify\`\` to modify the source of an existing component`" 794":ref:`dev-manual/devtool:use \`\`devtool modify\`\` to modify the source of an existing component`"
796section in the Yocto Project Application Development and the Extensible 795section in the Yocto Project Application Development and the Extensible
797Software Development Kit (SDK) manual and the 796Software Development Kit (SDK) manual and the
798":ref:`kernel-dev/common:using traditional kernel development to patch the kernel`" 797":ref:`kernel-dev/common:using traditional kernel development to patch the kernel`"
@@ -805,7 +804,7 @@ After source code is patched, BitBake executes tasks that configure and
805compile the source code. Once compilation occurs, the files are copied 804compile the source code. Once compilation occurs, the files are copied
806to a holding area (staged) in preparation for packaging: 805to a holding area (staged) in preparation for packaging:
807 806
808.. image:: figures/configuration-compile-autoreconf.png 807.. image:: svg/configuration-compile-autoreconf.*
809 :width: 100% 808 :width: 100%
810 809
811This step in the build process consists of the following tasks: 810This step in the build process consists of the following tasks:
@@ -861,7 +860,7 @@ Package Splitting
861After source code is configured, compiled, and staged, the build system 860After source code is configured, compiled, and staged, the build system
862analyzes the results and splits the output into packages: 861analyzes the results and splits the output into packages:
863 862
864.. image:: figures/analysis-for-package-splitting.png 863.. image:: svg/analysis-for-package-splitting.*
865 :width: 100% 864 :width: 100%
866 865
867The :ref:`ref-tasks-package` and 866The :ref:`ref-tasks-package` and
@@ -912,11 +911,62 @@ the analysis and package splitting process use several areas:
912 execute on a system and it generates code for yet another machine 911 execute on a system and it generates code for yet another machine
913 (e.g. :ref:`ref-classes-cross-canadian` recipes). 912 (e.g. :ref:`ref-classes-cross-canadian` recipes).
914 913
915The :term:`FILES` variable defines the 914Packages for a recipe are listed in the :term:`PACKAGES` variable. The
916files that go into each package in 915:oe_git:`bitbake.conf </openembedded-core/tree/meta/conf/bitbake.conf>`
917:term:`PACKAGES`. If you want 916configuration file defines the following default list of packages::
918details on how this is accomplished, you can look at 917
919:yocto_git:`package.bbclass </poky/tree/meta/classes-global/package.bbclass>`. 918 PACKAGES = "${PN}-src ${PN}-dbg ${PN}-staticdev ${PN}-dev ${PN}-doc ${PN}-locale ${PACKAGE_BEFORE_PN} ${PN}"
919
920Each of these packages contains a default list of files defined with the
921:term:`FILES` variable. For example, the package ``${PN}-dev`` represents files
922useful to the development of applications depending on ``${PN}``. The default
923list of files for ``${PN}-dev``, also defined in :oe_git:`bitbake.conf
924</openembedded-core/tree/meta/conf/bitbake.conf>`, is defined as follows::
925
926 FILES:${PN}-dev = "${includedir} ${FILES_SOLIBSDEV} ${libdir}/*.la \
927 ${libdir}/*.o ${libdir}/pkgconfig ${datadir}/pkgconfig \
928 ${datadir}/aclocal ${base_libdir}/*.o \
929 ${libdir}/${BPN}/*.la ${base_libdir}/*.la \
930 ${libdir}/cmake ${datadir}/cmake"
931
932The paths in this list must be *absolute* paths from the point of view of the
933root filesystem on the target, and must *not* make a reference to the variable
934:term:`D` or any :term:`WORKDIR` related variable. A correct example would be::
935
936 ${sysconfdir}/foo.conf
937
938.. note::
939
940 The list of files for a package is defined using the override syntax by
941 separating :term:`FILES` and the package name by a semi-colon (``:``).
942
943A given file can only ever be in one package. By iterating from the leftmost to
944rightmost package in :term:`PACKAGES`, each file matching one of the patterns
945defined in the corresponding :term:`FILES` definition is included in the
946package.
947
948.. note::
949
950 To find out which package installs a file, the ``oe-pkgdata-util``
951 command-line utility can be used::
952
953 $ oe-pkgdata-util find-path '/etc/fstab'
954 base-files: /etc/fstab
955
956 For more information on the ``oe-pkgdata-util`` utility, see the section
957 :ref:`dev-manual/debugging:Viewing Package Information with
958 ``oe-pkgdata-util``` of the Yocto Project Development Tasks Manual.
959
960To add a custom package variant of the ``${PN}`` recipe named
961``${PN}-extra`` (name is arbitrary), one can add it to the
962:term:`PACKAGE_BEFORE_PN` variable::
963
964 PACKAGE_BEFORE_PN += "${PN}-extra"
965
966Alternatively, a custom package can be added by adding it to the
967:term:`PACKAGES` variable using the prepend operator (``=+``)::
968
969 PACKAGES =+ "${PN}-extra"
920 970
921Depending on the type of packages being created (RPM, DEB, or IPK), the 971Depending on the type of packages being created (RPM, DEB, or IPK), the
922:ref:`do_package_write_* <ref-tasks-package_write_deb>` 972:ref:`do_package_write_* <ref-tasks-package_write_deb>`
@@ -2153,7 +2203,7 @@ require root privileges, the fact that some earlier steps ran in a fake
2153root environment does not cause problems. 2203root environment does not cause problems.
2154 2204
2155The capability to run tasks in a fake root environment is known as 2205The capability to run tasks in a fake root environment is known as
2156"`fakeroot <http://man.he.net/man1/fakeroot>`__", which is derived from 2206":manpage:`fakeroot <fakeroot(1)>`", which is derived from
2157the BitBake keyword/variable flag that requests a fake root environment 2207the BitBake keyword/variable flag that requests a fake root environment
2158for a task. 2208for a task.
2159 2209
@@ -2318,8 +2368,6 @@ The contents of ``libhello_0.1.bb`` are::
2318 # Change <username> accordingly 2368 # Change <username> accordingly
2319 SRC_URI = "git://github.com/<username>/libhello;branch=main;protocol=https" 2369 SRC_URI = "git://github.com/<username>/libhello;branch=main;protocol=https"
2320 2370
2321 S = "${WORKDIR}/git"
2322
2323 do_install(){ 2371 do_install(){
2324 install -d ${D}${includedir} 2372 install -d ${D}${includedir}
2325 install -d ${D}${libdir} 2373 install -d ${D}${libdir}
@@ -2344,8 +2392,6 @@ The contents of ``sayhello_0.1.bb`` are::
2344 DEPENDS += "libhello" 2392 DEPENDS += "libhello"
2345 RDEPENDS:${PN} += "libhello" 2393 RDEPENDS:${PN} += "libhello"
2346 2394
2347 S = "${WORKDIR}/git"
2348
2349 do_install(){ 2395 do_install(){
2350 install -d ${D}/usr/bin 2396 install -d ${D}/usr/bin
2351 install -m 0700 sayhello ${D}/usr/bin 2397 install -m 0700 sayhello ${D}/usr/bin