diff options
Diffstat (limited to 'documentation/overview-manual/concepts.rst')
-rw-r--r-- | documentation/overview-manual/concepts.rst | 118 |
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 | ||
99 | The term "package" is sometimes used to refer to recipes. However, since | 99 | The term "package" is sometimes used to refer to recipes. However, since |
100 | the word "package" is used for the packaged output from the OpenEmbedded | 100 | the word "package" is used for the packaged output from the OpenEmbedded |
101 | build system (i.e. ``.ipk`` or ``.deb`` files), this document avoids | 101 | build system (i.e. ``.ipk``, ``.deb`` or ``.rpm`` files), this document avoids |
102 | using the term "package" when referring to recipes. | 102 | using the term "package" when referring to recipes. |
103 | 103 | ||
104 | Classes | 104 | Classes |
@@ -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 | |||
352 | provide Metadata for the software, machine, and policies. | 352 | provide Metadata for the software, machine, and policies. |
353 | 353 | ||
354 | In general, there are three types of layer input. You can see them below | 354 | In general, there are three types of layer input. You can see them below |
355 | the "User Configuration" box in the `general workflow | 355 | the "User Configuration" box in the :ref:`general workflow |
356 | figure <overview-manual/concepts:openembedded build system concepts>`: | 356 | figure <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. | |||
420 | Distro Layer | 420 | Distro Layer |
421 | ~~~~~~~~~~~~ | 421 | ~~~~~~~~~~~~ |
422 | 422 | ||
423 | The distribution layer provides policy configurations for your | 423 | A distribution layer provides policy configurations for your |
424 | distribution. Best practices dictate that you isolate these types of | 424 | distribution. Best practices dictate that you isolate these types of |
425 | configurations into their own layer. Settings you provide in | 425 | configurations 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 |
427 | in your ``conf/local.conf`` file in the :term:`Build Directory`. | 427 | in your ``conf/local.conf`` file in the :term:`Build Directory`. |
428 | 428 | ||
429 | The following list provides some explanation and references for what you | 429 | The following list provides some explanation and references for what you |
430 | typically find in the distribution layer: | 430 | typically 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: | |||
454 | BSP Layer | 454 | BSP Layer |
455 | ~~~~~~~~~ | 455 | ~~~~~~~~~ |
456 | 456 | ||
457 | The BSP Layer provides machine configurations that target specific | 457 | A BSP layer provides machine configurations that target specific |
458 | hardware. Everything in this layer is specific to the machine for which | 458 | hardware. Everything in this layer is specific to the machine for which |
459 | you are building the image or the SDK. A common structure or form is | 459 | you are building the image or the SDK. A common structure or form is |
460 | defined for BSP layers. You can learn more about this structure in the | 460 | defined 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 | ||
468 | The BSP Layer's configuration directory contains configuration files for | 468 | A BSP layer's configuration directory contains configuration files for |
469 | the machine (``conf/machine/machine.conf``) and, of course, the layer | 469 | the 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 | ||
483 | Software Layer | 483 | Software Layer |
484 | ~~~~~~~~~~~~~~ | 484 | ~~~~~~~~~~~~~~ |
485 | 485 | ||
486 | The software layer provides the Metadata for additional software | 486 | A software layer provides the Metadata for additional software |
487 | packages used during the build. This layer does not include Metadata | 487 | packages used during the build. This layer does not include Metadata |
488 | that is specific to the distribution or the machine, which are found in | 488 | that is specific to the distribution or the machine, which are found in |
489 | their respective layers. | 489 | their respective layers. |
490 | 490 | ||
491 | This layer contains any recipes, append files, and patches, that your | 491 | This layer contains any recipes, append files, and patches that your |
492 | project needs. | 492 | project needs. |
493 | 493 | ||
494 | Sources | 494 | Sources |
@@ -560,9 +560,8 @@ source tree used by the group). | |||
560 | 560 | ||
561 | The canonical method through which to include a local project is to use the | 561 | The 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 |
563 | either the ``local.conf`` or a recipe's append file to override or set the | 563 | either ``local.conf`` or a recipe's append file to override or set the |
564 | recipe to point to the local directory on your disk to pull in the whole | 564 | recipe to point to the local directory from which to fetch the source. |
565 | source tree. | ||
566 | 565 | ||
567 | Source Control Managers (Optional) | 566 | Source Control Managers (Optional) |
568 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 567 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
@@ -683,7 +682,7 @@ Source Fetching | |||
683 | The first stages of building a recipe are to fetch and unpack the source | 682 | The first stages of building a recipe are to fetch and unpack the source |
684 | code: | 683 | code: |
685 | 684 | ||
686 | .. image:: figures/source-fetching.png | 685 | .. image:: svg/source-fetching.* |
687 | :width: 100% | 686 | :width: 100% |
688 | 687 | ||
689 | The :ref:`ref-tasks-fetch` and :ref:`ref-tasks-unpack` tasks fetch | 688 | The :ref:`ref-tasks-fetch` and :ref:`ref-tasks-unpack` tasks fetch |
@@ -704,10 +703,10 @@ a defined structure. For additional general information on the | |||
704 | the Yocto Project Reference Manual. | 703 | the Yocto Project Reference Manual. |
705 | 704 | ||
706 | Each recipe has an area in the :term:`Build Directory` where the unpacked | 705 | Each recipe has an area in the :term:`Build Directory` where the unpacked |
707 | source code resides. The :term:`S` variable points to this area for a recipe's | 706 | source code resides. The :term:`UNPACKDIR` variable points to this area for a |
708 | unpacked source code. The name of that directory for any given recipe is | 707 | recipe's unpacked source code, and has the default ``sources`` name. The |
709 | defined from several different variables. The preceding figure and the | 708 | preceding figure and the following list describe the :term:`Build Directory`'s |
710 | following list describe the :term:`Build Directory`'s hierarchy: | 709 | hierarchy: |
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 | |||
764 | Once source code is fetched and unpacked, BitBake locates patch files | 763 | Once source code is fetched and unpacked, BitBake locates patch files |
765 | and applies them to the source files: | 764 | and 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 | ||
770 | The :ref:`ref-tasks-patch` task uses a | 769 | The :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`" |
793 | section in the | 792 | section in the |
794 | Yocto Project Development Tasks Manual. You can also see the | 793 | Yocto 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`" |
796 | section in the Yocto Project Application Development and the Extensible | 795 | section in the Yocto Project Application Development and the Extensible |
797 | Software Development Kit (SDK) manual and the | 796 | Software 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 | |||
805 | compile the source code. Once compilation occurs, the files are copied | 804 | compile the source code. Once compilation occurs, the files are copied |
806 | to a holding area (staged) in preparation for packaging: | 805 | to 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 | ||
811 | This step in the build process consists of the following tasks: | 810 | This step in the build process consists of the following tasks: |
@@ -861,7 +860,7 @@ Package Splitting | |||
861 | After source code is configured, compiled, and staged, the build system | 860 | After source code is configured, compiled, and staged, the build system |
862 | analyzes the results and splits the output into packages: | 861 | analyzes 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 | ||
867 | The :ref:`ref-tasks-package` and | 866 | The :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 | ||
915 | The :term:`FILES` variable defines the | 914 | Packages for a recipe are listed in the :term:`PACKAGES` variable. The |
916 | files that go into each package in | 915 | :oe_git:`bitbake.conf </openembedded-core/tree/meta/conf/bitbake.conf>` |
917 | :term:`PACKAGES`. If you want | 916 | configuration file defines the following default list of packages:: |
918 | details 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 | |||
920 | Each of these packages contains a default list of files defined with the | ||
921 | :term:`FILES` variable. For example, the package ``${PN}-dev`` represents files | ||
922 | useful to the development of applications depending on ``${PN}``. The default | ||
923 | list 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 | |||
932 | The paths in this list must be *absolute* paths from the point of view of the | ||
933 | root 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 | |||
943 | A given file can only ever be in one package. By iterating from the leftmost to | ||
944 | rightmost package in :term:`PACKAGES`, each file matching one of the patterns | ||
945 | defined in the corresponding :term:`FILES` definition is included in the | ||
946 | package. | ||
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 | |||
960 | To 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 | |||
966 | Alternatively, 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 | ||
921 | Depending on the type of packages being created (RPM, DEB, or IPK), the | 971 | Depending 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 | |||
2153 | root environment does not cause problems. | 2203 | root environment does not cause problems. |
2154 | 2204 | ||
2155 | The capability to run tasks in a fake root environment is known as | 2205 | The 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 |
2157 | the BitBake keyword/variable flag that requests a fake root environment | 2207 | the BitBake keyword/variable flag that requests a fake root environment |
2158 | for a task. | 2208 | for 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 |