diff options
3 files changed, 131 insertions, 29 deletions
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-execution.rst b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-execution.rst index d58fbb32ea..d407f59c0d 100644 --- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-execution.rst +++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-execution.rst | |||
| @@ -64,11 +64,11 @@ data itself is of various types: | |||
| 64 | together. | 64 | together. |
| 65 | 65 | ||
| 66 | The ``layer.conf`` files are used to construct key variables such as | 66 | The ``layer.conf`` files are used to construct key variables such as |
| 67 | :term:`BBPATH` and :term:`BBFILES`. | 67 | :term:`BBPATH` and :term:`BBFILES`. :term:`BBPATH` is used to search for |
| 68 | :term:`BBPATH` is used to search for configuration and class files under the | 68 | configuration files under the ``conf`` directory and class files under the |
| 69 | ``conf`` and ``classes`` directories, respectively. :term:`BBFILES` is used | 69 | ``classes-global``, ``classes-recipe`` and ``classes`` directories. |
| 70 | to locate both recipe and recipe append files (``.bb`` and | 70 | :term:`BBFILES` is used to locate both recipe and recipe append files (``.bb`` |
| 71 | ``.bbappend``). If there is no ``bblayers.conf`` file, it is assumed the | 71 | and ``.bbappend``). If there is no ``bblayers.conf`` file, it is assumed the |
| 72 | user has set the :term:`BBPATH` and :term:`BBFILES` directly in the environment. | 72 | user has set the :term:`BBPATH` and :term:`BBFILES` directly in the environment. |
| 73 | 73 | ||
| 74 | Next, the ``bitbake.conf`` file is located using the :term:`BBPATH` variable | 74 | Next, the ``bitbake.conf`` file is located using the :term:`BBPATH` variable |
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-intro.rst b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-intro.rst index d941e212bf..9837b009ea 100644 --- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-intro.rst +++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-intro.rst | |||
| @@ -206,17 +206,33 @@ installing (empty by default) and packaging (empty by default). These | |||
| 206 | tasks are often overridden or extended by other classes added during the | 206 | tasks are often overridden or extended by other classes added during the |
| 207 | project development process. | 207 | project development process. |
| 208 | 208 | ||
| 209 | .. note:: | 209 | Class Types |
| 210 | ~~~~~~~~~~~ | ||
| 211 | |||
| 212 | BitBake supports class files installed in three different directories: | ||
| 213 | |||
| 214 | - ``classes-global/``: these classes must be inherited globally through the | ||
| 215 | :term:`INHERIT` variable in a :ref:`configuration file | ||
| 216 | <bitbake-user-manual/bitbake-user-manual-intro:Configuration Files>`. These | ||
| 217 | classes are included for every recipe being built. For example, you would use | ||
| 218 | the global class named ``myclass`` like so:: | ||
| 219 | |||
| 220 | INHERIT += "myclass" | ||
| 221 | |||
| 222 | - ``classes-recipe/``: these classes must be inherited from a recipe using the | ||
| 223 | :ref:`inherit <ref-bitbake-user-manual-metadata-inherit>` directive. They do | ||
| 224 | not support being inherited globally. For example, you would use the recipe | ||
| 225 | class named ``myclass`` like so:: | ||
| 226 | |||
| 227 | inherit myclass | ||
| 210 | 228 | ||
| 211 | While BitBake comes with just the one ``base.bbclass`` file in the | 229 | - ``classes/``: this final directory is meant for classes that can be used in |
| 212 | ``classes`` directory, it supports class files also being installed | 230 | the two contexts explain above. In other words, they can be inherit either |
| 213 | in related directories ``classes-global`` and ``classes-recipe`` and | 231 | globally or in a recipe. |
| 214 | will automatically search all three directories for a selected class | ||
| 215 | file. | ||
| 216 | 232 | ||
| 217 | This means that, in this documentation, when you see a reference to | 233 | For details on how BitBake locates class files, see the |
| 218 | class files being in the ``classes`` directory, you can interpret that | 234 | :ref:`bitbake-user-manual/bitbake-user-manual-metadata:Locating Class Files` |
| 219 | as meaning in any one of the above three directories. | 235 | section of the Bitbake User Manual. |
| 220 | 236 | ||
| 221 | Layers | 237 | Layers |
| 222 | ------ | 238 | ------ |
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst index 9d4f426bf7..4dadf0bc7b 100644 --- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst +++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst | |||
| @@ -758,21 +758,6 @@ directives. There is also a higher-level abstraction called | |||
| 758 | ``configuration fragments`` that is enabled with ``addfragments`` | 758 | ``configuration fragments`` that is enabled with ``addfragments`` |
| 759 | directive. | 759 | directive. |
| 760 | 760 | ||
| 761 | Locating Include and Class Files | ||
| 762 | -------------------------------- | ||
| 763 | |||
| 764 | BitBake uses the :term:`BBPATH` variable to locate | ||
| 765 | needed include and class files. Additionally, BitBake searches the | ||
| 766 | current directory for ``include`` and ``require`` directives. | ||
| 767 | |||
| 768 | .. note:: | ||
| 769 | |||
| 770 | The BBPATH variable is analogous to the environment variable PATH . | ||
| 771 | |||
| 772 | In order for include and class files to be found by BitBake, they need | ||
| 773 | to be located in a "classes" subdirectory that can be found in | ||
| 774 | :term:`BBPATH`. | ||
| 775 | |||
| 776 | .. _ref-bitbake-user-manual-metadata-inherit: | 761 | .. _ref-bitbake-user-manual-metadata-inherit: |
| 777 | 762 | ||
| 778 | ``inherit`` Directive | 763 | ``inherit`` Directive |
| @@ -874,6 +859,8 @@ becomes a no-op. | |||
| 874 | See also :term:`BB_DEFER_BBCLASSES` for automatically promoting classes | 859 | See also :term:`BB_DEFER_BBCLASSES` for automatically promoting classes |
| 875 | ``inherit`` calls to ``inherit_defer``. | 860 | ``inherit`` calls to ``inherit_defer``. |
| 876 | 861 | ||
| 862 | .. _ref-include-directive: | ||
| 863 | |||
| 877 | ``include`` Directive | 864 | ``include`` Directive |
| 878 | --------------------- | 865 | --------------------- |
| 879 | 866 | ||
| @@ -908,6 +895,8 @@ if the file cannot be found. | |||
| 908 | If you need to include all matching files, you need to use the | 895 | If you need to include all matching files, you need to use the |
| 909 | ``include_all`` directive, explained below. | 896 | ``include_all`` directive, explained below. |
| 910 | 897 | ||
| 898 | .. _ref-include-all-directive: | ||
| 899 | |||
| 911 | ``include_all`` Directive | 900 | ``include_all`` Directive |
| 912 | ------------------------- | 901 | ------------------------- |
| 913 | 902 | ||
| @@ -1062,6 +1051,103 @@ bitbake will treat that as direct value assignment in its configuration:: | |||
| 1062 | 1051 | ||
| 1063 | SOMEVARIABLE = "somevalue" | 1052 | SOMEVARIABLE = "somevalue" |
| 1064 | 1053 | ||
| 1054 | Locating Include Files | ||
| 1055 | ---------------------- | ||
| 1056 | |||
| 1057 | BitBake uses the :term:`BBPATH` variable to locate needed include files. | ||
| 1058 | Additionally, BitBake searches the current directory for :ref:`include | ||
| 1059 | <ref-include-directive>` and :ref:`require <require-inclusion>` directives. | ||
| 1060 | |||
| 1061 | .. note:: | ||
| 1062 | |||
| 1063 | The BBPATH variable is analogous to the environment variable PATH . | ||
| 1064 | |||
| 1065 | For these two directives, BitBake includes the first file it finds. | ||
| 1066 | |||
| 1067 | .. note:: | ||
| 1068 | |||
| 1069 | It is also possible to include *all* occurences of a file with the same name | ||
| 1070 | with the :ref:`include_all <ref-include-all-directive>` directive. | ||
| 1071 | |||
| 1072 | Let's consider the following statement called from a recipe file located in | ||
| 1073 | ``/layers/meta-custom2/recipes-example/example_0.1.bb``:: | ||
| 1074 | |||
| 1075 | require myfile.inc | ||
| 1076 | |||
| 1077 | Where ``myfile.inc`` is located in ``/layers/meta-custom2/recipes-example/``. | ||
| 1078 | |||
| 1079 | And let's assume that the value of :term:`BBPATH` is | ||
| 1080 | ``/layers/meta-custom1:/layers/meta-custom2``. Then BitBake will try to find | ||
| 1081 | ``myfile.inc`` in this order:: | ||
| 1082 | |||
| 1083 | /layers/meta-custom2/recipes-example/example/myfile.inc | ||
| 1084 | /layers/meta-custom1/myfile.inc | ||
| 1085 | /layers/meta-custom2/myfile.inc | ||
| 1086 | |||
| 1087 | In this case the first path of the list matches and BitBake includes this file | ||
| 1088 | in ``example_0.1.bb``. | ||
| 1089 | |||
| 1090 | Another common example would be:: | ||
| 1091 | |||
| 1092 | require recipes-other/other/otherfile.inc | ||
| 1093 | |||
| 1094 | Where ``otherfile.inc`` is located in | ||
| 1095 | ``/layers/meta-custom1/recipes-other/other/``. | ||
| 1096 | |||
| 1097 | In this case, the following paths would be searched:: | ||
| 1098 | |||
| 1099 | /layers/meta-custom2/recipes-example/example/recipes-other/other/otherfile.inc | ||
| 1100 | /layers/meta-custom1/recipes-other/other/otherfile.inc | ||
| 1101 | /layers/meta-custom2/recipes-other/other/otherfile.inc | ||
| 1102 | |||
| 1103 | This time, the second item of this list would be matched. | ||
| 1104 | |||
| 1105 | .. note:: | ||
| 1106 | |||
| 1107 | In the above examples, the exact same search order applies for the | ||
| 1108 | :ref:`include <ref-include-directive>` directive. | ||
| 1109 | |||
| 1110 | Locating Class Files | ||
| 1111 | -------------------- | ||
| 1112 | |||
| 1113 | Like include files, class files are located using the :term:`BBPATH` variable. | ||
| 1114 | The classes can be included in the ``classes-recipe``, ``classes-global`` and | ||
| 1115 | ``classes`` directories, as explained in the | ||
| 1116 | :ref:`bitbake-user-manual/bitbake-user-manual-intro:Class types` section of the | ||
| 1117 | Bitbake User Manual. Like for the :ref:`include <ref-include-directive>` and | ||
| 1118 | :ref:`require <require-inclusion>` directives, BitBake stops and inherits the | ||
| 1119 | first class that it finds. | ||
| 1120 | |||
| 1121 | For classes inherited with the :ref:`inherit | ||
| 1122 | <ref-bitbake-user-manual-metadata-inherit>` directive, BitBake will try to | ||
| 1123 | locate the class under each ``classes-recipe`` directory for each path in | ||
| 1124 | :term:`BBPATH`, and then do the same for each ``classes`` directory for each | ||
| 1125 | path in :term:`BBPATH`. | ||
| 1126 | |||
| 1127 | For example, if the value :term:`BBPATH` is | ||
| 1128 | ``/layers/meta-custom1:/layers/meta-custom2`` then the ``hello`` class | ||
| 1129 | would be searched in this order:: | ||
| 1130 | |||
| 1131 | /layers/meta-custom1/classes-recipe/hello.bbclass | ||
| 1132 | /layers/meta-custom2/classes-recipe/hello.bbclass | ||
| 1133 | /layers/meta-custom1/classes/hello.bbclass | ||
| 1134 | /layers/meta-custom2/classes/hello.bbclass | ||
| 1135 | |||
| 1136 | .. note:: | ||
| 1137 | |||
| 1138 | Note that the order of the list above does not depend on where the class in | ||
| 1139 | inherited from. | ||
| 1140 | |||
| 1141 | Likewise, for classes inherited with the :term:`INHERIT` variable, the | ||
| 1142 | ``classes-global`` directory is searched first, and the ``classes`` directory is | ||
| 1143 | searched second. Taking the above example, this would result in the following | ||
| 1144 | list:: | ||
| 1145 | |||
| 1146 | /layers/meta-custom1/classes-global/hello.bbclass | ||
| 1147 | /layers/meta-custom2/classes-global/hello.bbclass | ||
| 1148 | /layers/meta-custom1/classes/hello.bbclass | ||
| 1149 | /layers/meta-custom2/classes/hello.bbclass | ||
| 1150 | |||
| 1065 | Functions | 1151 | Functions |
| 1066 | ========= | 1152 | ========= |
| 1067 | 1153 | ||
