diff options
Diffstat (limited to 'bitbake/doc')
29 files changed, 0 insertions, 8207 deletions
diff --git a/bitbake/doc/.gitignore b/bitbake/doc/.gitignore deleted file mode 100644 index 69fa449dd9..0000000000 --- a/bitbake/doc/.gitignore +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | _build/ | ||
diff --git a/bitbake/doc/COPYING.GPL b/bitbake/doc/COPYING.GPL deleted file mode 100644 index d511905c16..0000000000 --- a/bitbake/doc/COPYING.GPL +++ /dev/null | |||
| @@ -1,339 +0,0 @@ | |||
| 1 | GNU GENERAL PUBLIC LICENSE | ||
| 2 | Version 2, June 1991 | ||
| 3 | |||
| 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., | ||
| 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 6 | Everyone is permitted to copy and distribute verbatim copies | ||
| 7 | of this license document, but changing it is not allowed. | ||
| 8 | |||
| 9 | Preamble | ||
| 10 | |||
| 11 | The licenses for most software are designed to take away your | ||
| 12 | freedom to share and change it. By contrast, the GNU General Public | ||
| 13 | License is intended to guarantee your freedom to share and change free | ||
| 14 | software--to make sure the software is free for all its users. This | ||
| 15 | General Public License applies to most of the Free Software | ||
| 16 | Foundation's software and to any other program whose authors commit to | ||
| 17 | using it. (Some other Free Software Foundation software is covered by | ||
| 18 | the GNU Lesser General Public License instead.) You can apply it to | ||
| 19 | your programs, too. | ||
| 20 | |||
| 21 | When we speak of free software, we are referring to freedom, not | ||
| 22 | price. Our General Public Licenses are designed to make sure that you | ||
| 23 | have the freedom to distribute copies of free software (and charge for | ||
| 24 | this service if you wish), that you receive source code or can get it | ||
| 25 | if you want it, that you can change the software or use pieces of it | ||
| 26 | in new free programs; and that you know you can do these things. | ||
| 27 | |||
| 28 | To protect your rights, we need to make restrictions that forbid | ||
| 29 | anyone to deny you these rights or to ask you to surrender the rights. | ||
| 30 | These restrictions translate to certain responsibilities for you if you | ||
| 31 | distribute copies of the software, or if you modify it. | ||
| 32 | |||
| 33 | For example, if you distribute copies of such a program, whether | ||
| 34 | gratis or for a fee, you must give the recipients all the rights that | ||
| 35 | you have. You must make sure that they, too, receive or can get the | ||
| 36 | source code. And you must show them these terms so they know their | ||
| 37 | rights. | ||
| 38 | |||
| 39 | We protect your rights with two steps: (1) copyright the software, and | ||
| 40 | (2) offer you this license which gives you legal permission to copy, | ||
| 41 | distribute and/or modify the software. | ||
| 42 | |||
| 43 | Also, for each author's protection and ours, we want to make certain | ||
| 44 | that everyone understands that there is no warranty for this free | ||
| 45 | software. If the software is modified by someone else and passed on, we | ||
| 46 | want its recipients to know that what they have is not the original, so | ||
| 47 | that any problems introduced by others will not reflect on the original | ||
| 48 | authors' reputations. | ||
| 49 | |||
| 50 | Finally, any free program is threatened constantly by software | ||
| 51 | patents. We wish to avoid the danger that redistributors of a free | ||
| 52 | program will individually obtain patent licenses, in effect making the | ||
| 53 | program proprietary. To prevent this, we have made it clear that any | ||
| 54 | patent must be licensed for everyone's free use or not licensed at all. | ||
| 55 | |||
| 56 | The precise terms and conditions for copying, distribution and | ||
| 57 | modification follow. | ||
| 58 | |||
| 59 | GNU GENERAL PUBLIC LICENSE | ||
| 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION | ||
| 61 | |||
| 62 | 0. This License applies to any program or other work which contains | ||
| 63 | a notice placed by the copyright holder saying it may be distributed | ||
| 64 | under the terms of this General Public License. The "Program", below, | ||
| 65 | refers to any such program or work, and a "work based on the Program" | ||
| 66 | means either the Program or any derivative work under copyright law: | ||
| 67 | that is to say, a work containing the Program or a portion of it, | ||
| 68 | either verbatim or with modifications and/or translated into another | ||
| 69 | language. (Hereinafter, translation is included without limitation in | ||
| 70 | the term "modification".) Each licensee is addressed as "you". | ||
| 71 | |||
| 72 | Activities other than copying, distribution and modification are not | ||
| 73 | covered by this License; they are outside its scope. The act of | ||
| 74 | running the Program is not restricted, and the output from the Program | ||
| 75 | is covered only if its contents constitute a work based on the | ||
| 76 | Program (independent of having been made by running the Program). | ||
| 77 | Whether that is true depends on what the Program does. | ||
| 78 | |||
| 79 | 1. You may copy and distribute verbatim copies of the Program's | ||
| 80 | source code as you receive it, in any medium, provided that you | ||
| 81 | conspicuously and appropriately publish on each copy an appropriate | ||
| 82 | copyright notice and disclaimer of warranty; keep intact all the | ||
| 83 | notices that refer to this License and to the absence of any warranty; | ||
| 84 | and give any other recipients of the Program a copy of this License | ||
| 85 | along with the Program. | ||
| 86 | |||
| 87 | You may charge a fee for the physical act of transferring a copy, and | ||
| 88 | you may at your option offer warranty protection in exchange for a fee. | ||
| 89 | |||
| 90 | 2. You may modify your copy or copies of the Program or any portion | ||
| 91 | of it, thus forming a work based on the Program, and copy and | ||
| 92 | distribute such modifications or work under the terms of Section 1 | ||
| 93 | above, provided that you also meet all of these conditions: | ||
| 94 | |||
| 95 | a) You must cause the modified files to carry prominent notices | ||
| 96 | stating that you changed the files and the date of any change. | ||
| 97 | |||
| 98 | b) You must cause any work that you distribute or publish, that in | ||
| 99 | whole or in part contains or is derived from the Program or any | ||
| 100 | part thereof, to be licensed as a whole at no charge to all third | ||
| 101 | parties under the terms of this License. | ||
| 102 | |||
| 103 | c) If the modified program normally reads commands interactively | ||
| 104 | when run, you must cause it, when started running for such | ||
| 105 | interactive use in the most ordinary way, to print or display an | ||
| 106 | announcement including an appropriate copyright notice and a | ||
| 107 | notice that there is no warranty (or else, saying that you provide | ||
| 108 | a warranty) and that users may redistribute the program under | ||
| 109 | these conditions, and telling the user how to view a copy of this | ||
| 110 | License. (Exception: if the Program itself is interactive but | ||
| 111 | does not normally print such an announcement, your work based on | ||
| 112 | the Program is not required to print an announcement.) | ||
| 113 | |||
| 114 | These requirements apply to the modified work as a whole. If | ||
| 115 | identifiable sections of that work are not derived from the Program, | ||
| 116 | and can be reasonably considered independent and separate works in | ||
| 117 | themselves, then this License, and its terms, do not apply to those | ||
| 118 | sections when you distribute them as separate works. But when you | ||
| 119 | distribute the same sections as part of a whole which is a work based | ||
| 120 | on the Program, the distribution of the whole must be on the terms of | ||
| 121 | this License, whose permissions for other licensees extend to the | ||
| 122 | entire whole, and thus to each and every part regardless of who wrote it. | ||
| 123 | |||
| 124 | Thus, it is not the intent of this section to claim rights or contest | ||
| 125 | your rights to work written entirely by you; rather, the intent is to | ||
| 126 | exercise the right to control the distribution of derivative or | ||
| 127 | collective works based on the Program. | ||
| 128 | |||
| 129 | In addition, mere aggregation of another work not based on the Program | ||
| 130 | with the Program (or with a work based on the Program) on a volume of | ||
| 131 | a storage or distribution medium does not bring the other work under | ||
| 132 | the scope of this License. | ||
| 133 | |||
| 134 | 3. You may copy and distribute the Program (or a work based on it, | ||
| 135 | under Section 2) in object code or executable form under the terms of | ||
| 136 | Sections 1 and 2 above provided that you also do one of the following: | ||
| 137 | |||
| 138 | a) Accompany it with the complete corresponding machine-readable | ||
| 139 | source code, which must be distributed under the terms of Sections | ||
| 140 | 1 and 2 above on a medium customarily used for software interchange; or, | ||
| 141 | |||
| 142 | b) Accompany it with a written offer, valid for at least three | ||
| 143 | years, to give any third party, for a charge no more than your | ||
| 144 | cost of physically performing source distribution, a complete | ||
| 145 | machine-readable copy of the corresponding source code, to be | ||
| 146 | distributed under the terms of Sections 1 and 2 above on a medium | ||
| 147 | customarily used for software interchange; or, | ||
| 148 | |||
| 149 | c) Accompany it with the information you received as to the offer | ||
| 150 | to distribute corresponding source code. (This alternative is | ||
| 151 | allowed only for noncommercial distribution and only if you | ||
| 152 | received the program in object code or executable form with such | ||
| 153 | an offer, in accord with Subsection b above.) | ||
| 154 | |||
| 155 | The source code for a work means the preferred form of the work for | ||
| 156 | making modifications to it. For an executable work, complete source | ||
| 157 | code means all the source code for all modules it contains, plus any | ||
| 158 | associated interface definition files, plus the scripts used to | ||
| 159 | control compilation and installation of the executable. However, as a | ||
| 160 | special exception, the source code distributed need not include | ||
| 161 | anything that is normally distributed (in either source or binary | ||
| 162 | form) with the major components (compiler, kernel, and so on) of the | ||
| 163 | operating system on which the executable runs, unless that component | ||
| 164 | itself accompanies the executable. | ||
| 165 | |||
| 166 | If distribution of executable or object code is made by offering | ||
| 167 | access to copy from a designated place, then offering equivalent | ||
| 168 | access to copy the source code from the same place counts as | ||
| 169 | distribution of the source code, even though third parties are not | ||
| 170 | compelled to copy the source along with the object code. | ||
| 171 | |||
| 172 | 4. You may not copy, modify, sublicense, or distribute the Program | ||
| 173 | except as expressly provided under this License. Any attempt | ||
| 174 | otherwise to copy, modify, sublicense or distribute the Program is | ||
| 175 | void, and will automatically terminate your rights under this License. | ||
| 176 | However, parties who have received copies, or rights, from you under | ||
| 177 | this License will not have their licenses terminated so long as such | ||
| 178 | parties remain in full compliance. | ||
| 179 | |||
| 180 | 5. You are not required to accept this License, since you have not | ||
| 181 | signed it. However, nothing else grants you permission to modify or | ||
| 182 | distribute the Program or its derivative works. These actions are | ||
| 183 | prohibited by law if you do not accept this License. Therefore, by | ||
| 184 | modifying or distributing the Program (or any work based on the | ||
| 185 | Program), you indicate your acceptance of this License to do so, and | ||
| 186 | all its terms and conditions for copying, distributing or modifying | ||
| 187 | the Program or works based on it. | ||
| 188 | |||
| 189 | 6. Each time you redistribute the Program (or any work based on the | ||
| 190 | Program), the recipient automatically receives a license from the | ||
| 191 | original licensor to copy, distribute or modify the Program subject to | ||
| 192 | these terms and conditions. You may not impose any further | ||
| 193 | restrictions on the recipients' exercise of the rights granted herein. | ||
| 194 | You are not responsible for enforcing compliance by third parties to | ||
| 195 | this License. | ||
| 196 | |||
| 197 | 7. If, as a consequence of a court judgment or allegation of patent | ||
| 198 | infringement or for any other reason (not limited to patent issues), | ||
| 199 | conditions are imposed on you (whether by court order, agreement or | ||
| 200 | otherwise) that contradict the conditions of this License, they do not | ||
| 201 | excuse you from the conditions of this License. If you cannot | ||
| 202 | distribute so as to satisfy simultaneously your obligations under this | ||
| 203 | License and any other pertinent obligations, then as a consequence you | ||
| 204 | may not distribute the Program at all. For example, if a patent | ||
| 205 | license would not permit royalty-free redistribution of the Program by | ||
| 206 | all those who receive copies directly or indirectly through you, then | ||
| 207 | the only way you could satisfy both it and this License would be to | ||
| 208 | refrain entirely from distribution of the Program. | ||
| 209 | |||
| 210 | If any portion of this section is held invalid or unenforceable under | ||
| 211 | any particular circumstance, the balance of the section is intended to | ||
| 212 | apply and the section as a whole is intended to apply in other | ||
| 213 | circumstances. | ||
| 214 | |||
| 215 | It is not the purpose of this section to induce you to infringe any | ||
| 216 | patents or other property right claims or to contest validity of any | ||
| 217 | such claims; this section has the sole purpose of protecting the | ||
| 218 | integrity of the free software distribution system, which is | ||
| 219 | implemented by public license practices. Many people have made | ||
| 220 | generous contributions to the wide range of software distributed | ||
| 221 | through that system in reliance on consistent application of that | ||
| 222 | system; it is up to the author/donor to decide if he or she is willing | ||
| 223 | to distribute software through any other system and a licensee cannot | ||
| 224 | impose that choice. | ||
| 225 | |||
| 226 | This section is intended to make thoroughly clear what is believed to | ||
| 227 | be a consequence of the rest of this License. | ||
| 228 | |||
| 229 | 8. If the distribution and/or use of the Program is restricted in | ||
| 230 | certain countries either by patents or by copyrighted interfaces, the | ||
| 231 | original copyright holder who places the Program under this License | ||
| 232 | may add an explicit geographical distribution limitation excluding | ||
| 233 | those countries, so that distribution is permitted only in or among | ||
| 234 | countries not thus excluded. In such case, this License incorporates | ||
| 235 | the limitation as if written in the body of this License. | ||
| 236 | |||
| 237 | 9. The Free Software Foundation may publish revised and/or new versions | ||
| 238 | of the General Public License from time to time. Such new versions will | ||
| 239 | be similar in spirit to the present version, but may differ in detail to | ||
| 240 | address new problems or concerns. | ||
| 241 | |||
| 242 | Each version is given a distinguishing version number. If the Program | ||
| 243 | specifies a version number of this License which applies to it and "any | ||
| 244 | later version", you have the option of following the terms and conditions | ||
| 245 | either of that version or of any later version published by the Free | ||
| 246 | Software Foundation. If the Program does not specify a version number of | ||
| 247 | this License, you may choose any version ever published by the Free Software | ||
| 248 | Foundation. | ||
| 249 | |||
| 250 | 10. If you wish to incorporate parts of the Program into other free | ||
| 251 | programs whose distribution conditions are different, write to the author | ||
| 252 | to ask for permission. For software which is copyrighted by the Free | ||
| 253 | Software Foundation, write to the Free Software Foundation; we sometimes | ||
| 254 | make exceptions for this. Our decision will be guided by the two goals | ||
| 255 | of preserving the free status of all derivatives of our free software and | ||
| 256 | of promoting the sharing and reuse of software generally. | ||
| 257 | |||
| 258 | NO WARRANTY | ||
| 259 | |||
| 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY | ||
| 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN | ||
| 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES | ||
| 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED | ||
| 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
| 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS | ||
| 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE | ||
| 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, | ||
| 268 | REPAIR OR CORRECTION. | ||
| 269 | |||
| 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING | ||
| 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR | ||
| 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, | ||
| 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING | ||
| 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED | ||
| 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY | ||
| 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER | ||
| 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE | ||
| 278 | POSSIBILITY OF SUCH DAMAGES. | ||
| 279 | |||
| 280 | END OF TERMS AND CONDITIONS | ||
| 281 | |||
| 282 | How to Apply These Terms to Your New Programs | ||
| 283 | |||
| 284 | If you develop a new program, and you want it to be of the greatest | ||
| 285 | possible use to the public, the best way to achieve this is to make it | ||
| 286 | free software which everyone can redistribute and change under these terms. | ||
| 287 | |||
| 288 | To do so, attach the following notices to the program. It is safest | ||
| 289 | to attach them to the start of each source file to most effectively | ||
| 290 | convey the exclusion of warranty; and each file should have at least | ||
| 291 | the "copyright" line and a pointer to where the full notice is found. | ||
| 292 | |||
| 293 | <one line to give the program's name and a brief idea of what it does.> | ||
| 294 | Copyright (C) <year> <name of author> | ||
| 295 | |||
| 296 | This program is free software; you can redistribute it and/or modify | ||
| 297 | it under the terms of the GNU General Public License as published by | ||
| 298 | the Free Software Foundation; either version 2 of the License, or | ||
| 299 | (at your option) any later version. | ||
| 300 | |||
| 301 | This program is distributed in the hope that it will be useful, | ||
| 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 304 | GNU General Public License for more details. | ||
| 305 | |||
| 306 | You should have received a copy of the GNU General Public License along | ||
| 307 | with this program; if not, write to the Free Software Foundation, Inc., | ||
| 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 309 | |||
| 310 | Also add information on how to contact you by electronic and paper mail. | ||
| 311 | |||
| 312 | If the program is interactive, make it output a short notice like this | ||
| 313 | when it starts in an interactive mode: | ||
| 314 | |||
| 315 | Gnomovision version 69, Copyright (C) year name of author | ||
| 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. | ||
| 317 | This is free software, and you are welcome to redistribute it | ||
| 318 | under certain conditions; type `show c' for details. | ||
| 319 | |||
| 320 | The hypothetical commands `show w' and `show c' should show the appropriate | ||
| 321 | parts of the General Public License. Of course, the commands you use may | ||
| 322 | be called something other than `show w' and `show c'; they could even be | ||
| 323 | mouse-clicks or menu items--whatever suits your program. | ||
| 324 | |||
| 325 | You should also get your employer (if you work as a programmer) or your | ||
| 326 | school, if any, to sign a "copyright disclaimer" for the program, if | ||
| 327 | necessary. Here is a sample; alter the names: | ||
| 328 | |||
| 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program | ||
| 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. | ||
| 331 | |||
| 332 | <signature of Ty Coon>, 1 April 1989 | ||
| 333 | Ty Coon, President of Vice | ||
| 334 | |||
| 335 | This General Public License does not permit incorporating your program into | ||
| 336 | proprietary programs. If your program is a subroutine library, you may | ||
| 337 | consider it more useful to permit linking proprietary applications with the | ||
| 338 | library. If this is what you want to do, use the GNU Lesser General | ||
| 339 | Public License instead of this License. | ||
diff --git a/bitbake/doc/COPYING.MIT b/bitbake/doc/COPYING.MIT deleted file mode 100644 index 7e7d57413d..0000000000 --- a/bitbake/doc/COPYING.MIT +++ /dev/null | |||
| @@ -1,17 +0,0 @@ | |||
| 1 | Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| 2 | of this software and associated documentation files (the "Software"), to deal | ||
| 3 | in the Software without restriction, including without limitation the rights | ||
| 4 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| 5 | copies of the Software, and to permit persons to whom the Software is | ||
| 6 | furnished to do so, subject to the following conditions: | ||
| 7 | |||
| 8 | The above copyright notice and this permission notice shall be included in all | ||
| 9 | copies or substantial portions of the Software. | ||
| 10 | |||
| 11 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 12 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 13 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT | ||
| 14 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, | ||
| 15 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
| 16 | OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR | ||
| 17 | THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
diff --git a/bitbake/doc/Makefile b/bitbake/doc/Makefile deleted file mode 100644 index 996f01b7d5..0000000000 --- a/bitbake/doc/Makefile +++ /dev/null | |||
| @@ -1,35 +0,0 @@ | |||
| 1 | # Minimal makefile for Sphinx documentation | ||
| 2 | # | ||
| 3 | |||
| 4 | # You can set these variables from the command line, and also | ||
| 5 | # from the environment for the first two. | ||
| 6 | SPHINXOPTS ?= -W --keep-going -j auto | ||
| 7 | SPHINXBUILD ?= sphinx-build | ||
| 8 | SOURCEDIR = . | ||
| 9 | BUILDDIR = _build | ||
| 10 | DESTDIR = final | ||
| 11 | |||
| 12 | ifeq ($(shell if which $(SPHINXBUILD) >/dev/null 2>&1; then echo 1; else echo 0; fi),0) | ||
| 13 | $(error "The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed") | ||
| 14 | endif | ||
| 15 | |||
| 16 | # Put it first so that "make" without argument is like "make help". | ||
| 17 | help: | ||
| 18 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
| 19 | |||
| 20 | .PHONY: help Makefile clean publish | ||
| 21 | |||
| 22 | publish: Makefile html singlehtml | ||
| 23 | rm -rf $(BUILDDIR)/$(DESTDIR)/ | ||
| 24 | mkdir -p $(BUILDDIR)/$(DESTDIR)/ | ||
| 25 | cp -r $(BUILDDIR)/html/* $(BUILDDIR)/$(DESTDIR)/ | ||
| 26 | cp $(BUILDDIR)/singlehtml/index.html $(BUILDDIR)/$(DESTDIR)/singleindex.html | ||
| 27 | sed -i -e 's@index.html#@singleindex.html#@g' $(BUILDDIR)/$(DESTDIR)/singleindex.html | ||
| 28 | |||
| 29 | clean: | ||
| 30 | @rm -rf $(BUILDDIR) | ||
| 31 | |||
| 32 | # Catch-all target: route all unknown targets to Sphinx using the new | ||
| 33 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). | ||
| 34 | %: Makefile | ||
| 35 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
diff --git a/bitbake/doc/README b/bitbake/doc/README deleted file mode 100644 index d4f56afa37..0000000000 --- a/bitbake/doc/README +++ /dev/null | |||
| @@ -1,55 +0,0 @@ | |||
| 1 | Documentation | ||
| 2 | ============= | ||
| 3 | |||
| 4 | This is the directory that contains the BitBake documentation. | ||
| 5 | |||
| 6 | Manual Organization | ||
| 7 | =================== | ||
| 8 | |||
| 9 | Folders exist for individual manuals as follows: | ||
| 10 | |||
| 11 | * bitbake-user-manual --- The BitBake User Manual | ||
| 12 | |||
| 13 | Each folder is self-contained regarding content and figures. | ||
| 14 | |||
| 15 | If you want to find HTML versions of the BitBake manuals on the web, | ||
| 16 | go to https://www.openembedded.org/wiki/Documentation. | ||
| 17 | |||
| 18 | Sphinx | ||
| 19 | ====== | ||
| 20 | |||
| 21 | The BitBake documentation was migrated from the original DocBook | ||
| 22 | format to Sphinx based documentation for the Yocto Project 3.2 | ||
| 23 | release. | ||
| 24 | |||
| 25 | Additional information related to the Sphinx migration, and guidelines | ||
| 26 | for developers willing to contribute to the BitBake documentation can | ||
| 27 | be found in the Yocto Project Documentation README file: | ||
| 28 | |||
| 29 | https://git.yoctoproject.org/cgit/cgit.cgi/yocto-docs/tree/documentation/README | ||
| 30 | |||
| 31 | How to build the Yocto Project documentation | ||
| 32 | ============================================ | ||
| 33 | |||
| 34 | Sphinx is written in Python. While it might work with Python2, for | ||
| 35 | obvious reasons, we will only support building the BitBake | ||
| 36 | documentation with Python3. | ||
| 37 | |||
| 38 | Sphinx might be available in your Linux distro packages repositories, | ||
| 39 | however it is not recommend using distro packages, as they might be | ||
| 40 | old versions, especially if you are using an LTS version of your | ||
| 41 | distro. The recommended method to install Sphinx and all required | ||
| 42 | dependencies is to use the Python Package Index (pip). | ||
| 43 | |||
| 44 | To install all required packages run: | ||
| 45 | |||
| 46 | $ pip3 install sphinx sphinx_rtd_theme pyyaml | ||
| 47 | |||
| 48 | To build the documentation locally, run: | ||
| 49 | |||
| 50 | $ cd doc | ||
| 51 | $ make html | ||
| 52 | |||
| 53 | The resulting HTML index page will be _build/html/index.html, and you | ||
| 54 | can browse your own copy of the locally generated documentation with | ||
| 55 | your browser. | ||
diff --git a/bitbake/doc/_templates/breadcrumbs.html b/bitbake/doc/_templates/breadcrumbs.html deleted file mode 100644 index eb6244b74c..0000000000 --- a/bitbake/doc/_templates/breadcrumbs.html +++ /dev/null | |||
| @@ -1,14 +0,0 @@ | |||
| 1 | {% extends "!breadcrumbs.html" %} | ||
| 2 | |||
| 3 | {% block breadcrumbs %} | ||
| 4 | <li> | ||
| 5 | <span class="doctype_switcher_placeholder">{{ doctype or 'single' }}</span> | ||
| 6 | <span class="version_switcher_placeholder">{{ release }}</span> | ||
| 7 | </li> | ||
| 8 | <li> »</li> | ||
| 9 | {% for doc in parents %} | ||
| 10 | <li><a href="{{ doc.link|e }}">{{ doc.title }}</a> »</li> | ||
| 11 | {% endfor %} | ||
| 12 | <li>{{ title }}</li> | ||
| 13 | {% endblock %} | ||
| 14 | |||
diff --git a/bitbake/doc/_templates/footer.html b/bitbake/doc/_templates/footer.html deleted file mode 100644 index 1398f20d7e..0000000000 --- a/bitbake/doc/_templates/footer.html +++ /dev/null | |||
| @@ -1,9 +0,0 @@ | |||
| 1 | <footer> | ||
| 2 | <hr/> | ||
| 3 | <div role="contentinfo"> | ||
| 4 | <p>© Copyright {{ copyright }} | ||
| 5 | <br>Last updated on {{ last_updated }} from the <a href="https://git.openembedded.org/bitbake/">bitbake</a> git repository. | ||
| 6 | </p> | ||
| 7 | </div> | ||
| 8 | </footer> | ||
| 9 | |||
diff --git a/bitbake/doc/_templates/layout.html b/bitbake/doc/_templates/layout.html deleted file mode 100644 index 308d5c7a28..0000000000 --- a/bitbake/doc/_templates/layout.html +++ /dev/null | |||
| @@ -1,7 +0,0 @@ | |||
| 1 | {% extends "!layout.html" %} | ||
| 2 | |||
| 3 | {% block extrabody %} | ||
| 4 | <div id="outdated-warning" style="text-align: center; background-color: #FFBABA; color: #6A0E0E;"> | ||
| 5 | </div> | ||
| 6 | {% endblock %} | ||
| 7 | |||
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-execution.rst b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-execution.rst deleted file mode 100644 index d407f59c0d..0000000000 --- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-execution.rst +++ /dev/null | |||
| @@ -1,761 +0,0 @@ | |||
| 1 | .. SPDX-License-Identifier: CC-BY-2.5 | ||
| 2 | |||
| 3 | ========= | ||
| 4 | Execution | ||
| 5 | ========= | ||
| 6 | |||
| 7 | | | ||
| 8 | |||
| 9 | The primary purpose for running BitBake is to produce some kind of | ||
| 10 | output such as a single installable package, a kernel, a software | ||
| 11 | development kit, or even a full, board-specific bootable Linux image, | ||
| 12 | complete with bootloader, kernel, and root filesystem. Of course, you | ||
| 13 | can execute the ``bitbake`` command with options that cause it to | ||
| 14 | execute single tasks, compile single recipe files, capture or clear | ||
| 15 | data, or simply return information about the execution environment. | ||
| 16 | |||
| 17 | This chapter describes BitBake's execution process from start to finish | ||
| 18 | when you use it to create an image. The execution process is launched | ||
| 19 | using the following command form:: | ||
| 20 | |||
| 21 | $ bitbake target | ||
| 22 | |||
| 23 | For information on | ||
| 24 | the BitBake command and its options, see ":ref:`The BitBake Command | ||
| 25 | <bitbake-user-manual-command>`" section. | ||
| 26 | |||
| 27 | .. note:: | ||
| 28 | |||
| 29 | Prior to executing BitBake, you should take advantage of available | ||
| 30 | parallel thread execution on your build host by setting the | ||
| 31 | :term:`BB_NUMBER_THREADS` variable in | ||
| 32 | your project's ``local.conf`` configuration file. | ||
| 33 | |||
| 34 | A common method to determine this value for your build host is to run | ||
| 35 | the following:: | ||
| 36 | |||
| 37 | $ grep processor /proc/cpuinfo | ||
| 38 | |||
| 39 | This command returns | ||
| 40 | the number of processors, which takes into account hyper-threading. | ||
| 41 | Thus, a quad-core build host with hyper-threading most likely shows | ||
| 42 | eight processors, which is the value you would then assign to | ||
| 43 | :term:`BB_NUMBER_THREADS`. | ||
| 44 | |||
| 45 | A possibly simpler solution is that some Linux distributions (e.g. | ||
| 46 | Debian and Ubuntu) provide the ``ncpus`` command. | ||
| 47 | |||
| 48 | Parsing the Base Configuration Metadata | ||
| 49 | ======================================= | ||
| 50 | |||
| 51 | The first thing BitBake does is parse base configuration metadata. Base | ||
| 52 | configuration metadata consists of your project's ``bblayers.conf`` file | ||
| 53 | to determine what layers BitBake needs to recognize, all necessary | ||
| 54 | ``layer.conf`` files (one from each layer), and ``bitbake.conf``. The | ||
| 55 | data itself is of various types: | ||
| 56 | |||
| 57 | - **Recipes:** Details about particular pieces of software. | ||
| 58 | |||
| 59 | - **Class Data:** An abstraction of common build information (e.g. how to | ||
| 60 | build a Linux kernel). | ||
| 61 | |||
| 62 | - **Configuration Data:** Machine-specific settings, policy decisions, | ||
| 63 | and so forth. Configuration data acts as the glue to bind everything | ||
| 64 | together. | ||
| 65 | |||
| 66 | The ``layer.conf`` files are used to construct key variables such as | ||
| 67 | :term:`BBPATH` and :term:`BBFILES`. :term:`BBPATH` is used to search for | ||
| 68 | configuration files under the ``conf`` directory and class files under the | ||
| 69 | ``classes-global``, ``classes-recipe`` and ``classes`` directories. | ||
| 70 | :term:`BBFILES` is used to locate both recipe and recipe append files (``.bb`` | ||
| 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. | ||
| 73 | |||
| 74 | Next, the ``bitbake.conf`` file is located using the :term:`BBPATH` variable | ||
| 75 | that was just constructed. The ``bitbake.conf`` file may also include | ||
| 76 | other configuration files using the ``include`` or ``require`` | ||
| 77 | directives. | ||
| 78 | |||
| 79 | Prior to parsing configuration files, BitBake looks at certain | ||
| 80 | variables, including: | ||
| 81 | |||
| 82 | - :term:`BB_ENV_PASSTHROUGH` | ||
| 83 | - :term:`BB_ENV_PASSTHROUGH_ADDITIONS` | ||
| 84 | - :term:`BB_PRESERVE_ENV` | ||
| 85 | - :term:`BB_ORIGENV` | ||
| 86 | - :term:`BITBAKE_UI` | ||
| 87 | |||
| 88 | The first four variables in this list relate to how BitBake treats shell | ||
| 89 | environment variables during task execution. By default, BitBake cleans | ||
| 90 | the environment variables and provides tight control over the shell | ||
| 91 | execution environment. However, through the use of these first four | ||
| 92 | variables, you can apply your control regarding the environment | ||
| 93 | variables allowed to be used by BitBake in the shell during execution of | ||
| 94 | tasks. See the | ||
| 95 | ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:Passing Information Into the Build Task Environment`" | ||
| 96 | section and the information about these variables in the variable | ||
| 97 | glossary for more information on how they work and on how to use them. | ||
| 98 | |||
| 99 | The base configuration metadata is global and therefore affects all | ||
| 100 | recipes and tasks that are executed. | ||
| 101 | |||
| 102 | BitBake first searches the current working directory for an optional | ||
| 103 | ``conf/bblayers.conf`` configuration file. This file is expected to | ||
| 104 | contain a :term:`BBLAYERS` variable that is a | ||
| 105 | space-delimited list of 'layer' directories. Recall that if BitBake | ||
| 106 | cannot find a ``bblayers.conf`` file, then it is assumed the user has | ||
| 107 | set the :term:`BBPATH` and :term:`BBFILES` variables directly in the | ||
| 108 | environment. | ||
| 109 | |||
| 110 | For each directory (layer) in this list, a ``conf/layer.conf`` file is | ||
| 111 | located and parsed with the :term:`LAYERDIR` variable | ||
| 112 | being set to the directory where the layer was found. The idea is these | ||
| 113 | files automatically set up :term:`BBPATH` and other | ||
| 114 | variables correctly for a given build directory. | ||
| 115 | |||
| 116 | BitBake then expects to find the ``conf/bitbake.conf`` file somewhere in | ||
| 117 | the user-specified :term:`BBPATH`. That configuration file generally has | ||
| 118 | include directives to pull in any other metadata such as files specific | ||
| 119 | to the architecture, the machine, the local environment, and so forth. | ||
| 120 | |||
| 121 | Only variable definitions and include directives are allowed in BitBake | ||
| 122 | ``.conf`` files. Some variables directly influence BitBake's behavior. | ||
| 123 | These variables might have been set from the environment depending on | ||
| 124 | the environment variables previously mentioned or set in the | ||
| 125 | configuration files. The ":ref:`bitbake-user-manual/bitbake-user-manual-ref-variables:Variables Glossary`" | ||
| 126 | chapter presents a full list of | ||
| 127 | variables. | ||
| 128 | |||
| 129 | After parsing configuration files, BitBake uses its rudimentary | ||
| 130 | inheritance mechanism, which is through class files, to inherit some | ||
| 131 | standard classes. BitBake parses a class when the inherit directive | ||
| 132 | responsible for getting that class is encountered. | ||
| 133 | |||
| 134 | The ``base.bbclass`` file is always included. Other classes that are | ||
| 135 | specified in the configuration using the | ||
| 136 | :term:`INHERIT` variable are also included. BitBake | ||
| 137 | searches for class files in a ``classes`` subdirectory under the paths | ||
| 138 | in :term:`BBPATH` in the same way as configuration files. | ||
| 139 | |||
| 140 | A good way to get an idea of the configuration files and the class files | ||
| 141 | used in your execution environment is to run the following BitBake | ||
| 142 | command:: | ||
| 143 | |||
| 144 | $ bitbake -e > mybb.log | ||
| 145 | |||
| 146 | Examining the top of the ``mybb.log`` | ||
| 147 | shows you the many configuration files and class files used in your | ||
| 148 | execution environment. | ||
| 149 | |||
| 150 | .. note:: | ||
| 151 | |||
| 152 | You need to be aware of how BitBake parses curly braces. If a recipe | ||
| 153 | uses a closing curly brace within the function and the character has | ||
| 154 | no leading spaces, BitBake produces a parsing error. If you use a | ||
| 155 | pair of curly braces in a shell function, the closing curly brace | ||
| 156 | must not be located at the start of the line without leading spaces. | ||
| 157 | |||
| 158 | Here is an example that causes BitBake to produce a parsing error:: | ||
| 159 | |||
| 160 | fakeroot create_shar() { | ||
| 161 | cat << "EOF" > ${SDK_DEPLOY}/${TOOLCHAIN_OUTPUTNAME}.sh | ||
| 162 | usage() | ||
| 163 | { | ||
| 164 | echo "test" | ||
| 165 | ###### The following "}" at the start of the line causes a parsing error ###### | ||
| 166 | } | ||
| 167 | EOF | ||
| 168 | } | ||
| 169 | |||
| 170 | Writing the recipe this way avoids the error: | ||
| 171 | fakeroot create_shar() { | ||
| 172 | cat << "EOF" > ${SDK_DEPLOY}/${TOOLCHAIN_OUTPUTNAME}.sh | ||
| 173 | usage() | ||
| 174 | { | ||
| 175 | echo "test" | ||
| 176 | ###### The following "}" with a leading space at the start of the line avoids the error ###### | ||
| 177 | } | ||
| 178 | EOF | ||
| 179 | } | ||
| 180 | |||
| 181 | Locating and Parsing Recipes | ||
| 182 | ============================ | ||
| 183 | |||
| 184 | During the configuration phase, BitBake will have set | ||
| 185 | :term:`BBFILES`. BitBake now uses it to construct a | ||
| 186 | list of recipes to parse, along with any append files (``.bbappend``) to | ||
| 187 | apply. :term:`BBFILES` is a space-separated list of available files and | ||
| 188 | supports wildcards. An example would be:: | ||
| 189 | |||
| 190 | BBFILES = "/path/to/bbfiles/*.bb /path/to/appends/*.bbappend" | ||
| 191 | |||
| 192 | BitBake parses each | ||
| 193 | recipe and append file located with :term:`BBFILES` and stores the values of | ||
| 194 | various variables into the datastore. | ||
| 195 | |||
| 196 | .. note:: | ||
| 197 | |||
| 198 | Append files are applied in the order they are encountered in BBFILES. | ||
| 199 | |||
| 200 | For each file, a fresh copy of the base configuration is made, then the | ||
| 201 | recipe is parsed line by line. Any inherit statements cause BitBake to | ||
| 202 | find and then parse class files (``.bbclass``) using | ||
| 203 | :term:`BBPATH` as the search path. Finally, BitBake | ||
| 204 | parses in order any append files found in :term:`BBFILES`. | ||
| 205 | |||
| 206 | One common convention is to use the recipe filename to define pieces of | ||
| 207 | metadata. For example, in ``bitbake.conf`` the recipe name and version | ||
| 208 | are used to set the variables :term:`PN` and | ||
| 209 | :term:`PV`:: | ||
| 210 | |||
| 211 | PN = "${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[0] or 'defaultpkgname'}" | ||
| 212 | PV = "${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[1] or '1.0'}" | ||
| 213 | |||
| 214 | In this example, a recipe called "something_1.2.3.bb" would set | ||
| 215 | :term:`PN` to "something" and :term:`PV` to "1.2.3". | ||
| 216 | |||
| 217 | By the time parsing is complete for a recipe, BitBake has a list of | ||
| 218 | tasks that the recipe defines and a set of data consisting of keys and | ||
| 219 | values as well as dependency information about the tasks. | ||
| 220 | |||
| 221 | BitBake does not need all of this information. It only needs a small | ||
| 222 | subset of the information to make decisions about the recipe. | ||
| 223 | Consequently, BitBake caches the values in which it is interested and | ||
| 224 | does not store the rest of the information. Experience has shown it is | ||
| 225 | faster to re-parse the metadata than to try and write it out to the disk | ||
| 226 | and then reload it. | ||
| 227 | |||
| 228 | Where possible, subsequent BitBake commands reuse this cache of recipe | ||
| 229 | information. The validity of this cache is determined by first computing | ||
| 230 | a checksum of the base configuration data (see | ||
| 231 | :term:`BB_HASHCONFIG_IGNORE_VARS`) and | ||
| 232 | then checking if the checksum matches. If that checksum matches what is | ||
| 233 | in the cache and the recipe and class files have not changed, BitBake is | ||
| 234 | able to use the cache. BitBake then reloads the cached information about | ||
| 235 | the recipe instead of reparsing it from scratch. | ||
| 236 | |||
| 237 | Recipe file collections exist to allow the user to have multiple | ||
| 238 | repositories of ``.bb`` files that contain the same exact package. For | ||
| 239 | example, one could easily use them to make one's own local copy of an | ||
| 240 | upstream repository, but with custom modifications that one does not | ||
| 241 | want upstream. Here is an example:: | ||
| 242 | |||
| 243 | BBFILES = "/stuff/openembedded/*/*.bb /stuff/openembedded.modified/*/*.bb" | ||
| 244 | BBFILE_COLLECTIONS = "upstream local" | ||
| 245 | BBFILE_PATTERN_upstream = "^/stuff/openembedded/" | ||
| 246 | BBFILE_PATTERN_local = "^/stuff/openembedded.modified/" | ||
| 247 | BBFILE_PRIORITY_upstream = "5" | ||
| 248 | BBFILE_PRIORITY_local = "10" | ||
| 249 | |||
| 250 | .. note:: | ||
| 251 | |||
| 252 | The layers mechanism is now the preferred method of collecting code. | ||
| 253 | While the collections code remains, its main use is to set layer | ||
| 254 | priorities and to deal with overlap (conflicts) between layers. | ||
| 255 | |||
| 256 | .. _bb-bitbake-providers: | ||
| 257 | |||
| 258 | Providers | ||
| 259 | ========= | ||
| 260 | |||
| 261 | Assuming BitBake has been instructed to execute a target and that all | ||
| 262 | the recipe files have been parsed, BitBake starts to figure out how to | ||
| 263 | build the target. BitBake looks through the :term:`PROVIDES` list for each | ||
| 264 | of the recipes. A :term:`PROVIDES` list is the list of names by which the | ||
| 265 | recipe can be known. Each recipe's :term:`PROVIDES` list is created | ||
| 266 | implicitly through the recipe's :term:`PN` variable and | ||
| 267 | explicitly through the recipe's :term:`PROVIDES` | ||
| 268 | variable, which is optional. | ||
| 269 | |||
| 270 | When a recipe uses :term:`PROVIDES`, that recipe's functionality can be | ||
| 271 | found under an alternative name or names other than the implicit :term:`PN` | ||
| 272 | name. As an example, suppose a recipe named ``keyboard_1.0.bb`` | ||
| 273 | contained the following:: | ||
| 274 | |||
| 275 | PROVIDES += "fullkeyboard" | ||
| 276 | |||
| 277 | The :term:`PROVIDES` | ||
| 278 | list for this recipe becomes "keyboard", which is implicit, and | ||
| 279 | "fullkeyboard", which is explicit. Consequently, the functionality found | ||
| 280 | in ``keyboard_1.0.bb`` can be found under two different names. | ||
| 281 | |||
| 282 | .. _bb-bitbake-preferences: | ||
| 283 | |||
| 284 | Preferences | ||
| 285 | =========== | ||
| 286 | |||
| 287 | The :term:`PROVIDES` list is only part of the solution for figuring out a | ||
| 288 | target's recipes. Because targets might have multiple providers, BitBake | ||
| 289 | needs to prioritize providers by determining provider preferences. | ||
| 290 | |||
| 291 | A common example in which a target has multiple providers is | ||
| 292 | "virtual/kernel", which is on the :term:`PROVIDES` list for each kernel | ||
| 293 | recipe. Each machine often selects the best kernel provider by using a | ||
| 294 | line similar to the following in the machine configuration file:: | ||
| 295 | |||
| 296 | PREFERRED_PROVIDER_virtual/kernel = "linux-yocto" | ||
| 297 | |||
| 298 | The default :term:`PREFERRED_PROVIDER` is the provider | ||
| 299 | with the same name as the target. BitBake iterates through each target | ||
| 300 | it needs to build and resolves them and their dependencies using this | ||
| 301 | process. | ||
| 302 | |||
| 303 | Understanding how providers are chosen is made complicated by the fact | ||
| 304 | that multiple versions might exist for a given provider. BitBake | ||
| 305 | defaults to the highest version of a provider. Version comparisons are | ||
| 306 | made using the same method as Debian. You can use the | ||
| 307 | :term:`PREFERRED_VERSION` variable to | ||
| 308 | specify a particular version. You can influence the order by using the | ||
| 309 | :term:`DEFAULT_PREFERENCE` variable. | ||
| 310 | |||
| 311 | By default, files have a preference of "0". Setting | ||
| 312 | :term:`DEFAULT_PREFERENCE` to "-1" makes the recipe unlikely to be used | ||
| 313 | unless it is explicitly referenced. Setting :term:`DEFAULT_PREFERENCE` to | ||
| 314 | "1" makes it likely the recipe is used. :term:`PREFERRED_VERSION` overrides | ||
| 315 | any :term:`DEFAULT_PREFERENCE` setting. :term:`DEFAULT_PREFERENCE` is often used | ||
| 316 | to mark newer and more experimental recipe versions until they have | ||
| 317 | undergone sufficient testing to be considered stable. | ||
| 318 | |||
| 319 | When there are multiple "versions" of a given recipe, BitBake defaults | ||
| 320 | to selecting the most recent version, unless otherwise specified. If the | ||
| 321 | recipe in question has a | ||
| 322 | :term:`DEFAULT_PREFERENCE` set lower than | ||
| 323 | the other recipes (default is 0), then it will not be selected. This | ||
| 324 | allows the person or persons maintaining the repository of recipe files | ||
| 325 | to specify their preference for the default selected version. | ||
| 326 | Additionally, the user can specify their preferred version. | ||
| 327 | |||
| 328 | If the first recipe is named ``a_1.1.bb``, then the | ||
| 329 | :term:`PN` variable will be set to "a", and the | ||
| 330 | :term:`PV` variable will be set to 1.1. | ||
| 331 | |||
| 332 | Thus, if a recipe named ``a_1.2.bb`` exists, BitBake will choose 1.2 by | ||
| 333 | default. However, if you define the following variable in a ``.conf`` | ||
| 334 | file that BitBake parses, you can change that preference:: | ||
| 335 | |||
| 336 | PREFERRED_VERSION_a = "1.1" | ||
| 337 | |||
| 338 | .. note:: | ||
| 339 | |||
| 340 | It is common for a recipe to provide two versions -- a stable, | ||
| 341 | numbered (and preferred) version, and a version that is automatically | ||
| 342 | checked out from a source code repository that is considered more | ||
| 343 | "bleeding edge" but can be selected only explicitly. | ||
| 344 | |||
| 345 | For example, in the OpenEmbedded codebase, there is a standard, | ||
| 346 | versioned recipe file for BusyBox, ``busybox_1.22.1.bb``, but there | ||
| 347 | is also a Git-based version, ``busybox_git.bb``, which explicitly | ||
| 348 | contains the line :: | ||
| 349 | |||
| 350 | DEFAULT_PREFERENCE = "-1" | ||
| 351 | |||
| 352 | to ensure that the | ||
| 353 | numbered, stable version is always preferred unless the developer | ||
| 354 | selects otherwise. | ||
| 355 | |||
| 356 | .. _bb-bitbake-dependencies: | ||
| 357 | |||
| 358 | Dependencies | ||
| 359 | ============ | ||
| 360 | |||
| 361 | Each target BitBake builds consists of multiple tasks such as ``fetch``, | ||
| 362 | ``unpack``, ``patch``, ``configure``, and ``compile``. For best | ||
| 363 | performance on multi-core systems, BitBake considers each task as an | ||
| 364 | independent entity with its own set of dependencies. | ||
| 365 | |||
| 366 | Dependencies are defined through several variables. You can find | ||
| 367 | information about variables BitBake uses in the | ||
| 368 | :doc:`bitbake-user-manual-ref-variables` near the end of this manual. At a | ||
| 369 | basic level, it is sufficient to know that BitBake uses the | ||
| 370 | :term:`DEPENDS` and | ||
| 371 | :term:`RDEPENDS` variables when calculating | ||
| 372 | dependencies. | ||
| 373 | |||
| 374 | For more information on how BitBake handles dependencies, see the | ||
| 375 | :ref:`bitbake-user-manual/bitbake-user-manual-metadata:Dependencies` | ||
| 376 | section. | ||
| 377 | |||
| 378 | .. _ref-bitbake-tasklist: | ||
| 379 | |||
| 380 | The Task List | ||
| 381 | ============= | ||
| 382 | |||
| 383 | Based on the generated list of providers and the dependency information, | ||
| 384 | BitBake can now calculate exactly what tasks it needs to run and in what | ||
| 385 | order it needs to run them. The | ||
| 386 | :ref:`bitbake-user-manual/bitbake-user-manual-execution:executing tasks` | ||
| 387 | section has more information on how BitBake chooses which task to | ||
| 388 | execute next. | ||
| 389 | |||
| 390 | The build now starts with BitBake forking off threads up to the limit | ||
| 391 | set in the :term:`BB_NUMBER_THREADS` | ||
| 392 | variable. BitBake continues to fork threads as long as there are tasks | ||
| 393 | ready to run, those tasks have all their dependencies met, and the | ||
| 394 | thread threshold has not been exceeded. | ||
| 395 | |||
| 396 | It is worth noting that you can greatly speed up the build time by | ||
| 397 | properly setting the :term:`BB_NUMBER_THREADS` variable. | ||
| 398 | |||
| 399 | As each task completes, a timestamp is written to the directory | ||
| 400 | specified by the :term:`STAMP` variable. On subsequent | ||
| 401 | runs, BitBake looks in the build directory within ``tmp/stamps`` and | ||
| 402 | does not rerun tasks that are already completed unless a timestamp is | ||
| 403 | found to be invalid. Currently, invalid timestamps are only considered | ||
| 404 | on a per recipe file basis. So, for example, if the configure stamp has | ||
| 405 | a timestamp greater than the compile timestamp for a given target, then | ||
| 406 | the compile task would rerun. Running the compile task again, however, | ||
| 407 | has no effect on other providers that depend on that target. | ||
| 408 | |||
| 409 | The exact format of the stamps is partly configurable. In modern | ||
| 410 | versions of BitBake, a hash is appended to the stamp so that if the | ||
| 411 | configuration changes, the stamp becomes invalid and the task is | ||
| 412 | automatically rerun. This hash, or signature used, is governed by the | ||
| 413 | signature policy that is configured (see the | ||
| 414 | :ref:`bitbake-user-manual/bitbake-user-manual-execution:checksums (signatures)` | ||
| 415 | section for information). It is also | ||
| 416 | possible to append extra metadata to the stamp using the | ||
| 417 | ``[stamp-extra-info]`` task flag. For example, OpenEmbedded uses this | ||
| 418 | flag to make some tasks machine-specific. | ||
| 419 | |||
| 420 | .. note:: | ||
| 421 | |||
| 422 | Some tasks are marked as "nostamp" tasks. No timestamp file is | ||
| 423 | created when these tasks are run. Consequently, "nostamp" tasks are | ||
| 424 | always rerun. | ||
| 425 | |||
| 426 | For more information on tasks, see the | ||
| 427 | :ref:`bitbake-user-manual/bitbake-user-manual-metadata:tasks` section. | ||
| 428 | |||
| 429 | Executing Tasks | ||
| 430 | =============== | ||
| 431 | |||
| 432 | Tasks can be either a shell task or a Python task. For shell tasks, | ||
| 433 | BitBake writes a shell script to | ||
| 434 | ``${``\ :term:`T`\ ``}/run.do_taskname.pid`` and then | ||
| 435 | executes the script. The generated shell script contains all the | ||
| 436 | exported variables, and the shell functions with all variables expanded. | ||
| 437 | Output from the shell script goes to the file | ||
| 438 | ``${``\ :term:`T`\ ``}/log.do_taskname.pid``. Looking at the expanded shell functions in | ||
| 439 | the run file and the output in the log files is a useful debugging | ||
| 440 | technique. | ||
| 441 | |||
| 442 | For Python tasks, BitBake executes the task internally and logs | ||
| 443 | information to the controlling terminal. Future versions of BitBake will | ||
| 444 | write the functions to files similar to the way shell tasks are handled. | ||
| 445 | Logging will be handled in a way similar to shell tasks as well. | ||
| 446 | |||
| 447 | The order in which BitBake runs the tasks is controlled by its task | ||
| 448 | scheduler. It is possible to configure the scheduler and define custom | ||
| 449 | implementations for specific use cases. For more information, see these | ||
| 450 | variables that control the behavior: | ||
| 451 | |||
| 452 | - :term:`BB_SCHEDULER` | ||
| 453 | |||
| 454 | - :term:`BB_SCHEDULERS` | ||
| 455 | |||
| 456 | It is possible to have functions run before and after a task's main | ||
| 457 | function. This is done using the ``[prefuncs]`` and ``[postfuncs]`` | ||
| 458 | flags of the task that lists the functions to run. | ||
| 459 | |||
| 460 | .. _checksums: | ||
| 461 | |||
| 462 | Checksums (Signatures) | ||
| 463 | ====================== | ||
| 464 | |||
| 465 | A checksum is a unique signature of a task's inputs. The signature of a | ||
| 466 | task can be used to determine if a task needs to be run. Because it is a | ||
| 467 | change in a task's inputs that triggers running the task, BitBake needs | ||
| 468 | to detect all the inputs to a given task. For shell tasks, this turns | ||
| 469 | out to be fairly easy because BitBake generates a "run" shell script for | ||
| 470 | each task and it is possible to create a checksum that gives you a good | ||
| 471 | idea of when the task's data changes. | ||
| 472 | |||
| 473 | To complicate the problem, some things should not be included in the | ||
| 474 | checksum. First, there is the actual specific build path of a given task | ||
| 475 | - the working directory. It does not matter if the working directory | ||
| 476 | changes because it should not affect the output for target packages. The | ||
| 477 | simplistic approach for excluding the working directory is to set it to | ||
| 478 | some fixed value and create the checksum for the "run" script. BitBake | ||
| 479 | goes one step better and uses the | ||
| 480 | :term:`BB_BASEHASH_IGNORE_VARS` variable | ||
| 481 | to define a list of variables that should never be included when | ||
| 482 | generating the signatures. | ||
| 483 | |||
| 484 | Another problem results from the "run" scripts containing functions that | ||
| 485 | might or might not get called. The incremental build solution contains | ||
| 486 | code that figures out dependencies between shell functions. This code is | ||
| 487 | used to prune the "run" scripts down to the minimum set, thereby | ||
| 488 | alleviating this problem and making the "run" scripts much more readable | ||
| 489 | as a bonus. | ||
| 490 | |||
| 491 | So far we have solutions for shell scripts. What about Python tasks? The | ||
| 492 | same approach applies even though these tasks are more difficult. The | ||
| 493 | process needs to figure out what variables a Python function accesses | ||
| 494 | and what functions it calls. Again, the incremental build solution | ||
| 495 | contains code that first figures out the variable and function | ||
| 496 | dependencies, and then creates a checksum for the data used as the input | ||
| 497 | to the task. | ||
| 498 | |||
| 499 | Like the working directory case, situations exist where dependencies | ||
| 500 | should be ignored. For these cases, you can instruct the build process | ||
| 501 | to ignore a dependency by using a line like the following:: | ||
| 502 | |||
| 503 | PACKAGE_ARCHS[vardepsexclude] = "MACHINE" | ||
| 504 | |||
| 505 | This example ensures that the | ||
| 506 | ``PACKAGE_ARCHS`` variable does not depend on the value of ``MACHINE``, | ||
| 507 | even if it does reference it. | ||
| 508 | |||
| 509 | Equally, there are cases where we need to add dependencies BitBake is | ||
| 510 | not able to find. You can accomplish this by using a line like the | ||
| 511 | following:: | ||
| 512 | |||
| 513 | PACKAGE_ARCHS[vardeps] = "MACHINE" | ||
| 514 | |||
| 515 | This example explicitly | ||
| 516 | adds the ``MACHINE`` variable as a dependency for ``PACKAGE_ARCHS``. | ||
| 517 | |||
| 518 | Consider a case with in-line Python, for example, where BitBake is not | ||
| 519 | able to figure out dependencies. When running in debug mode (i.e. using | ||
| 520 | ``-DDD``), BitBake produces output when it discovers something for which | ||
| 521 | it cannot figure out dependencies. | ||
| 522 | |||
| 523 | Thus far, this section has limited discussion to the direct inputs into | ||
| 524 | a task. Information based on direct inputs is referred to as the | ||
| 525 | "basehash" in the code. However, there is still the question of a task's | ||
| 526 | indirect inputs --- the things that were already built and present in the | ||
| 527 | build directory. The checksum (or signature) for a particular task needs | ||
| 528 | to add the hashes of all the tasks on which the particular task depends. | ||
| 529 | Choosing which dependencies to add is a policy decision. However, the | ||
| 530 | effect is to generate a master checksum that combines the basehash and | ||
| 531 | the hashes of the task's dependencies. | ||
| 532 | |||
| 533 | At the code level, there are a variety of ways both the basehash and the | ||
| 534 | dependent task hashes can be influenced. Within the BitBake | ||
| 535 | configuration file, we can give BitBake some extra information to help | ||
| 536 | it construct the basehash. The following statement effectively results | ||
| 537 | in a list of global variable dependency excludes --- variables never | ||
| 538 | included in any checksum. This example uses variables from OpenEmbedded | ||
| 539 | to help illustrate the concept:: | ||
| 540 | |||
| 541 | BB_BASEHASH_IGNORE_VARS ?= "TMPDIR FILE PATH PWD BB_TASKHASH BBPATH DL_DIR \ | ||
| 542 | SSTATE_DIR THISDIR FILESEXTRAPATHS FILE_DIRNAME HOME LOGNAME SHELL \ | ||
| 543 | USER FILESPATH STAGING_DIR_HOST STAGING_DIR_TARGET COREBASE PRSERV_HOST \ | ||
| 544 | PRSERV_DUMPDIR PRSERV_DUMPFILE PRSERV_LOCKDOWN PARALLEL_MAKE \ | ||
| 545 | CCACHE_DIR EXTERNAL_TOOLCHAIN CCACHE CCACHE_DISABLE LICENSE_PATH SDKPKGSUFFIX" | ||
| 546 | |||
| 547 | The previous example excludes the work directory, which is part of | ||
| 548 | ``TMPDIR``. | ||
| 549 | |||
| 550 | The rules for deciding which hashes of dependent tasks to include | ||
| 551 | through dependency chains are more complex and are generally | ||
| 552 | accomplished with a Python function. The code in | ||
| 553 | ``meta/lib/oe/sstatesig.py`` shows two examples of this and also | ||
| 554 | illustrates how you can insert your own policy into the system if so | ||
| 555 | desired. This file defines the basic signature generator | ||
| 556 | OpenEmbedded-Core uses: "OEBasicHash". By default, there | ||
| 557 | is a dummy "noop" signature handler enabled in BitBake. This means that | ||
| 558 | behavior is unchanged from previous versions. ``OE-Core`` uses the | ||
| 559 | "OEBasicHash" signature handler by default through this setting in the | ||
| 560 | ``bitbake.conf`` file:: | ||
| 561 | |||
| 562 | BB_SIGNATURE_HANDLER ?= "OEBasicHash" | ||
| 563 | |||
| 564 | The main feature of the "OEBasicHash" :term:`BB_SIGNATURE_HANDLER` is that | ||
| 565 | it adds the task hash to the stamp files. Thanks to this, any metadata | ||
| 566 | change will change the task hash, automatically causing the task to be run | ||
| 567 | again. This removes the need to bump :term:`PR` values, and changes to | ||
| 568 | metadata automatically ripple across the build. | ||
| 569 | |||
| 570 | It is also worth noting that the end result of signature | ||
| 571 | generators is to make some dependency and hash information available to | ||
| 572 | the build. This information includes: | ||
| 573 | |||
| 574 | - ``BB_BASEHASH_task-``\ *taskname*: The base hashes for each task in the | ||
| 575 | recipe. | ||
| 576 | |||
| 577 | - ``BB_BASEHASH_``\ *filename:taskname*: The base hashes for each | ||
| 578 | dependent task. | ||
| 579 | |||
| 580 | - :term:`BB_TASKHASH`: The hash of the currently running task. | ||
| 581 | |||
| 582 | It is worth noting that BitBake's "-S" option lets you debug BitBake's | ||
| 583 | processing of signatures. The options passed to -S allow different | ||
| 584 | debugging modes to be used, either using BitBake's own debug functions | ||
| 585 | or possibly those defined in the metadata/signature handler itself. The | ||
| 586 | simplest parameter to pass is "none", which causes a set of signature | ||
| 587 | information to be written out into ``STAMPS_DIR`` corresponding to the | ||
| 588 | targets specified. The other currently available parameter is | ||
| 589 | "printdiff", which causes BitBake to try to establish the most recent | ||
| 590 | signature match it can (e.g. in the sstate cache) and then run | ||
| 591 | compare the matched signatures to determine the stamps and delta | ||
| 592 | where these two stamp trees diverge. This can be used to determine why | ||
| 593 | tasks need to be re-run in situations where that is not expected. | ||
| 594 | |||
| 595 | .. note:: | ||
| 596 | |||
| 597 | It is likely that future versions of BitBake will provide other | ||
| 598 | signature handlers triggered through additional "-S" parameters. | ||
| 599 | |||
| 600 | You can find more information on checksum metadata in the | ||
| 601 | :ref:`bitbake-user-manual/bitbake-user-manual-metadata:task checksums and setscene` | ||
| 602 | section. | ||
| 603 | |||
| 604 | Setscene | ||
| 605 | ======== | ||
| 606 | |||
| 607 | The setscene process enables BitBake to handle "pre-built" artifacts. | ||
| 608 | The ability to handle and reuse these artifacts allows BitBake the | ||
| 609 | luxury of not having to build something from scratch every time. | ||
| 610 | Instead, BitBake can use, when possible, existing build artifacts. | ||
| 611 | |||
| 612 | BitBake needs to have reliable data indicating whether or not an | ||
| 613 | artifact is compatible. Signatures, described in the previous section, | ||
| 614 | provide an ideal way of representing whether an artifact is compatible. | ||
| 615 | If a signature is the same, an object can be reused. | ||
| 616 | |||
| 617 | If an object can be reused, the problem then becomes how to replace a | ||
| 618 | given task or set of tasks with the pre-built artifact. BitBake solves | ||
| 619 | the problem with the "setscene" process. | ||
| 620 | |||
| 621 | When BitBake is asked to build a given target, before building anything, | ||
| 622 | it first asks whether cached information is available for any of the | ||
| 623 | targets it's building, or any of the intermediate targets. If cached | ||
| 624 | information is available, BitBake uses this information instead of | ||
| 625 | running the main tasks. | ||
| 626 | |||
| 627 | BitBake first calls the function defined by the | ||
| 628 | :term:`BB_HASHCHECK_FUNCTION` variable | ||
| 629 | with a list of tasks and corresponding hashes it wants to build. This | ||
| 630 | function is designed to be fast and returns a list of the tasks for | ||
| 631 | which it believes in can obtain artifacts. | ||
| 632 | |||
| 633 | Next, for each of the tasks that were returned as possibilities, BitBake | ||
| 634 | executes a setscene version of the task that the possible artifact | ||
| 635 | covers. Setscene versions of a task have the string "_setscene" appended | ||
| 636 | to the task name. So, for example, the task with the name ``xxx`` has a | ||
| 637 | setscene task named ``xxx_setscene``. The setscene version of the task | ||
| 638 | executes and provides the necessary artifacts returning either success | ||
| 639 | or failure. | ||
| 640 | |||
| 641 | As previously mentioned, an artifact can cover more than one task. For | ||
| 642 | example, it is pointless to obtain a compiler if you already have the | ||
| 643 | compiled binary. To handle this, BitBake calls the | ||
| 644 | :term:`BB_SETSCENE_DEPVALID` function for | ||
| 645 | each successful setscene task to know whether or not it needs to obtain | ||
| 646 | the dependencies of that task. | ||
| 647 | |||
| 648 | You can find more information on setscene metadata in the | ||
| 649 | :ref:`bitbake-user-manual/bitbake-user-manual-metadata:task checksums and setscene` | ||
| 650 | section. | ||
| 651 | |||
| 652 | Logging | ||
| 653 | ======= | ||
| 654 | |||
| 655 | In addition to the standard command line option to control how verbose | ||
| 656 | builds are when execute, bitbake also supports user defined | ||
| 657 | configuration of the `Python | ||
| 658 | logging <https://docs.python.org/3/library/logging.html>`__ facilities | ||
| 659 | through the :term:`BB_LOGCONFIG` variable. This | ||
| 660 | variable defines a JSON or YAML `logging | ||
| 661 | configuration <https://docs.python.org/3/library/logging.config.html>`__ | ||
| 662 | that will be intelligently merged into the default configuration. The | ||
| 663 | logging configuration is merged using the following rules: | ||
| 664 | |||
| 665 | - The user defined configuration will completely replace the default | ||
| 666 | configuration if top level key ``bitbake_merge`` is set to the value | ||
| 667 | ``False``. In this case, all other rules are ignored. | ||
| 668 | |||
| 669 | - The user configuration must have a top level ``version`` which must | ||
| 670 | match the value of the default configuration. | ||
| 671 | |||
| 672 | - Any keys defined in the ``handlers``, ``formatters``, or ``filters``, | ||
| 673 | will be merged into the same section in the default configuration, | ||
| 674 | with the user specified keys taking replacing a default one if there | ||
| 675 | is a conflict. In practice, this means that if both the default | ||
| 676 | configuration and user configuration specify a handler named | ||
| 677 | ``myhandler``, the user defined one will replace the default. To | ||
| 678 | prevent the user from inadvertently replacing a default handler, | ||
| 679 | formatter, or filter, all of the default ones are named with a prefix | ||
| 680 | of "``BitBake.``" | ||
| 681 | |||
| 682 | - If a logger is defined by the user with the key ``bitbake_merge`` set | ||
| 683 | to ``False``, that logger will be completely replaced by user | ||
| 684 | configuration. In this case, no other rules will apply to that | ||
| 685 | logger. | ||
| 686 | |||
| 687 | - All user defined ``filter`` and ``handlers`` properties for a given | ||
| 688 | logger will be merged with corresponding properties from the default | ||
| 689 | logger. For example, if the user configuration adds a filter called | ||
| 690 | ``myFilter`` to the ``BitBake.SigGen``, and the default configuration | ||
| 691 | adds a filter called ``BitBake.defaultFilter``, both filters will be | ||
| 692 | applied to the logger | ||
| 693 | |||
| 694 | As a first example, you can create a ``hashequiv.json`` user logging | ||
| 695 | configuration file to log all Hash Equivalence related messages of ``VERBOSE`` | ||
| 696 | or higher priority to a file called ``hashequiv.log``:: | ||
| 697 | |||
| 698 | { | ||
| 699 | "version": 1, | ||
| 700 | "handlers": { | ||
| 701 | "autobuilderlog": { | ||
| 702 | "class": "logging.FileHandler", | ||
| 703 | "formatter": "logfileFormatter", | ||
| 704 | "level": "DEBUG", | ||
| 705 | "filename": "hashequiv.log", | ||
| 706 | "mode": "w" | ||
| 707 | } | ||
| 708 | }, | ||
| 709 | "formatters": { | ||
| 710 | "logfileFormatter": { | ||
| 711 | "format": "%(name)s: %(levelname)s: %(message)s" | ||
| 712 | } | ||
| 713 | }, | ||
| 714 | "loggers": { | ||
| 715 | "BitBake.SigGen.HashEquiv": { | ||
| 716 | "level": "VERBOSE", | ||
| 717 | "handlers": ["autobuilderlog"] | ||
| 718 | }, | ||
| 719 | "BitBake.RunQueue.HashEquiv": { | ||
| 720 | "level": "VERBOSE", | ||
| 721 | "handlers": ["autobuilderlog"] | ||
| 722 | } | ||
| 723 | } | ||
| 724 | } | ||
| 725 | |||
| 726 | Then set the :term:`BB_LOGCONFIG` variable in ``conf/local.conf``:: | ||
| 727 | |||
| 728 | BB_LOGCONFIG = "hashequiv.json" | ||
| 729 | |||
| 730 | Another example is this ``warn.json`` file to log all ``WARNING`` and | ||
| 731 | higher priority messages to a ``warn.log`` file:: | ||
| 732 | |||
| 733 | { | ||
| 734 | "version": 1, | ||
| 735 | "formatters": { | ||
| 736 | "warnlogFormatter": { | ||
| 737 | "()": "bb.msg.BBLogFormatter", | ||
| 738 | "format": "%(levelname)s: %(message)s" | ||
| 739 | } | ||
| 740 | }, | ||
| 741 | |||
| 742 | "handlers": { | ||
| 743 | "warnlog": { | ||
| 744 | "class": "logging.FileHandler", | ||
| 745 | "formatter": "warnlogFormatter", | ||
| 746 | "level": "WARNING", | ||
| 747 | "filename": "warn.log" | ||
| 748 | } | ||
| 749 | }, | ||
| 750 | |||
| 751 | "loggers": { | ||
| 752 | "BitBake": { | ||
| 753 | "handlers": ["warnlog"] | ||
| 754 | } | ||
| 755 | }, | ||
| 756 | |||
| 757 | "@disable_existing_loggers": false | ||
| 758 | } | ||
| 759 | |||
| 760 | Note that BitBake's helper classes for structured logging are implemented in | ||
| 761 | ``lib/bb/msg.py``. | ||
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst deleted file mode 100644 index f357765b77..0000000000 --- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst +++ /dev/null | |||
| @@ -1,846 +0,0 @@ | |||
| 1 | .. SPDX-License-Identifier: CC-BY-2.5 | ||
| 2 | |||
| 3 | ===================== | ||
| 4 | File Download Support | ||
| 5 | ===================== | ||
| 6 | |||
| 7 | | | ||
| 8 | |||
| 9 | BitBake's fetch module is a standalone piece of library code that deals | ||
| 10 | with the intricacies of downloading source code and files from remote | ||
| 11 | systems. Fetching source code is one of the cornerstones of building | ||
| 12 | software. As such, this module forms an important part of BitBake. | ||
| 13 | |||
| 14 | The current fetch module is called "fetch2" and refers to the fact that | ||
| 15 | it is the second major version of the API. The original version is | ||
| 16 | obsolete and has been removed from the codebase. Thus, in all cases, | ||
| 17 | "fetch" refers to "fetch2" in this manual. | ||
| 18 | |||
| 19 | The Download (Fetch) | ||
| 20 | ==================== | ||
| 21 | |||
| 22 | BitBake takes several steps when fetching source code or files. The | ||
| 23 | fetcher codebase deals with two distinct processes in order: obtaining | ||
| 24 | the files from somewhere (cached or otherwise) and then unpacking those | ||
| 25 | files into a specific location and perhaps in a specific way. Getting | ||
| 26 | and unpacking the files is often optionally followed by patching. | ||
| 27 | Patching, however, is not covered by this module. | ||
| 28 | |||
| 29 | The code to execute the first part of this process, a fetch, looks | ||
| 30 | something like the following:: | ||
| 31 | |||
| 32 | src_uri = (d.getVar('SRC_URI') or "").split() | ||
| 33 | fetcher = bb.fetch2.Fetch(src_uri, d) | ||
| 34 | fetcher.download() | ||
| 35 | |||
| 36 | This code sets up an instance of the fetch class. The instance uses a | ||
| 37 | space-separated list of URLs from the :term:`SRC_URI` | ||
| 38 | variable and then calls the ``download`` method to download the files. | ||
| 39 | |||
| 40 | The instantiation of the fetch class is usually followed by:: | ||
| 41 | |||
| 42 | rootdir = l.getVar('UNPACKDIR') | ||
| 43 | fetcher.unpack(rootdir) | ||
| 44 | |||
| 45 | This code unpacks the downloaded files to the specified by ``UNPACKDIR``. | ||
| 46 | |||
| 47 | .. note:: | ||
| 48 | |||
| 49 | For convenience, the naming in these examples matches the variables | ||
| 50 | used by OpenEmbedded. If you want to see the above code in action, | ||
| 51 | examine the OpenEmbedded class file ``base.bbclass`` | ||
| 52 | . | ||
| 53 | |||
| 54 | The :term:`SRC_URI` and ``UNPACKDIR`` variables are not hardcoded into the | ||
| 55 | fetcher, since those fetcher methods can be (and are) called with | ||
| 56 | different variable names. In OpenEmbedded for example, the shared state | ||
| 57 | (sstate) code uses the fetch module to fetch the sstate files. | ||
| 58 | |||
| 59 | When the ``download()`` method is called, BitBake tries to resolve the | ||
| 60 | URLs by looking for source files in a specific search order: | ||
| 61 | |||
| 62 | - *Pre-mirror Sites:* BitBake first uses pre-mirrors to try and find | ||
| 63 | source files. These locations are defined using the | ||
| 64 | :term:`PREMIRRORS` variable. | ||
| 65 | |||
| 66 | - *Source URI:* If pre-mirrors fail, BitBake uses the original URL (e.g | ||
| 67 | from :term:`SRC_URI`). | ||
| 68 | |||
| 69 | - *Mirror Sites:* If fetch failures occur, BitBake next uses mirror | ||
| 70 | locations as defined by the :term:`MIRRORS` variable. | ||
| 71 | |||
| 72 | For each URL passed to the fetcher, the fetcher calls the submodule that | ||
| 73 | handles that particular URL type. This behavior can be the source of | ||
| 74 | some confusion when you are providing URLs for the :term:`SRC_URI` variable. | ||
| 75 | Consider the following two URLs:: | ||
| 76 | |||
| 77 | https://git.yoctoproject.org/git/poky;protocol=git | ||
| 78 | git://git.yoctoproject.org/git/poky;protocol=http | ||
| 79 | |||
| 80 | In the former case, the URL is passed to the ``wget`` fetcher, which does not | ||
| 81 | understand "git". Therefore, the latter case is the correct form since the Git | ||
| 82 | fetcher does know how to use HTTP as a transport. | ||
| 83 | |||
| 84 | Here are some examples that show commonly used mirror definitions:: | ||
| 85 | |||
| 86 | PREMIRRORS ?= "\ | ||
| 87 | bzr://.*/.\* http://somemirror.org/sources/ \ | ||
| 88 | cvs://.*/.\* http://somemirror.org/sources/ \ | ||
| 89 | git://.*/.\* http://somemirror.org/sources/ \ | ||
| 90 | hg://.*/.\* http://somemirror.org/sources/ \ | ||
| 91 | osc://.*/.\* http://somemirror.org/sources/ \ | ||
| 92 | p4://.*/.\* http://somemirror.org/sources/ \ | ||
| 93 | svn://.*/.\* http://somemirror.org/sources/" | ||
| 94 | |||
| 95 | MIRRORS =+ "\ | ||
| 96 | ftp://.*/.\* http://somemirror.org/sources/ \ | ||
| 97 | http://.*/.\* http://somemirror.org/sources/ \ | ||
| 98 | https://.*/.\* http://somemirror.org/sources/" | ||
| 99 | |||
| 100 | It is useful to note that BitBake | ||
| 101 | supports cross-URLs. It is possible to mirror a Git repository on an | ||
| 102 | HTTP server as a tarball. This is what the ``git://`` mapping in the | ||
| 103 | previous example does. | ||
| 104 | |||
| 105 | Since network accesses are slow, BitBake maintains a cache of files | ||
| 106 | downloaded from the network. Any source files that are not local (i.e. | ||
| 107 | downloaded from the Internet) are placed into the download directory, | ||
| 108 | which is specified by the :term:`DL_DIR` variable. | ||
| 109 | |||
| 110 | File integrity is of key importance for reproducing builds. For | ||
| 111 | non-local archive downloads, the fetcher code can verify SHA-256 and MD5 | ||
| 112 | checksums to ensure the archives have been downloaded correctly. You can | ||
| 113 | specify these checksums by using the :term:`SRC_URI` variable with the | ||
| 114 | appropriate varflags as follows:: | ||
| 115 | |||
| 116 | SRC_URI[md5sum] = "value" | ||
| 117 | SRC_URI[sha256sum] = "value" | ||
| 118 | |||
| 119 | You can also specify the checksums as | ||
| 120 | parameters on the :term:`SRC_URI` as shown below:: | ||
| 121 | |||
| 122 | SRC_URI = "http://example.com/foobar.tar.bz2;md5sum=4a8e0f237e961fd7785d19d07fdb994d" | ||
| 123 | |||
| 124 | If multiple URIs exist, you can specify the checksums either directly as | ||
| 125 | in the previous example, or you can name the URLs. The following syntax | ||
| 126 | shows how you name the URIs:: | ||
| 127 | |||
| 128 | SRC_URI = "http://example.com/foobar.tar.bz2;name=foo" | ||
| 129 | SRC_URI[foo.md5sum] = 4a8e0f237e961fd7785d19d07fdb994d | ||
| 130 | |||
| 131 | After a file has been downloaded and | ||
| 132 | has had its checksum checked, a ".done" stamp is placed in :term:`DL_DIR`. | ||
| 133 | BitBake uses this stamp during subsequent builds to avoid downloading or | ||
| 134 | comparing a checksum for the file again. | ||
| 135 | |||
| 136 | .. note:: | ||
| 137 | |||
| 138 | It is assumed that local storage is safe from data corruption. If | ||
| 139 | this were not the case, there would be bigger issues to worry about. | ||
| 140 | |||
| 141 | If :term:`BB_STRICT_CHECKSUM` is set, any | ||
| 142 | download without a checksum triggers an error message. The | ||
| 143 | :term:`BB_NO_NETWORK` variable can be used to | ||
| 144 | make any attempted network access a fatal error, which is useful for | ||
| 145 | checking that mirrors are complete as well as other things. | ||
| 146 | |||
| 147 | If :term:`BB_CHECK_SSL_CERTS` is set to ``0`` then SSL certificate checking will | ||
| 148 | be disabled. This variable defaults to ``1`` so SSL certificates are normally | ||
| 149 | checked. | ||
| 150 | |||
| 151 | .. _bb-the-unpack: | ||
| 152 | |||
| 153 | The Unpack | ||
| 154 | ========== | ||
| 155 | |||
| 156 | The unpack process usually immediately follows the download. For all | ||
| 157 | URLs except Git URLs, BitBake uses the common ``unpack`` method. | ||
| 158 | |||
| 159 | A number of parameters exist that you can specify within the URL to | ||
| 160 | govern the behavior of the unpack stage: | ||
| 161 | |||
| 162 | - *unpack:* Controls whether the URL components are unpacked. If set to | ||
| 163 | "1", which is the default, the components are unpacked. If set to | ||
| 164 | "0", the unpack stage leaves the file alone. This parameter is useful | ||
| 165 | when you want an archive to be copied in and not be unpacked. | ||
| 166 | |||
| 167 | - *dos:* Applies to ``.zip`` and ``.jar`` files and specifies whether | ||
| 168 | to use DOS line ending conversion on text files. | ||
| 169 | |||
| 170 | - *striplevel:* Strip specified number of leading components (levels) | ||
| 171 | from file names on extraction | ||
| 172 | |||
| 173 | - *subdir:* Unpacks the specific URL to the specified subdirectory | ||
| 174 | within the root directory. | ||
| 175 | |||
| 176 | The unpack call automatically decompresses and extracts files with ".Z", | ||
| 177 | ".z", ".gz", ".xz", ".zip", ".jar", ".ipk", ".rpm". ".srpm", ".deb" and | ||
| 178 | ".bz2" extensions as well as various combinations of tarball extensions. | ||
| 179 | |||
| 180 | As mentioned, the Git fetcher has its own unpack method that is | ||
| 181 | optimized to work with Git trees. Basically, this method works by | ||
| 182 | cloning the tree into the final directory. The process is completed | ||
| 183 | using references so that there is only one central copy of the Git | ||
| 184 | metadata needed. | ||
| 185 | |||
| 186 | .. _bb-fetchers: | ||
| 187 | |||
| 188 | Fetchers | ||
| 189 | ======== | ||
| 190 | |||
| 191 | As mentioned earlier, the URL prefix determines which fetcher submodule | ||
| 192 | BitBake uses. Each submodule can support different URL parameters, which | ||
| 193 | are described in the following sections. | ||
| 194 | |||
| 195 | .. _local-file-fetcher: | ||
| 196 | |||
| 197 | Local file fetcher (``file://``) | ||
| 198 | -------------------------------- | ||
| 199 | |||
| 200 | This submodule handles URLs that begin with ``file://``. The filename | ||
| 201 | you specify within the URL can be either an absolute or relative path to | ||
| 202 | a file. If the filename is relative, the contents of the | ||
| 203 | :term:`FILESPATH` variable is used in the same way | ||
| 204 | ``PATH`` is used to find executables. If the file cannot be found, it is | ||
| 205 | assumed that it is available in :term:`DL_DIR` by the | ||
| 206 | time the ``download()`` method is called. | ||
| 207 | |||
| 208 | If you specify a directory, the entire directory is unpacked. | ||
| 209 | |||
| 210 | Here are a couple of example URLs, the first relative and the second | ||
| 211 | absolute:: | ||
| 212 | |||
| 213 | SRC_URI = "file://relativefile.patch" | ||
| 214 | SRC_URI = "file:///Users/ich/very_important_software" | ||
| 215 | |||
| 216 | .. _http-ftp-fetcher: | ||
| 217 | |||
| 218 | HTTP/FTP wget fetcher (``http://``, ``ftp://``, ``https://``) | ||
| 219 | ------------------------------------------------------------- | ||
| 220 | |||
| 221 | This fetcher obtains files from web and FTP servers. Internally, the | ||
| 222 | fetcher uses the wget utility. | ||
| 223 | |||
| 224 | The executable and parameters used are specified by the | ||
| 225 | ``FETCHCMD_wget`` variable, which defaults to sensible values. The | ||
| 226 | fetcher supports a parameter "downloadfilename" that allows the name of | ||
| 227 | the downloaded file to be specified. Specifying the name of the | ||
| 228 | downloaded file is useful for avoiding collisions in | ||
| 229 | :term:`DL_DIR` when dealing with multiple files that | ||
| 230 | have the same name. | ||
| 231 | |||
| 232 | If a username and password are specified in the ``SRC_URI``, a Basic | ||
| 233 | Authorization header will be added to each request, including across redirects. | ||
| 234 | To instead limit the Authorization header to the first request, add | ||
| 235 | "redirectauth=0" to the list of parameters. | ||
| 236 | |||
| 237 | Some example URLs are as follows:: | ||
| 238 | |||
| 239 | SRC_URI = "http://oe.handhelds.org/not_there.aac" | ||
| 240 | SRC_URI = "ftp://oe.handhelds.org/not_there_as_well.aac" | ||
| 241 | SRC_URI = "ftp://you@oe.handhelds.org/home/you/secret.plan" | ||
| 242 | |||
| 243 | .. note:: | ||
| 244 | |||
| 245 | Because URL parameters are delimited by semi-colons, this can | ||
| 246 | introduce ambiguity when parsing URLs that also contain semi-colons, | ||
| 247 | for example:: | ||
| 248 | |||
| 249 | SRC_URI = "http://abc123.org/git/?p=gcc/gcc.git;a=snapshot;h=a5dd47" | ||
| 250 | |||
| 251 | |||
| 252 | Such URLs should should be modified by replacing semi-colons with '&' | ||
| 253 | characters:: | ||
| 254 | |||
| 255 | SRC_URI = "http://abc123.org/git/?p=gcc/gcc.git&a=snapshot&h=a5dd47" | ||
| 256 | |||
| 257 | |||
| 258 | In most cases this should work. Treating semi-colons and '&' in | ||
| 259 | queries identically is recommended by the World Wide Web Consortium | ||
| 260 | (W3C). Note that due to the nature of the URL, you may have to | ||
| 261 | specify the name of the downloaded file as well:: | ||
| 262 | |||
| 263 | SRC_URI = "http://abc123.org/git/?p=gcc/gcc.git&a=snapshot&h=a5dd47;downloadfilename=myfile.bz2" | ||
| 264 | |||
| 265 | |||
| 266 | .. _cvs-fetcher: | ||
| 267 | |||
| 268 | CVS fetcher (``(cvs://``) | ||
| 269 | ------------------------- | ||
| 270 | |||
| 271 | This submodule handles checking out files from the CVS version control | ||
| 272 | system. You can configure it using a number of different variables: | ||
| 273 | |||
| 274 | - :term:`FETCHCMD_cvs <FETCHCMD>`: The name of the executable to use when running | ||
| 275 | the ``cvs`` command. This name is usually "cvs". | ||
| 276 | |||
| 277 | - :term:`SRCDATE`: The date to use when fetching the CVS source code. A | ||
| 278 | special value of "now" causes the checkout to be updated on every | ||
| 279 | build. | ||
| 280 | |||
| 281 | - :term:`CVSDIR`: Specifies where a temporary | ||
| 282 | checkout is saved. The location is often ``DL_DIR/cvs``. | ||
| 283 | |||
| 284 | - CVS_PROXY_HOST: The name to use as a "proxy=" parameter to the | ||
| 285 | ``cvs`` command. | ||
| 286 | |||
| 287 | - CVS_PROXY_PORT: The port number to use as a "proxyport=" | ||
| 288 | parameter to the ``cvs`` command. | ||
| 289 | |||
| 290 | As well as the standard username and password URL syntax, you can also | ||
| 291 | configure the fetcher with various URL parameters: | ||
| 292 | |||
| 293 | The supported parameters are as follows: | ||
| 294 | |||
| 295 | - *"method":* The protocol over which to communicate with the CVS | ||
| 296 | server. By default, this protocol is "pserver". If "method" is set to | ||
| 297 | "ext", BitBake examines the "rsh" parameter and sets ``CVS_RSH``. You | ||
| 298 | can use "dir" for local directories. | ||
| 299 | |||
| 300 | - *"module":* Specifies the module to check out. You must supply this | ||
| 301 | parameter. | ||
| 302 | |||
| 303 | - *"tag":* Describes which CVS TAG should be used for the checkout. By | ||
| 304 | default, the TAG is empty. | ||
| 305 | |||
| 306 | - *"date":* Specifies a date. If no "date" is specified, the | ||
| 307 | :term:`SRCDATE` of the configuration is used to | ||
| 308 | checkout a specific date. The special value of "now" causes the | ||
| 309 | checkout to be updated on every build. | ||
| 310 | |||
| 311 | - *"localdir":* Used to rename the module. Effectively, you are | ||
| 312 | renaming the output directory to which the module is unpacked. You | ||
| 313 | are forcing the module into a special directory relative to | ||
| 314 | :term:`CVSDIR`. | ||
| 315 | |||
| 316 | - *"rsh":* Used in conjunction with the "method" parameter. | ||
| 317 | |||
| 318 | - *"scmdata":* Causes the CVS metadata to be maintained in the tarball | ||
| 319 | the fetcher creates when set to "keep". The tarball is expanded into | ||
| 320 | the work directory. By default, the CVS metadata is removed. | ||
| 321 | |||
| 322 | - *"fullpath":* Controls whether the resulting checkout is at the | ||
| 323 | module level, which is the default, or is at deeper paths. | ||
| 324 | |||
| 325 | - *"norecurse":* Causes the fetcher to only checkout the specified | ||
| 326 | directory with no recurse into any subdirectories. | ||
| 327 | |||
| 328 | - *"port":* The port to which the CVS server connects. | ||
| 329 | |||
| 330 | Some example URLs are as follows:: | ||
| 331 | |||
| 332 | SRC_URI = "cvs://CVSROOT;module=mymodule;tag=some-version;method=ext" | ||
| 333 | SRC_URI = "cvs://CVSROOT;module=mymodule;date=20060126;localdir=usethat" | ||
| 334 | |||
| 335 | .. _svn-fetcher: | ||
| 336 | |||
| 337 | Subversion (SVN) Fetcher (``svn://``) | ||
| 338 | ------------------------------------- | ||
| 339 | |||
| 340 | This fetcher submodule fetches code from the Subversion source control | ||
| 341 | system. The executable used is specified by ``FETCHCMD_svn``, which | ||
| 342 | defaults to "svn". The fetcher's temporary working directory is set by | ||
| 343 | :term:`SVNDIR`, which is usually ``DL_DIR/svn``. | ||
| 344 | |||
| 345 | The supported parameters are as follows: | ||
| 346 | |||
| 347 | - *"module":* The name of the svn module to checkout. You must provide | ||
| 348 | this parameter. You can think of this parameter as the top-level | ||
| 349 | directory of the repository data you want. | ||
| 350 | |||
| 351 | - *"path_spec":* A specific directory in which to checkout the | ||
| 352 | specified svn module. | ||
| 353 | |||
| 354 | - *"protocol":* The protocol to use, which defaults to "svn". If | ||
| 355 | "protocol" is set to "svn+ssh", the "ssh" parameter is also used. | ||
| 356 | |||
| 357 | - *"rev":* The revision of the source code to checkout. | ||
| 358 | |||
| 359 | - *"scmdata":* Causes the ".svn" directories to be available during | ||
| 360 | compile-time when set to "keep". By default, these directories are | ||
| 361 | removed. | ||
| 362 | |||
| 363 | - *"ssh":* An optional parameter used when "protocol" is set to | ||
| 364 | "svn+ssh". You can use this parameter to specify the ssh program used | ||
| 365 | by svn. | ||
| 366 | |||
| 367 | - *"transportuser":* When required, sets the username for the | ||
| 368 | transport. By default, this parameter is empty. The transport | ||
| 369 | username is different than the username used in the main URL, which | ||
| 370 | is passed to the subversion command. | ||
| 371 | |||
| 372 | Following are three examples using svn:: | ||
| 373 | |||
| 374 | SRC_URI = "svn://myrepos/proj1;module=vip;protocol=http;rev=667" | ||
| 375 | SRC_URI = "svn://myrepos/proj1;module=opie;protocol=svn+ssh" | ||
| 376 | SRC_URI = "svn://myrepos/proj1;module=trunk;protocol=http;path_spec=${MY_DIR}/proj1" | ||
| 377 | |||
| 378 | .. _git-fetcher: | ||
| 379 | |||
| 380 | Git Fetcher (``git://``) | ||
| 381 | ------------------------ | ||
| 382 | |||
| 383 | This fetcher submodule fetches code from the Git source control system. | ||
| 384 | The fetcher works by creating a bare clone of the remote into | ||
| 385 | :term:`GITDIR`, which is usually ``DL_DIR/git2``. This | ||
| 386 | bare clone is then cloned into the work directory during the unpack | ||
| 387 | stage when a specific tree is checked out. This is done using alternates | ||
| 388 | and by reference to minimize the amount of duplicate data on the disk | ||
| 389 | and make the unpack process fast. The executable used can be set with | ||
| 390 | ``FETCHCMD_git``. | ||
| 391 | |||
| 392 | This fetcher supports the following parameters: | ||
| 393 | |||
| 394 | - *"protocol":* The protocol used to fetch the files. The default is | ||
| 395 | "git" when a hostname is set. If a hostname is not set, the Git | ||
| 396 | protocol is "file". You can also use "http", "https", "ssh" and | ||
| 397 | "rsync". | ||
| 398 | |||
| 399 | .. note:: | ||
| 400 | |||
| 401 | When ``protocol`` is "ssh", the URL expected in :term:`SRC_URI` differs | ||
| 402 | from the one that is typically passed to ``git clone`` command and provided | ||
| 403 | by the Git server to fetch from. For example, the URL returned by GitLab | ||
| 404 | server for ``mesa`` when cloning over SSH is | ||
| 405 | ``git@gitlab.freedesktop.org:mesa/mesa.git``, however the expected URL in | ||
| 406 | :term:`SRC_URI` is the following:: | ||
| 407 | |||
| 408 | SRC_URI = "git://git@gitlab.freedesktop.org/mesa/mesa.git;branch=main;protocol=ssh;..." | ||
| 409 | |||
| 410 | Note the ``:`` character changed for a ``/`` before the path to the project. | ||
| 411 | |||
| 412 | - *"nocheckout":* Tells the fetcher to not checkout source code when | ||
| 413 | unpacking when set to "1". Set this option for the URL where there is | ||
| 414 | a custom routine to checkout code. The default is "0". | ||
| 415 | |||
| 416 | - *"rebaseable":* Indicates that the upstream Git repository can be | ||
| 417 | rebased. You should set this parameter to "1" if revisions can become | ||
| 418 | detached from branches. In this case, the source mirror tarball is | ||
| 419 | done per revision, which has a loss of efficiency. Rebasing the | ||
| 420 | upstream Git repository could cause the current revision to disappear | ||
| 421 | from the upstream repository. This option reminds the fetcher to | ||
| 422 | preserve the local cache carefully for future use. The default value | ||
| 423 | for this parameter is "0". | ||
| 424 | |||
| 425 | - *"nobranch":* Tells the fetcher to not check the SHA validation for | ||
| 426 | the branch when set to "1". The default is "0". Set this option for | ||
| 427 | the recipe that refers to the commit that is valid for any namespace | ||
| 428 | (branch, tag, ...) instead of the branch. | ||
| 429 | |||
| 430 | - *"bareclone":* Tells the fetcher to clone a bare clone into the | ||
| 431 | destination directory without checking out a working tree. Only the | ||
| 432 | raw Git metadata is provided. This parameter implies the "nocheckout" | ||
| 433 | parameter as well. | ||
| 434 | |||
| 435 | - *"branch":* The branch(es) of the Git tree to clone. Unless | ||
| 436 | "nobranch" is set to "1", this is a mandatory parameter. The number of | ||
| 437 | branch parameters must match the number of name parameters. | ||
| 438 | |||
| 439 | - *"rev":* The revision to use for the checkout. If :term:`SRCREV` is also set, | ||
| 440 | this parameter must match its value. | ||
| 441 | |||
| 442 | - *"tag":* Specifies a tag to use when fetching. To correctly resolve | ||
| 443 | tags, BitBake must access the network. If a ``rev`` parameter or | ||
| 444 | :term:`SRCREV` is also specified, network access is not necessary to resolve | ||
| 445 | the tag and instead, it is verified that they both resolve to the same commit | ||
| 446 | SHA at unpack time. The ``tag`` parameter is optional, but strongly | ||
| 447 | recommended if the checked out revision is a tag. | ||
| 448 | |||
| 449 | - *"subpath":* Limits the checkout to a specific subpath of the tree. | ||
| 450 | By default, the whole tree is checked out. | ||
| 451 | |||
| 452 | - *"destsuffix":* The name of the path in which to place the checkout. | ||
| 453 | By default, the path is ``git/``. | ||
| 454 | |||
| 455 | - *"usehead":* Enables local ``git://`` URLs to use the current branch | ||
| 456 | HEAD as the revision for use with ``AUTOREV``. The "usehead" | ||
| 457 | parameter implies no branch and only works when the transfer protocol | ||
| 458 | is ``file://``. | ||
| 459 | |||
| 460 | Here are some example URLs:: | ||
| 461 | |||
| 462 | SRC_URI = "git://github.com/fronteed/icheck.git;protocol=https;branch=${PV};tag=${PV}" | ||
| 463 | SRC_URI = "git://github.com/asciidoc/asciidoc-py;protocol=https;branch=main" | ||
| 464 | SRC_URI = "git://git@gitlab.freedesktop.org/mesa/mesa.git;branch=main;protocol=ssh;..." | ||
| 465 | |||
| 466 | .. note:: | ||
| 467 | |||
| 468 | Specifying passwords directly in ``git://`` urls is not supported. | ||
| 469 | There are several reasons: :term:`SRC_URI` is often written out to logs and | ||
| 470 | other places, and that could easily leak passwords; it is also all too | ||
| 471 | easy to share metadata without removing passwords. SSH keys, ``~/.netrc`` | ||
| 472 | and ``~/.ssh/config`` files can be used as alternatives. | ||
| 473 | |||
| 474 | Using tags with the git fetcher may cause surprising behaviour. Bitbake needs to | ||
| 475 | resolve the tag to a specific revision and to do that, it has to connect to and use | ||
| 476 | the upstream repository. This is because the revision the tags point at can change and | ||
| 477 | we've seen cases of this happening in well known public repositories. This can mean | ||
| 478 | many more network connections than expected and recipes may be reparsed at every build. | ||
| 479 | Source mirrors will also be bypassed as the upstream repository is the only source | ||
| 480 | of truth to resolve the revision accurately. For these reasons, whilst the fetcher | ||
| 481 | can support tags, we recommend being specific about revisions in recipes. | ||
| 482 | |||
| 483 | .. _gitsm-fetcher: | ||
| 484 | |||
| 485 | Git Submodule Fetcher (``gitsm://``) | ||
| 486 | ------------------------------------ | ||
| 487 | |||
| 488 | This fetcher submodule inherits from the :ref:`Git | ||
| 489 | fetcher<bitbake-user-manual/bitbake-user-manual-fetching:git fetcher | ||
| 490 | (\`\`git://\`\`)>` and extends that fetcher's behavior by fetching a | ||
| 491 | repository's submodules. :term:`SRC_URI` is passed to the Git fetcher as | ||
| 492 | described in the :ref:`bitbake-user-manual/bitbake-user-manual-fetching:git | ||
| 493 | fetcher (\`\`git://\`\`)` section. | ||
| 494 | |||
| 495 | .. note:: | ||
| 496 | |||
| 497 | You must clean a recipe when switching between '``git://``' and | ||
| 498 | '``gitsm://``' URLs. | ||
| 499 | |||
| 500 | The Git Submodules fetcher is not a complete fetcher implementation. | ||
| 501 | The fetcher has known issues where it does not use the normal source | ||
| 502 | mirroring infrastructure properly. Further, the submodule sources it | ||
| 503 | fetches are not visible to the licensing and source archiving | ||
| 504 | infrastructures. | ||
| 505 | |||
| 506 | .. _clearcase-fetcher: | ||
| 507 | |||
| 508 | ClearCase Fetcher (``ccrc://``) | ||
| 509 | ------------------------------- | ||
| 510 | |||
| 511 | This fetcher submodule fetches code from a | ||
| 512 | `ClearCase <http://en.wikipedia.org/wiki/Rational_ClearCase>`__ | ||
| 513 | repository. | ||
| 514 | |||
| 515 | To use this fetcher, make sure your recipe has proper | ||
| 516 | :term:`SRC_URI`, :term:`SRCREV`, and | ||
| 517 | :term:`PV` settings. Here is an example:: | ||
| 518 | |||
| 519 | SRC_URI = "ccrc://cc.example.org/ccrc;vob=/example_vob;module=/example_module" | ||
| 520 | SRCREV = "EXAMPLE_CLEARCASE_TAG" | ||
| 521 | PV = "${@d.getVar("SRCREV", False).replace("/", "+")}" | ||
| 522 | |||
| 523 | The fetcher uses the ``rcleartool`` or | ||
| 524 | ``cleartool`` remote client, depending on which one is available. | ||
| 525 | |||
| 526 | Following are options for the :term:`SRC_URI` statement: | ||
| 527 | |||
| 528 | - *vob*: The name, which must include the prepending "/" character, | ||
| 529 | of the ClearCase VOB. This option is required. | ||
| 530 | |||
| 531 | - *module*: The module, which must include the prepending "/" | ||
| 532 | character, in the selected VOB. | ||
| 533 | |||
| 534 | .. note:: | ||
| 535 | |||
| 536 | The module and vob options are combined to create the load rule in the | ||
| 537 | view config spec. As an example, consider the vob and module values from | ||
| 538 | the SRC_URI statement at the start of this section. Combining those values | ||
| 539 | results in the following:: | ||
| 540 | |||
| 541 | load /example_vob/example_module | ||
| 542 | |||
| 543 | - *proto*: The protocol, which can be either ``http`` or ``https``. | ||
| 544 | |||
| 545 | By default, the fetcher creates a configuration specification. If you | ||
| 546 | want this specification written to an area other than the default, use | ||
| 547 | the ``CCASE_CUSTOM_CONFIG_SPEC`` variable in your recipe to define where | ||
| 548 | the specification is written. | ||
| 549 | |||
| 550 | .. note:: | ||
| 551 | |||
| 552 | the SRCREV loses its functionality if you specify this variable. However, | ||
| 553 | SRCREV is still used to label the archive after a fetch even though it does | ||
| 554 | not define what is fetched. | ||
| 555 | |||
| 556 | Here are a couple of other behaviors worth mentioning: | ||
| 557 | |||
| 558 | - When using ``cleartool``, the login of ``cleartool`` is handled by | ||
| 559 | the system. The login require no special steps. | ||
| 560 | |||
| 561 | - In order to use ``rcleartool`` with authenticated users, an | ||
| 562 | "rcleartool login" is necessary before using the fetcher. | ||
| 563 | |||
| 564 | .. _perforce-fetcher: | ||
| 565 | |||
| 566 | Perforce Fetcher (``p4://``) | ||
| 567 | ---------------------------- | ||
| 568 | |||
| 569 | This fetcher submodule fetches code from the | ||
| 570 | `Perforce <https://www.perforce.com/>`__ source control system. The | ||
| 571 | executable used is specified by ``FETCHCMD_p4``, which defaults to "p4". | ||
| 572 | The fetcher's temporary working directory is set by | ||
| 573 | :term:`P4DIR`, which defaults to "DL_DIR/p4". | ||
| 574 | The fetcher does not make use of a perforce client, instead it | ||
| 575 | relies on ``p4 files`` to retrieve a list of | ||
| 576 | files and ``p4 print`` to transfer the content | ||
| 577 | of those files locally. | ||
| 578 | |||
| 579 | To use this fetcher, make sure your recipe has proper | ||
| 580 | :term:`SRC_URI`, :term:`SRCREV`, and | ||
| 581 | :term:`PV` values. The p4 executable is able to use the | ||
| 582 | config file defined by your system's ``P4CONFIG`` environment variable | ||
| 583 | in order to define the Perforce server URL and port, username, and | ||
| 584 | password if you do not wish to keep those values in a recipe itself. If | ||
| 585 | you choose not to use ``P4CONFIG``, or to explicitly set variables that | ||
| 586 | ``P4CONFIG`` can contain, you can specify the ``P4PORT`` value, which is | ||
| 587 | the server's URL and port number, and you can specify a username and | ||
| 588 | password directly in your recipe within :term:`SRC_URI`. | ||
| 589 | |||
| 590 | Here is an example that relies on ``P4CONFIG`` to specify the server URL | ||
| 591 | and port, username, and password, and fetches the Head Revision:: | ||
| 592 | |||
| 593 | SRC_URI = "p4://example-depot/main/source/..." | ||
| 594 | SRCREV = "${AUTOREV}" | ||
| 595 | PV = "p4-${SRCPV}" | ||
| 596 | S = "${UNPACKDIR}/p4" | ||
| 597 | |||
| 598 | Here is an example that specifies the server URL and port, username, and | ||
| 599 | password, and fetches a Revision based on a Label:: | ||
| 600 | |||
| 601 | P4PORT = "tcp:p4server.example.net:1666" | ||
| 602 | SRC_URI = "p4://user:passwd@example-depot/main/source/..." | ||
| 603 | SRCREV = "release-1.0" | ||
| 604 | PV = "p4-${SRCPV}" | ||
| 605 | S = "${UNPACKDIR}/p4" | ||
| 606 | |||
| 607 | .. note:: | ||
| 608 | |||
| 609 | You should always set S to "${UNPACKDIR}/p4" in your recipe. | ||
| 610 | |||
| 611 | By default, the fetcher strips the depot location from the local file paths. In | ||
| 612 | the above example, the content of ``example-depot/main/source/`` will be placed | ||
| 613 | in ``${UNPACKDIR}/p4``. For situations where preserving parts of the remote depot | ||
| 614 | paths locally is desirable, the fetcher supports two parameters: | ||
| 615 | |||
| 616 | - *"module":* | ||
| 617 | The top-level depot location or directory to fetch. The value of this | ||
| 618 | parameter can also point to a single file within the depot, in which case | ||
| 619 | the local file path will include the module path. | ||
| 620 | - *"remotepath":* | ||
| 621 | When used with the value "``keep``", the fetcher will mirror the full depot | ||
| 622 | paths locally for the specified location, even in combination with the | ||
| 623 | ``module`` parameter. | ||
| 624 | |||
| 625 | Here is an example use of the the ``module`` parameter:: | ||
| 626 | |||
| 627 | SRC_URI = "p4://user:passwd@example-depot/main;module=source/..." | ||
| 628 | |||
| 629 | In this case, the content of the top-level directory ``source/`` will be fetched | ||
| 630 | to ``${P4DIR}``, including the directory itself. The top-level directory will | ||
| 631 | be accesible at ``${P4DIR}/source/``. | ||
| 632 | |||
| 633 | Here is an example use of the the ``remotepath`` parameter:: | ||
| 634 | |||
| 635 | SRC_URI = "p4://user:passwd@example-depot/main;module=source/...;remotepath=keep" | ||
| 636 | |||
| 637 | In this case, the content of the top-level directory ``source/`` will be fetched | ||
| 638 | to ``${P4DIR}``, but the complete depot paths will be mirrored locally. The | ||
| 639 | top-level directory will be accessible at | ||
| 640 | ``${P4DIR}/example-depot/main/source/``. | ||
| 641 | |||
| 642 | .. _repo-fetcher: | ||
| 643 | |||
| 644 | Repo Fetcher (``repo://``) | ||
| 645 | -------------------------- | ||
| 646 | |||
| 647 | This fetcher submodule fetches code from ``google-repo`` source control | ||
| 648 | system. The fetcher works by initiating and syncing sources of the | ||
| 649 | repository into :term:`REPODIR`, which is usually | ||
| 650 | ``${DL_DIR}/repo``. | ||
| 651 | |||
| 652 | This fetcher supports the following parameters: | ||
| 653 | |||
| 654 | - *"protocol":* Protocol to fetch the repository manifest (default: | ||
| 655 | git). | ||
| 656 | |||
| 657 | - *"branch":* Branch or tag of repository to get (default: master). | ||
| 658 | |||
| 659 | - *"manifest":* Name of the manifest file (default: ``default.xml``). | ||
| 660 | |||
| 661 | Here are some example URLs:: | ||
| 662 | |||
| 663 | SRC_URI = "repo://REPOROOT;protocol=git;branch=some_branch;manifest=my_manifest.xml" | ||
| 664 | SRC_URI = "repo://REPOROOT;protocol=file;branch=some_branch;manifest=my_manifest.xml" | ||
| 665 | |||
| 666 | .. _az-fetcher: | ||
| 667 | |||
| 668 | Az Fetcher (``az://``) | ||
| 669 | -------------------------- | ||
| 670 | |||
| 671 | This submodule fetches data from an | ||
| 672 | `Azure Storage account <https://docs.microsoft.com/en-us/azure/storage/>`__ , | ||
| 673 | it inherits its functionality from the HTTP wget fetcher, but modifies its | ||
| 674 | behavior to accomodate the usage of a | ||
| 675 | `Shared Access Signature (SAS) <https://docs.microsoft.com/en-us/azure/storage/common/storage-sas-overview>`__ | ||
| 676 | for non-public data. | ||
| 677 | |||
| 678 | Such functionality is set by the variable: | ||
| 679 | |||
| 680 | - :term:`AZ_SAS`: The Azure Storage Shared Access Signature provides secure | ||
| 681 | delegate access to resources, if this variable is set, the Az Fetcher will | ||
| 682 | use it when fetching artifacts from the cloud. | ||
| 683 | |||
| 684 | You can specify the AZ_SAS variable prefixed with a ? as shown below:: | ||
| 685 | |||
| 686 | AZ_SAS = "?se=2021-01-01&sp=r&sv=2018-11-09&sr=c&skoid=<skoid>&sig=<signature>" | ||
| 687 | |||
| 688 | Here is an example URL:: | ||
| 689 | |||
| 690 | SRC_URI = "az://<azure-storage-account>.blob.core.windows.net/<foo_container>/<bar_file>" | ||
| 691 | |||
| 692 | It can also be used when setting mirrors definitions using the :term:`PREMIRRORS` variable. | ||
| 693 | |||
| 694 | .. _gcp-fetcher: | ||
| 695 | |||
| 696 | GCP Fetcher (``gs://``) | ||
| 697 | -------------------------- | ||
| 698 | |||
| 699 | This submodule fetches data from a | ||
| 700 | `Google Cloud Storage Bucket <https://cloud.google.com/storage/docs/buckets>`__. | ||
| 701 | It uses the `Google Cloud Storage Python Client <https://cloud.google.com/python/docs/reference/storage/latest>`__ | ||
| 702 | to check the status of objects in the bucket and download them. | ||
| 703 | The use of the Python client makes it substantially faster than using command | ||
| 704 | line tools such as gsutil. | ||
| 705 | |||
| 706 | The fetcher requires the Google Cloud Storage Python Client to be installed, along | ||
| 707 | with the gsutil tool. | ||
| 708 | |||
| 709 | The fetcher requires that the machine has valid credentials for accessing the | ||
| 710 | chosen bucket. Instructions for authentication can be found in the | ||
| 711 | `Google Cloud documentation <https://cloud.google.com/docs/authentication/provide-credentials-adc#local-dev>`__. | ||
| 712 | |||
| 713 | If it used from the OpenEmbedded build system, the fetcher can be used for | ||
| 714 | fetching sstate artifacts from a GCS bucket by specifying the | ||
| 715 | ``SSTATE_MIRRORS`` variable as shown below:: | ||
| 716 | |||
| 717 | SSTATE_MIRRORS ?= "\ | ||
| 718 | file://.* gs://<bucket name>/PATH \ | ||
| 719 | " | ||
| 720 | |||
| 721 | The fetcher can also be used in recipes:: | ||
| 722 | |||
| 723 | SRC_URI = "gs://<bucket name>/<foo_container>/<bar_file>" | ||
| 724 | |||
| 725 | However, the checksum of the file should be also be provided:: | ||
| 726 | |||
| 727 | SRC_URI[sha256sum] = "<sha256 string>" | ||
| 728 | |||
| 729 | .. _crate-fetcher: | ||
| 730 | |||
| 731 | Crate Fetcher (``crate://``) | ||
| 732 | ---------------------------- | ||
| 733 | |||
| 734 | This submodule fetches code for | ||
| 735 | `Rust language "crates" <https://doc.rust-lang.org/reference/glossary.html?highlight=crate#crate>`__ | ||
| 736 | corresponding to Rust libraries and programs to compile. Such crates are typically shared | ||
| 737 | on https://crates.io/ but this fetcher supports other crate registries too. | ||
| 738 | |||
| 739 | The format for the :term:`SRC_URI` setting must be:: | ||
| 740 | |||
| 741 | SRC_URI = "crate://REGISTRY/NAME/VERSION" | ||
| 742 | |||
| 743 | Here is an example URL:: | ||
| 744 | |||
| 745 | SRC_URI = "crate://crates.io/glob/0.2.11" | ||
| 746 | |||
| 747 | .. _npm-fetcher: | ||
| 748 | |||
| 749 | NPM Fetcher (``npm://``) | ||
| 750 | ------------------------ | ||
| 751 | |||
| 752 | This submodule fetches source code from an | ||
| 753 | `NPM <https://en.wikipedia.org/wiki/Npm_(software)>`__ | ||
| 754 | Javascript package registry. | ||
| 755 | |||
| 756 | The format for the :term:`SRC_URI` setting must be:: | ||
| 757 | |||
| 758 | SRC_URI = "npm://some.registry.url;ParameterA=xxx;ParameterB=xxx;..." | ||
| 759 | |||
| 760 | This fetcher supports the following parameters: | ||
| 761 | |||
| 762 | - *"package":* The NPM package name. This is a mandatory parameter. | ||
| 763 | |||
| 764 | - *"version":* The NPM package version. This is a mandatory parameter. | ||
| 765 | |||
| 766 | - *"downloadfilename":* Specifies the filename used when storing the downloaded file. | ||
| 767 | |||
| 768 | - *"destsuffix":* Specifies the directory to use to unpack the package (default: ``npm``). | ||
| 769 | |||
| 770 | Note that NPM fetcher only fetches the package source itself. The dependencies | ||
| 771 | can be fetched through the `npmsw-fetcher`_. | ||
| 772 | |||
| 773 | Here is an example URL with both fetchers:: | ||
| 774 | |||
| 775 | SRC_URI = " \ | ||
| 776 | npm://registry.npmjs.org/;package=cute-files;version=${PV} \ | ||
| 777 | npmsw://${THISDIR}/${BPN}/npm-shrinkwrap.json \ | ||
| 778 | " | ||
| 779 | |||
| 780 | See :yocto_docs:`Creating Node Package Manager (NPM) Packages | ||
| 781 | </dev-manual/packages.html#creating-node-package-manager-npm-packages>` | ||
| 782 | in the Yocto Project manual for details about using | ||
| 783 | :yocto_docs:`devtool <https://docs.yoctoproject.org/ref-manual/devtool-reference.html>` | ||
| 784 | to automatically create a recipe from an NPM URL. | ||
| 785 | |||
| 786 | .. _npmsw-fetcher: | ||
| 787 | |||
| 788 | NPM shrinkwrap Fetcher (``npmsw://``) | ||
| 789 | ------------------------------------- | ||
| 790 | |||
| 791 | This submodule fetches source code from an | ||
| 792 | `NPM shrinkwrap <https://docs.npmjs.com/cli/v8/commands/npm-shrinkwrap>`__ | ||
| 793 | description file, which lists the dependencies | ||
| 794 | of an NPM package while locking their versions. | ||
| 795 | |||
| 796 | The format for the :term:`SRC_URI` setting must be:: | ||
| 797 | |||
| 798 | SRC_URI = "npmsw://some.registry.url;ParameterA=xxx;ParameterB=xxx;..." | ||
| 799 | |||
| 800 | This fetcher supports the following parameters: | ||
| 801 | |||
| 802 | - *"dev":* Set this parameter to ``1`` to install "devDependencies". | ||
| 803 | |||
| 804 | - *"destsuffix":* Specifies the directory to use to unpack the dependencies | ||
| 805 | (``${S}`` by default). | ||
| 806 | |||
| 807 | Note that the shrinkwrap file can also be provided by the recipe for | ||
| 808 | the package which has such dependencies, for example:: | ||
| 809 | |||
| 810 | SRC_URI = " \ | ||
| 811 | npm://registry.npmjs.org/;package=cute-files;version=${PV} \ | ||
| 812 | npmsw://${THISDIR}/${BPN}/npm-shrinkwrap.json \ | ||
| 813 | " | ||
| 814 | |||
| 815 | Such a file can automatically be generated using | ||
| 816 | :yocto_docs:`devtool <https://docs.yoctoproject.org/ref-manual/devtool-reference.html>` | ||
| 817 | as described in the :yocto_docs:`Creating Node Package Manager (NPM) Packages | ||
| 818 | </dev-manual/packages.html#creating-node-package-manager-npm-packages>` | ||
| 819 | section of the Yocto Project. | ||
| 820 | |||
| 821 | Other Fetchers | ||
| 822 | -------------- | ||
| 823 | |||
| 824 | Fetch submodules also exist for the following: | ||
| 825 | |||
| 826 | - Bazaar (``bzr://``) | ||
| 827 | |||
| 828 | - Mercurial (``hg://``) | ||
| 829 | |||
| 830 | - OSC (``osc://``) | ||
| 831 | |||
| 832 | - S3 (``s3://``) | ||
| 833 | |||
| 834 | - Secure FTP (``sftp://``) | ||
| 835 | |||
| 836 | - Secure Shell (``ssh://``) | ||
| 837 | |||
| 838 | - Trees using Git Annex (``gitannex://``) | ||
| 839 | |||
| 840 | No documentation currently exists for these lesser used fetcher | ||
| 841 | submodules. However, you might find the code helpful and readable. | ||
| 842 | |||
| 843 | Auto Revisions | ||
| 844 | ============== | ||
| 845 | |||
| 846 | We need to document ``AUTOREV`` and :term:`SRCREV_FORMAT` here. | ||
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-hello.rst b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-hello.rst deleted file mode 100644 index 654196ca24..0000000000 --- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-hello.rst +++ /dev/null | |||
| @@ -1,408 +0,0 @@ | |||
| 1 | .. SPDX-License-Identifier: CC-BY-2.5 | ||
| 2 | |||
| 3 | =================== | ||
| 4 | Hello World Example | ||
| 5 | =================== | ||
| 6 | |||
| 7 | BitBake Hello World | ||
| 8 | =================== | ||
| 9 | |||
| 10 | The simplest example commonly used to demonstrate any new programming | ||
| 11 | language or tool is the "`Hello | ||
| 12 | World <http://en.wikipedia.org/wiki/Hello_world_program>`__" example. | ||
| 13 | This appendix demonstrates, in tutorial form, Hello World within the | ||
| 14 | context of BitBake. The tutorial describes how to create a new project | ||
| 15 | and the applicable metadata files necessary to allow BitBake to build | ||
| 16 | it. | ||
| 17 | |||
| 18 | Obtaining BitBake | ||
| 19 | ================= | ||
| 20 | |||
| 21 | See the :ref:`bitbake-user-manual/bitbake-user-manual-intro:obtaining bitbake` section for | ||
| 22 | information on how to obtain BitBake. Once you have the source code on | ||
| 23 | your machine, the BitBake directory appears as follows:: | ||
| 24 | |||
| 25 | $ ls -al | ||
| 26 | total 108 | ||
| 27 | drwxr-xr-x 9 fawkh 10000 4096 feb 24 12:10 . | ||
| 28 | drwx------ 36 fawkh 10000 4096 mar 2 17:00 .. | ||
| 29 | -rw-r--r-- 1 fawkh 10000 365 feb 24 12:10 AUTHORS | ||
| 30 | drwxr-xr-x 2 fawkh 10000 4096 feb 24 12:10 bin | ||
| 31 | -rw-r--r-- 1 fawkh 10000 16501 feb 24 12:10 ChangeLog | ||
| 32 | drwxr-xr-x 2 fawkh 10000 4096 feb 24 12:10 classes | ||
| 33 | drwxr-xr-x 2 fawkh 10000 4096 feb 24 12:10 conf | ||
| 34 | drwxr-xr-x 5 fawkh 10000 4096 feb 24 12:10 contrib | ||
| 35 | drwxr-xr-x 6 fawkh 10000 4096 feb 24 12:10 doc | ||
| 36 | drwxr-xr-x 8 fawkh 10000 4096 mar 2 16:26 .git | ||
| 37 | -rw-r--r-- 1 fawkh 10000 31 feb 24 12:10 .gitattributes | ||
| 38 | -rw-r--r-- 1 fawkh 10000 392 feb 24 12:10 .gitignore | ||
| 39 | drwxr-xr-x 13 fawkh 10000 4096 feb 24 12:11 lib | ||
| 40 | -rw-r--r-- 1 fawkh 10000 1224 feb 24 12:10 LICENSE | ||
| 41 | -rw-r--r-- 1 fawkh 10000 15394 feb 24 12:10 LICENSE.GPL-2.0-only | ||
| 42 | -rw-r--r-- 1 fawkh 10000 1286 feb 24 12:10 LICENSE.MIT | ||
| 43 | -rw-r--r-- 1 fawkh 10000 229 feb 24 12:10 MANIFEST.in | ||
| 44 | -rw-r--r-- 1 fawkh 10000 2413 feb 24 12:10 README | ||
| 45 | -rw-r--r-- 1 fawkh 10000 43 feb 24 12:10 toaster-requirements.txt | ||
| 46 | -rw-r--r-- 1 fawkh 10000 2887 feb 24 12:10 TODO | ||
| 47 | |||
| 48 | At this point, you should have BitBake cloned to a directory that | ||
| 49 | matches the previous listing except for dates and user names. | ||
| 50 | |||
| 51 | Setting Up the BitBake Environment | ||
| 52 | ================================== | ||
| 53 | |||
| 54 | First, you need to be sure that you can run BitBake. Set your working | ||
| 55 | directory to where your local BitBake files are and run the following | ||
| 56 | command:: | ||
| 57 | |||
| 58 | $ ./bin/bitbake --version | ||
| 59 | BitBake Build Tool Core version 2.3.1 | ||
| 60 | |||
| 61 | The console output tells you what version | ||
| 62 | you are running. | ||
| 63 | |||
| 64 | The recommended method to run BitBake is from a directory of your | ||
| 65 | choice. To be able to run BitBake from any directory, you need to add | ||
| 66 | the executable binary to your binary to your shell's environment | ||
| 67 | ``PATH`` variable. First, look at your current ``PATH`` variable by | ||
| 68 | entering the following:: | ||
| 69 | |||
| 70 | $ echo $PATH | ||
| 71 | |||
| 72 | Next, add the directory location | ||
| 73 | for the BitBake binary to the ``PATH``. Here is an example that adds the | ||
| 74 | ``/home/scott-lenovo/bitbake/bin`` directory to the front of the | ||
| 75 | ``PATH`` variable:: | ||
| 76 | |||
| 77 | $ export PATH=/home/scott-lenovo/bitbake/bin:$PATH | ||
| 78 | |||
| 79 | You should now be able to enter the ``bitbake`` command from the command | ||
| 80 | line while working from any directory. | ||
| 81 | |||
| 82 | The Hello World Example | ||
| 83 | ======================= | ||
| 84 | |||
| 85 | The overall goal of this exercise is to build a complete "Hello World" | ||
| 86 | example utilizing task and layer concepts. Because this is how modern | ||
| 87 | projects such as OpenEmbedded and the Yocto Project utilize BitBake, the | ||
| 88 | example provides an excellent starting point for understanding BitBake. | ||
| 89 | |||
| 90 | To help you understand how to use BitBake to build targets, the example | ||
| 91 | starts with nothing but the ``bitbake`` command, which causes BitBake to | ||
| 92 | fail and report problems. The example progresses by adding pieces to the | ||
| 93 | build to eventually conclude with a working, minimal "Hello World" | ||
| 94 | example. | ||
| 95 | |||
| 96 | While every attempt is made to explain what is happening during the | ||
| 97 | example, the descriptions cannot cover everything. You can find further | ||
| 98 | information throughout this manual. Also, you can actively participate | ||
| 99 | in the :oe_lists:`/g/bitbake-devel` | ||
| 100 | discussion mailing list about the BitBake build tool. | ||
| 101 | |||
| 102 | .. note:: | ||
| 103 | |||
| 104 | This example was inspired by and drew heavily from | ||
| 105 | `Mailing List post - The BitBake equivalent of "Hello, World!" | ||
| 106 | <https://www.mail-archive.com/yocto@yoctoproject.org/msg09379.html>`_. | ||
| 107 | |||
| 108 | As stated earlier, the goal of this example is to eventually compile | ||
| 109 | "Hello World". However, it is unknown what BitBake needs and what you | ||
| 110 | have to provide in order to achieve that goal. Recall that BitBake | ||
| 111 | utilizes three types of metadata files: | ||
| 112 | :ref:`bitbake-user-manual/bitbake-user-manual-intro:configuration files`, | ||
| 113 | :ref:`bitbake-user-manual/bitbake-user-manual-intro:classes`, and | ||
| 114 | :ref:`bitbake-user-manual/bitbake-user-manual-intro:recipes`. | ||
| 115 | But where do they go? How does BitBake find | ||
| 116 | them? BitBake's error messaging helps you answer these types of | ||
| 117 | questions and helps you better understand exactly what is going on. | ||
| 118 | |||
| 119 | Following is the complete "Hello World" example. | ||
| 120 | |||
| 121 | #. **Create a Project Directory:** First, set up a directory for the | ||
| 122 | "Hello World" project. Here is how you can do so in your home | ||
| 123 | directory:: | ||
| 124 | |||
| 125 | $ mkdir ~/hello | ||
| 126 | $ cd ~/hello | ||
| 127 | |||
| 128 | This is the directory that | ||
| 129 | BitBake will use to do all of its work. You can use this directory | ||
| 130 | to keep all the metafiles needed by BitBake. Having a project | ||
| 131 | directory is a good way to isolate your project. | ||
| 132 | |||
| 133 | #. **Run BitBake:** At this point, you have nothing but a project | ||
| 134 | directory. Run the ``bitbake`` command and see what it does:: | ||
| 135 | |||
| 136 | $ bitbake | ||
| 137 | ERROR: The BBPATH variable is not set and bitbake did not find a conf/bblayers.conf file in the expected location. | ||
| 138 | Maybe you accidentally invoked bitbake from the wrong directory? | ||
| 139 | |||
| 140 | When you run BitBake, it begins looking for metadata files. The | ||
| 141 | :term:`BBPATH` variable is what tells BitBake where | ||
| 142 | to look for those files. :term:`BBPATH` is not set and you need to set | ||
| 143 | it. Without :term:`BBPATH`, BitBake cannot find any configuration files | ||
| 144 | (``.conf``) or recipe files (``.bb``) at all. BitBake also cannot | ||
| 145 | find the ``bitbake.conf`` file. | ||
| 146 | |||
| 147 | #. **Setting BBPATH:** For this example, you can set :term:`BBPATH` in | ||
| 148 | the same manner that you set ``PATH`` earlier in the appendix. You | ||
| 149 | should realize, though, that it is much more flexible to set the | ||
| 150 | :term:`BBPATH` variable up in a configuration file for each project. | ||
| 151 | |||
| 152 | From your shell, enter the following commands to set and export the | ||
| 153 | :term:`BBPATH` variable:: | ||
| 154 | |||
| 155 | $ BBPATH="projectdirectory" | ||
| 156 | $ export BBPATH | ||
| 157 | |||
| 158 | Use your actual project directory in the command. BitBake uses that | ||
| 159 | directory to find the metadata it needs for your project. | ||
| 160 | |||
| 161 | .. note:: | ||
| 162 | |||
| 163 | When specifying your project directory, do not use the tilde | ||
| 164 | ("~") character as BitBake does not expand that character as the | ||
| 165 | shell would. | ||
| 166 | |||
| 167 | #. **Run BitBake:** Now that you have :term:`BBPATH` defined, run the | ||
| 168 | ``bitbake`` command again:: | ||
| 169 | |||
| 170 | $ bitbake | ||
| 171 | ERROR: Unable to parse /home/scott-lenovo/bitbake/lib/bb/parse/__init__.py | ||
| 172 | Traceback (most recent call last): | ||
| 173 | File "/home/scott-lenovo/bitbake/lib/bb/parse/__init__.py", line 127, in resolve_file(fn='conf/bitbake.conf', d=<bb.data_smart.DataSmart object at 0x7f22919a3df0>): | ||
| 174 | if not newfn: | ||
| 175 | > raise IOError(errno.ENOENT, "file %s not found in %s" % (fn, bbpath)) | ||
| 176 | fn = newfn | ||
| 177 | FileNotFoundError: [Errno 2] file conf/bitbake.conf not found in <projectdirectory> | ||
| 178 | |||
| 179 | |||
| 180 | This sample output shows that BitBake could not find the | ||
| 181 | ``conf/bitbake.conf`` file in the project directory. This file is | ||
| 182 | the first thing BitBake must find in order to build a target. And, | ||
| 183 | since the project directory for this example is empty, you need to | ||
| 184 | provide a ``conf/bitbake.conf`` file. | ||
| 185 | |||
| 186 | #. **Creating conf/bitbake.conf:** The ``conf/bitbake.conf`` includes | ||
| 187 | a number of configuration variables BitBake uses for metadata and | ||
| 188 | recipe files. For this example, you need to create the file in your | ||
| 189 | project directory and define some key BitBake variables. For more | ||
| 190 | information on the ``bitbake.conf`` file, see | ||
| 191 | https://git.openembedded.org/bitbake/tree/conf/bitbake.conf. | ||
| 192 | |||
| 193 | Use the following commands to create the ``conf`` directory in the | ||
| 194 | project directory:: | ||
| 195 | |||
| 196 | $ mkdir conf | ||
| 197 | |||
| 198 | From within the ``conf`` directory, | ||
| 199 | use some editor to create the ``bitbake.conf`` so that it contains | ||
| 200 | the following:: | ||
| 201 | |||
| 202 | PN = "${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[0] or 'defaultpkgname'}" | ||
| 203 | |||
| 204 | TMPDIR = "${TOPDIR}/tmp" | ||
| 205 | CACHE = "${TMPDIR}/cache" | ||
| 206 | STAMP = "${TMPDIR}/${PN}/stamps" | ||
| 207 | T = "${TMPDIR}/${PN}/work" | ||
| 208 | B = "${TMPDIR}/${PN}" | ||
| 209 | |||
| 210 | .. note:: | ||
| 211 | |||
| 212 | Without a value for :term:`PN`, the variables :term:`STAMP`, :term:`T`, and :term:`B`, prevent more | ||
| 213 | than one recipe from working. You can fix this by either setting :term:`PN` to | ||
| 214 | have a value similar to what OpenEmbedded and BitBake use in the default | ||
| 215 | ``bitbake.conf`` file (see previous example). Or, by manually updating each | ||
| 216 | recipe to set :term:`PN`. You will also need to include :term:`PN` as part of the :term:`STAMP`, | ||
| 217 | :term:`T`, and :term:`B` variable definitions in the ``local.conf`` file. | ||
| 218 | |||
| 219 | The ``TMPDIR`` variable establishes a directory that BitBake uses | ||
| 220 | for build output and intermediate files other than the cached | ||
| 221 | information used by the | ||
| 222 | :ref:`bitbake-user-manual/bitbake-user-manual-execution:setscene` | ||
| 223 | process. Here, the ``TMPDIR`` directory is set to ``hello/tmp``. | ||
| 224 | |||
| 225 | .. tip:: | ||
| 226 | |||
| 227 | You can always safely delete the tmp directory in order to rebuild a | ||
| 228 | BitBake target. The build process creates the directory for you when you | ||
| 229 | run BitBake. | ||
| 230 | |||
| 231 | For information about each of the other variables defined in this | ||
| 232 | example, check :term:`PN`, :term:`TOPDIR`, :term:`CACHE`, :term:`STAMP`, | ||
| 233 | :term:`T` or :term:`B` to take you to the definitions in the | ||
| 234 | glossary. | ||
| 235 | |||
| 236 | #. **Run BitBake:** After making sure that the ``conf/bitbake.conf`` file | ||
| 237 | exists, you can run the ``bitbake`` command again:: | ||
| 238 | |||
| 239 | $ bitbake | ||
| 240 | ERROR: Unable to parse /home/scott-lenovo/bitbake/lib/bb/parse/parse_py/BBHandler.py | ||
| 241 | Traceback (most recent call last): | ||
| 242 | File "/home/scott-lenovo/bitbake/lib/bb/parse/parse_py/BBHandler.py", line 67, in inherit(files=['base'], fn='configuration INHERITs', lineno=0, d=<bb.data_smart.DataSmart object at 0x7fab6815edf0>): | ||
| 243 | if not os.path.exists(file): | ||
| 244 | > raise ParseError("Could not inherit file %s" % (file), fn, lineno) | ||
| 245 | |||
| 246 | bb.parse.ParseError: ParseError in configuration INHERITs: Could not inherit file classes/base.bbclass | ||
| 247 | |||
| 248 | |||
| 249 | In the sample output, | ||
| 250 | BitBake could not find the ``classes/base.bbclass`` file. You need | ||
| 251 | to create that file next. | ||
| 252 | |||
| 253 | #. **Creating classes/base.bbclass:** BitBake uses class files to | ||
| 254 | provide common code and functionality. The minimally required class | ||
| 255 | for BitBake is the ``classes/base.bbclass`` file. The ``base`` class | ||
| 256 | is implicitly inherited by every recipe. BitBake looks for the class | ||
| 257 | in the ``classes`` directory of the project (i.e ``hello/classes`` | ||
| 258 | in this example). | ||
| 259 | |||
| 260 | Create the ``classes`` directory as follows:: | ||
| 261 | |||
| 262 | $ cd $HOME/hello | ||
| 263 | $ mkdir classes | ||
| 264 | |||
| 265 | Move to the ``classes`` directory and then create the | ||
| 266 | ``base.bbclass`` file by inserting this single line:: | ||
| 267 | |||
| 268 | addtask build | ||
| 269 | |||
| 270 | The minimal task that BitBake runs is the ``do_build`` task. This is | ||
| 271 | all the example needs in order to build the project. Of course, the | ||
| 272 | ``base.bbclass`` can have much more depending on which build | ||
| 273 | environments BitBake is supporting. | ||
| 274 | |||
| 275 | #. **Run BitBake:** After making sure that the ``classes/base.bbclass`` | ||
| 276 | file exists, you can run the ``bitbake`` command again:: | ||
| 277 | |||
| 278 | $ bitbake | ||
| 279 | Nothing to do. Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information. | ||
| 280 | |||
| 281 | BitBake is finally reporting | ||
| 282 | no errors. However, you can see that it really does not have | ||
| 283 | anything to do. You need to create a recipe that gives BitBake | ||
| 284 | something to do. | ||
| 285 | |||
| 286 | #. **Creating a Layer:** While it is not really necessary for such a | ||
| 287 | small example, it is good practice to create a layer in which to | ||
| 288 | keep your code separate from the general metadata used by BitBake. | ||
| 289 | Thus, this example creates and uses a layer called "mylayer". | ||
| 290 | |||
| 291 | .. note:: | ||
| 292 | |||
| 293 | You can find additional information on layers in the | ||
| 294 | ":ref:`bitbake-user-manual/bitbake-user-manual-intro:Layers`" section. | ||
| 295 | |||
| 296 | Minimally, you need a recipe file and a layer configuration file in | ||
| 297 | your layer. The configuration file needs to be in the ``conf`` | ||
| 298 | directory inside the layer. Use these commands to set up the layer | ||
| 299 | and the ``conf`` directory:: | ||
| 300 | |||
| 301 | $ cd $HOME | ||
| 302 | $ mkdir mylayer | ||
| 303 | $ cd mylayer | ||
| 304 | $ mkdir conf | ||
| 305 | |||
| 306 | Move to the ``conf`` directory and create a ``layer.conf`` file that has the | ||
| 307 | following:: | ||
| 308 | |||
| 309 | BBPATH .= ":${LAYERDIR}" | ||
| 310 | BBFILES += "${LAYERDIR}/*.bb" | ||
| 311 | BBFILE_COLLECTIONS += "mylayer" | ||
| 312 | BBFILE_PATTERN_mylayer := "^${LAYERDIR_RE}/" | ||
| 313 | LAYERSERIES_CORENAMES = "hello_world_example" | ||
| 314 | LAYERSERIES_COMPAT_mylayer = "hello_world_example" | ||
| 315 | |||
| 316 | For information on these variables, click on :term:`BBFILES`, | ||
| 317 | :term:`LAYERDIR`, :term:`BBFILE_COLLECTIONS`, :term:`BBFILE_PATTERN_mylayer <BBFILE_PATTERN>` | ||
| 318 | or :term:`LAYERSERIES_COMPAT` to go to the definitions in the glossary. | ||
| 319 | |||
| 320 | .. note:: | ||
| 321 | |||
| 322 | We are setting both ``LAYERSERIES_CORENAMES`` and :term:`LAYERSERIES_COMPAT` in this particular case, because we | ||
| 323 | are using bitbake without OpenEmbedded. | ||
| 324 | You should usually just use :term:`LAYERSERIES_COMPAT` to specify the OE-Core versions for which your layer | ||
| 325 | is compatible, and add the meta-openembedded layer to your project. | ||
| 326 | |||
| 327 | You need to create the recipe file next. Inside your layer at the | ||
| 328 | top-level, use an editor and create a recipe file named | ||
| 329 | ``printhello.bb`` that has the following:: | ||
| 330 | |||
| 331 | DESCRIPTION = "Prints Hello World" | ||
| 332 | PN = 'printhello' | ||
| 333 | PV = '1' | ||
| 334 | |||
| 335 | python do_build() { | ||
| 336 | bb.plain("********************"); | ||
| 337 | bb.plain("* *"); | ||
| 338 | bb.plain("* Hello, World! *"); | ||
| 339 | bb.plain("* *"); | ||
| 340 | bb.plain("********************"); | ||
| 341 | } | ||
| 342 | |||
| 343 | The recipe file simply provides | ||
| 344 | a description of the recipe, the name, version, and the ``do_build`` | ||
| 345 | task, which prints out "Hello World" to the console. For more | ||
| 346 | information on :term:`DESCRIPTION`, :term:`PN` or :term:`PV` | ||
| 347 | follow the links to the glossary. | ||
| 348 | |||
| 349 | #. **Run BitBake With a Target:** Now that a BitBake target exists, run | ||
| 350 | the command and provide that target:: | ||
| 351 | |||
| 352 | $ cd $HOME/hello | ||
| 353 | $ bitbake printhello | ||
| 354 | ERROR: no recipe files to build, check your BBPATH and BBFILES? | ||
| 355 | |||
| 356 | Summary: There was 1 ERROR message shown, returning a non-zero exit code. | ||
| 357 | |||
| 358 | We have created the layer with the recipe and | ||
| 359 | the layer configuration file but it still seems that BitBake cannot | ||
| 360 | find the recipe. BitBake needs a ``conf/bblayers.conf`` that lists | ||
| 361 | the layers for the project. Without this file, BitBake cannot find | ||
| 362 | the recipe. | ||
| 363 | |||
| 364 | #. **Creating conf/bblayers.conf:** BitBake uses the | ||
| 365 | ``conf/bblayers.conf`` file to locate layers needed for the project. | ||
| 366 | This file must reside in the ``conf`` directory of the project (i.e. | ||
| 367 | ``hello/conf`` for this example). | ||
| 368 | |||
| 369 | Set your working directory to the ``hello/conf`` directory and then | ||
| 370 | create the ``bblayers.conf`` file so that it contains the following:: | ||
| 371 | |||
| 372 | BBLAYERS ?= " \ | ||
| 373 | /home/<you>/mylayer \ | ||
| 374 | " | ||
| 375 | |||
| 376 | You need to provide your own information for ``you`` in the file. | ||
| 377 | |||
| 378 | #. **Run BitBake With a Target:** Now that you have supplied the | ||
| 379 | ``bblayers.conf`` file, run the ``bitbake`` command and provide the | ||
| 380 | target:: | ||
| 381 | |||
| 382 | $ bitbake printhello | ||
| 383 | Loading cache: 100% | | ||
| 384 | Loaded 0 entries from dependency cache. | ||
| 385 | Parsing recipes: 100% |##################################################################################| | ||
| 386 | Parsing of 1 .bb files complete (0 cached, 1 parsed). 1 targets, 0 skipped, 0 masked, 0 errors. | ||
| 387 | NOTE: Resolving any missing task queue dependencies | ||
| 388 | Initialising tasks: 100% |###############################################################################| | ||
| 389 | NOTE: No setscene tasks | ||
| 390 | NOTE: Executing Tasks | ||
| 391 | ******************** | ||
| 392 | * * | ||
| 393 | * Hello, World! * | ||
| 394 | * * | ||
| 395 | ******************** | ||
| 396 | NOTE: Tasks Summary: Attempted 1 tasks of which 0 didn't need to be rerun and all succeeded. | ||
| 397 | |||
| 398 | .. note:: | ||
| 399 | |||
| 400 | After the first execution, re-running bitbake printhello again will not | ||
| 401 | result in a BitBake run that prints the same console output. The reason | ||
| 402 | for this is that the first time the printhello.bb recipe's do_build task | ||
| 403 | executes successfully, BitBake writes a stamp file for the task. Thus, | ||
| 404 | the next time you attempt to run the task using that same bitbake | ||
| 405 | command, BitBake notices the stamp and therefore determines that the task | ||
| 406 | does not need to be re-run. If you delete the tmp directory or run | ||
| 407 | bitbake -c clean printhello and then re-run the build, the "Hello, | ||
| 408 | World!" message will be printed again. | ||
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-intro.rst b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-intro.rst deleted file mode 100644 index 9837b009ea..0000000000 --- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-intro.rst +++ /dev/null | |||
| @@ -1,709 +0,0 @@ | |||
| 1 | .. SPDX-License-Identifier: CC-BY-2.5 | ||
| 2 | |||
| 3 | ======== | ||
| 4 | Overview | ||
| 5 | ======== | ||
| 6 | |||
| 7 | | | ||
| 8 | |||
| 9 | Welcome to the BitBake User Manual. This manual provides information on | ||
| 10 | the BitBake tool. The information attempts to be as independent as | ||
| 11 | possible regarding systems that use BitBake, such as OpenEmbedded and | ||
| 12 | the Yocto Project. In some cases, scenarios or examples within the | ||
| 13 | context of a build system are used in the manual to help with | ||
| 14 | understanding. For these cases, the manual clearly states the context. | ||
| 15 | |||
| 16 | .. _intro: | ||
| 17 | |||
| 18 | Introduction | ||
| 19 | ============ | ||
| 20 | |||
| 21 | Fundamentally, BitBake is a generic task execution engine that allows | ||
| 22 | shell and Python tasks to be run efficiently and in parallel while | ||
| 23 | working within complex inter-task dependency constraints. One of | ||
| 24 | BitBake's main users, OpenEmbedded, takes this core and builds embedded | ||
| 25 | Linux software stacks using a task-oriented approach. | ||
| 26 | |||
| 27 | Conceptually, BitBake is similar to GNU Make in some regards but has | ||
| 28 | significant differences: | ||
| 29 | |||
| 30 | - BitBake executes tasks according to the provided metadata that builds up | ||
| 31 | the tasks. Metadata is stored in recipe (``.bb``) and related recipe | ||
| 32 | "append" (``.bbappend``) files, configuration (``.conf``) and | ||
| 33 | underlying include (``.inc``) files, and in class (``.bbclass``) | ||
| 34 | files. The metadata provides BitBake with instructions on what tasks | ||
| 35 | to run and the dependencies between those tasks. | ||
| 36 | |||
| 37 | - BitBake includes a fetcher library for obtaining source code from | ||
| 38 | various places such as local files, source control systems, or | ||
| 39 | websites. | ||
| 40 | |||
| 41 | - The instructions for each unit to be built (e.g. a piece of software) | ||
| 42 | are known as "recipe" files and contain all the information about the | ||
| 43 | unit (dependencies, source file locations, checksums, description and | ||
| 44 | so on). | ||
| 45 | |||
| 46 | - BitBake includes a client/server abstraction and can be used from a | ||
| 47 | command line or used as a service over XML-RPC and has several | ||
| 48 | different user interfaces. | ||
| 49 | |||
| 50 | History and Goals | ||
| 51 | ================= | ||
| 52 | |||
| 53 | BitBake was originally a part of the OpenEmbedded project. It was | ||
| 54 | inspired by the Portage package management system used by the Gentoo | ||
| 55 | Linux distribution. On December 7, 2004, OpenEmbedded project team | ||
| 56 | member Chris Larson split the project into two distinct pieces: | ||
| 57 | |||
| 58 | - BitBake, a generic task executor | ||
| 59 | |||
| 60 | - OpenEmbedded, a metadata set utilized by BitBake | ||
| 61 | |||
| 62 | Today, BitBake is the primary basis of the | ||
| 63 | `OpenEmbedded <https://www.openembedded.org/>`__ project, which is being | ||
| 64 | used to build and maintain Linux distributions such as the `Poky | ||
| 65 | Reference Distribution <https://www.yoctoproject.org/software-item/poky/>`__, | ||
| 66 | developed under the umbrella of the `Yocto Project <https://www.yoctoproject.org>`__. | ||
| 67 | |||
| 68 | Prior to BitBake, no other build tool adequately met the needs of an | ||
| 69 | aspiring embedded Linux distribution. All of the build systems used by | ||
| 70 | traditional desktop Linux distributions lacked important functionality, | ||
| 71 | and none of the ad hoc Buildroot-based systems, prevalent in the | ||
| 72 | embedded space, were scalable or maintainable. | ||
| 73 | |||
| 74 | Some important original goals for BitBake were: | ||
| 75 | |||
| 76 | - Handle cross-compilation. | ||
| 77 | |||
| 78 | - Handle inter-package dependencies (build time on target architecture, | ||
| 79 | build time on native architecture, and runtime). | ||
| 80 | |||
| 81 | - Support running any number of tasks within a given package, | ||
| 82 | including, but not limited to, fetching upstream sources, unpacking | ||
| 83 | them, patching them, configuring them, and so forth. | ||
| 84 | |||
| 85 | - Be Linux distribution agnostic for both build and target systems. | ||
| 86 | |||
| 87 | - Be architecture agnostic. | ||
| 88 | |||
| 89 | - Support multiple build and target operating systems (e.g. Cygwin, the | ||
| 90 | BSDs, and so forth). | ||
| 91 | |||
| 92 | - Be self-contained, rather than tightly integrated into the build | ||
| 93 | machine's root filesystem. | ||
| 94 | |||
| 95 | - Handle conditional metadata on the target architecture, operating | ||
| 96 | system, distribution, and machine. | ||
| 97 | |||
| 98 | - Be easy to use the tools to supply local metadata and packages | ||
| 99 | against which to operate. | ||
| 100 | |||
| 101 | - Be easy to use BitBake to collaborate between multiple projects for | ||
| 102 | their builds. | ||
| 103 | |||
| 104 | - Provide an inheritance mechanism to share common metadata between | ||
| 105 | many packages. | ||
| 106 | |||
| 107 | Over time it became apparent that some further requirements were | ||
| 108 | necessary: | ||
| 109 | |||
| 110 | - Handle variants of a base recipe (e.g. native, sdk, and multilib). | ||
| 111 | |||
| 112 | - Split metadata into layers and allow layers to enhance or override | ||
| 113 | other layers. | ||
| 114 | |||
| 115 | - Allow representation of a given set of input variables to a task as a | ||
| 116 | checksum. Based on that checksum, allow acceleration of builds with | ||
| 117 | prebuilt components. | ||
| 118 | |||
| 119 | BitBake satisfies all the original requirements and many more with | ||
| 120 | extensions being made to the basic functionality to reflect the | ||
| 121 | additional requirements. Flexibility and power have always been the | ||
| 122 | priorities. BitBake is highly extensible and supports embedded Python | ||
| 123 | code and execution of any arbitrary tasks. | ||
| 124 | |||
| 125 | .. _Concepts: | ||
| 126 | |||
| 127 | Concepts | ||
| 128 | ======== | ||
| 129 | |||
| 130 | BitBake is a program written in the Python language. At the highest | ||
| 131 | level, BitBake interprets metadata, decides what tasks are required to | ||
| 132 | run, and executes those tasks. Similar to GNU Make, BitBake controls how | ||
| 133 | software is built. GNU Make achieves its control through "makefiles", | ||
| 134 | while BitBake uses "recipes". | ||
| 135 | |||
| 136 | BitBake extends the capabilities of a simple tool like GNU Make by | ||
| 137 | allowing for the definition of much more complex tasks, such as | ||
| 138 | assembling entire embedded Linux distributions. | ||
| 139 | |||
| 140 | The remainder of this section introduces several concepts that should be | ||
| 141 | understood in order to better leverage the power of BitBake. | ||
| 142 | |||
| 143 | Recipes | ||
| 144 | ------- | ||
| 145 | |||
| 146 | BitBake Recipes, which are denoted by the file extension ``.bb``, are | ||
| 147 | the most basic metadata files. These recipe files provide BitBake with | ||
| 148 | the following: | ||
| 149 | |||
| 150 | - Descriptive information about the package (author, homepage, license, | ||
| 151 | and so on) | ||
| 152 | |||
| 153 | - The version of the recipe | ||
| 154 | |||
| 155 | - Existing dependencies (both build and runtime dependencies) | ||
| 156 | |||
| 157 | - Where the source code resides and how to fetch it | ||
| 158 | |||
| 159 | - Whether the source code requires any patches, where to find them, and | ||
| 160 | how to apply them | ||
| 161 | |||
| 162 | - How to configure and compile the source code | ||
| 163 | |||
| 164 | - How to assemble the generated artifacts into one or more installable | ||
| 165 | packages | ||
| 166 | |||
| 167 | - Where on the target machine to install the package or packages | ||
| 168 | created | ||
| 169 | |||
| 170 | Within the context of BitBake, or any project utilizing BitBake as its | ||
| 171 | build system, files with the ``.bb`` extension are referred to as | ||
| 172 | recipes. | ||
| 173 | |||
| 174 | .. note:: | ||
| 175 | |||
| 176 | The term "package" is also commonly used to describe recipes. | ||
| 177 | However, since the same word is used to describe packaged output from | ||
| 178 | a project, it is best to maintain a single descriptive term - | ||
| 179 | "recipes". Put another way, a single "recipe" file is quite capable | ||
| 180 | of generating a number of related but separately installable | ||
| 181 | "packages". In fact, that ability is fairly common. | ||
| 182 | |||
| 183 | Configuration Files | ||
| 184 | ------------------- | ||
| 185 | |||
| 186 | Configuration files, which are denoted by the ``.conf`` extension, | ||
| 187 | define various configuration variables that govern the project's build | ||
| 188 | process. These files fall into several areas that define machine | ||
| 189 | configuration, distribution configuration, possible compiler tuning, | ||
| 190 | general common configuration, and user configuration. The main | ||
| 191 | configuration file is the sample ``bitbake.conf`` file, which is located | ||
| 192 | within the BitBake source tree ``conf`` directory. | ||
| 193 | |||
| 194 | Classes | ||
| 195 | ------- | ||
| 196 | |||
| 197 | Class files, which are denoted by the ``.bbclass`` extension, contain | ||
| 198 | information that is useful to share between metadata files. The BitBake | ||
| 199 | source tree currently comes with one class metadata file called | ||
| 200 | ``base.bbclass``. You can find this file in the ``classes`` directory. | ||
| 201 | The ``base.bbclass`` class files is special since it is always included | ||
| 202 | automatically for all recipes and classes. This class contains | ||
| 203 | definitions for standard basic tasks such as fetching, unpacking, | ||
| 204 | configuring (empty by default), compiling (runs any Makefile present), | ||
| 205 | installing (empty by default) and packaging (empty by default). These | ||
| 206 | tasks are often overridden or extended by other classes added during the | ||
| 207 | project development process. | ||
| 208 | |||
| 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 | ||
| 228 | |||
| 229 | - ``classes/``: this final directory is meant for classes that can be used in | ||
| 230 | the two contexts explain above. In other words, they can be inherit either | ||
| 231 | globally or in a recipe. | ||
| 232 | |||
| 233 | For details on how BitBake locates class files, see the | ||
| 234 | :ref:`bitbake-user-manual/bitbake-user-manual-metadata:Locating Class Files` | ||
| 235 | section of the Bitbake User Manual. | ||
| 236 | |||
| 237 | Layers | ||
| 238 | ------ | ||
| 239 | |||
| 240 | Layers allow you to isolate different types of customizations from each | ||
| 241 | other. While you might find it tempting to keep everything in one layer | ||
| 242 | when working on a single project, the more modular your metadata, the | ||
| 243 | easier it is to cope with future changes. | ||
| 244 | |||
| 245 | To illustrate how you can use layers to keep things modular, consider | ||
| 246 | customizations you might make to support a specific target machine. | ||
| 247 | These types of customizations typically reside in a special layer, | ||
| 248 | rather than a general layer, called a Board Support Package (BSP) layer. | ||
| 249 | Furthermore, the machine customizations should be isolated from recipes | ||
| 250 | and metadata that support a new GUI environment, for example. This | ||
| 251 | situation gives you a couple of layers: one for the machine | ||
| 252 | configurations and one for the GUI environment. It is important to | ||
| 253 | understand, however, that the BSP layer can still make machine-specific | ||
| 254 | additions to recipes within the GUI environment layer without polluting | ||
| 255 | the GUI layer itself with those machine-specific changes. You can | ||
| 256 | accomplish this through a recipe that is a BitBake append | ||
| 257 | (``.bbappend``) file. | ||
| 258 | |||
| 259 | .. _append-bbappend-files: | ||
| 260 | |||
| 261 | Append Files | ||
| 262 | ------------ | ||
| 263 | |||
| 264 | Append files, which are files that have the ``.bbappend`` file | ||
| 265 | extension, extend or override information in an existing recipe file. | ||
| 266 | |||
| 267 | BitBake expects every append file to have a corresponding recipe file. | ||
| 268 | Furthermore, the append file and corresponding recipe file must use the | ||
| 269 | same root filename. The filenames can differ only in the file type | ||
| 270 | suffix used (e.g. ``formfactor_0.0.bb`` and | ||
| 271 | ``formfactor_0.0.bbappend``). | ||
| 272 | |||
| 273 | Information in append files extends or overrides the information in the | ||
| 274 | underlying, similarly-named recipe files. | ||
| 275 | |||
| 276 | When you name an append file, you can use the "``%``" wildcard character | ||
| 277 | to allow for matching recipe names. For example, suppose you have an | ||
| 278 | append file named as follows:: | ||
| 279 | |||
| 280 | busybox_1.21.%.bbappend | ||
| 281 | |||
| 282 | That append file | ||
| 283 | would match any ``busybox_1.21.``\ x\ ``.bb`` version of the recipe. So, | ||
| 284 | the append file would match the following recipe names:: | ||
| 285 | |||
| 286 | busybox_1.21.1.bb | ||
| 287 | busybox_1.21.2.bb | ||
| 288 | busybox_1.21.3.bb | ||
| 289 | busybox_1.21.10.bb | ||
| 290 | busybox_1.21.11.bb | ||
| 291 | |||
| 292 | .. note:: | ||
| 293 | |||
| 294 | The use of the " % " character is limited in that it only works directly in | ||
| 295 | front of the .bbappend portion of the append file's name. You cannot use the | ||
| 296 | wildcard character in any other location of the name. | ||
| 297 | |||
| 298 | If the ``busybox`` recipe was updated to ``busybox_1.3.0.bb``, the | ||
| 299 | append name would not match. However, if you named the append file | ||
| 300 | ``busybox_1.%.bbappend``, then you would have a match. | ||
| 301 | |||
| 302 | In the most general case, you could name the append file something as | ||
| 303 | simple as ``busybox_%.bbappend`` to be entirely version independent. | ||
| 304 | |||
| 305 | Obtaining BitBake | ||
| 306 | ================= | ||
| 307 | |||
| 308 | You can obtain BitBake several different ways: | ||
| 309 | |||
| 310 | - **Cloning BitBake:** Using Git to clone the BitBake source code | ||
| 311 | repository is the recommended method for obtaining BitBake. Cloning | ||
| 312 | the repository makes it easy to get bug fixes and have access to | ||
| 313 | stable branches and the master branch. Once you have cloned BitBake, | ||
| 314 | you should use the latest stable branch for development since the | ||
| 315 | master branch is for BitBake development and might contain less | ||
| 316 | stable changes. | ||
| 317 | |||
| 318 | You usually need a version of BitBake that matches the metadata you | ||
| 319 | are using. The metadata is generally backwards compatible but not | ||
| 320 | forward compatible. | ||
| 321 | |||
| 322 | Here is an example that clones the BitBake repository:: | ||
| 323 | |||
| 324 | $ git clone git://git.openembedded.org/bitbake | ||
| 325 | |||
| 326 | This command clones the BitBake | ||
| 327 | Git repository into a directory called ``bitbake``. Alternatively, | ||
| 328 | you can designate a directory after the ``git clone`` command if you | ||
| 329 | want to call the new directory something other than ``bitbake``. Here | ||
| 330 | is an example that names the directory ``bbdev``:: | ||
| 331 | |||
| 332 | $ git clone git://git.openembedded.org/bitbake bbdev | ||
| 333 | |||
| 334 | - **Installation using your Distribution Package Management System:** | ||
| 335 | This method is not recommended because the BitBake version that is | ||
| 336 | provided by your distribution, in most cases, is several releases | ||
| 337 | behind a snapshot of the BitBake repository. | ||
| 338 | |||
| 339 | - **Taking a snapshot of BitBake:** Downloading a snapshot of BitBake | ||
| 340 | from the source code repository gives you access to a known branch or | ||
| 341 | release of BitBake. | ||
| 342 | |||
| 343 | .. note:: | ||
| 344 | |||
| 345 | Cloning the Git repository, as described earlier, is the preferred | ||
| 346 | method for getting BitBake. Cloning the repository makes it easier | ||
| 347 | to update as patches are added to the stable branches. | ||
| 348 | |||
| 349 | The following example downloads a snapshot of BitBake version 1.17.0:: | ||
| 350 | |||
| 351 | $ wget https://git.openembedded.org/bitbake/snapshot/bitbake-1.17.0.tar.gz | ||
| 352 | $ tar zxpvf bitbake-1.17.0.tar.gz | ||
| 353 | |||
| 354 | After extraction of the tarball using | ||
| 355 | the tar utility, you have a directory entitled ``bitbake-1.17.0``. | ||
| 356 | |||
| 357 | - **Using the BitBake that Comes With Your Build Checkout:** A final | ||
| 358 | possibility for getting a copy of BitBake is that it already comes | ||
| 359 | with your checkout of a larger BitBake-based build system, such as | ||
| 360 | Poky. Rather than manually checking out individual layers and gluing | ||
| 361 | them together yourself, you can check out an entire build system. The | ||
| 362 | checkout will already include a version of BitBake that has been | ||
| 363 | thoroughly tested for compatibility with the other components. For | ||
| 364 | information on how to check out a particular BitBake-based build | ||
| 365 | system, consult that build system's supporting documentation. | ||
| 366 | |||
| 367 | .. _bitbake-user-manual-command: | ||
| 368 | |||
| 369 | The BitBake Command | ||
| 370 | =================== | ||
| 371 | |||
| 372 | The ``bitbake`` command is the primary interface to the BitBake tool. | ||
| 373 | This section presents the BitBake command syntax and provides several | ||
| 374 | execution examples. | ||
| 375 | |||
| 376 | Usage and syntax | ||
| 377 | ---------------- | ||
| 378 | |||
| 379 | Following is the usage and syntax for BitBake:: | ||
| 380 | |||
| 381 | $ bitbake -h | ||
| 382 | usage: bitbake [-s] [-e] [-g] [-u UI] [--version] [-h] [-f] [-c CMD] | ||
| 383 | [-C INVALIDATE_STAMP] [--runall RUNALL] [--runonly RUNONLY] | ||
| 384 | [--no-setscene] [--skip-setscene] [--setscene-only] [-n] [-p] | ||
| 385 | [-k] [-P] [-S SIGNATURE_HANDLER] [--revisions-changed] | ||
| 386 | [-b BUILDFILE] [-D] [-l DEBUG_DOMAINS] [-v] [-q] | ||
| 387 | [-w WRITEEVENTLOG] [-B BIND] [-T SERVER_TIMEOUT] | ||
| 388 | [--remote-server REMOTE_SERVER] [-m] [--token XMLRPCTOKEN] | ||
| 389 | [--observe-only] [--status-only] [--server-only] [-r PREFILE] | ||
| 390 | [-R POSTFILE] [-I EXTRA_ASSUME_PROVIDED] | ||
| 391 | [recipename/target ...] | ||
| 392 | |||
| 393 | It is assumed there is a conf/bblayers.conf available in cwd or in BBPATH | ||
| 394 | which will provide the layer, BBFILES and other configuration information. | ||
| 395 | |||
| 396 | General options: | ||
| 397 | recipename/target Execute the specified task (default is 'build') for | ||
| 398 | these target recipes (.bb files). | ||
| 399 | -s, --show-versions Show current and preferred versions of all recipes. | ||
| 400 | -e, --environment Show the global or per-recipe environment complete | ||
| 401 | with information about where variables were | ||
| 402 | set/changed. | ||
| 403 | -g, --graphviz Save dependency tree information for the specified | ||
| 404 | targets in the dot syntax. | ||
| 405 | -u UI, --ui UI The user interface to use (knotty, ncurses, taskexp, | ||
| 406 | taskexp_ncurses or teamcity - default knotty). | ||
| 407 | --version Show programs version and exit. | ||
| 408 | -h, --help Show this help message and exit. | ||
| 409 | |||
| 410 | Task control options: | ||
| 411 | -f, --force Force the specified targets/task to run (invalidating | ||
| 412 | any existing stamp file). | ||
| 413 | -c CMD, --cmd CMD Specify the task to execute. The exact options | ||
| 414 | available depend on the metadata. Some examples might | ||
| 415 | be 'compile' or 'populate_sysroot' or 'listtasks' may | ||
| 416 | give a list of the tasks available. | ||
| 417 | -C INVALIDATE_STAMP, --clear-stamp INVALIDATE_STAMP | ||
| 418 | Invalidate the stamp for the specified task such as | ||
| 419 | 'compile' and then run the default task for the | ||
| 420 | specified target(s). | ||
| 421 | --runall RUNALL Run the specified task for any recipe in the taskgraph | ||
| 422 | of the specified target (even if it wouldn't otherwise | ||
| 423 | have run). | ||
| 424 | --runonly RUNONLY Run only the specified task within the taskgraph of | ||
| 425 | the specified targets (and any task dependencies those | ||
| 426 | tasks may have). | ||
| 427 | --no-setscene Do not run any setscene tasks. sstate will be ignored | ||
| 428 | and everything needed, built. | ||
| 429 | --skip-setscene Skip setscene tasks if they would be executed. Tasks | ||
| 430 | previously restored from sstate will be kept, unlike | ||
| 431 | --no-setscene. | ||
| 432 | --setscene-only Only run setscene tasks, don't run any real tasks. | ||
| 433 | |||
| 434 | Execution control options: | ||
| 435 | -n, --dry-run Don't execute, just go through the motions. | ||
| 436 | -p, --parse-only Quit after parsing the BB recipes. | ||
| 437 | -k, --continue Continue as much as possible after an error. While the | ||
| 438 | target that failed and anything depending on it cannot | ||
| 439 | be built, as much as possible will be built before | ||
| 440 | stopping. | ||
| 441 | -P, --profile Profile the command and save reports. | ||
| 442 | -S SIGNATURE_HANDLER, --dump-signatures SIGNATURE_HANDLER | ||
| 443 | Dump out the signature construction information, with | ||
| 444 | no task execution. The SIGNATURE_HANDLER parameter is | ||
| 445 | passed to the handler. Two common values are none and | ||
| 446 | printdiff but the handler may define more/less. none | ||
| 447 | means only dump the signature, printdiff means | ||
| 448 | recursively compare the dumped signature with the most | ||
| 449 | recent one in a local build or sstate cache (can be | ||
| 450 | used to find out why tasks re-run when that is not | ||
| 451 | expected) | ||
| 452 | --revisions-changed Set the exit code depending on whether upstream | ||
| 453 | floating revisions have changed or not. | ||
| 454 | -b BUILDFILE, --buildfile BUILDFILE | ||
| 455 | Execute tasks from a specific .bb recipe directly. | ||
| 456 | WARNING: Does not handle any dependencies from other | ||
| 457 | recipes. | ||
| 458 | |||
| 459 | Logging/output control options: | ||
| 460 | -D, --debug Increase the debug level. You can specify this more | ||
| 461 | than once. -D sets the debug level to 1, where only | ||
| 462 | bb.debug(1, ...) messages are printed to stdout; -DD | ||
| 463 | sets the debug level to 2, where both bb.debug(1, ...) | ||
| 464 | and bb.debug(2, ...) messages are printed; etc. | ||
| 465 | Without -D, no debug messages are printed. Note that | ||
| 466 | -D only affects output to stdout. All debug messages | ||
| 467 | are written to ${T}/log.do_taskname, regardless of the | ||
| 468 | debug level. | ||
| 469 | -l DEBUG_DOMAINS, --log-domains DEBUG_DOMAINS | ||
| 470 | Show debug logging for the specified logging domains. | ||
| 471 | -v, --verbose Enable tracing of shell tasks (with 'set -x'). Also | ||
| 472 | print bb.note(...) messages to stdout (in addition to | ||
| 473 | writing them to ${T}/log.do_<task>). | ||
| 474 | -q, --quiet Output less log message data to the terminal. You can | ||
| 475 | specify this more than once. | ||
| 476 | -w WRITEEVENTLOG, --write-log WRITEEVENTLOG | ||
| 477 | Writes the event log of the build to a bitbake event | ||
| 478 | json file. Use '' (empty string) to assign the name | ||
| 479 | automatically. | ||
| 480 | |||
| 481 | Server options: | ||
| 482 | -B BIND, --bind BIND The name/address for the bitbake xmlrpc server to bind | ||
| 483 | to. | ||
| 484 | -T SERVER_TIMEOUT, --idle-timeout SERVER_TIMEOUT | ||
| 485 | Set timeout to unload bitbake server due to | ||
| 486 | inactivity, set to -1 means no unload, default: | ||
| 487 | Environment variable BB_SERVER_TIMEOUT. | ||
| 488 | --remote-server REMOTE_SERVER | ||
| 489 | Connect to the specified server. | ||
| 490 | -m, --kill-server Terminate any running bitbake server. | ||
| 491 | --token XMLRPCTOKEN Specify the connection token to be used when | ||
| 492 | connecting to a remote server. | ||
| 493 | --observe-only Connect to a server as an observing-only client. | ||
| 494 | --status-only Check the status of the remote bitbake server. | ||
| 495 | --server-only Run bitbake without a UI, only starting a server | ||
| 496 | (cooker) process. | ||
| 497 | |||
| 498 | Configuration options: | ||
| 499 | -r PREFILE, --read PREFILE | ||
| 500 | Read the specified file before bitbake.conf. | ||
| 501 | -R POSTFILE, --postread POSTFILE | ||
| 502 | Read the specified file after bitbake.conf. | ||
| 503 | -I EXTRA_ASSUME_PROVIDED, --ignore-deps EXTRA_ASSUME_PROVIDED | ||
| 504 | Assume these dependencies don't exist and are already | ||
| 505 | provided (equivalent to ASSUME_PROVIDED). Useful to | ||
| 506 | make dependency graphs more appealing. | ||
| 507 | |||
| 508 | .. | ||
| 509 | Bitbake help output generated with "stty columns 80; bin/bitbake -h" | ||
| 510 | |||
| 511 | .. _bitbake-examples: | ||
| 512 | |||
| 513 | Examples | ||
| 514 | -------- | ||
| 515 | |||
| 516 | This section presents some examples showing how to use BitBake. | ||
| 517 | |||
| 518 | .. _example-executing-a-task-against-a-single-recipe: | ||
| 519 | |||
| 520 | Executing a Task Against a Single Recipe | ||
| 521 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 522 | |||
| 523 | Executing tasks for a single recipe file is relatively simple. You | ||
| 524 | specify the file in question, and BitBake parses it and executes the | ||
| 525 | specified task. If you do not specify a task, BitBake executes the | ||
| 526 | default task, which is "build". BitBake obeys inter-task dependencies | ||
| 527 | when doing so. | ||
| 528 | |||
| 529 | The following command runs the build task, which is the default task, on | ||
| 530 | the ``foo_1.0.bb`` recipe file:: | ||
| 531 | |||
| 532 | $ bitbake -b foo_1.0.bb | ||
| 533 | |||
| 534 | The following command runs the clean task on the ``foo.bb`` recipe file:: | ||
| 535 | |||
| 536 | $ bitbake -b foo.bb -c clean | ||
| 537 | |||
| 538 | .. note:: | ||
| 539 | |||
| 540 | The "-b" option explicitly does not handle recipe dependencies. Other | ||
| 541 | than for debugging purposes, it is instead recommended that you use | ||
| 542 | the syntax presented in the next section. | ||
| 543 | |||
| 544 | Executing Tasks Against a Set of Recipe Files | ||
| 545 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 546 | |||
| 547 | There are a number of additional complexities introduced when one wants | ||
| 548 | to manage multiple ``.bb`` files. Clearly there needs to be a way to | ||
| 549 | tell BitBake what files are available and, of those, which you want to | ||
| 550 | execute. There also needs to be a way for each recipe to express its | ||
| 551 | dependencies, both for build-time and runtime. There must be a way for | ||
| 552 | you to express recipe preferences when multiple recipes provide the same | ||
| 553 | functionality, or when there are multiple versions of a recipe. | ||
| 554 | |||
| 555 | The ``bitbake`` command, when not using "--buildfile" or "-b" only | ||
| 556 | accepts a "PROVIDES". You cannot provide anything else. By default, a | ||
| 557 | recipe file generally "PROVIDES" its "packagename" as shown in the | ||
| 558 | following example:: | ||
| 559 | |||
| 560 | $ bitbake foo | ||
| 561 | |||
| 562 | This next example "PROVIDES" the | ||
| 563 | package name and also uses the "-c" option to tell BitBake to just | ||
| 564 | execute the ``do_clean`` task:: | ||
| 565 | |||
| 566 | $ bitbake -c clean foo | ||
| 567 | |||
| 568 | Executing a List of Task and Recipe Combinations | ||
| 569 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 570 | |||
| 571 | The BitBake command line supports specifying different tasks for | ||
| 572 | individual targets when you specify multiple targets. For example, | ||
| 573 | suppose you had two targets (or recipes) ``myfirstrecipe`` and | ||
| 574 | ``mysecondrecipe`` and you needed BitBake to run ``taskA`` for the first | ||
| 575 | recipe and ``taskB`` for the second recipe:: | ||
| 576 | |||
| 577 | $ bitbake myfirstrecipe:do_taskA mysecondrecipe:do_taskB | ||
| 578 | |||
| 579 | Generating Dependency Graphs | ||
| 580 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 581 | |||
| 582 | BitBake is able to generate dependency graphs using the ``dot`` syntax. | ||
| 583 | You can convert these graphs into images using the ``dot`` tool from | ||
| 584 | `Graphviz <http://www.graphviz.org>`__. | ||
| 585 | |||
| 586 | When you generate a dependency graph, BitBake writes two files to the | ||
| 587 | current working directory: | ||
| 588 | |||
| 589 | - ``task-depends.dot``: Shows dependencies between tasks. These | ||
| 590 | dependencies match BitBake's internal task execution list. | ||
| 591 | |||
| 592 | - ``pn-buildlist``: Shows a simple list of targets that are to be | ||
| 593 | built. | ||
| 594 | |||
| 595 | To stop depending on common depends, use the ``-I`` depend option and | ||
| 596 | BitBake omits them from the graph. Leaving this information out can | ||
| 597 | produce more readable graphs. This way, you can remove from the graph | ||
| 598 | :term:`DEPENDS` from inherited classes such as ``base.bbclass``. | ||
| 599 | |||
| 600 | Here are two examples that create dependency graphs. The second example | ||
| 601 | omits depends common in OpenEmbedded from the graph:: | ||
| 602 | |||
| 603 | $ bitbake -g foo | ||
| 604 | |||
| 605 | $ bitbake -g -I virtual/kernel -I eglibc foo | ||
| 606 | |||
| 607 | Executing a Multiple Configuration Build | ||
| 608 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 609 | |||
| 610 | BitBake is able to build multiple images or packages using a single | ||
| 611 | command where the different targets require different configurations | ||
| 612 | (multiple configuration builds). Each target, in this scenario, is | ||
| 613 | referred to as a "multiconfig". | ||
| 614 | |||
| 615 | To accomplish a multiple configuration build, you must define each | ||
| 616 | target's configuration separately using a parallel configuration file in | ||
| 617 | the build directory. The location for these multiconfig configuration | ||
| 618 | files is specific. They must reside in the current build directory in a | ||
| 619 | sub-directory of ``conf`` named ``multiconfig``. Following is an example | ||
| 620 | for two separate targets: | ||
| 621 | |||
| 622 | .. image:: figures/bb_multiconfig_files.png | ||
| 623 | :align: center | ||
| 624 | |||
| 625 | The reason for this required file hierarchy is because the :term:`BBPATH` | ||
| 626 | variable is not constructed until the layers are parsed. Consequently, | ||
| 627 | using the configuration file as a pre-configuration file is not possible | ||
| 628 | unless it is located in the current working directory. | ||
| 629 | |||
| 630 | Minimally, each configuration file must define the machine and the | ||
| 631 | temporary directory BitBake uses for the build. Suggested practice | ||
| 632 | dictates that you do not overlap the temporary directories used during | ||
| 633 | the builds. | ||
| 634 | |||
| 635 | Aside from separate configuration files for each target, you must also | ||
| 636 | enable BitBake to perform multiple configuration builds. Enabling is | ||
| 637 | accomplished by setting the | ||
| 638 | :term:`BBMULTICONFIG` variable in the | ||
| 639 | ``local.conf`` configuration file. As an example, suppose you had | ||
| 640 | configuration files for ``target1`` and ``target2`` defined in the build | ||
| 641 | directory. The following statement in the ``local.conf`` file both | ||
| 642 | enables BitBake to perform multiple configuration builds and specifies | ||
| 643 | the two extra multiconfigs:: | ||
| 644 | |||
| 645 | BBMULTICONFIG = "target1 target2" | ||
| 646 | |||
| 647 | Once the target configuration files are in place and BitBake has been | ||
| 648 | enabled to perform multiple configuration builds, use the following | ||
| 649 | command form to start the builds:: | ||
| 650 | |||
| 651 | $ bitbake [mc:multiconfigname:]target [[[mc:multiconfigname:]target] ... ] | ||
| 652 | |||
| 653 | Here is an example for two extra multiconfigs: ``target1`` and ``target2``:: | ||
| 654 | |||
| 655 | $ bitbake mc::target mc:target1:target mc:target2:target | ||
| 656 | |||
| 657 | .. _bb-enabling-multiple-configuration-build-dependencies: | ||
| 658 | |||
| 659 | Enabling Multiple Configuration Build Dependencies | ||
| 660 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 661 | |||
| 662 | Sometimes dependencies can exist between targets (multiconfigs) in a | ||
| 663 | multiple configuration build. For example, suppose that in order to | ||
| 664 | build an image for a particular architecture, the root filesystem of | ||
| 665 | another build for a different architecture needs to exist. In other | ||
| 666 | words, the image for the first multiconfig depends on the root | ||
| 667 | filesystem of the second multiconfig. This dependency is essentially | ||
| 668 | that the task in the recipe that builds one multiconfig is dependent on | ||
| 669 | the completion of the task in the recipe that builds another | ||
| 670 | multiconfig. | ||
| 671 | |||
| 672 | To enable dependencies in a multiple configuration build, you must | ||
| 673 | declare the dependencies in the recipe using the following statement | ||
| 674 | form:: | ||
| 675 | |||
| 676 | task_or_package[mcdepends] = "mc:from_multiconfig:to_multiconfig:recipe_name:task_on_which_to_depend" | ||
| 677 | |||
| 678 | To better show how to use this statement, consider an example with two | ||
| 679 | multiconfigs: ``target1`` and ``target2``:: | ||
| 680 | |||
| 681 | image_task[mcdepends] = "mc:target1:target2:image2:rootfs_task" | ||
| 682 | |||
| 683 | In this example, the | ||
| 684 | ``from_multiconfig`` is "target1" and the ``to_multiconfig`` is "target2". The | ||
| 685 | task on which the image whose recipe contains image_task depends on the | ||
| 686 | completion of the rootfs_task used to build out image2, which is | ||
| 687 | associated with the "target2" multiconfig. | ||
| 688 | |||
| 689 | Once you set up this dependency, you can build the "target1" multiconfig | ||
| 690 | using a BitBake command as follows:: | ||
| 691 | |||
| 692 | $ bitbake mc:target1:image1 | ||
| 693 | |||
| 694 | This command executes all the tasks needed to create ``image1`` for the "target1" | ||
| 695 | multiconfig. Because of the dependency, BitBake also executes through | ||
| 696 | the ``rootfs_task`` for the "target2" multiconfig build. | ||
| 697 | |||
| 698 | Having a recipe depend on the root filesystem of another build might not | ||
| 699 | seem that useful. Consider this change to the statement in the image1 | ||
| 700 | recipe:: | ||
| 701 | |||
| 702 | image_task[mcdepends] = "mc:target1:target2:image2:image_task" | ||
| 703 | |||
| 704 | In this case, BitBake must create ``image2`` for the "target2" build since | ||
| 705 | the "target1" build depends on it. | ||
| 706 | |||
| 707 | Because "target1" and "target2" are enabled for multiple configuration | ||
| 708 | builds and have separate configuration files, BitBake places the | ||
| 709 | artifacts for each build in the respective temporary build directories. | ||
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-library-functions.rst b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-library-functions.rst deleted file mode 100644 index 09e353945b..0000000000 --- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-library-functions.rst +++ /dev/null | |||
| @@ -1,59 +0,0 @@ | |||
| 1 | .. SPDX-License-Identifier: CC-BY-2.5 | ||
| 2 | |||
| 3 | ================= | ||
| 4 | Library Functions | ||
| 5 | ================= | ||
| 6 | |||
| 7 | | | ||
| 8 | |||
| 9 | This chapter lists common library functions available under the ``lib/`` | ||
| 10 | directory in BitBake. | ||
| 11 | |||
| 12 | These functions can be used in recipes or configuration files with | ||
| 13 | :ref:`inline-Python <bitbake-user-manual/bitbake-user-manual-metadata:Inline | ||
| 14 | Python Variable Expansion>` or :ref:`Python | ||
| 15 | <bitbake-user-manual/bitbake-user-manual-metadata:BitBake-Style Python | ||
| 16 | Functions>` functions. | ||
| 17 | |||
| 18 | Logging utilities | ||
| 19 | ================= | ||
| 20 | |||
| 21 | Different logging utilities can be used from Python code in recipes or | ||
| 22 | configuration files. | ||
| 23 | |||
| 24 | The strings passed below can be formatted with ``str.format()``, for example:: | ||
| 25 | |||
| 26 | bb.warn("Houston, we have a %s", "bit of a problem") | ||
| 27 | |||
| 28 | Formatted string can also be used directly:: | ||
| 29 | |||
| 30 | bb.error("%s, we have a %s" % ("Houston", "big problem")) | ||
| 31 | |||
| 32 | Python f-strings may also be used:: | ||
| 33 | |||
| 34 | h = "Houston" | ||
| 35 | bb.fatal(f"{h}, we have a critical problem") | ||
| 36 | |||
| 37 | .. automodule:: bb | ||
| 38 | :members: | ||
| 39 | debug, | ||
| 40 | error, | ||
| 41 | erroronce, | ||
| 42 | fatal, | ||
| 43 | note, | ||
| 44 | plain, | ||
| 45 | verbnote, | ||
| 46 | warn, | ||
| 47 | warnonce, | ||
| 48 | |||
| 49 | ``bb.utils`` | ||
| 50 | ============ | ||
| 51 | |||
| 52 | .. automodule:: bb.utils | ||
| 53 | :members: | ||
| 54 | :exclude-members: | ||
| 55 | LogCatcher, | ||
| 56 | PrCtlError, | ||
| 57 | VersionStringException, | ||
| 58 | better_compile, | ||
| 59 | better_exec, | ||
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst deleted file mode 100644 index 4dadf0bc7b..0000000000 --- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst +++ /dev/null | |||
| @@ -1,2276 +0,0 @@ | |||
| 1 | .. SPDX-License-Identifier: CC-BY-2.5 | ||
| 2 | |||
| 3 | ==================== | ||
| 4 | Syntax and Operators | ||
| 5 | ==================== | ||
| 6 | |||
| 7 | | | ||
| 8 | |||
| 9 | BitBake files have their own syntax. The syntax has similarities to | ||
| 10 | several other languages but also has some unique features. This section | ||
| 11 | describes the available syntax and operators as well as provides | ||
| 12 | examples. | ||
| 13 | |||
| 14 | Basic Syntax | ||
| 15 | ============ | ||
| 16 | |||
| 17 | This section provides some basic syntax examples. | ||
| 18 | |||
| 19 | Basic Variable Setting | ||
| 20 | ---------------------- | ||
| 21 | |||
| 22 | The following example sets ``VARIABLE`` to "value". This assignment | ||
| 23 | occurs immediately as the statement is parsed. It is a "hard" | ||
| 24 | assignment. :: | ||
| 25 | |||
| 26 | VARIABLE = "value" | ||
| 27 | |||
| 28 | As expected, if you include leading or | ||
| 29 | trailing spaces as part of an assignment, the spaces are retained:: | ||
| 30 | |||
| 31 | VARIABLE = " value" | ||
| 32 | VARIABLE = "value " | ||
| 33 | |||
| 34 | Setting ``VARIABLE`` to "" sets | ||
| 35 | it to an empty string, while setting the variable to " " sets it to a | ||
| 36 | blank space (i.e. these are not the same values). :: | ||
| 37 | |||
| 38 | VARIABLE = "" | ||
| 39 | VARIABLE = " " | ||
| 40 | |||
| 41 | You can use single quotes instead of double quotes when setting a | ||
| 42 | variable's value. Doing so allows you to use values that contain the | ||
| 43 | double quote character:: | ||
| 44 | |||
| 45 | VARIABLE = 'I have a " in my value' | ||
| 46 | |||
| 47 | .. note:: | ||
| 48 | |||
| 49 | Unlike in Bourne shells, single quotes work identically to double | ||
| 50 | quotes in all other ways. They do not suppress variable expansions. | ||
| 51 | |||
| 52 | Modifying Existing Variables | ||
| 53 | ---------------------------- | ||
| 54 | |||
| 55 | Sometimes you need to modify existing variables. Following are some | ||
| 56 | cases where you might find you want to modify an existing variable: | ||
| 57 | |||
| 58 | - Customize a recipe that uses the variable. | ||
| 59 | |||
| 60 | - Change a variable's default value used in a ``*.bbclass`` file. | ||
| 61 | |||
| 62 | - Change the variable in a ``*.bbappend`` file to override the variable | ||
| 63 | in the original recipe. | ||
| 64 | |||
| 65 | - Change the variable in a configuration file so that the value | ||
| 66 | overrides an existing configuration. | ||
| 67 | |||
| 68 | Changing a variable value can sometimes depend on how the value was | ||
| 69 | originally assigned and also on the desired intent of the change. In | ||
| 70 | particular, when you append a value to a variable that has a default | ||
| 71 | value, the resulting value might not be what you expect. In this case, | ||
| 72 | the value you provide might replace the value rather than append to the | ||
| 73 | default value. | ||
| 74 | |||
| 75 | If after you have changed a variable's value and something unexplained | ||
| 76 | occurs, you can use BitBake to check the actual value of the suspect | ||
| 77 | variable. You can make these checks for both configuration and recipe | ||
| 78 | level changes: | ||
| 79 | |||
| 80 | - For configuration changes, use the following:: | ||
| 81 | |||
| 82 | $ bitbake -e | ||
| 83 | |||
| 84 | This | ||
| 85 | command displays variable values after the configuration files (i.e. | ||
| 86 | ``local.conf``, ``bblayers.conf``, ``bitbake.conf`` and so forth) | ||
| 87 | have been parsed. | ||
| 88 | |||
| 89 | .. note:: | ||
| 90 | |||
| 91 | Variables that are exported to the environment are preceded by the | ||
| 92 | string "export" in the command's output. | ||
| 93 | |||
| 94 | - To find changes to a given variable in a specific recipe, use the | ||
| 95 | following:: | ||
| 96 | |||
| 97 | $ bitbake recipename -e | grep VARIABLENAME=\" | ||
| 98 | |||
| 99 | This command checks to see if the variable actually makes | ||
| 100 | it into a specific recipe. | ||
| 101 | |||
| 102 | Line Joining | ||
| 103 | ------------ | ||
| 104 | |||
| 105 | Outside of :ref:`functions <bitbake-user-manual/bitbake-user-manual-metadata:functions>`, | ||
| 106 | BitBake joins any line ending in | ||
| 107 | a backslash character ("\\") with the following line before parsing | ||
| 108 | statements. The most common use for the "\\" character is to split | ||
| 109 | variable assignments over multiple lines, as in the following example:: | ||
| 110 | |||
| 111 | FOO = "bar \ | ||
| 112 | baz \ | ||
| 113 | qaz" | ||
| 114 | |||
| 115 | Both the "\\" character and the newline | ||
| 116 | character that follow it are removed when joining lines. Thus, no | ||
| 117 | newline characters end up in the value of ``FOO``. | ||
| 118 | |||
| 119 | Consider this additional example where the two assignments both assign | ||
| 120 | "barbaz" to ``FOO``:: | ||
| 121 | |||
| 122 | FOO = "barbaz" | ||
| 123 | FOO = "bar\ | ||
| 124 | baz" | ||
| 125 | |||
| 126 | .. note:: | ||
| 127 | |||
| 128 | BitBake does not interpret escape sequences like "\\n" in variable | ||
| 129 | values. For these to have an effect, the value must be passed to some | ||
| 130 | utility that interprets escape sequences, such as | ||
| 131 | ``printf`` or ``echo -n``. | ||
| 132 | |||
| 133 | Variable Expansion | ||
| 134 | ------------------ | ||
| 135 | |||
| 136 | Variables can reference the contents of other variables using a syntax | ||
| 137 | that is similar to variable expansion in Bourne shells. The following | ||
| 138 | assignments result in A containing "aval" and B evaluating to | ||
| 139 | "preavalpost". :: | ||
| 140 | |||
| 141 | A = "aval" | ||
| 142 | B = "pre${A}post" | ||
| 143 | |||
| 144 | .. note:: | ||
| 145 | |||
| 146 | Unlike in Bourne shells, the curly braces are mandatory: Only ``${FOO}`` and not | ||
| 147 | ``$FOO`` is recognized as an expansion of ``FOO``. | ||
| 148 | |||
| 149 | The "=" operator does not immediately expand variable references in the | ||
| 150 | right-hand side. Instead, expansion is deferred until the variable | ||
| 151 | assigned to is actually used. The result depends on the current values | ||
| 152 | of the referenced variables. The following example should clarify this | ||
| 153 | behavior:: | ||
| 154 | |||
| 155 | A = "${B} baz" | ||
| 156 | B = "${C} bar" | ||
| 157 | C = "foo" | ||
| 158 | *At this point, ${A} equals "foo bar baz"* | ||
| 159 | C = "qux" | ||
| 160 | *At this point, ${A} equals "qux bar baz"* | ||
| 161 | B = "norf" | ||
| 162 | *At this point, ${A} equals "norf baz"* | ||
| 163 | |||
| 164 | Contrast this behavior with the | ||
| 165 | :ref:`bitbake-user-manual/bitbake-user-manual-metadata:immediate variable | ||
| 166 | expansion (:=)` operator. | ||
| 167 | |||
| 168 | If the variable expansion syntax is used on a variable that does not | ||
| 169 | exist, the string is kept as is. For example, given the following | ||
| 170 | assignment, ``BAR`` expands to the literal string "${FOO}" as long as | ||
| 171 | ``FOO`` does not exist. :: | ||
| 172 | |||
| 173 | BAR = "${FOO}" | ||
| 174 | |||
| 175 | Setting a default value (?=) | ||
| 176 | ---------------------------- | ||
| 177 | |||
| 178 | You can use the "?=" operator to achieve a "softer" assignment for a | ||
| 179 | variable. This type of assignment allows you to define a variable if it | ||
| 180 | is undefined when the statement is parsed, but to leave the value alone | ||
| 181 | if the variable has a value. Here is an example:: | ||
| 182 | |||
| 183 | A ?= "aval" | ||
| 184 | |||
| 185 | If ``A`` is | ||
| 186 | set at the time this statement is parsed, the variable retains its | ||
| 187 | value. However, if ``A`` is not set, the variable is set to "aval". | ||
| 188 | |||
| 189 | .. note:: | ||
| 190 | |||
| 191 | This assignment is immediate. Consequently, if multiple "?=" | ||
| 192 | assignments to a single variable exist, the first of those ends up | ||
| 193 | getting used. | ||
| 194 | |||
| 195 | Setting a weak default value (??=) | ||
| 196 | ---------------------------------- | ||
| 197 | |||
| 198 | The weak default value of a variable is the value which that variable | ||
| 199 | will expand to if no value has been assigned to it via any of the other | ||
| 200 | assignment operators. The "??=" operator takes effect immediately, replacing | ||
| 201 | any previously defined weak default value. Here is an example:: | ||
| 202 | |||
| 203 | W ??= "x" | ||
| 204 | A := "${W}" # Immediate variable expansion | ||
| 205 | W ??= "y" | ||
| 206 | B := "${W}" # Immediate variable expansion | ||
| 207 | W ??= "z" | ||
| 208 | C = "${W}" | ||
| 209 | W ?= "i" | ||
| 210 | |||
| 211 | After parsing we will have:: | ||
| 212 | |||
| 213 | A = "x" | ||
| 214 | B = "y" | ||
| 215 | C = "i" | ||
| 216 | W = "i" | ||
| 217 | |||
| 218 | Appending and prepending non-override style will not substitute the weak | ||
| 219 | default value, which means that after parsing:: | ||
| 220 | |||
| 221 | W ??= "x" | ||
| 222 | W += "y" | ||
| 223 | |||
| 224 | we will have:: | ||
| 225 | |||
| 226 | W = " y" | ||
| 227 | |||
| 228 | On the other hand, override-style appends/prepends/removes are applied after | ||
| 229 | any active weak default value has been substituted:: | ||
| 230 | |||
| 231 | W ??= "x" | ||
| 232 | W:append = "y" | ||
| 233 | |||
| 234 | After parsing we will have:: | ||
| 235 | |||
| 236 | W = "xy" | ||
| 237 | |||
| 238 | Immediate variable expansion (:=) | ||
| 239 | --------------------------------- | ||
| 240 | |||
| 241 | The ":=" operator results in a variable's contents being expanded | ||
| 242 | immediately, rather than when the variable is actually used:: | ||
| 243 | |||
| 244 | T = "123" | ||
| 245 | A := "test ${T}" | ||
| 246 | T = "456" | ||
| 247 | B := "${T} ${C}" | ||
| 248 | C = "cval" | ||
| 249 | C := "${C}append" | ||
| 250 | |||
| 251 | In this example, ``A`` contains "test 123", even though the final value | ||
| 252 | of :term:`T` is "456". The variable :term:`B` will end up containing "456 | ||
| 253 | cvalappend". This is because references to undefined variables are | ||
| 254 | preserved as is during (immediate)expansion. This is in contrast to GNU | ||
| 255 | Make, where undefined variables expand to nothing. The variable ``C`` | ||
| 256 | contains "cvalappend" since ``${C}`` immediately expands to "cval". | ||
| 257 | |||
| 258 | .. _appending-and-prepending: | ||
| 259 | |||
| 260 | Appending (+=) and prepending (=+) With Spaces | ||
| 261 | ---------------------------------------------- | ||
| 262 | |||
| 263 | Appending and prepending values is common and can be accomplished using | ||
| 264 | the "+=" and "=+" operators. These operators insert a space between the | ||
| 265 | current value and prepended or appended value. | ||
| 266 | |||
| 267 | These operators take immediate effect during parsing. Here are some | ||
| 268 | examples:: | ||
| 269 | |||
| 270 | B = "bval" | ||
| 271 | B += "additionaldata" | ||
| 272 | C = "cval" | ||
| 273 | C =+ "test" | ||
| 274 | |||
| 275 | The variable :term:`B` contains "bval additionaldata" and ``C`` contains "test | ||
| 276 | cval". | ||
| 277 | |||
| 278 | .. _appending-and-prepending-without-spaces: | ||
| 279 | |||
| 280 | Appending (.=) and Prepending (=.) Without Spaces | ||
| 281 | ------------------------------------------------- | ||
| 282 | |||
| 283 | If you want to append or prepend values without an inserted space, use | ||
| 284 | the ".=" and "=." operators. | ||
| 285 | |||
| 286 | These operators take immediate effect during parsing. Here are some | ||
| 287 | examples:: | ||
| 288 | |||
| 289 | B = "bval" | ||
| 290 | B .= "additionaldata" | ||
| 291 | C = "cval" | ||
| 292 | C =. "test" | ||
| 293 | |||
| 294 | The variable :term:`B` contains "bvaladditionaldata" and ``C`` contains | ||
| 295 | "testcval". | ||
| 296 | |||
| 297 | Appending and Prepending (Override Style Syntax) | ||
| 298 | ------------------------------------------------ | ||
| 299 | |||
| 300 | You can also append and prepend a variable's value using an override | ||
| 301 | style syntax. When you use this syntax, no spaces are inserted. | ||
| 302 | |||
| 303 | These operators differ from the ":=", ".=", "=.", "+=", and "=+" | ||
| 304 | operators in that their effects are applied at variable expansion time | ||
| 305 | rather than being immediately applied. Here are some examples:: | ||
| 306 | |||
| 307 | B = "bval" | ||
| 308 | B:append = " additional data" | ||
| 309 | C = "cval" | ||
| 310 | C:prepend = "additional data " | ||
| 311 | D = "dval" | ||
| 312 | D:append = "additional data" | ||
| 313 | |||
| 314 | The variable :term:`B` | ||
| 315 | becomes "bval additional data" and ``C`` becomes "additional data cval". | ||
| 316 | The variable ``D`` becomes "dvaladditional data". | ||
| 317 | |||
| 318 | .. note:: | ||
| 319 | |||
| 320 | You must control all spacing when you use the override syntax. | ||
| 321 | |||
| 322 | .. note:: | ||
| 323 | |||
| 324 | The overrides are applied in this order, ":append", ":prepend", ":remove". | ||
| 325 | |||
| 326 | It is also possible to append and prepend to shell functions and | ||
| 327 | BitBake-style Python functions. See the ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:shell functions`" and ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:bitbake-style python functions`" | ||
| 328 | sections for examples. | ||
| 329 | |||
| 330 | .. _removing-override-style-syntax: | ||
| 331 | |||
| 332 | Removal (Override Style Syntax) | ||
| 333 | ------------------------------- | ||
| 334 | |||
| 335 | You can remove values from lists using the removal override style | ||
| 336 | syntax. Specifying a value for removal causes all occurrences of that | ||
| 337 | value to be removed from the variable. Unlike ":append" and ":prepend", | ||
| 338 | there is no need to add a leading or trailing space to the value. | ||
| 339 | |||
| 340 | When you use this syntax, BitBake expects one or more strings. | ||
| 341 | Surrounding spaces and spacing are preserved. Here is an example:: | ||
| 342 | |||
| 343 | FOO = "123 456 789 123456 123 456 123 456" | ||
| 344 | FOO:remove = "123" | ||
| 345 | FOO:remove = "456" | ||
| 346 | FOO2 = " abc def ghi abcdef abc def abc def def" | ||
| 347 | FOO2:remove = "\ | ||
| 348 | def \ | ||
| 349 | abc \ | ||
| 350 | ghi \ | ||
| 351 | " | ||
| 352 | |||
| 353 | The variable ``FOO`` becomes | ||
| 354 | " 789 123456 " and ``FOO2`` becomes " abcdef ". | ||
| 355 | |||
| 356 | Like ":append" and ":prepend", ":remove" is applied at variable | ||
| 357 | expansion time. | ||
| 358 | |||
| 359 | .. note:: | ||
| 360 | |||
| 361 | The overrides are applied in this order, ":append", ":prepend", ":remove". | ||
| 362 | This implies it is not possible to re-append previously removed strings. | ||
| 363 | However, one can undo a ":remove" by using an intermediate variable whose | ||
| 364 | content is passed to the ":remove" so that modifying the intermediate | ||
| 365 | variable equals to keeping the string in:: | ||
| 366 | |||
| 367 | FOOREMOVE = "123 456 789" | ||
| 368 | FOO:remove = "${FOOREMOVE}" | ||
| 369 | ... | ||
| 370 | FOOREMOVE = "123 789" | ||
| 371 | |||
| 372 | This expands to ``FOO:remove = "123 789"``. | ||
| 373 | |||
| 374 | .. note:: | ||
| 375 | |||
| 376 | Override application order may not match variable parse history, i.e. | ||
| 377 | the output of ``bitbake -e`` may contain ":remove" before ":append", | ||
| 378 | but the result will be removed string, because ":remove" is handled | ||
| 379 | last. | ||
| 380 | |||
| 381 | Override Style Operation Advantages | ||
| 382 | ----------------------------------- | ||
| 383 | |||
| 384 | An advantage of the override style operations ":append", ":prepend", and | ||
| 385 | ":remove" as compared to the "+=" and "=+" operators is that the | ||
| 386 | override style operators provide guaranteed operations. For example, | ||
| 387 | consider a class ``foo.bbclass`` that needs to add the value "val" to | ||
| 388 | the variable ``FOO``, and a recipe that uses ``foo.bbclass`` as follows:: | ||
| 389 | |||
| 390 | inherit foo | ||
| 391 | FOO = "initial" | ||
| 392 | |||
| 393 | If ``foo.bbclass`` uses the "+=" operator, | ||
| 394 | as follows, then the final value of ``FOO`` will be "initial", which is | ||
| 395 | not what is desired:: | ||
| 396 | |||
| 397 | FOO += "val" | ||
| 398 | |||
| 399 | If, on the other hand, ``foo.bbclass`` | ||
| 400 | uses the ":append" operator, then the final value of ``FOO`` will be | ||
| 401 | "initial val", as intended:: | ||
| 402 | |||
| 403 | FOO:append = " val" | ||
| 404 | |||
| 405 | .. note:: | ||
| 406 | |||
| 407 | It is never necessary to use "+=" together with ":append". The following | ||
| 408 | sequence of assignments appends "barbaz" to FOO:: | ||
| 409 | |||
| 410 | FOO:append = "bar" | ||
| 411 | FOO:append = "baz" | ||
| 412 | |||
| 413 | |||
| 414 | The only effect of changing the second assignment in the previous | ||
| 415 | example to use "+=" would be to add a space before "baz" in the | ||
| 416 | appended value (due to how the "+=" operator works). | ||
| 417 | |||
| 418 | Another advantage of the override style operations is that you can | ||
| 419 | combine them with other overrides as described in the | ||
| 420 | ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:conditional syntax (overrides)`" section. | ||
| 421 | |||
| 422 | Variable Flag Syntax | ||
| 423 | -------------------- | ||
| 424 | |||
| 425 | Variable flags are BitBake's implementation of variable properties or | ||
| 426 | attributes. It is a way of tagging extra information onto a variable. | ||
| 427 | You can find more out about variable flags in general in the | ||
| 428 | ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:variable flags`" section. | ||
| 429 | |||
| 430 | You can define, append, and prepend values to variable flags. All the | ||
| 431 | standard syntax operations previously mentioned work for variable flags | ||
| 432 | except for override style syntax (i.e. ":prepend", ":append", and | ||
| 433 | ":remove"). | ||
| 434 | |||
| 435 | Here are some examples showing how to set variable flags:: | ||
| 436 | |||
| 437 | FOO[a] = "abc" | ||
| 438 | FOO[b] = "123" | ||
| 439 | FOO[a] += "456" | ||
| 440 | |||
| 441 | The variable ``FOO`` has two flags: | ||
| 442 | ``[a]`` and ``[b]``. The flags are immediately set to "abc" and "123", | ||
| 443 | respectively. The ``[a]`` flag becomes "abc 456". | ||
| 444 | |||
| 445 | No need exists to pre-define variable flags. You can simply start using | ||
| 446 | them. One extremely common application is to attach some brief | ||
| 447 | documentation to a BitBake variable as follows:: | ||
| 448 | |||
| 449 | CACHE[doc] = "The directory holding the cache of the metadata." | ||
| 450 | |||
| 451 | .. note:: | ||
| 452 | |||
| 453 | Variable flag names starting with an underscore (``_``) character | ||
| 454 | are allowed but are ignored by ``d.getVarFlags("VAR")`` | ||
| 455 | in Python code. Such flag names are used internally by BitBake. | ||
| 456 | |||
| 457 | Inline Python Variable Expansion | ||
| 458 | -------------------------------- | ||
| 459 | |||
| 460 | You can use inline Python variable expansion to set variables. Here is | ||
| 461 | an example:: | ||
| 462 | |||
| 463 | DATE = "${@time.strftime('%Y%m%d',time.gmtime())}" | ||
| 464 | |||
| 465 | This example results in the ``DATE`` variable being set to the current date. | ||
| 466 | |||
| 467 | Probably the most common use of this feature is to extract the value of | ||
| 468 | variables from BitBake's internal data dictionary, ``d``. The following | ||
| 469 | lines select the values of a package name and its version number, | ||
| 470 | respectively:: | ||
| 471 | |||
| 472 | PN = "${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[0] or 'defaultpkgname'}" | ||
| 473 | PV = "${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[1] or '1.0'}" | ||
| 474 | |||
| 475 | .. note:: | ||
| 476 | |||
| 477 | Inline Python expressions work just like variable expansions insofar as the | ||
| 478 | "=" and ":=" operators are concerned. Given the following assignment, foo() | ||
| 479 | is called each time FOO is expanded:: | ||
| 480 | |||
| 481 | FOO = "${@foo()}" | ||
| 482 | |||
| 483 | Contrast this with the following immediate assignment, where foo() is only | ||
| 484 | called once, while the assignment is parsed:: | ||
| 485 | |||
| 486 | FOO := "${@foo()}" | ||
| 487 | |||
| 488 | For a different way to set variables with Python code during parsing, | ||
| 489 | see the | ||
| 490 | ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:anonymous python functions`" section. | ||
| 491 | |||
| 492 | Unsetting variables | ||
| 493 | ------------------- | ||
| 494 | |||
| 495 | It is possible to completely remove a variable or a variable flag from | ||
| 496 | BitBake's internal data dictionary by using the "unset" keyword. Here is | ||
| 497 | an example:: | ||
| 498 | |||
| 499 | unset DATE | ||
| 500 | unset do_fetch[noexec] | ||
| 501 | |||
| 502 | These two statements remove the ``DATE`` and the ``do_fetch[noexec]`` flag. | ||
| 503 | |||
| 504 | Providing Pathnames | ||
| 505 | ------------------- | ||
| 506 | |||
| 507 | When specifying pathnames for use with BitBake, do not use the tilde | ||
| 508 | ("~") character as a shortcut for your home directory. Doing so might | ||
| 509 | cause BitBake to not recognize the path since BitBake does not expand | ||
| 510 | this character in the same way a shell would. | ||
| 511 | |||
| 512 | Instead, provide a fuller path as the following example illustrates:: | ||
| 513 | |||
| 514 | BBLAYERS ?= " \ | ||
| 515 | /home/scott-lenovo/LayerA \ | ||
| 516 | " | ||
| 517 | |||
| 518 | Exporting Variables to the Environment | ||
| 519 | ====================================== | ||
| 520 | |||
| 521 | You can export variables to the environment of running tasks by using | ||
| 522 | the ``export`` keyword. For example, in the following example, the | ||
| 523 | ``do_foo`` task prints "value from the environment" when run:: | ||
| 524 | |||
| 525 | export ENV_VARIABLE | ||
| 526 | ENV_VARIABLE = "value from the environment" | ||
| 527 | |||
| 528 | do_foo() { | ||
| 529 | bbplain "$ENV_VARIABLE" | ||
| 530 | } | ||
| 531 | |||
| 532 | .. note:: | ||
| 533 | |||
| 534 | BitBake does not expand ``$ENV_VARIABLE`` in this case because it lacks the | ||
| 535 | obligatory ``{}`` . Rather, ``$ENV_VARIABLE`` is expanded by the shell. | ||
| 536 | |||
| 537 | It does not matter whether ``export ENV_VARIABLE`` appears before or | ||
| 538 | after assignments to ``ENV_VARIABLE``. | ||
| 539 | |||
| 540 | It is also possible to combine ``export`` with setting a value for the | ||
| 541 | variable. Here is an example:: | ||
| 542 | |||
| 543 | export ENV_VARIABLE = "variable-value" | ||
| 544 | |||
| 545 | In the output of ``bitbake -e``, variables that are exported to the | ||
| 546 | environment are preceded by "export". | ||
| 547 | |||
| 548 | Among the variables commonly exported to the environment are ``CC`` and | ||
| 549 | ``CFLAGS``, which are picked up by many build systems. | ||
| 550 | |||
| 551 | Conditional Syntax (Overrides) | ||
| 552 | ============================== | ||
| 553 | |||
| 554 | BitBake uses :term:`OVERRIDES` to control what | ||
| 555 | variables are overridden after BitBake parses recipes and configuration | ||
| 556 | files. This section describes how you can use :term:`OVERRIDES` as | ||
| 557 | conditional metadata, talks about key expansion in relationship to | ||
| 558 | :term:`OVERRIDES`, and provides some examples to help with understanding. | ||
| 559 | |||
| 560 | Conditional Metadata | ||
| 561 | -------------------- | ||
| 562 | |||
| 563 | You can use :term:`OVERRIDES` to conditionally select a specific version of | ||
| 564 | a variable and to conditionally append or prepend the value of a | ||
| 565 | variable. | ||
| 566 | |||
| 567 | .. note:: | ||
| 568 | |||
| 569 | Overrides can only use lower-case characters, digits and dashes. | ||
| 570 | In particular, colons are not permitted in override names as they are used to | ||
| 571 | separate overrides from each other and from the variable name. | ||
| 572 | |||
| 573 | - *Selecting a Variable:* The :term:`OVERRIDES` variable is a | ||
| 574 | colon-character-separated list that contains items for which you want | ||
| 575 | to satisfy conditions. Thus, if you have a variable that is | ||
| 576 | conditional on "arm", and "arm" is in :term:`OVERRIDES`, then the | ||
| 577 | "arm"-specific version of the variable is used rather than the | ||
| 578 | non-conditional version. Here is an example:: | ||
| 579 | |||
| 580 | OVERRIDES = "architecture:os:machine" | ||
| 581 | TEST = "default" | ||
| 582 | TEST:os = "osspecific" | ||
| 583 | TEST:nooverride = "othercondvalue" | ||
| 584 | |||
| 585 | In this example, the :term:`OVERRIDES` | ||
| 586 | variable lists three overrides: "architecture", "os", and "machine". | ||
| 587 | The variable ``TEST`` by itself has a default value of "default". You | ||
| 588 | select the os-specific version of the ``TEST`` variable by appending | ||
| 589 | the "os" override to the variable (i.e. ``TEST:os``). | ||
| 590 | |||
| 591 | To better understand this, consider a practical example that assumes | ||
| 592 | an OpenEmbedded metadata-based Linux kernel recipe file. The | ||
| 593 | following lines from the recipe file first set the kernel branch | ||
| 594 | variable ``KBRANCH`` to a default value, then conditionally override | ||
| 595 | that value based on the architecture of the build:: | ||
| 596 | |||
| 597 | KBRANCH = "standard/base" | ||
| 598 | KBRANCH:qemuarm = "standard/arm-versatile-926ejs" | ||
| 599 | KBRANCH:qemumips = "standard/mti-malta32" | ||
| 600 | KBRANCH:qemuppc = "standard/qemuppc" | ||
| 601 | KBRANCH:qemux86 = "standard/common-pc/base" | ||
| 602 | KBRANCH:qemux86-64 = "standard/common-pc-64/base" | ||
| 603 | KBRANCH:qemumips64 = "standard/mti-malta64" | ||
| 604 | |||
| 605 | - *Appending and Prepending:* BitBake also supports append and prepend | ||
| 606 | operations to variable values based on whether a specific item is | ||
| 607 | listed in :term:`OVERRIDES`. Here is an example:: | ||
| 608 | |||
| 609 | DEPENDS = "glibc ncurses" | ||
| 610 | OVERRIDES = "machine:local" | ||
| 611 | DEPENDS:append:machine = "libmad" | ||
| 612 | |||
| 613 | In this example, :term:`DEPENDS` becomes "glibc ncurses libmad". | ||
| 614 | |||
| 615 | Again, using an OpenEmbedded metadata-based kernel recipe file as an | ||
| 616 | example, the following lines will conditionally append to the | ||
| 617 | ``KERNEL_FEATURES`` variable based on the architecture:: | ||
| 618 | |||
| 619 | KERNEL_FEATURES:append = " ${KERNEL_EXTRA_FEATURES}" | ||
| 620 | KERNEL_FEATURES:append:qemux86=" cfg/sound.scc cfg/paravirt_kvm.scc" | ||
| 621 | KERNEL_FEATURES:append:qemux86-64=" cfg/sound.scc cfg/paravirt_kvm.scc" | ||
| 622 | |||
| 623 | - *Setting a Variable for a Single Task:* BitBake supports setting a | ||
| 624 | variable just for the duration of a single task. Here is an example:: | ||
| 625 | |||
| 626 | FOO:task-configure = "val 1" | ||
| 627 | FOO:task-compile = "val 2" | ||
| 628 | |||
| 629 | In the | ||
| 630 | previous example, ``FOO`` has the value "val 1" while the | ||
| 631 | ``do_configure`` task is executed, and the value "val 2" while the | ||
| 632 | ``do_compile`` task is executed. | ||
| 633 | |||
| 634 | Internally, this is implemented by prepending the task (e.g. | ||
| 635 | "task-compile:") to the value of | ||
| 636 | :term:`OVERRIDES` for the local datastore of the | ||
| 637 | ``do_compile`` task. | ||
| 638 | |||
| 639 | You can also use this syntax with other combinations (e.g. | ||
| 640 | "``:prepend``") as shown in the following example:: | ||
| 641 | |||
| 642 | EXTRA_OEMAKE:prepend:task-compile = "${PARALLEL_MAKE} " | ||
| 643 | |||
| 644 | .. note:: | ||
| 645 | |||
| 646 | Before BitBake 1.52 (Honister 3.4), the syntax for :term:`OVERRIDES` | ||
| 647 | used ``_`` instead of ``:``, so you will still find a lot of documentation | ||
| 648 | using ``_append``, ``_prepend``, and ``_remove``, for example. | ||
| 649 | |||
| 650 | For details, see the | ||
| 651 | :yocto_docs:`Overrides Syntax Changes </migration-guides/migration-3.4.html#override-syntax-changes>` | ||
| 652 | section in the Yocto Project manual migration notes. | ||
| 653 | |||
| 654 | Key Expansion | ||
| 655 | ------------- | ||
| 656 | |||
| 657 | Key expansion happens when the BitBake datastore is finalized. To better | ||
| 658 | understand this, consider the following example:: | ||
| 659 | |||
| 660 | A${B} = "X" | ||
| 661 | B = "2" | ||
| 662 | A2 = "Y" | ||
| 663 | |||
| 664 | In this case, after all the parsing is complete, BitBake expands | ||
| 665 | ``${B}`` into "2". This expansion causes ``A2``, which was set to "Y" | ||
| 666 | before the expansion, to become "X". | ||
| 667 | |||
| 668 | .. _variable-interaction-worked-examples: | ||
| 669 | |||
| 670 | Examples | ||
| 671 | -------- | ||
| 672 | |||
| 673 | Despite the previous explanations that show the different forms of | ||
| 674 | variable definitions, it can be hard to work out exactly what happens | ||
| 675 | when variable operators, conditional overrides, and unconditional | ||
| 676 | overrides are combined. This section presents some common scenarios | ||
| 677 | along with explanations for variable interactions that typically confuse | ||
| 678 | users. | ||
| 679 | |||
| 680 | There is often confusion concerning the order in which overrides and | ||
| 681 | various "append" operators take effect. Recall that an append or prepend | ||
| 682 | operation using ":append" and ":prepend" does not result in an immediate | ||
| 683 | assignment as would "+=", ".=", "=+", or "=.". Consider the following | ||
| 684 | example:: | ||
| 685 | |||
| 686 | OVERRIDES = "foo" | ||
| 687 | A = "Z" | ||
| 688 | A:foo:append = "X" | ||
| 689 | |||
| 690 | For this case, | ||
| 691 | ``A`` is unconditionally set to "Z" and "X" is unconditionally and | ||
| 692 | immediately appended to the variable ``A:foo``. Because overrides have | ||
| 693 | not been applied yet, ``A:foo`` is set to "X" due to the append and | ||
| 694 | ``A`` simply equals "Z". | ||
| 695 | |||
| 696 | Applying overrides, however, changes things. Since "foo" is listed in | ||
| 697 | :term:`OVERRIDES`, the conditional variable ``A`` is replaced with the "foo" | ||
| 698 | version, which is equal to "X". So effectively, ``A:foo`` replaces | ||
| 699 | ``A``. | ||
| 700 | |||
| 701 | This next example changes the order of the override and the append:: | ||
| 702 | |||
| 703 | OVERRIDES = "foo" | ||
| 704 | A = "Z" | ||
| 705 | A:append:foo = "X" | ||
| 706 | |||
| 707 | For this case, before | ||
| 708 | overrides are handled, ``A`` is set to "Z" and ``A:append:foo`` is set | ||
| 709 | to "X". Once the override for "foo" is applied, however, ``A`` gets | ||
| 710 | appended with "X". Consequently, ``A`` becomes "ZX". Notice that spaces | ||
| 711 | are not appended. | ||
| 712 | |||
| 713 | This next example has the order of the appends and overrides reversed | ||
| 714 | back as in the first example:: | ||
| 715 | |||
| 716 | OVERRIDES = "foo" | ||
| 717 | A = "Y" | ||
| 718 | A:foo:append = "Z" | ||
| 719 | A:foo:append = "X" | ||
| 720 | |||
| 721 | For this case, before any overrides are resolved, | ||
| 722 | ``A`` is set to "Y" using an immediate assignment. After this immediate | ||
| 723 | assignment, ``A:foo`` is set to "Z", and then further appended with "X" | ||
| 724 | leaving the variable set to "ZX". Finally, applying the override for | ||
| 725 | "foo" results in the conditional variable ``A`` becoming "ZX" (i.e. | ||
| 726 | ``A`` is replaced with ``A:foo``). | ||
| 727 | |||
| 728 | This final example mixes in some varying operators:: | ||
| 729 | |||
| 730 | A = "1" | ||
| 731 | A:append = "2" | ||
| 732 | A:append = "3" | ||
| 733 | A += "4" | ||
| 734 | A .= "5" | ||
| 735 | |||
| 736 | For this case, the type of append | ||
| 737 | operators are affecting the order of assignments as BitBake passes | ||
| 738 | through the code multiple times. Initially, ``A`` is set to "1 45" | ||
| 739 | because of the three statements that use immediate operators. After | ||
| 740 | these assignments are made, BitBake applies the ":append" operations. | ||
| 741 | Those operations result in ``A`` becoming "1 4523". | ||
| 742 | |||
| 743 | Sharing Functionality | ||
| 744 | ===================== | ||
| 745 | |||
| 746 | BitBake allows for metadata sharing through include files (``.inc``) and | ||
| 747 | class files (``.bbclass``). For example, suppose you have a piece of | ||
| 748 | common functionality such as a task definition that you want to share | ||
| 749 | between more than one recipe. In this case, creating a ``.bbclass`` file | ||
| 750 | that contains the common functionality and then using the ``inherit`` | ||
| 751 | directive in your recipes to inherit the class would be a common way to | ||
| 752 | share the task. | ||
| 753 | |||
| 754 | This section presents the mechanisms BitBake provides to allow you to | ||
| 755 | share functionality between recipes. Specifically, the mechanisms | ||
| 756 | include ``include``, ``inherit``, :term:`INHERIT`, and ``require`` | ||
| 757 | directives. There is also a higher-level abstraction called | ||
| 758 | ``configuration fragments`` that is enabled with ``addfragments`` | ||
| 759 | directive. | ||
| 760 | |||
| 761 | .. _ref-bitbake-user-manual-metadata-inherit: | ||
| 762 | |||
| 763 | ``inherit`` Directive | ||
| 764 | --------------------- | ||
| 765 | |||
| 766 | When writing a recipe or class file, you can use the ``inherit`` | ||
| 767 | directive to inherit the functionality of a class (``.bbclass``). | ||
| 768 | BitBake only supports this directive when used within recipe and class | ||
| 769 | files (i.e. ``.bb`` and ``.bbclass``). | ||
| 770 | |||
| 771 | The ``inherit`` directive is a rudimentary means of specifying | ||
| 772 | functionality contained in class files that your recipes require. For | ||
| 773 | example, you can easily abstract out the tasks involved in building a | ||
| 774 | package that uses Autoconf and Automake and put those tasks into a class | ||
| 775 | file and then have your recipe inherit that class file. | ||
| 776 | |||
| 777 | As an example, your recipes could use the following directive to inherit | ||
| 778 | an ``autotools.bbclass`` file. The class file would contain common | ||
| 779 | functionality for using Autotools that could be shared across recipes:: | ||
| 780 | |||
| 781 | inherit autotools | ||
| 782 | |||
| 783 | In this case, BitBake would search for the directory | ||
| 784 | ``classes/autotools.bbclass`` in :term:`BBPATH`. | ||
| 785 | |||
| 786 | .. note:: | ||
| 787 | |||
| 788 | You can override any values and functions of the inherited class | ||
| 789 | within your recipe by doing so after the "inherit" statement. | ||
| 790 | |||
| 791 | If you want to use the directive to inherit multiple classes, separate | ||
| 792 | them with spaces. The following example shows how to inherit both the | ||
| 793 | ``buildhistory`` and ``rm_work`` classes:: | ||
| 794 | |||
| 795 | inherit buildhistory rm_work | ||
| 796 | |||
| 797 | An advantage with the inherit directive as compared to both the | ||
| 798 | :ref:`include <bitbake-user-manual/bitbake-user-manual-metadata:\`\`include\`\` directive>` and :ref:`require <bitbake-user-manual/bitbake-user-manual-metadata:\`\`require\`\` directive>` | ||
| 799 | directives is that you can inherit class files conditionally. You can | ||
| 800 | accomplish this by using a variable expression after the ``inherit`` | ||
| 801 | statement. | ||
| 802 | |||
| 803 | For inheriting classes conditionally, using the :ref:`inherit_defer | ||
| 804 | <ref-bitbake-user-manual-metadata-inherit-defer>` directive is advised as | ||
| 805 | :ref:`inherit_defer <ref-bitbake-user-manual-metadata-inherit-defer>` is | ||
| 806 | evaluated at the end of parsing. | ||
| 807 | |||
| 808 | .. _ref-bitbake-user-manual-metadata-inherit-defer: | ||
| 809 | |||
| 810 | ``inherit_defer`` Directive | ||
| 811 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 812 | |||
| 813 | The :ref:`inherit_defer <ref-bitbake-user-manual-metadata-inherit-defer>` | ||
| 814 | directive works like the :ref:`inherit | ||
| 815 | <ref-bitbake-user-manual-metadata-inherit>` directive, except that it is only | ||
| 816 | evaluated at the end of parsing. Its usage is recommended when a conditional | ||
| 817 | expression is used. | ||
| 818 | |||
| 819 | This allows conditional expressions to be evaluated "late", meaning changes to | ||
| 820 | the variable after the line is parsed will take effect. With the :ref:`inherit | ||
| 821 | <ref-bitbake-user-manual-metadata-inherit>` directive this is not the case. | ||
| 822 | |||
| 823 | Here is an example:: | ||
| 824 | |||
| 825 | inherit_defer ${VARNAME} | ||
| 826 | |||
| 827 | If ``VARNAME`` is | ||
| 828 | going to be set, it needs to be set before the ``inherit_defer`` statement is | ||
| 829 | parsed. One way to achieve a conditional inherit in this case is to use | ||
| 830 | overrides:: | ||
| 831 | |||
| 832 | VARIABLE = "" | ||
| 833 | VARIABLE:someoverride = "myclass" | ||
| 834 | |||
| 835 | Another method is by using :ref:`anonymous Python | ||
| 836 | <bitbake-user-manual/bitbake-user-manual-metadata:Anonymous Python Functions>`. | ||
| 837 | Here is an example:: | ||
| 838 | |||
| 839 | python () { | ||
| 840 | if condition == value: | ||
| 841 | d.setVar('VARIABLE', 'myclass') | ||
| 842 | else: | ||
| 843 | d.setVar('VARIABLE', '') | ||
| 844 | } | ||
| 845 | |||
| 846 | Alternatively, you could use an inline Python expression in the | ||
| 847 | following form:: | ||
| 848 | |||
| 849 | inherit_defer ${@'classname' if condition else ''} | ||
| 850 | |||
| 851 | Or:: | ||
| 852 | |||
| 853 | inherit_defer ${@bb.utils.contains('VARIABLE', 'something', 'classname', '', d)} | ||
| 854 | |||
| 855 | In all cases, if the expression evaluates to an | ||
| 856 | empty string, the statement does not trigger a syntax error because it | ||
| 857 | becomes a no-op. | ||
| 858 | |||
| 859 | See also :term:`BB_DEFER_BBCLASSES` for automatically promoting classes | ||
| 860 | ``inherit`` calls to ``inherit_defer``. | ||
| 861 | |||
| 862 | .. _ref-include-directive: | ||
| 863 | |||
| 864 | ``include`` Directive | ||
| 865 | --------------------- | ||
| 866 | |||
| 867 | The ``include`` directive causes BitBake to parse a given file, | ||
| 868 | and to include that file's contents at the location of the | ||
| 869 | ``include`` statement. This directive is similar to its equivalent | ||
| 870 | in Make, except that if the path specified on the BitBake ``include`` | ||
| 871 | line is a relative path, BitBake will search for it on the path designated | ||
| 872 | by :term:`BBPATH` and will include *only the first matching file*. | ||
| 873 | |||
| 874 | The ``include`` directive is a more generic method of including | ||
| 875 | functionality as compared to the :ref:`inherit <bitbake-user-manual/bitbake-user-manual-metadata:\`\`inherit\`\` directive>` | ||
| 876 | directive, which is restricted to class (i.e. ``.bbclass``) files. The | ||
| 877 | ``include`` directive is applicable for any other kind of shared or | ||
| 878 | encapsulated functionality or configuration that does not suit a | ||
| 879 | ``.bbclass`` file. | ||
| 880 | |||
| 881 | For example, if you needed a recipe to include some self-test definitions, | ||
| 882 | you might write:: | ||
| 883 | |||
| 884 | include test_defs.inc | ||
| 885 | |||
| 886 | The ``include`` directive does not produce an error if the specified file | ||
| 887 | cannot be found. If the included file *must* exist, then you should use | ||
| 888 | use :ref:`require <require-inclusion>` instead, which will generate an error | ||
| 889 | if the file cannot be found. | ||
| 890 | |||
| 891 | .. note:: | ||
| 892 | |||
| 893 | Note well that the ``include`` directive will include the first matching | ||
| 894 | file and nothing further (which is almost always the behaviour you want). | ||
| 895 | If you need to include all matching files, you need to use the | ||
| 896 | ``include_all`` directive, explained below. | ||
| 897 | |||
| 898 | .. _ref-include-all-directive: | ||
| 899 | |||
| 900 | ``include_all`` Directive | ||
| 901 | ------------------------- | ||
| 902 | |||
| 903 | The ``include_all`` directive works like the :ref:`include | ||
| 904 | <bitbake-user-manual/bitbake-user-manual-metadata:\`\`include\`\` directive>` | ||
| 905 | directive but will include *all* of the files that match the specified path in | ||
| 906 | the enabled layers (layers part of :term:`BBLAYERS`). | ||
| 907 | |||
| 908 | .. note:: | ||
| 909 | |||
| 910 | This behaviour is rarely what you want in normal operation, and should | ||
| 911 | be reserved for only those situations when you explicitly want to parse | ||
| 912 | and include all matching files found across all layers, as the following | ||
| 913 | example shows. | ||
| 914 | |||
| 915 | As a realistic example of this directive, imagine that all of your active | ||
| 916 | layers contain a file ``conf/distro/include/maintainers.inc``, containing | ||
| 917 | maintainer information for the recipes in that layer, and you wanted to | ||
| 918 | collect all of the content from all of those files across all of those layers. | ||
| 919 | You could use the statement:: | ||
| 920 | |||
| 921 | include_all conf/distro/include/maintainers.inc | ||
| 922 | |||
| 923 | In this case, BitBake will iterate through all of the directories in | ||
| 924 | the colon-separated :term:`BBPATH` (from left to right) and collect the | ||
| 925 | contents of all matching files, so you end up with the maintainer | ||
| 926 | information of all of your active layers, not just the first one. | ||
| 927 | |||
| 928 | As the ``include_all`` directive uses the ``include`` directive in the | ||
| 929 | background, as with ``include``, no error is produced if no files are matched. | ||
| 930 | |||
| 931 | .. _require-inclusion: | ||
| 932 | |||
| 933 | ``require`` Directive | ||
| 934 | --------------------- | ||
| 935 | |||
| 936 | BitBake understands the ``require`` directive. This directive behaves | ||
| 937 | just like the ``include`` directive with the exception that BitBake | ||
| 938 | raises a parsing error if the file to be included cannot be found. Thus, | ||
| 939 | any file you require is inserted into the file that is being parsed at | ||
| 940 | the location of the directive. | ||
| 941 | |||
| 942 | The require directive, like the include directive previously described, | ||
| 943 | is a more generic method of including functionality as compared to the | ||
| 944 | :ref:`inherit <bitbake-user-manual/bitbake-user-manual-metadata:\`\`inherit\`\` directive>` directive, which is restricted to class | ||
| 945 | (i.e. ``.bbclass``) files. The require directive is applicable for any | ||
| 946 | other kind of shared or encapsulated functionality or configuration that | ||
| 947 | does not suit a ``.bbclass`` file. | ||
| 948 | |||
| 949 | Similar to how BitBake handles :ref:`include <bitbake-user-manual/bitbake-user-manual-metadata:\`\`include\`\` directive>`, if | ||
| 950 | the path specified on the require line is a relative path, BitBake | ||
| 951 | locates the first file it can find within :term:`BBPATH`. | ||
| 952 | |||
| 953 | As an example, suppose you have two versions of a recipe (e.g. | ||
| 954 | ``foo_1.2.2.bb`` and ``foo_2.0.0.bb``) where each version contains some | ||
| 955 | identical functionality that could be shared. You could create an | ||
| 956 | include file named ``foo.inc`` that contains the common definitions | ||
| 957 | needed to build "foo". You need to be sure ``foo.inc`` is located in the | ||
| 958 | same directory as your two recipe files as well. Once these conditions | ||
| 959 | are set up, you can share the functionality using a ``require`` | ||
| 960 | directive from within each recipe:: | ||
| 961 | |||
| 962 | require foo.inc | ||
| 963 | |||
| 964 | ``INHERIT`` Configuration Directive | ||
| 965 | ----------------------------------- | ||
| 966 | |||
| 967 | When creating a configuration file (``.conf``), you can use the | ||
| 968 | :term:`INHERIT` configuration directive to inherit a | ||
| 969 | class. BitBake only supports this directive when used within a | ||
| 970 | configuration file. | ||
| 971 | |||
| 972 | As an example, suppose you needed to inherit a class file called | ||
| 973 | ``abc.bbclass`` from a configuration file as follows:: | ||
| 974 | |||
| 975 | INHERIT += "abc" | ||
| 976 | |||
| 977 | This configuration directive causes the named class to be inherited at | ||
| 978 | the point of the directive during parsing. As with the ``inherit`` | ||
| 979 | directive, the ``.bbclass`` file must be located in a "classes" | ||
| 980 | subdirectory in one of the directories specified in :term:`BBPATH`. | ||
| 981 | |||
| 982 | .. note:: | ||
| 983 | |||
| 984 | Because .conf files are parsed first during BitBake's execution, using | ||
| 985 | INHERIT to inherit a class effectively inherits the class globally (i.e. for | ||
| 986 | all recipes). | ||
| 987 | |||
| 988 | If you want to use the directive to inherit multiple classes, you can | ||
| 989 | provide them on the same line in the ``local.conf`` file. Use spaces to | ||
| 990 | separate the classes. The following example shows how to inherit both | ||
| 991 | the ``autotools`` and ``pkgconfig`` classes:: | ||
| 992 | |||
| 993 | INHERIT += "autotools pkgconfig" | ||
| 994 | |||
| 995 | ``addfragments`` Directive | ||
| 996 | -------------------------- | ||
| 997 | |||
| 998 | This directive allows fine-tuning local configurations with configuration | ||
| 999 | snippets contained in layers in a structured, controlled way. Typically it would | ||
| 1000 | go into ``bitbake.conf``, for example:: | ||
| 1001 | |||
| 1002 | addfragments conf/fragments OE_FRAGMENTS OE_FRAGMENTS_METADATA_VARS OE_BUILTIN_FRAGMENTS | ||
| 1003 | |||
| 1004 | ``addfragments`` takes four parameters: | ||
| 1005 | |||
| 1006 | - path prefix for fragment files inside the layer file tree that bitbake | ||
| 1007 | uses to construct full paths to the fragment files | ||
| 1008 | |||
| 1009 | - name of variable that holds the list of enabled fragments in an | ||
| 1010 | active build | ||
| 1011 | |||
| 1012 | - name of variable that contains a list of variable names containing | ||
| 1013 | fragment-specific metadata (such as descriptions) | ||
| 1014 | |||
| 1015 | - name of variable that contains definitions for built-in fragments | ||
| 1016 | |||
| 1017 | This allows listing enabled configuration fragments in ``OE_FRAGMENTS`` | ||
| 1018 | variable like this:: | ||
| 1019 | |||
| 1020 | OE_FRAGMENTS = "core/domain/somefragment core/someotherfragment anotherlayer/anotherdomain/anotherfragment" | ||
| 1021 | |||
| 1022 | Fragment names listed in this variable must be prefixed by the layer name | ||
| 1023 | where a fragment file is located, defined by :term:`BBFILE_COLLECTIONS` in ``layer.conf``. | ||
| 1024 | |||
| 1025 | The implementation then expands this list into | ||
| 1026 | :ref:`require <bitbake-user-manual/bitbake-user-manual-metadata:\`\`require\`\` directive>` | ||
| 1027 | directives with full paths to respective layers:: | ||
| 1028 | |||
| 1029 | require /path/to/core-layer/conf/fragments/domain/somefragment.conf | ||
| 1030 | require /path/to/core-layer/conf/fragments/someotherfragment.conf | ||
| 1031 | require /path/to/another-layer/conf/fragments/anotherdomain/anotherfragment.conf | ||
| 1032 | |||
| 1033 | The variable containing a list of fragment metadata variables could look like this:: | ||
| 1034 | |||
| 1035 | OE_FRAGMENTS_METADATA_VARS = "BB_CONF_FRAGMENT_SUMMARY BB_CONF_FRAGMENT_DESCRIPTION" | ||
| 1036 | |||
| 1037 | The implementation will add a flag containing the fragment name to each of those variables | ||
| 1038 | when parsing fragments, so that the variables are namespaced by fragment name, and do not override | ||
| 1039 | each other when several fragments are enabled. | ||
| 1040 | |||
| 1041 | The variable containing a built-in fragment definitions could look like this:: | ||
| 1042 | |||
| 1043 | OE_BUILTIN_FRAGMENTS = "someprefix:SOMEVARIABLE anotherprefix:ANOTHERVARIABLE" | ||
| 1044 | |||
| 1045 | and then if 'someprefix/somevalue' is added to the variable that holds the list | ||
| 1046 | of enabled fragments: | ||
| 1047 | |||
| 1048 | OE_FRAGMENTS = "... someprefix/somevalue" | ||
| 1049 | |||
| 1050 | bitbake will treat that as direct value assignment in its configuration:: | ||
| 1051 | |||
| 1052 | SOMEVARIABLE = "somevalue" | ||
| 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 | |||
| 1151 | Functions | ||
| 1152 | ========= | ||
| 1153 | |||
| 1154 | As with most languages, functions are the building blocks that are used | ||
| 1155 | to build up operations into tasks. BitBake supports these types of | ||
| 1156 | functions: | ||
| 1157 | |||
| 1158 | - *Shell Functions:* Functions written in shell script and executed | ||
| 1159 | either directly as functions, tasks, or both. They can also be called | ||
| 1160 | by other shell functions. | ||
| 1161 | |||
| 1162 | - *BitBake-Style Python Functions:* Functions written in Python and | ||
| 1163 | executed by BitBake or other Python functions using | ||
| 1164 | ``bb.build.exec_func()``. | ||
| 1165 | |||
| 1166 | - *Python Functions:* Functions written in Python and executed by | ||
| 1167 | Python. | ||
| 1168 | |||
| 1169 | - *Anonymous Python Functions:* Python functions executed automatically | ||
| 1170 | during parsing. | ||
| 1171 | |||
| 1172 | Regardless of the type of function, you can only define them in class | ||
| 1173 | (``.bbclass``) and recipe (``.bb`` or ``.inc``) files. | ||
| 1174 | |||
| 1175 | Shell Functions | ||
| 1176 | --------------- | ||
| 1177 | |||
| 1178 | Functions written in shell script are executed either directly as | ||
| 1179 | functions, tasks, or both. They can also be called by other shell | ||
| 1180 | functions. Here is an example shell function definition:: | ||
| 1181 | |||
| 1182 | some_function () { | ||
| 1183 | echo "Hello World" | ||
| 1184 | } | ||
| 1185 | |||
| 1186 | When you create these types of functions in | ||
| 1187 | your recipe or class files, you need to follow the shell programming | ||
| 1188 | rules. The scripts are executed by ``/bin/sh``, which may not be a bash | ||
| 1189 | shell but might be something such as ``dash``. You should not use | ||
| 1190 | Bash-specific script (bashisms). | ||
| 1191 | |||
| 1192 | Overrides and override-style operators like ``:append`` and ``:prepend`` | ||
| 1193 | can also be applied to shell functions. Most commonly, this application | ||
| 1194 | would be used in a ``.bbappend`` file to modify functions in the main | ||
| 1195 | recipe. It can also be used to modify functions inherited from classes. | ||
| 1196 | |||
| 1197 | As an example, consider the following:: | ||
| 1198 | |||
| 1199 | do_foo() { | ||
| 1200 | bbplain first | ||
| 1201 | fn | ||
| 1202 | } | ||
| 1203 | |||
| 1204 | fn:prepend() { | ||
| 1205 | bbplain second | ||
| 1206 | } | ||
| 1207 | |||
| 1208 | fn() { | ||
| 1209 | bbplain third | ||
| 1210 | } | ||
| 1211 | |||
| 1212 | do_foo:append() { | ||
| 1213 | bbplain fourth | ||
| 1214 | } | ||
| 1215 | |||
| 1216 | Running ``do_foo`` prints the following:: | ||
| 1217 | |||
| 1218 | recipename do_foo: first | ||
| 1219 | recipename do_foo: second | ||
| 1220 | recipename do_foo: third | ||
| 1221 | recipename do_foo: fourth | ||
| 1222 | |||
| 1223 | .. note:: | ||
| 1224 | |||
| 1225 | Overrides and override-style operators can be applied to any shell | ||
| 1226 | function, not just :ref:`tasks <bitbake-user-manual/bitbake-user-manual-metadata:tasks>`. | ||
| 1227 | |||
| 1228 | You can use the ``bitbake -e recipename`` command to view the final | ||
| 1229 | assembled function after all overrides have been applied. | ||
| 1230 | |||
| 1231 | BitBake-Style Python Functions | ||
| 1232 | ------------------------------ | ||
| 1233 | |||
| 1234 | These functions are written in Python and executed by BitBake or other | ||
| 1235 | Python functions using ``bb.build.exec_func()``. | ||
| 1236 | |||
| 1237 | An example BitBake function is:: | ||
| 1238 | |||
| 1239 | python some_python_function () { | ||
| 1240 | d.setVar("TEXT", "Hello World") | ||
| 1241 | print d.getVar("TEXT") | ||
| 1242 | } | ||
| 1243 | |||
| 1244 | Because the | ||
| 1245 | Python "bb" and "os" modules are already imported, you do not need to | ||
| 1246 | import these modules. Also in these types of functions, the datastore | ||
| 1247 | ("d") is a global variable and is always automatically available. | ||
| 1248 | |||
| 1249 | .. note:: | ||
| 1250 | |||
| 1251 | Variable expressions (e.g. ``${X}`` ) are no longer expanded within Python | ||
| 1252 | functions. This behavior is intentional in order to allow you to freely set | ||
| 1253 | variable values to expandable expressions without having them expanded | ||
| 1254 | prematurely. If you do wish to expand a variable within a Python function, | ||
| 1255 | use ``d.getVar("X")`` . Or, for more complicated expressions, use ``d.expand()``. | ||
| 1256 | |||
| 1257 | Similar to shell functions, you can also apply overrides and | ||
| 1258 | override-style operators to BitBake-style Python functions. | ||
| 1259 | |||
| 1260 | As an example, consider the following:: | ||
| 1261 | |||
| 1262 | python do_foo:prepend() { | ||
| 1263 | bb.plain("first") | ||
| 1264 | } | ||
| 1265 | |||
| 1266 | python do_foo() { | ||
| 1267 | bb.plain("second") | ||
| 1268 | } | ||
| 1269 | |||
| 1270 | python do_foo:append() { | ||
| 1271 | bb.plain("third") | ||
| 1272 | } | ||
| 1273 | |||
| 1274 | Running ``do_foo`` prints the following:: | ||
| 1275 | |||
| 1276 | recipename do_foo: first | ||
| 1277 | recipename do_foo: second | ||
| 1278 | recipename do_foo: third | ||
| 1279 | |||
| 1280 | You can use the ``bitbake -e recipename`` command to view | ||
| 1281 | the final assembled function after all overrides have been applied. | ||
| 1282 | |||
| 1283 | Python Functions | ||
| 1284 | ---------------- | ||
| 1285 | |||
| 1286 | These functions are written in Python and are executed by other Python | ||
| 1287 | code. Examples of Python functions are utility functions that you intend | ||
| 1288 | to call from in-line Python or from within other Python functions. Here | ||
| 1289 | is an example:: | ||
| 1290 | |||
| 1291 | def get_depends(d): | ||
| 1292 | if d.getVar('SOMECONDITION'): | ||
| 1293 | return "dependencywithcond" | ||
| 1294 | else: | ||
| 1295 | return "dependency" | ||
| 1296 | |||
| 1297 | SOMECONDITION = "1" | ||
| 1298 | DEPENDS = "${@get_depends(d)}" | ||
| 1299 | |||
| 1300 | This would result in :term:`DEPENDS` containing ``dependencywithcond``. | ||
| 1301 | |||
| 1302 | Here are some things to know about Python functions: | ||
| 1303 | |||
| 1304 | - Python functions can take parameters. | ||
| 1305 | |||
| 1306 | - The BitBake datastore is not automatically available. Consequently, | ||
| 1307 | you must pass it in as a parameter to the function. | ||
| 1308 | |||
| 1309 | - The "bb" and "os" Python modules are automatically available. You do | ||
| 1310 | not need to import them. | ||
| 1311 | |||
| 1312 | BitBake-Style Python Functions Versus Python Functions | ||
| 1313 | ------------------------------------------------------ | ||
| 1314 | |||
| 1315 | Following are some important differences between BitBake-style Python | ||
| 1316 | functions and regular Python functions defined with "def": | ||
| 1317 | |||
| 1318 | - Only BitBake-style Python functions can be :ref:`tasks <bitbake-user-manual/bitbake-user-manual-metadata:tasks>`. | ||
| 1319 | |||
| 1320 | - Overrides and override-style operators can only be applied to | ||
| 1321 | BitBake-style Python functions. | ||
| 1322 | |||
| 1323 | - Only regular Python functions can take arguments and return values. | ||
| 1324 | |||
| 1325 | - :ref:`Variable flags <bitbake-user-manual/bitbake-user-manual-metadata:variable flags>` such as | ||
| 1326 | ``[dirs]``, ``[cleandirs]``, and ``[lockfiles]`` can be used on BitBake-style | ||
| 1327 | Python functions, but not on regular Python functions. | ||
| 1328 | |||
| 1329 | - BitBake-style Python functions generate a separate | ||
| 1330 | ``${``\ :term:`T`\ ``}/run.``\ function-name\ ``.``\ pid | ||
| 1331 | script that is executed to run the function, and also generate a log | ||
| 1332 | file in ``${T}/log.``\ function-name\ ``.``\ pid if they are executed | ||
| 1333 | as tasks. | ||
| 1334 | |||
| 1335 | Regular Python functions execute "inline" and do not generate any | ||
| 1336 | files in ``${T}``. | ||
| 1337 | |||
| 1338 | - Regular Python functions are called with the usual Python syntax. | ||
| 1339 | BitBake-style Python functions are usually tasks and are called | ||
| 1340 | directly by BitBake, but can also be called manually from Python code | ||
| 1341 | by using the ``bb.build.exec_func()`` function. Here is an example:: | ||
| 1342 | |||
| 1343 | bb.build.exec_func("my_bitbake_style_function", d) | ||
| 1344 | |||
| 1345 | .. note:: | ||
| 1346 | |||
| 1347 | ``bb.build.exec_func()`` can also be used to run shell functions from Python | ||
| 1348 | code. If you want to run a shell function before a Python function within | ||
| 1349 | the same task, then you can use a parent helper Python function that | ||
| 1350 | starts by running the shell function with ``bb.build.exec_func()`` and then | ||
| 1351 | runs the Python code. | ||
| 1352 | |||
| 1353 | To detect errors from functions executed with | ||
| 1354 | ``bb.build.exec_func()``, you can catch the ``bb.build.FuncFailed`` | ||
| 1355 | exception. | ||
| 1356 | |||
| 1357 | .. note:: | ||
| 1358 | |||
| 1359 | Functions in metadata (recipes and classes) should not themselves raise | ||
| 1360 | ``bb.build.FuncFailed``. Rather, ``bb.build.FuncFailed`` should be viewed as a | ||
| 1361 | general indicator that the called function failed by raising an | ||
| 1362 | exception. For example, an exception raised by ``bb.fatal()`` will be caught | ||
| 1363 | inside ``bb.build.exec_func()``, and a ``bb.build.FuncFailed`` will be raised in | ||
| 1364 | response. | ||
| 1365 | |||
| 1366 | Due to their simplicity, you should prefer regular Python functions over | ||
| 1367 | BitBake-style Python functions unless you need a feature specific to | ||
| 1368 | BitBake-style Python functions. Regular Python functions in metadata are | ||
| 1369 | a more recent invention than BitBake-style Python functions, and older | ||
| 1370 | code tends to use ``bb.build.exec_func()`` more often. | ||
| 1371 | |||
| 1372 | Anonymous Python Functions | ||
| 1373 | -------------------------- | ||
| 1374 | |||
| 1375 | Sometimes it is useful to set variables or perform other operations | ||
| 1376 | programmatically during parsing. To do this, you can define special | ||
| 1377 | Python functions, called anonymous Python functions, that run at the end | ||
| 1378 | of parsing. For example, the following conditionally sets a variable | ||
| 1379 | based on the value of another variable:: | ||
| 1380 | |||
| 1381 | python () { | ||
| 1382 | if d.getVar('SOMEVAR') == 'value': | ||
| 1383 | d.setVar('ANOTHERVAR', 'value2') | ||
| 1384 | } | ||
| 1385 | |||
| 1386 | An equivalent way to mark a function as an anonymous function is to give it | ||
| 1387 | the name "__anonymous", rather than no name. | ||
| 1388 | |||
| 1389 | Anonymous Python functions always run at the end of parsing, regardless | ||
| 1390 | of where they are defined. If a recipe contains many anonymous | ||
| 1391 | functions, they run in the same order as they are defined within the | ||
| 1392 | recipe. As an example, consider the following snippet:: | ||
| 1393 | |||
| 1394 | python () { | ||
| 1395 | d.setVar('FOO', 'foo 2') | ||
| 1396 | } | ||
| 1397 | |||
| 1398 | FOO = "foo 1" | ||
| 1399 | |||
| 1400 | python () { | ||
| 1401 | d.appendVar('BAR',' bar 2') | ||
| 1402 | } | ||
| 1403 | |||
| 1404 | BAR = "bar 1" | ||
| 1405 | |||
| 1406 | The previous example is conceptually | ||
| 1407 | equivalent to the following snippet:: | ||
| 1408 | |||
| 1409 | FOO = "foo 1" | ||
| 1410 | BAR = "bar 1" | ||
| 1411 | FOO = "foo 2" | ||
| 1412 | BAR += "bar 2" | ||
| 1413 | |||
| 1414 | ``FOO`` ends up with the value "foo 2", and | ||
| 1415 | ``BAR`` with the value "bar 1 bar 2". Just as in the second snippet, the | ||
| 1416 | values set for the variables within the anonymous functions become | ||
| 1417 | available to tasks, which always run after parsing. | ||
| 1418 | |||
| 1419 | Overrides and override-style operators such as "``:append``" are applied | ||
| 1420 | before anonymous functions run. In the following example, ``FOO`` ends | ||
| 1421 | up with the value "foo from anonymous":: | ||
| 1422 | |||
| 1423 | FOO = "foo" | ||
| 1424 | FOO:append = " from outside" | ||
| 1425 | |||
| 1426 | python () { | ||
| 1427 | d.setVar("FOO", "foo from anonymous") | ||
| 1428 | } | ||
| 1429 | |||
| 1430 | For methods | ||
| 1431 | you can use with anonymous Python functions, see the | ||
| 1432 | ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:functions you can call from within python`" | ||
| 1433 | section. For a different method to run Python code during parsing, see | ||
| 1434 | the ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:inline python variable expansion`" section. | ||
| 1435 | |||
| 1436 | Flexible Inheritance for Class Functions | ||
| 1437 | ---------------------------------------- | ||
| 1438 | |||
| 1439 | Through coding techniques and the use of ``EXPORT_FUNCTIONS``, BitBake | ||
| 1440 | supports exporting a function from a class such that the class function | ||
| 1441 | appears as the default implementation of the function, but can still be | ||
| 1442 | called if a recipe inheriting the class needs to define its own version | ||
| 1443 | of the function. | ||
| 1444 | |||
| 1445 | To understand the benefits of this feature, consider the basic scenario | ||
| 1446 | where a class defines a task function and your recipe inherits the | ||
| 1447 | class. In this basic scenario, your recipe inherits the task function as | ||
| 1448 | defined in the class. If desired, your recipe can add to the start and | ||
| 1449 | end of the function by using the ":prepend" or ":append" operations | ||
| 1450 | respectively, or it can redefine the function completely. However, if it | ||
| 1451 | redefines the function, there is no means for it to call the class | ||
| 1452 | version of the function. ``EXPORT_FUNCTIONS`` provides a mechanism that | ||
| 1453 | enables the recipe's version of the function to call the original | ||
| 1454 | version of the function. | ||
| 1455 | |||
| 1456 | To make use of this technique, you need the following things in place: | ||
| 1457 | |||
| 1458 | - The class needs to define the function as follows:: | ||
| 1459 | |||
| 1460 | classname_functionname | ||
| 1461 | |||
| 1462 | For example, if you have a class file | ||
| 1463 | ``bar.bbclass`` and a function named ``do_foo``, the class must | ||
| 1464 | define the function as follows:: | ||
| 1465 | |||
| 1466 | bar_do_foo | ||
| 1467 | |||
| 1468 | - The class needs to contain the ``EXPORT_FUNCTIONS`` statement as | ||
| 1469 | follows:: | ||
| 1470 | |||
| 1471 | EXPORT_FUNCTIONS functionname | ||
| 1472 | |||
| 1473 | For example, continuing with | ||
| 1474 | the same example, the statement in the ``bar.bbclass`` would be as | ||
| 1475 | follows:: | ||
| 1476 | |||
| 1477 | EXPORT_FUNCTIONS do_foo | ||
| 1478 | |||
| 1479 | - You need to call the function appropriately from within your recipe. | ||
| 1480 | Continuing with the same example, if your recipe needs to call the | ||
| 1481 | class version of the function, it should call ``bar_do_foo``. | ||
| 1482 | Assuming ``do_foo`` was a shell function and ``EXPORT_FUNCTIONS`` was | ||
| 1483 | used as above, the recipe's function could conditionally call the | ||
| 1484 | class version of the function as follows:: | ||
| 1485 | |||
| 1486 | do_foo() { | ||
| 1487 | if [ somecondition ] ; then | ||
| 1488 | bar_do_foo | ||
| 1489 | else | ||
| 1490 | # Do something else | ||
| 1491 | fi | ||
| 1492 | } | ||
| 1493 | |||
| 1494 | To call your modified version of the function as defined in your recipe, | ||
| 1495 | call it as ``do_foo``. | ||
| 1496 | |||
| 1497 | With these conditions met, your single recipe can freely choose between | ||
| 1498 | the original function as defined in the class file and the modified | ||
| 1499 | function in your recipe. If you do not set up these conditions, you are | ||
| 1500 | limited to using one function or the other. | ||
| 1501 | |||
| 1502 | Tasks | ||
| 1503 | ===== | ||
| 1504 | |||
| 1505 | Tasks are BitBake execution units that make up the steps that BitBake | ||
| 1506 | can run for a given recipe. Tasks are only supported in recipes and | ||
| 1507 | classes (i.e. in ``.bb`` files and files included or inherited from | ||
| 1508 | ``.bb`` files). By convention, tasks have names that start with "do\_". | ||
| 1509 | |||
| 1510 | Promoting a Function to a Task | ||
| 1511 | ------------------------------ | ||
| 1512 | |||
| 1513 | Tasks are either :ref:`shell functions <bitbake-user-manual/bitbake-user-manual-metadata:shell functions>` or | ||
| 1514 | :ref:`BitBake-style Python functions <bitbake-user-manual/bitbake-user-manual-metadata:bitbake-style python functions>` | ||
| 1515 | that have been promoted to tasks by using the ``addtask`` command. The | ||
| 1516 | ``addtask`` command can also optionally describe dependencies between | ||
| 1517 | the task and other tasks. Here is an example that shows how to define a | ||
| 1518 | task and declare some dependencies:: | ||
| 1519 | |||
| 1520 | python do_printdate () { | ||
| 1521 | import datetime | ||
| 1522 | bb.plain('Date: %s' % (datetime.date.today())) | ||
| 1523 | } | ||
| 1524 | addtask printdate after do_fetch before do_build | ||
| 1525 | |||
| 1526 | The first argument to ``addtask`` is the name | ||
| 1527 | of the function to promote to a task. If the name does not start with | ||
| 1528 | "do\_", "do\_" is implicitly added, which enforces the convention that all | ||
| 1529 | task names start with "do\_". | ||
| 1530 | |||
| 1531 | In the previous example, the ``do_printdate`` task becomes a dependency | ||
| 1532 | of the ``do_build`` task, which is the default task (i.e. the task run | ||
| 1533 | by the ``bitbake`` command unless another task is specified explicitly). | ||
| 1534 | Additionally, the ``do_printdate`` task becomes dependent upon the | ||
| 1535 | ``do_fetch`` task. Running the ``do_build`` task results in the | ||
| 1536 | ``do_printdate`` task running first. | ||
| 1537 | |||
| 1538 | .. note:: | ||
| 1539 | |||
| 1540 | If you try out the previous example, you might see that the | ||
| 1541 | ``do_printdate`` | ||
| 1542 | task is only run the first time you build the recipe with the | ||
| 1543 | ``bitbake`` | ||
| 1544 | command. This is because BitBake considers the task "up-to-date" | ||
| 1545 | after that initial run. If you want to force the task to always be | ||
| 1546 | rerun for experimentation purposes, you can make BitBake always | ||
| 1547 | consider the task "out-of-date" by using the | ||
| 1548 | :ref:`[nostamp] <bitbake-user-manual/bitbake-user-manual-metadata:Variable Flags>` | ||
| 1549 | variable flag, as follows:: | ||
| 1550 | |||
| 1551 | do_printdate[nostamp] = "1" | ||
| 1552 | |||
| 1553 | You can also explicitly run the task and provide the | ||
| 1554 | -f option as follows:: | ||
| 1555 | |||
| 1556 | $ bitbake recipe -c printdate -f | ||
| 1557 | |||
| 1558 | When manually selecting a task to run with the bitbake ``recipe | ||
| 1559 | -c task`` command, you can omit the "do\_" prefix as part of the task | ||
| 1560 | name. | ||
| 1561 | |||
| 1562 | You might wonder about the practical effects of using ``addtask`` | ||
| 1563 | without specifying any dependencies as is done in the following example:: | ||
| 1564 | |||
| 1565 | addtask printdate | ||
| 1566 | |||
| 1567 | In this example, assuming dependencies have not been | ||
| 1568 | added through some other means, the only way to run the task is by | ||
| 1569 | explicitly selecting it with ``bitbake`` recipe ``-c printdate``. You | ||
| 1570 | can use the ``do_listtasks`` task to list all tasks defined in a recipe | ||
| 1571 | as shown in the following example:: | ||
| 1572 | |||
| 1573 | $ bitbake recipe -c listtasks | ||
| 1574 | |||
| 1575 | For more information on task dependencies, see the | ||
| 1576 | ":ref:`bitbake-user-manual/bitbake-user-manual-execution:dependencies`" section. | ||
| 1577 | |||
| 1578 | See the ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:variable flags`" section for information | ||
| 1579 | on variable flags you can use with tasks. | ||
| 1580 | |||
| 1581 | .. note:: | ||
| 1582 | |||
| 1583 | While it's infrequent, it's possible to define multiple tasks as | ||
| 1584 | dependencies when calling ``addtask``. For example, here's a snippet | ||
| 1585 | from the OpenEmbedded class file ``package_tar.bbclass``:: | ||
| 1586 | |||
| 1587 | addtask package_write_tar before do_build after do_packagedata do_package | ||
| 1588 | |||
| 1589 | Note how the ``package_write_tar`` task has to wait until both of | ||
| 1590 | ``do_packagedata`` and ``do_package`` complete. | ||
| 1591 | |||
| 1592 | Deleting a Task | ||
| 1593 | --------------- | ||
| 1594 | |||
| 1595 | As well as being able to add tasks, you can delete them. Simply use the | ||
| 1596 | ``deltask`` command to delete a task. For example, to delete the example | ||
| 1597 | task used in the previous sections, you would use:: | ||
| 1598 | |||
| 1599 | deltask printdate | ||
| 1600 | |||
| 1601 | If you delete a task using the ``deltask`` command and the task has | ||
| 1602 | dependencies, the dependencies are not reconnected. For example, suppose | ||
| 1603 | you have three tasks named ``do_a``, ``do_b``, and ``do_c``. | ||
| 1604 | Furthermore, ``do_c`` is dependent on ``do_b``, which in turn is | ||
| 1605 | dependent on ``do_a``. Given this scenario, if you use ``deltask`` to | ||
| 1606 | delete ``do_b``, the implicit dependency relationship between ``do_c`` | ||
| 1607 | and ``do_a`` through ``do_b`` no longer exists, and ``do_c`` | ||
| 1608 | dependencies are not updated to include ``do_a``. Thus, ``do_c`` is free | ||
| 1609 | to run before ``do_a``. | ||
| 1610 | |||
| 1611 | If you want dependencies such as these to remain intact, use the | ||
| 1612 | ``[noexec]`` varflag to disable the task instead of using the | ||
| 1613 | ``deltask`` command to delete it:: | ||
| 1614 | |||
| 1615 | do_b[noexec] = "1" | ||
| 1616 | |||
| 1617 | Passing Information Into the Build Task Environment | ||
| 1618 | --------------------------------------------------- | ||
| 1619 | |||
| 1620 | When running a task, BitBake tightly controls the shell execution | ||
| 1621 | environment of the build tasks to make sure unwanted contamination from | ||
| 1622 | the build machine cannot influence the build. | ||
| 1623 | |||
| 1624 | .. note:: | ||
| 1625 | |||
| 1626 | By default, BitBake cleans the environment to include only those | ||
| 1627 | things exported or listed in its passthrough list to ensure that the | ||
| 1628 | build environment is reproducible and consistent. You can prevent this | ||
| 1629 | "cleaning" by setting the :term:`BB_PRESERVE_ENV` variable. | ||
| 1630 | |||
| 1631 | Consequently, if you do want something to get passed into the build task | ||
| 1632 | environment, you must take these two steps: | ||
| 1633 | |||
| 1634 | #. Tell BitBake to load what you want from the environment into the | ||
| 1635 | datastore. You can do so through the | ||
| 1636 | :term:`BB_ENV_PASSTHROUGH` and | ||
| 1637 | :term:`BB_ENV_PASSTHROUGH_ADDITIONS` variables. For | ||
| 1638 | example, assume you want to prevent the build system from accessing | ||
| 1639 | your ``$HOME/.ccache`` directory. The following command adds the | ||
| 1640 | the environment variable ``CCACHE_DIR`` to BitBake's passthrough | ||
| 1641 | list to allow that variable into the datastore:: | ||
| 1642 | |||
| 1643 | export BB_ENV_PASSTHROUGH_ADDITIONS="$BB_ENV_PASSTHROUGH_ADDITIONS CCACHE_DIR" | ||
| 1644 | |||
| 1645 | #. Tell BitBake to export what you have loaded into the datastore to the | ||
| 1646 | task environment of every running task. Loading something from the | ||
| 1647 | environment into the datastore (previous step) only makes it | ||
| 1648 | available in the datastore. To export it to the task environment of | ||
| 1649 | every running task, use a command similar to the following in your | ||
| 1650 | local configuration file ``local.conf`` or your distribution | ||
| 1651 | configuration file:: | ||
| 1652 | |||
| 1653 | export CCACHE_DIR | ||
| 1654 | |||
| 1655 | .. note:: | ||
| 1656 | |||
| 1657 | A side effect of the previous steps is that BitBake records the | ||
| 1658 | variable as a dependency of the build process in things like the | ||
| 1659 | setscene checksums. If doing so results in unnecessary rebuilds of | ||
| 1660 | tasks, you can also flag the variable so that the setscene code | ||
| 1661 | ignores the dependency when it creates checksums. | ||
| 1662 | |||
| 1663 | Sometimes, it is useful to be able to obtain information from the | ||
| 1664 | original execution environment. BitBake saves a copy of the original | ||
| 1665 | environment into a special variable named :term:`BB_ORIGENV`. | ||
| 1666 | |||
| 1667 | The :term:`BB_ORIGENV` variable returns a datastore object that can be | ||
| 1668 | queried using the standard datastore operators such as | ||
| 1669 | ``getVar(, False)``. The datastore object is useful, for example, to | ||
| 1670 | find the original ``DISPLAY`` variable. Here is an example:: | ||
| 1671 | |||
| 1672 | origenv = d.getVar("BB_ORIGENV", False) | ||
| 1673 | bar = origenv.getVar("BAR", False) | ||
| 1674 | |||
| 1675 | The previous example returns ``BAR`` from the original execution | ||
| 1676 | environment. | ||
| 1677 | |||
| 1678 | Variable Flags | ||
| 1679 | ============== | ||
| 1680 | |||
| 1681 | Variable flags (varflags) help control a task's functionality and | ||
| 1682 | dependencies. BitBake reads and writes varflags to the datastore using | ||
| 1683 | the following command forms:: | ||
| 1684 | |||
| 1685 | variable = d.getVarFlags("variable") | ||
| 1686 | self.d.setVarFlags("FOO", {"func": True}) | ||
| 1687 | |||
| 1688 | When working with varflags, the same syntax, with the exception of | ||
| 1689 | overrides, applies. In other words, you can set, append, and prepend | ||
| 1690 | varflags just like variables. See the | ||
| 1691 | ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:variable flag syntax`" section for details. | ||
| 1692 | |||
| 1693 | BitBake has a defined set of varflags available for recipes and classes. | ||
| 1694 | Tasks support a number of these flags which control various | ||
| 1695 | functionality of the task: | ||
| 1696 | |||
| 1697 | - ``[cleandirs]``: Empty directories that should be created before | ||
| 1698 | the task runs. Directories that already exist are removed and | ||
| 1699 | recreated to empty them. | ||
| 1700 | |||
| 1701 | - ``[depends]``: Controls inter-task dependencies. See the | ||
| 1702 | :term:`DEPENDS` variable and the | ||
| 1703 | ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:inter-task | ||
| 1704 | dependencies`" section for more information. | ||
| 1705 | |||
| 1706 | - ``[deptask]``: Controls task build-time dependencies. See the | ||
| 1707 | :term:`DEPENDS` variable and the ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:build dependencies`" section for more information. | ||
| 1708 | |||
| 1709 | - ``[dirs]``: Directories that should be created before the task | ||
| 1710 | runs. Directories that already exist are left as is. The last | ||
| 1711 | directory listed is used as the current working directory for the | ||
| 1712 | task. | ||
| 1713 | |||
| 1714 | - ``[file-checksums]``: Controls the file dependencies for a task. The | ||
| 1715 | baseline file list is the set of files associated with | ||
| 1716 | :term:`SRC_URI`. May be used to set additional dependencies on | ||
| 1717 | files not associated with :term:`SRC_URI`. | ||
| 1718 | |||
| 1719 | The value set to the list is a file-boolean pair where the first | ||
| 1720 | value is the file name and the second is whether or not it | ||
| 1721 | physically exists on the filesystem. :: | ||
| 1722 | |||
| 1723 | do_configure[file-checksums] += "${MY_DIRPATH}/my-file.txt:True" | ||
| 1724 | |||
| 1725 | It is important to record any paths which the task looked at and | ||
| 1726 | which didn't exist. This means that if these do exist at a later | ||
| 1727 | time, the task can be rerun with the new additional files. The | ||
| 1728 | "exists" True or False value after the path allows this to be | ||
| 1729 | handled. | ||
| 1730 | |||
| 1731 | - ``[lockfiles]``: Specifies one or more lockfiles to lock while the | ||
| 1732 | task executes. Only one task may hold a lockfile, and any task that | ||
| 1733 | attempts to lock an already locked file will block until the lock is | ||
| 1734 | released. You can use this variable flag to accomplish mutual | ||
| 1735 | exclusion. | ||
| 1736 | |||
| 1737 | - ``[network]``: When set to "1", allows a task to access the network. By | ||
| 1738 | default, only the ``do_fetch`` task is granted network access. Recipes | ||
| 1739 | shouldn't access the network outside of ``do_fetch`` as it usually | ||
| 1740 | undermines fetcher source mirroring, image and licence manifests, software | ||
| 1741 | auditing and supply chain security. | ||
| 1742 | |||
| 1743 | - ``[noexec]``: When set to "1", marks the task as being empty, with | ||
| 1744 | no execution required. You can use the ``[noexec]`` flag to set up | ||
| 1745 | tasks as dependency placeholders, or to disable tasks defined | ||
| 1746 | elsewhere that are not needed in a particular recipe. | ||
| 1747 | |||
| 1748 | - ``[nostamp]``: When set to "1", tells BitBake to not generate a | ||
| 1749 | stamp file for a task, which implies the task should always be | ||
| 1750 | executed. | ||
| 1751 | |||
| 1752 | .. caution:: | ||
| 1753 | |||
| 1754 | Any task that depends (possibly indirectly) on a ``[nostamp]`` task will | ||
| 1755 | always be executed as well. This can cause unnecessary rebuilding if you | ||
| 1756 | are not careful. | ||
| 1757 | |||
| 1758 | - ``[number_threads]``: Limits tasks to a specific number of | ||
| 1759 | simultaneous threads during execution. This varflag is useful when | ||
| 1760 | your build host has a large number of cores but certain tasks need to | ||
| 1761 | be rate-limited due to various kinds of resource constraints (e.g. to | ||
| 1762 | avoid network throttling). ``number_threads`` works similarly to the | ||
| 1763 | :term:`BB_NUMBER_THREADS` variable but is task-specific. | ||
| 1764 | |||
| 1765 | Set the value globally. For example, the following makes sure the | ||
| 1766 | ``do_fetch`` task uses no more than two simultaneous execution | ||
| 1767 | threads: do_fetch[number_threads] = "2" | ||
| 1768 | |||
| 1769 | .. warning:: | ||
| 1770 | |||
| 1771 | - Setting the varflag in individual recipes rather than globally | ||
| 1772 | can result in unpredictable behavior. | ||
| 1773 | |||
| 1774 | - Setting the varflag to a value greater than the value used in | ||
| 1775 | the :term:`BB_NUMBER_THREADS` variable causes ``number_threads`` to | ||
| 1776 | have no effect. | ||
| 1777 | |||
| 1778 | - ``[postfuncs]``: List of functions to call after the completion of | ||
| 1779 | the task. | ||
| 1780 | |||
| 1781 | - ``[prefuncs]``: List of functions to call before the task executes. | ||
| 1782 | |||
| 1783 | - ``[rdepends]``: Controls inter-task runtime dependencies. See the | ||
| 1784 | :term:`RDEPENDS` variable, the | ||
| 1785 | :term:`RRECOMMENDS` variable, and the | ||
| 1786 | ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:inter-task dependencies`" section for | ||
| 1787 | more information. | ||
| 1788 | |||
| 1789 | - ``[rdeptask]``: Controls task runtime dependencies. See the | ||
| 1790 | :term:`RDEPENDS` variable, the | ||
| 1791 | :term:`RRECOMMENDS` variable, and the | ||
| 1792 | ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:runtime dependencies`" section for more | ||
| 1793 | information. | ||
| 1794 | |||
| 1795 | - ``[recideptask]``: When set in conjunction with ``recrdeptask``, | ||
| 1796 | specifies a task that should be inspected for additional | ||
| 1797 | dependencies. | ||
| 1798 | |||
| 1799 | - ``[recrdeptask]``: Controls task recursive runtime dependencies. | ||
| 1800 | See the :term:`RDEPENDS` variable, the | ||
| 1801 | :term:`RRECOMMENDS` variable, and the | ||
| 1802 | ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:recursive dependencies`" section for | ||
| 1803 | more information. | ||
| 1804 | |||
| 1805 | - ``[stamp-extra-info]``: Extra stamp information to append to the | ||
| 1806 | task's stamp. As an example, OpenEmbedded uses this flag to allow | ||
| 1807 | machine-specific tasks. | ||
| 1808 | |||
| 1809 | - ``[umask]``: The umask to run the task under. | ||
| 1810 | |||
| 1811 | Several varflags are useful for controlling how signatures are | ||
| 1812 | calculated for variables. For more information on this process, see the | ||
| 1813 | ":ref:`bitbake-user-manual/bitbake-user-manual-execution:checksums (signatures)`" section. | ||
| 1814 | |||
| 1815 | - ``[vardeps]``: Specifies a space-separated list of additional | ||
| 1816 | variables to add to a variable's dependencies for the purposes of | ||
| 1817 | calculating its signature. Adding variables to this list is useful, | ||
| 1818 | for example, when a function refers to a variable in a manner that | ||
| 1819 | does not allow BitBake to automatically determine that the variable | ||
| 1820 | is referred to. | ||
| 1821 | |||
| 1822 | - ``[vardepsexclude]``: Specifies a space-separated list of variables | ||
| 1823 | that should be excluded from a variable's dependencies for the | ||
| 1824 | purposes of calculating its signature. | ||
| 1825 | |||
| 1826 | - ``[vardepvalue]``: If set, instructs BitBake to ignore the actual | ||
| 1827 | value of the variable and instead use the specified value when | ||
| 1828 | calculating the variable's signature. | ||
| 1829 | |||
| 1830 | - ``[vardepvalueexclude]``: Specifies a pipe-separated list of | ||
| 1831 | strings to exclude from the variable's value when calculating the | ||
| 1832 | variable's signature. | ||
| 1833 | |||
| 1834 | Events | ||
| 1835 | ====== | ||
| 1836 | |||
| 1837 | BitBake allows installation of event handlers within recipe and class | ||
| 1838 | files. Events are triggered at certain points during operation, such as | ||
| 1839 | the beginning of operation against a given recipe (i.e. ``*.bb``), the | ||
| 1840 | start of a given task, a task failure, a task success, and so forth. The | ||
| 1841 | intent is to make it easy to do things like email notification on build | ||
| 1842 | failures. | ||
| 1843 | |||
| 1844 | Following is an example event handler that prints the name of the event | ||
| 1845 | and the content of the :term:`FILE` variable:: | ||
| 1846 | |||
| 1847 | addhandler myclass_eventhandler | ||
| 1848 | python myclass_eventhandler() { | ||
| 1849 | from bb.event import getName | ||
| 1850 | print("The name of the Event is %s" % getName(e)) | ||
| 1851 | print("The file we run for is %s" % d.getVar('FILE')) | ||
| 1852 | } | ||
| 1853 | myclass_eventhandler[eventmask] = "bb.event.BuildStarted | ||
| 1854 | bb.event.BuildCompleted" | ||
| 1855 | |||
| 1856 | In the previous example, an eventmask has been | ||
| 1857 | set so that the handler only sees the "BuildStarted" and | ||
| 1858 | "BuildCompleted" events. This event handler gets called every time an | ||
| 1859 | event matching the eventmask is triggered. A global variable "e" is | ||
| 1860 | defined, which represents the current event. With the ``getName(e)`` | ||
| 1861 | method, you can get the name of the triggered event. The global | ||
| 1862 | datastore is available as "d". In legacy code, you might see "e.data" | ||
| 1863 | used to get the datastore. However, realize that "e.data" is deprecated | ||
| 1864 | and you should use "d" going forward. | ||
| 1865 | |||
| 1866 | The context of the datastore is appropriate to the event in question. | ||
| 1867 | For example, "BuildStarted" and "BuildCompleted" events run before any | ||
| 1868 | tasks are executed so would be in the global configuration datastore | ||
| 1869 | namespace. No recipe-specific metadata exists in that namespace. The | ||
| 1870 | "BuildStarted" and "BuildCompleted" events also run in the main | ||
| 1871 | cooker/server process rather than any worker context. Thus, any changes | ||
| 1872 | made to the datastore would be seen by other cooker/server events within | ||
| 1873 | the current build but not seen outside of that build or in any worker | ||
| 1874 | context. Task events run in the actual tasks in question consequently | ||
| 1875 | have recipe-specific and task-specific contents. These events run in the | ||
| 1876 | worker context and are discarded at the end of task execution. | ||
| 1877 | |||
| 1878 | During a standard build, the following common events might occur. The | ||
| 1879 | following events are the most common kinds of events that most metadata | ||
| 1880 | might have an interest in viewing: | ||
| 1881 | |||
| 1882 | - ``bb.event.ConfigParsed()``: Fired when the base configuration; which | ||
| 1883 | consists of ``bitbake.conf``, ``base.bbclass`` and any global | ||
| 1884 | :term:`INHERIT` statements; has been parsed. You can see multiple such | ||
| 1885 | events when each of the workers parse the base configuration or if | ||
| 1886 | the server changes configuration and reparses. Any given datastore | ||
| 1887 | only has one such event executed against it, however. If | ||
| 1888 | :term:`BB_INVALIDCONF` is set in the datastore by the event | ||
| 1889 | handler, the configuration is reparsed and a new event triggered, | ||
| 1890 | allowing the metadata to update configuration. | ||
| 1891 | |||
| 1892 | - ``bb.event.HeartbeatEvent()``: Fires at regular time intervals of one | ||
| 1893 | second. You can configure the interval time using the | ||
| 1894 | ``BB_HEARTBEAT_EVENT`` variable. The event's "time" attribute is the | ||
| 1895 | ``time.time()`` value when the event is triggered. This event is | ||
| 1896 | useful for activities such as system state monitoring. | ||
| 1897 | |||
| 1898 | - ``bb.event.ParseStarted()``: Fired when BitBake is about to start | ||
| 1899 | parsing recipes. This event's "total" attribute represents the number | ||
| 1900 | of recipes BitBake plans to parse. | ||
| 1901 | |||
| 1902 | - ``bb.event.ParseProgress()``: Fired as parsing progresses. This | ||
| 1903 | event's "current" attribute is the number of recipes parsed as well | ||
| 1904 | as the "total" attribute. | ||
| 1905 | |||
| 1906 | - ``bb.event.ParseCompleted()``: Fired when parsing is complete. This | ||
| 1907 | event's "cached", "parsed", "skipped", "virtuals", "masked", and | ||
| 1908 | "errors" attributes provide statistics for the parsing results. | ||
| 1909 | |||
| 1910 | - ``bb.event.BuildStarted()``: Fired when a new build starts. BitBake | ||
| 1911 | fires multiple "BuildStarted" events (one per configuration) when | ||
| 1912 | multiple configuration (multiconfig) is enabled. | ||
| 1913 | |||
| 1914 | - ``bb.build.TaskStarted()``: Fired when a task starts. This event's | ||
| 1915 | "taskfile" attribute points to the recipe from which the task | ||
| 1916 | originates. The "taskname" attribute, which is the task's name, | ||
| 1917 | includes the ``do_`` prefix, and the "logfile" attribute point to | ||
| 1918 | where the task's output is stored. Finally, the "time" attribute is | ||
| 1919 | the task's execution start time. | ||
| 1920 | |||
| 1921 | - ``bb.build.TaskInvalid()``: Fired if BitBake tries to execute a task | ||
| 1922 | that does not exist. | ||
| 1923 | |||
| 1924 | - ``bb.build.TaskFailedSilent()``: Fired for setscene tasks that fail | ||
| 1925 | and should not be presented to the user verbosely. | ||
| 1926 | |||
| 1927 | - ``bb.build.TaskFailed()``: Fired for normal tasks that fail. | ||
| 1928 | |||
| 1929 | - ``bb.build.TaskSucceeded()``: Fired when a task successfully | ||
| 1930 | completes. | ||
| 1931 | |||
| 1932 | - ``bb.event.BuildCompleted()``: Fired when a build finishes. | ||
| 1933 | |||
| 1934 | - ``bb.cooker.CookerExit()``: Fired when the BitBake server/cooker | ||
| 1935 | shuts down. This event is usually only seen by the UIs as a sign they | ||
| 1936 | should also shutdown. | ||
| 1937 | |||
| 1938 | This next list of example events occur based on specific requests to the | ||
| 1939 | server. These events are often used to communicate larger pieces of | ||
| 1940 | information from the BitBake server to other parts of BitBake such as | ||
| 1941 | user interfaces: | ||
| 1942 | |||
| 1943 | - ``bb.event.TreeDataPreparationStarted()`` | ||
| 1944 | - ``bb.event.TreeDataPreparationProgress()`` | ||
| 1945 | - ``bb.event.TreeDataPreparationCompleted()`` | ||
| 1946 | - ``bb.event.DepTreeGenerated()`` | ||
| 1947 | - ``bb.event.CoreBaseFilesFound()`` | ||
| 1948 | - ``bb.event.ConfigFilePathFound()`` | ||
| 1949 | - ``bb.event.FilesMatchingFound()`` | ||
| 1950 | - ``bb.event.ConfigFilesFound()`` | ||
| 1951 | - ``bb.event.TargetsTreeGenerated()`` | ||
| 1952 | |||
| 1953 | .. _variants-class-extension-mechanism: | ||
| 1954 | |||
| 1955 | Variants --- Class Extension Mechanism | ||
| 1956 | ====================================== | ||
| 1957 | |||
| 1958 | BitBake supports multiple incarnations of a recipe file via the | ||
| 1959 | :term:`BBCLASSEXTEND` variable. | ||
| 1960 | |||
| 1961 | The :term:`BBCLASSEXTEND` variable is a space separated list of classes used | ||
| 1962 | to "extend" the recipe for each variant. Here is an example that results in a | ||
| 1963 | second incarnation of the current recipe being available. This second | ||
| 1964 | incarnation will have the "native" class inherited. :: | ||
| 1965 | |||
| 1966 | BBCLASSEXTEND = "native" | ||
| 1967 | |||
| 1968 | .. note:: | ||
| 1969 | |||
| 1970 | The mechanism for this class extension is extremely specific to the | ||
| 1971 | implementation. Usually, the recipe's :term:`PROVIDES` , :term:`PN` , and | ||
| 1972 | :term:`DEPENDS` variables would need to be modified by the extension | ||
| 1973 | class. For specific examples, see the OE-Core native , nativesdk , and | ||
| 1974 | multilib classes. | ||
| 1975 | |||
| 1976 | Dependencies | ||
| 1977 | ============ | ||
| 1978 | |||
| 1979 | To allow for efficient parallel processing, BitBake handles dependencies | ||
| 1980 | at the task level. Dependencies can exist both between tasks within a | ||
| 1981 | single recipe and between tasks in different recipes. Following are | ||
| 1982 | examples of each: | ||
| 1983 | |||
| 1984 | - For tasks within a single recipe, a recipe's ``do_configure`` task | ||
| 1985 | might need to complete before its ``do_compile`` task can run. | ||
| 1986 | |||
| 1987 | - For tasks in different recipes, one recipe's ``do_configure`` task | ||
| 1988 | might require another recipe's ``do_populate_sysroot`` task to finish | ||
| 1989 | first such that the libraries and headers provided by the other | ||
| 1990 | recipe are available. | ||
| 1991 | |||
| 1992 | This section describes several ways to declare dependencies. Remember, | ||
| 1993 | even though dependencies are declared in different ways, they are all | ||
| 1994 | simply dependencies between tasks. | ||
| 1995 | |||
| 1996 | .. _dependencies-internal-to-the-bb-file: | ||
| 1997 | |||
| 1998 | Dependencies Internal to the ``.bb`` File | ||
| 1999 | ----------------------------------------- | ||
| 2000 | |||
| 2001 | BitBake uses the ``addtask`` directive to manage dependencies that are | ||
| 2002 | internal to a given recipe file. You can use the ``addtask`` directive | ||
| 2003 | to indicate when a task is dependent on other tasks or when other tasks | ||
| 2004 | depend on that recipe. Here is an example:: | ||
| 2005 | |||
| 2006 | addtask printdate after do_fetch before do_build | ||
| 2007 | |||
| 2008 | In this example, the ``do_printdate`` task | ||
| 2009 | depends on the completion of the ``do_fetch`` task, and the ``do_build`` | ||
| 2010 | task depends on the completion of the ``do_printdate`` task. | ||
| 2011 | |||
| 2012 | .. note:: | ||
| 2013 | |||
| 2014 | For a task to run, it must be a direct or indirect dependency of some | ||
| 2015 | other task that is scheduled to run. | ||
| 2016 | |||
| 2017 | For illustration, here are some examples: | ||
| 2018 | |||
| 2019 | - The directive ``addtask mytask before do_configure`` causes | ||
| 2020 | ``do_mytask`` to run before ``do_configure`` runs. Be aware that | ||
| 2021 | ``do_mytask`` still only runs if its :ref:`input | ||
| 2022 | checksum <bitbake-user-manual/bitbake-user-manual-execution:checksums (signatures)>` has changed since the last time it was | ||
| 2023 | run. Changes to the input checksum of ``do_mytask`` also | ||
| 2024 | indirectly cause ``do_configure`` to run. | ||
| 2025 | |||
| 2026 | - The directive ``addtask mytask after do_configure`` by itself | ||
| 2027 | never causes ``do_mytask`` to run. ``do_mytask`` can still be run | ||
| 2028 | manually as follows:: | ||
| 2029 | |||
| 2030 | $ bitbake recipe -c mytask | ||
| 2031 | |||
| 2032 | Declaring ``do_mytask`` as a dependency of some other task that is | ||
| 2033 | scheduled to run also causes it to run. Regardless, the task runs after | ||
| 2034 | ``do_configure``. | ||
| 2035 | |||
| 2036 | Build Dependencies | ||
| 2037 | ------------------ | ||
| 2038 | |||
| 2039 | BitBake uses the :term:`DEPENDS` variable to manage | ||
| 2040 | build time dependencies. The ``[deptask]`` varflag for tasks signifies | ||
| 2041 | the task of each item listed in :term:`DEPENDS` that must complete before | ||
| 2042 | that task can be executed. Here is an example:: | ||
| 2043 | |||
| 2044 | do_configure[deptask] = "do_populate_sysroot" | ||
| 2045 | |||
| 2046 | In this example, the ``do_populate_sysroot`` task | ||
| 2047 | of each item in :term:`DEPENDS` must complete before ``do_configure`` can | ||
| 2048 | execute. | ||
| 2049 | |||
| 2050 | Runtime Dependencies | ||
| 2051 | -------------------- | ||
| 2052 | |||
| 2053 | BitBake uses the :term:`PACKAGES`, :term:`RDEPENDS`, and :term:`RRECOMMENDS` | ||
| 2054 | variables to manage runtime dependencies. | ||
| 2055 | |||
| 2056 | The :term:`PACKAGES` variable lists runtime packages. Each of those packages | ||
| 2057 | can have :term:`RDEPENDS` and :term:`RRECOMMENDS` runtime dependencies. The | ||
| 2058 | ``[rdeptask]`` flag for tasks is used to signify the task of each item | ||
| 2059 | runtime dependency which must have completed before that task can be | ||
| 2060 | executed. :: | ||
| 2061 | |||
| 2062 | do_package_qa[rdeptask] = "do_packagedata" | ||
| 2063 | |||
| 2064 | In the previous | ||
| 2065 | example, the ``do_packagedata`` task of each item in :term:`RDEPENDS` must | ||
| 2066 | have completed before ``do_package_qa`` can execute. | ||
| 2067 | Although :term:`RDEPENDS` contains entries from the | ||
| 2068 | runtime dependency namespace, BitBake knows how to map them back | ||
| 2069 | to the build-time dependency namespace, in which the tasks are defined. | ||
| 2070 | |||
| 2071 | Recursive Dependencies | ||
| 2072 | ---------------------- | ||
| 2073 | |||
| 2074 | BitBake uses the ``[recrdeptask]`` flag to manage recursive task | ||
| 2075 | dependencies. BitBake looks through the build-time and runtime | ||
| 2076 | dependencies of the current recipe, looks through the task's inter-task | ||
| 2077 | dependencies, and then adds dependencies for the listed task. Once | ||
| 2078 | BitBake has accomplished this, it recursively works through the | ||
| 2079 | dependencies of those tasks. Iterative passes continue until all | ||
| 2080 | dependencies are discovered and added. | ||
| 2081 | |||
| 2082 | The ``[recrdeptask]`` flag is most commonly used in high-level recipes | ||
| 2083 | that need to wait for some task to finish "globally". For example, | ||
| 2084 | ``image.bbclass`` has the following:: | ||
| 2085 | |||
| 2086 | do_rootfs[recrdeptask] += "do_packagedata" | ||
| 2087 | |||
| 2088 | This statement says that the ``do_packagedata`` task of | ||
| 2089 | the current recipe and all recipes reachable (by way of dependencies) | ||
| 2090 | from the image recipe must run before the ``do_rootfs`` task can run. | ||
| 2091 | |||
| 2092 | BitBake allows a task to recursively depend on itself by | ||
| 2093 | referencing itself in the task list:: | ||
| 2094 | |||
| 2095 | do_a[recrdeptask] = "do_a do_b" | ||
| 2096 | |||
| 2097 | In the same way as before, this means that the ``do_a`` | ||
| 2098 | and ``do_b`` tasks of the current recipe and all | ||
| 2099 | recipes reachable (by way of dependencies) from the recipe | ||
| 2100 | must run before the ``do_a`` task can run. In this | ||
| 2101 | case BitBake will ignore the current recipe's ``do_a`` | ||
| 2102 | task circular dependency on itself. | ||
| 2103 | |||
| 2104 | Inter-Task Dependencies | ||
| 2105 | ----------------------- | ||
| 2106 | |||
| 2107 | BitBake uses the ``[depends]`` flag in a more generic form to manage | ||
| 2108 | inter-task dependencies. This more generic form allows for | ||
| 2109 | inter-dependency checks for specific tasks rather than checks for the | ||
| 2110 | data in :term:`DEPENDS`. Here is an example:: | ||
| 2111 | |||
| 2112 | do_patch[depends] = "quilt-native:do_populate_sysroot" | ||
| 2113 | |||
| 2114 | In this example, the ``do_populate_sysroot`` task of the target ``quilt-native`` | ||
| 2115 | must have completed before the ``do_patch`` task can execute. | ||
| 2116 | |||
| 2117 | The ``[rdepends]`` flag works in a similar way but takes targets in the | ||
| 2118 | runtime namespace instead of the build-time dependency namespace. | ||
| 2119 | |||
| 2120 | Functions You Can Call From Within Python | ||
| 2121 | ========================================= | ||
| 2122 | |||
| 2123 | BitBake provides many functions you can call from within Python | ||
| 2124 | functions. This section lists the most commonly used functions, and | ||
| 2125 | mentions where to find others. | ||
| 2126 | |||
| 2127 | Functions for Accessing Datastore Variables | ||
| 2128 | ------------------------------------------- | ||
| 2129 | |||
| 2130 | It is often necessary to access variables in the BitBake datastore using | ||
| 2131 | Python functions. The BitBake datastore has an API that allows you this | ||
| 2132 | access. Here is a list of available operations: | ||
| 2133 | |||
| 2134 | .. list-table:: | ||
| 2135 | :widths: auto | ||
| 2136 | :header-rows: 1 | ||
| 2137 | |||
| 2138 | * - *Operation* | ||
| 2139 | - *Description* | ||
| 2140 | * - ``d.getVar("X", expand)`` | ||
| 2141 | - Returns the value of variable "X". Using "expand=True" expands the | ||
| 2142 | value. Returns "None" if the variable "X" does not exist. | ||
| 2143 | * - ``d.setVar("X", "value")`` | ||
| 2144 | - Sets the variable "X" to "value" | ||
| 2145 | * - ``d.appendVar("X", "value")`` | ||
| 2146 | - Adds "value" to the end of the variable "X". Acts like ``d.setVar("X", | ||
| 2147 | "value")`` if the variable "X" does not exist. | ||
| 2148 | * - ``d.prependVar("X", "value")`` | ||
| 2149 | - Adds "value" to the start of the variable "X". Acts like | ||
| 2150 | ``d.setVar("X","value")`` if the variable "X" does not exist. | ||
| 2151 | * - ``d.delVar("X")`` | ||
| 2152 | - Deletes the variable "X" from the datastore. Does nothing if the variable | ||
| 2153 | "X" does not exist. | ||
| 2154 | * - ``d.renameVar("X", "Y")`` | ||
| 2155 | - Renames the variable "X" to "Y". Does nothing if the variable "X" does | ||
| 2156 | not exist. | ||
| 2157 | * - ``d.getVarFlag("X", flag, expand)`` | ||
| 2158 | - Returns the value of variable "X". Using "expand=True" expands the | ||
| 2159 | value. Returns "None" if either the variable "X" or the named flag does | ||
| 2160 | not exist. | ||
| 2161 | * - ``d.setVarFlag("X", flag, "value")`` | ||
| 2162 | - Sets the named flag for variable "X" to "value". | ||
| 2163 | * - ``d.appendVarFlag("X", flag, "value")`` | ||
| 2164 | - Appends "value" to the named flag on the variable "X". Acts like | ||
| 2165 | ``d.setVarFlag("X", flag, "value")`` if the named flag does not exist. | ||
| 2166 | * - ``d.prependVarFlag("X", flag, "value")`` | ||
| 2167 | - Prepends "value" to the named flag on the variable "X". Acts like | ||
| 2168 | ``d.setVarFlag("X", flag, "value")`` if the named flag does not exist. | ||
| 2169 | * - ``d.delVarFlag("X", flag)`` | ||
| 2170 | - Deletes the named flag on the variable "X" from the datastore. | ||
| 2171 | * - ``d.setVarFlags("X", flagsdict)`` | ||
| 2172 | - Sets the flags specified in the ``flagsdict()`` | ||
| 2173 | parameter. ``setVarFlags`` does not clear previous flags. Think of this | ||
| 2174 | operation as ``addVarFlags``. | ||
| 2175 | * - ``d.getVarFlags("X")`` | ||
| 2176 | - Returns a ``flagsdict`` of the flags for the variable "X". Returns "None" | ||
| 2177 | if the variable "X" does not exist. | ||
| 2178 | * - ``d.delVarFlags("X")`` | ||
| 2179 | - Deletes all the flags for the variable "X". Does nothing if the variable | ||
| 2180 | "X" does not exist. | ||
| 2181 | * - ``d.expand(expression)`` | ||
| 2182 | - Expands variable references in the specified string | ||
| 2183 | expression. References to variables that do not exist are left as is. For | ||
| 2184 | example, ``d.expand("foo ${X}")`` expands to the literal string "foo | ||
| 2185 | ${X}" if the variable "X" does not exist. | ||
| 2186 | |||
| 2187 | Other Functions | ||
| 2188 | --------------- | ||
| 2189 | |||
| 2190 | Other functions are documented in the | ||
| 2191 | :doc:`/bitbake-user-manual/bitbake-user-manual-library-functions` document. | ||
| 2192 | |||
| 2193 | Extending Python Library Code | ||
| 2194 | ----------------------------- | ||
| 2195 | |||
| 2196 | If you wish to add your own Python library code (e.g. to provide | ||
| 2197 | functions/classes you can use from Python functions in the metadata) | ||
| 2198 | you can do so from any layer using the ``addpylib`` directive. | ||
| 2199 | This directive is typically added to your layer configuration ( | ||
| 2200 | ``conf/layer.conf``) although it will be handled in any ``.conf`` file. | ||
| 2201 | |||
| 2202 | Usage is of the form:: | ||
| 2203 | |||
| 2204 | addpylib <directory> <namespace> | ||
| 2205 | |||
| 2206 | Where <directory> specifies the directory to add to the library path. | ||
| 2207 | The specified <namespace> is imported automatically, and if the imported | ||
| 2208 | module specifies an attribute named ``BBIMPORTS``, that list of | ||
| 2209 | sub-modules is iterated and imported too. | ||
| 2210 | |||
| 2211 | Testing and Debugging BitBake Python code | ||
| 2212 | ----------------------------------------- | ||
| 2213 | |||
| 2214 | The OpenEmbedded build system implements a convenient ``pydevshell`` target which | ||
| 2215 | you can use to access the BitBake datastore and experiment with your own Python | ||
| 2216 | code. See :yocto_docs:`Using a Python Development Shell | ||
| 2217 | </dev-manual/python-development-shell.html#using-a-python-development-shell>` in the Yocto | ||
| 2218 | Project manual for details. | ||
| 2219 | |||
| 2220 | Task Checksums and Setscene | ||
| 2221 | =========================== | ||
| 2222 | |||
| 2223 | BitBake uses checksums (or signatures) along with the setscene to | ||
| 2224 | determine if a task needs to be run. This section describes the process. | ||
| 2225 | To help understand how BitBake does this, the section assumes an | ||
| 2226 | OpenEmbedded metadata-based example. | ||
| 2227 | |||
| 2228 | These checksums are stored in :term:`STAMP`. You can | ||
| 2229 | examine the checksums using the following BitBake command:: | ||
| 2230 | |||
| 2231 | $ bitbake-dumpsigs | ||
| 2232 | |||
| 2233 | This command returns the signature data in a readable | ||
| 2234 | format that allows you to examine the inputs used when the OpenEmbedded | ||
| 2235 | build system generates signatures. For example, using | ||
| 2236 | ``bitbake-dumpsigs`` allows you to examine the ``do_compile`` task's | ||
| 2237 | "sigdata" for a C application (e.g. ``bash``). Running the command also | ||
| 2238 | reveals that the "CC" variable is part of the inputs that are hashed. | ||
| 2239 | Any changes to this variable would invalidate the stamp and cause the | ||
| 2240 | ``do_compile`` task to run. | ||
| 2241 | |||
| 2242 | The following list describes related variables: | ||
| 2243 | |||
| 2244 | - :term:`BB_HASHCHECK_FUNCTION`: | ||
| 2245 | Specifies the name of the function to call during the "setscene" part | ||
| 2246 | of the task's execution in order to validate the list of task hashes. | ||
| 2247 | |||
| 2248 | - :term:`BB_SETSCENE_DEPVALID`: | ||
| 2249 | Specifies a function BitBake calls that determines whether BitBake | ||
| 2250 | requires a setscene dependency to be met. | ||
| 2251 | |||
| 2252 | - :term:`BB_TASKHASH`: Within an executing task, | ||
| 2253 | this variable holds the hash of the task as returned by the currently | ||
| 2254 | enabled signature generator. | ||
| 2255 | |||
| 2256 | - :term:`STAMP`: The base path to create stamp files. | ||
| 2257 | |||
| 2258 | - :term:`STAMPCLEAN`: Again, the base path to | ||
| 2259 | create stamp files but can use wildcards for matching a range of | ||
| 2260 | files for clean operations. | ||
| 2261 | |||
| 2262 | Wildcard Support in Variables | ||
| 2263 | ============================= | ||
| 2264 | |||
| 2265 | Support for wildcard use in variables varies depending on the context in | ||
| 2266 | which it is used. For example, some variables and filenames allow | ||
| 2267 | limited use of wildcards through the "``%``" and "``*``" characters. | ||
| 2268 | Other variables or names support Python's | ||
| 2269 | `glob <https://docs.python.org/3/library/glob.html>`_ syntax, | ||
| 2270 | `fnmatch <https://docs.python.org/3/library/fnmatch.html#module-fnmatch>`_ | ||
| 2271 | syntax, or | ||
| 2272 | `Regular Expression (re) <https://docs.python.org/3/library/re.html>`_ | ||
| 2273 | syntax. | ||
| 2274 | |||
| 2275 | For variables that have wildcard suport, the documentation describes | ||
| 2276 | which form of wildcard, its use, and its limitations. | ||
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables-context.rst b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables-context.rst deleted file mode 100644 index e9c454ba11..0000000000 --- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables-context.rst +++ /dev/null | |||
| @@ -1,91 +0,0 @@ | |||
| 1 | .. SPDX-License-Identifier: CC-BY-2.5 | ||
| 2 | |||
| 3 | ================ | ||
| 4 | Variable Context | ||
| 5 | ================ | ||
| 6 | |||
| 7 | | | ||
| 8 | |||
| 9 | Variables might only have an impact or can be used in certain contexts. Some | ||
| 10 | should only be used in global files like ``.conf``, while others are intended only | ||
| 11 | for local files like ``.bb``. This chapter aims to describe some important variable | ||
| 12 | contexts. | ||
| 13 | |||
| 14 | .. _ref-varcontext-configuration: | ||
| 15 | |||
| 16 | BitBake's own configuration | ||
| 17 | =========================== | ||
| 18 | |||
| 19 | Variables starting with ``BB_`` usually configure the behaviour of BitBake itself. | ||
| 20 | For example, one could configure: | ||
| 21 | |||
| 22 | - System resources, like disk space to be used (:term:`BB_DISKMON_DIRS`), | ||
| 23 | or the number of tasks to be run in parallel by BitBake (:term:`BB_NUMBER_THREADS`). | ||
| 24 | |||
| 25 | - How the fetchers shall behave, e.g., :term:`BB_FETCH_PREMIRRORONLY` is used | ||
| 26 | by BitBake to determine if BitBake's fetcher shall search only | ||
| 27 | :term:`PREMIRRORS` for files. | ||
| 28 | |||
| 29 | Those variables are usually configured globally. | ||
| 30 | |||
| 31 | BitBake configuration | ||
| 32 | ===================== | ||
| 33 | |||
| 34 | There are variables: | ||
| 35 | |||
| 36 | - Like :term:`B` or :term:`T`, that are used to specify directories used by | ||
| 37 | BitBake during the build of a particular recipe. Those variables are | ||
| 38 | specified in ``bitbake.conf``. Some, like :term:`B`, are quite often | ||
| 39 | overwritten in recipes. | ||
| 40 | |||
| 41 | - Starting with ``FAKEROOT``, to configure how the ``fakeroot`` command is | ||
| 42 | handled. Those are usually set by ``bitbake.conf`` and might get adapted in a | ||
| 43 | ``bbclass``. | ||
| 44 | |||
| 45 | - Detailing where BitBake will store and fetch information from, for | ||
| 46 | data reuse between build runs like :term:`CACHE`, :term:`DL_DIR` or | ||
| 47 | :term:`PERSISTENT_DIR`. Those are usually global. | ||
| 48 | |||
| 49 | |||
| 50 | Layers and files | ||
| 51 | ================ | ||
| 52 | |||
| 53 | Variables starting with ``LAYER`` configure how BitBake handles layers. | ||
| 54 | Additionally, variables starting with ``BB`` configure how layers and files are | ||
| 55 | handled. For example: | ||
| 56 | |||
| 57 | - :term:`LAYERDEPENDS` is used to configure on which layers a given layer | ||
| 58 | depends. | ||
| 59 | |||
| 60 | - The configured layers are contained in :term:`BBLAYERS` and files in | ||
| 61 | :term:`BBFILES`. | ||
| 62 | |||
| 63 | Those variables are often used in the files ``layer.conf`` and ``bblayers.conf``. | ||
| 64 | |||
| 65 | Recipes and packages | ||
| 66 | ==================== | ||
| 67 | |||
| 68 | Variables handling recipes and packages can be split into: | ||
| 69 | |||
| 70 | - :term:`PN`, :term:`PV` or :term:`PF` for example, contain information about | ||
| 71 | the name or revision of a recipe or package. Usually, the default set in | ||
| 72 | ``bitbake.conf`` is used, but those are from time to time overwritten in | ||
| 73 | recipes. | ||
| 74 | |||
| 75 | - :term:`SUMMARY`, :term:`DESCRIPTION`, :term:`LICENSE` or :term:`HOMEPAGE` | ||
| 76 | contain the expected information and should be set specifically for every | ||
| 77 | recipe. | ||
| 78 | |||
| 79 | - In recipes, variables are also used to control build and runtime | ||
| 80 | dependencies between recipes/packages with other recipes/packages. The | ||
| 81 | most common should be: :term:`PROVIDES`, :term:`RPROVIDES`, :term:`DEPENDS`, | ||
| 82 | and :term:`RDEPENDS`. | ||
| 83 | |||
| 84 | - There are further variables starting with ``SRC`` that specify the sources in | ||
| 85 | a recipe like :term:`SRC_URI` or :term:`SRCDATE`. Those are also usually set | ||
| 86 | in recipes. | ||
| 87 | |||
| 88 | - Which version or provider of a recipe should be given preference when | ||
| 89 | multiple recipes would provide the same item, is controlled by variables | ||
| 90 | starting with ``PREFERRED_``. Those are normally set in the configuration | ||
| 91 | files of a ``MACHINE`` or ``DISTRO``. | ||
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst deleted file mode 100644 index 810f886897..0000000000 --- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst +++ /dev/null | |||
| @@ -1,1699 +0,0 @@ | |||
| 1 | .. SPDX-License-Identifier: CC-BY-2.5 | ||
| 2 | |||
| 3 | ================== | ||
| 4 | Variables Glossary | ||
| 5 | ================== | ||
| 6 | |||
| 7 | | | ||
| 8 | |||
| 9 | This chapter lists common variables used by BitBake and gives an | ||
| 10 | overview of their function and contents. | ||
| 11 | |||
| 12 | .. note:: | ||
| 13 | |||
| 14 | Following are some points regarding the variables listed in this | ||
| 15 | glossary: | ||
| 16 | |||
| 17 | - The variables listed in this glossary are specific to BitBake. | ||
| 18 | Consequently, the descriptions are limited to that context. | ||
| 19 | |||
| 20 | - Also, variables exist in other systems that use BitBake (e.g. The | ||
| 21 | Yocto Project and OpenEmbedded) that have names identical to those | ||
| 22 | found in this glossary. For such cases, the variables in those | ||
| 23 | systems extend the functionality of the variable as it is | ||
| 24 | described here in this glossary. | ||
| 25 | |||
| 26 | .. glossary:: | ||
| 27 | :sorted: | ||
| 28 | |||
| 29 | :term:`ASSUME_PROVIDED` | ||
| 30 | Lists recipe names (:term:`PN` values) BitBake does not | ||
| 31 | attempt to build. Instead, BitBake assumes these recipes have already | ||
| 32 | been built. | ||
| 33 | |||
| 34 | In OpenEmbedded-Core, :term:`ASSUME_PROVIDED` mostly specifies native | ||
| 35 | tools that should not be built. An example is ``git-native``, which | ||
| 36 | when specified allows for the Git binary from the host to be used | ||
| 37 | rather than building ``git-native``. | ||
| 38 | |||
| 39 | :term:`AZ_SAS` | ||
| 40 | Azure Storage Shared Access Signature, when using the | ||
| 41 | :ref:`Azure Storage fetcher <bitbake-user-manual/bitbake-user-manual-fetching:fetchers>` | ||
| 42 | This variable can be defined to be used by the fetcher to authenticate | ||
| 43 | and gain access to non-public artifacts:: | ||
| 44 | |||
| 45 | AZ_SAS = ""se=2021-01-01&sp=r&sv=2018-11-09&sr=c&skoid=<skoid>&sig=<signature>"" | ||
| 46 | |||
| 47 | For more information see Microsoft's Azure Storage documentation at | ||
| 48 | https://docs.microsoft.com/en-us/azure/storage/common/storage-sas-overview | ||
| 49 | |||
| 50 | |||
| 51 | :term:`B` | ||
| 52 | The directory in which BitBake executes functions during a recipe's | ||
| 53 | build process. | ||
| 54 | |||
| 55 | :term:`BB_ALLOWED_NETWORKS` | ||
| 56 | Specifies a space-delimited list of hosts that the fetcher is allowed | ||
| 57 | to use to obtain the required source code. Following are | ||
| 58 | considerations surrounding this variable: | ||
| 59 | |||
| 60 | - This host list is only used if | ||
| 61 | :term:`BB_NO_NETWORK` is either not set or | ||
| 62 | set to "0". | ||
| 63 | |||
| 64 | - Limited support for the "``*``" wildcard character for matching | ||
| 65 | against the beginning of host names exists. For example, the | ||
| 66 | following setting matches ``git.gnu.org``, ``ftp.gnu.org``, and | ||
| 67 | ``foo.git.gnu.org``. :: | ||
| 68 | |||
| 69 | BB_ALLOWED_NETWORKS = "\*.gnu.org" | ||
| 70 | |||
| 71 | .. important:: | ||
| 72 | |||
| 73 | The use of the "``*``" character only works at the beginning of | ||
| 74 | a host name and it must be isolated from the remainder of the | ||
| 75 | host name. You cannot use the wildcard character in any other | ||
| 76 | location of the name or combined with the front part of the | ||
| 77 | name. | ||
| 78 | |||
| 79 | For example, ``*.foo.bar`` is supported, while ``*aa.foo.bar`` | ||
| 80 | is not. | ||
| 81 | |||
| 82 | - Mirrors not in the host list are skipped and logged in debug. | ||
| 83 | |||
| 84 | - Attempts to access networks not in the host list cause a failure. | ||
| 85 | |||
| 86 | Using :term:`BB_ALLOWED_NETWORKS` in conjunction with | ||
| 87 | :term:`PREMIRRORS` is very useful. Adding the | ||
| 88 | host you want to use to :term:`PREMIRRORS` results in the source code | ||
| 89 | being fetched from an allowed location and avoids raising an error | ||
| 90 | when a host that is not allowed is in a | ||
| 91 | :term:`SRC_URI` statement. This is because the | ||
| 92 | fetcher does not attempt to use the host listed in :term:`SRC_URI` after | ||
| 93 | a successful fetch from the :term:`PREMIRRORS` occurs. | ||
| 94 | |||
| 95 | :term:`BB_BASEHASH_IGNORE_VARS` | ||
| 96 | Lists variables that are excluded from checksum and dependency data. | ||
| 97 | Variables that are excluded can therefore change without affecting | ||
| 98 | the checksum mechanism. A common example would be the variable for | ||
| 99 | the path of the build. BitBake's output should not (and usually does | ||
| 100 | not) depend on the directory in which it was built. | ||
| 101 | |||
| 102 | :term:`BB_CACHEDIR` | ||
| 103 | Specifies the code parser cache directory (distinct from :term:`CACHE` | ||
| 104 | and :term:`PERSISTENT_DIR` although they can be set to the same value | ||
| 105 | if desired). The default value is "${TOPDIR}/cache". | ||
| 106 | |||
| 107 | :term:`BB_CHECK_SSL_CERTS` | ||
| 108 | Specifies if SSL certificates should be checked when fetching. The default | ||
| 109 | value is ``1`` and certificates are not checked if the value is set to ``0``. | ||
| 110 | |||
| 111 | :term:`BB_HASH_CODEPARSER_VALS` | ||
| 112 | Specifies values for variables to use when populating the codeparser cache. | ||
| 113 | This can be used selectively to set dummy values for variables to avoid | ||
| 114 | the codeparser cache growing on every parse. Variables that would typically | ||
| 115 | be included are those where the value is not significant for where the | ||
| 116 | codeparser cache is used (i.e. when calculating variable dependencies for | ||
| 117 | code fragments.) The value is space-separated without quoting values, for | ||
| 118 | example:: | ||
| 119 | |||
| 120 | BB_HASH_CODEPARSER_VALS = "T=/ WORKDIR=/ DATE=1234 TIME=1234" | ||
| 121 | |||
| 122 | :term:`BB_CONSOLELOG` | ||
| 123 | Specifies the path to a log file into which BitBake's user interface | ||
| 124 | writes output during the build. | ||
| 125 | |||
| 126 | :term:`BB_CURRENTTASK` | ||
| 127 | Contains the name of the currently running task. The name does not | ||
| 128 | include the ``do_`` prefix. | ||
| 129 | |||
| 130 | :term:`BB_CURRENT_MC` | ||
| 131 | Contains the name of the current multiconfig a task is being run under. | ||
| 132 | The name is taken from the multiconfig configuration file (a file | ||
| 133 | ``mc1.conf`` would make this variable equal to ``mc1``). | ||
| 134 | |||
| 135 | :term:`BB_DEFAULT_TASK` | ||
| 136 | The default task to use when none is specified (e.g. with the ``-c`` | ||
| 137 | command line option). The task name specified should not include the | ||
| 138 | ``do_`` prefix. | ||
| 139 | |||
| 140 | :term:`BB_DEFAULT_UMASK` | ||
| 141 | The default umask to apply to tasks if specified and no task specific | ||
| 142 | umask flag is set. | ||
| 143 | |||
| 144 | :term:`BB_DEFER_BBCLASSES` | ||
| 145 | The classes listed in this variable have their :ref:`inherit | ||
| 146 | <ref-bitbake-user-manual-metadata-inherit>` calls automatically promoted | ||
| 147 | to deferred inherits. See :ref:`inherit_defer | ||
| 148 | <ref-bitbake-user-manual-metadata-inherit-defer>` for more information on | ||
| 149 | deferred inherits. | ||
| 150 | |||
| 151 | This means that if :term:`BB_DEFER_BBCLASSES` is set as follows:: | ||
| 152 | |||
| 153 | BB_DEFER_BBCLASSES = "foo" | ||
| 154 | |||
| 155 | The following statement:: | ||
| 156 | |||
| 157 | inherit foo | ||
| 158 | |||
| 159 | Will automatically be equal to calling:: | ||
| 160 | |||
| 161 | inherit_defer foo | ||
| 162 | |||
| 163 | :term:`BB_DISKMON_DIRS` | ||
| 164 | Monitors disk space and available inodes during the build and allows | ||
| 165 | you to control the build based on these parameters. | ||
| 166 | |||
| 167 | Disk space monitoring is disabled by default. When setting this | ||
| 168 | variable, use the following form:: | ||
| 169 | |||
| 170 | BB_DISKMON_DIRS = "<action>,<dir>,<threshold> [...]" | ||
| 171 | |||
| 172 | where: | ||
| 173 | |||
| 174 | <action> is: | ||
| 175 | HALT: Immediately halt the build when | ||
| 176 | a threshold is broken. | ||
| 177 | STOPTASKS: Stop the build after the currently | ||
| 178 | executing tasks have finished when | ||
| 179 | a threshold is broken. | ||
| 180 | WARN: Issue a warning but continue the | ||
| 181 | build when a threshold is broken. | ||
| 182 | Subsequent warnings are issued as | ||
| 183 | defined by the | ||
| 184 | BB_DISKMON_WARNINTERVAL variable, | ||
| 185 | which must be defined. | ||
| 186 | |||
| 187 | <dir> is: | ||
| 188 | Any directory you choose. You can specify one or | ||
| 189 | more directories to monitor by separating the | ||
| 190 | groupings with a space. If two directories are | ||
| 191 | on the same device, only the first directory | ||
| 192 | is monitored. | ||
| 193 | |||
| 194 | <threshold> is: | ||
| 195 | Either the minimum available disk space, | ||
| 196 | the minimum number of free inodes, or | ||
| 197 | both. You must specify at least one. To | ||
| 198 | omit one or the other, simply omit the value. | ||
| 199 | Specify the threshold using G, M, K for Gbytes, | ||
| 200 | Mbytes, and Kbytes, respectively. If you do | ||
| 201 | not specify G, M, or K, Kbytes is assumed by | ||
| 202 | default. Do not use GB, MB, or KB. | ||
| 203 | |||
| 204 | Here are some examples:: | ||
| 205 | |||
| 206 | BB_DISKMON_DIRS = "HALT,${TMPDIR},1G,100K WARN,${SSTATE_DIR},1G,100K" | ||
| 207 | BB_DISKMON_DIRS = "STOPTASKS,${TMPDIR},1G" | ||
| 208 | BB_DISKMON_DIRS = "HALT,${TMPDIR},,100K" | ||
| 209 | |||
| 210 | The first example works only if you also set the | ||
| 211 | :term:`BB_DISKMON_WARNINTERVAL` | ||
| 212 | variable. This example causes the build system to immediately halt | ||
| 213 | when either the disk space in ``${TMPDIR}`` drops below 1 Gbyte or | ||
| 214 | the available free inodes drops below 100 Kbytes. Because two | ||
| 215 | directories are provided with the variable, the build system also | ||
| 216 | issues a warning when the disk space in the ``${SSTATE_DIR}`` | ||
| 217 | directory drops below 1 Gbyte or the number of free inodes drops | ||
| 218 | below 100 Kbytes. Subsequent warnings are issued during intervals as | ||
| 219 | defined by the :term:`BB_DISKMON_WARNINTERVAL` variable. | ||
| 220 | |||
| 221 | The second example stops the build after all currently executing | ||
| 222 | tasks complete when the minimum disk space in the ``${TMPDIR}`` | ||
| 223 | directory drops below 1 Gbyte. No disk monitoring occurs for the free | ||
| 224 | inodes in this case. | ||
| 225 | |||
| 226 | The final example immediately halts the build when the number of | ||
| 227 | free inodes in the ``${TMPDIR}`` directory drops below 100 Kbytes. No | ||
| 228 | disk space monitoring for the directory itself occurs in this case. | ||
| 229 | |||
| 230 | :term:`BB_DISKMON_WARNINTERVAL` | ||
| 231 | Defines the disk space and free inode warning intervals. | ||
| 232 | |||
| 233 | If you are going to use the :term:`BB_DISKMON_WARNINTERVAL` variable, you | ||
| 234 | must also use the :term:`BB_DISKMON_DIRS` | ||
| 235 | variable and define its action as "WARN". During the build, | ||
| 236 | subsequent warnings are issued each time disk space or number of free | ||
| 237 | inodes further reduces by the respective interval. | ||
| 238 | |||
| 239 | If you do not provide a :term:`BB_DISKMON_WARNINTERVAL` variable and you | ||
| 240 | do use :term:`BB_DISKMON_DIRS` with the "WARN" action, the disk | ||
| 241 | monitoring interval defaults to the following: | ||
| 242 | BB_DISKMON_WARNINTERVAL = "50M,5K" | ||
| 243 | |||
| 244 | When specifying the variable in your configuration file, use the | ||
| 245 | following form:: | ||
| 246 | |||
| 247 | BB_DISKMON_WARNINTERVAL = "<disk_space_interval>,<disk_inode_interval>" | ||
| 248 | |||
| 249 | where: | ||
| 250 | |||
| 251 | <disk_space_interval> is: | ||
| 252 | An interval of memory expressed in either | ||
| 253 | G, M, or K for Gbytes, Mbytes, or Kbytes, | ||
| 254 | respectively. You cannot use GB, MB, or KB. | ||
| 255 | |||
| 256 | <disk_inode_interval> is: | ||
| 257 | An interval of free inodes expressed in either | ||
| 258 | G, M, or K for Gbytes, Mbytes, or Kbytes, | ||
| 259 | respectively. You cannot use GB, MB, or KB. | ||
| 260 | |||
| 261 | Here is an example:: | ||
| 262 | |||
| 263 | BB_DISKMON_DIRS = "WARN,${SSTATE_DIR},1G,100K" | ||
| 264 | BB_DISKMON_WARNINTERVAL = "50M,5K" | ||
| 265 | |||
| 266 | These variables cause BitBake to | ||
| 267 | issue subsequent warnings each time the available disk space further | ||
| 268 | reduces by 50 Mbytes or the number of free inodes further reduces by | ||
| 269 | 5 Kbytes in the ``${SSTATE_DIR}`` directory. Subsequent warnings | ||
| 270 | based on the interval occur each time a respective interval is | ||
| 271 | reached beyond the initial warning (i.e. 1 Gbytes and 100 Kbytes). | ||
| 272 | |||
| 273 | :term:`BB_ENV_PASSTHROUGH` | ||
| 274 | Specifies the internal list of variables to allow through from | ||
| 275 | the external environment into BitBake's datastore. If the value of | ||
| 276 | this variable is not specified (which is the default), the following | ||
| 277 | list is used: :term:`BBPATH`, :term:`BB_PRESERVE_ENV`, | ||
| 278 | :term:`BB_ENV_PASSTHROUGH`, and :term:`BB_ENV_PASSTHROUGH_ADDITIONS`. | ||
| 279 | |||
| 280 | .. note:: | ||
| 281 | |||
| 282 | You must set this variable in the external environment in order | ||
| 283 | for it to work. | ||
| 284 | |||
| 285 | :term:`BB_ENV_PASSTHROUGH_ADDITIONS` | ||
| 286 | Specifies an additional set of variables to allow through from the | ||
| 287 | external environment into BitBake's datastore. This list of variables | ||
| 288 | are on top of the internal list set in | ||
| 289 | :term:`BB_ENV_PASSTHROUGH`. | ||
| 290 | |||
| 291 | .. note:: | ||
| 292 | |||
| 293 | You must set this variable in the external environment in order | ||
| 294 | for it to work. | ||
| 295 | |||
| 296 | :term:`BB_FETCH_PREMIRRORONLY` | ||
| 297 | When set to "1", causes BitBake's fetcher module to only search | ||
| 298 | :term:`PREMIRRORS` for files. BitBake will not | ||
| 299 | search the main :term:`SRC_URI` or | ||
| 300 | :term:`MIRRORS`. | ||
| 301 | |||
| 302 | :term:`BB_FILENAME` | ||
| 303 | Contains the filename of the recipe that owns the currently running | ||
| 304 | task. For example, if the ``do_fetch`` task that resides in the | ||
| 305 | ``my-recipe.bb`` is executing, the :term:`BB_FILENAME` variable contains | ||
| 306 | "/foo/path/my-recipe.bb". | ||
| 307 | |||
| 308 | :term:`BB_GENERATE_MIRROR_TARBALLS` | ||
| 309 | Causes tarballs of the Git repositories, including the Git metadata, | ||
| 310 | to be placed in the :term:`DL_DIR` directory. Anyone | ||
| 311 | wishing to create a source mirror would want to enable this variable. | ||
| 312 | |||
| 313 | For performance reasons, creating and placing tarballs of the Git | ||
| 314 | repositories is not the default action by BitBake. :: | ||
| 315 | |||
| 316 | BB_GENERATE_MIRROR_TARBALLS = "1" | ||
| 317 | |||
| 318 | :term:`BB_GENERATE_SHALLOW_TARBALLS` | ||
| 319 | Setting this variable to "1" when :term:`BB_GIT_SHALLOW` is also set to | ||
| 320 | "1" causes bitbake to generate shallow mirror tarballs when fetching git | ||
| 321 | repositories. The number of commits included in the shallow mirror | ||
| 322 | tarballs is controlled by :term:`BB_GIT_SHALLOW_DEPTH`. | ||
| 323 | |||
| 324 | If both :term:`BB_GIT_SHALLOW` and :term:`BB_GENERATE_MIRROR_TARBALLS` are | ||
| 325 | enabled, bitbake will generate shallow mirror tarballs by default for git | ||
| 326 | repositories. This separate variable exists so that shallow tarball | ||
| 327 | generation can be enabled without needing to also enable normal mirror | ||
| 328 | generation if it is not desired. | ||
| 329 | |||
| 330 | For example usage, see :term:`BB_GIT_SHALLOW`. | ||
| 331 | |||
| 332 | :term:`BB_GIT_DEFAULT_DESTSUFFIX` | ||
| 333 | The default destination directory where the :ref:`Git fetcher | ||
| 334 | <git-fetcher>` unpacks the source code. If this variable is not set, the | ||
| 335 | source code is unpacked in a directory named "git". | ||
| 336 | |||
| 337 | :term:`BB_GIT_SHALLOW` | ||
| 338 | Setting this variable to "1" enables the support for fetching, using and | ||
| 339 | generating mirror tarballs of `shallow git repositories <https://riptutorial.com/git/example/4584/shallow-clone>`_. | ||
| 340 | The external `git-make-shallow <https://git.openembedded.org/bitbake/tree/bin/git-make-shallow>`_ | ||
| 341 | script is used for shallow mirror tarball creation. | ||
| 342 | |||
| 343 | When :term:`BB_GIT_SHALLOW` is enabled, bitbake will attempt to fetch a shallow | ||
| 344 | mirror tarball. If the shallow mirror tarball cannot be fetched, it will | ||
| 345 | try to fetch the full mirror tarball and use that. | ||
| 346 | |||
| 347 | This setting causes an initial shallow clone instead of an initial full bare clone. | ||
| 348 | The amount of data transferred during the initial clone will be significantly reduced. | ||
| 349 | |||
| 350 | However, every time the source revision (referenced in :term:`SRCREV`) | ||
| 351 | changes, regardless of whether the cache within the download directory | ||
| 352 | (defined by :term:`DL_DIR`) has been cleaned up or not, | ||
| 353 | the data transfer may be significantly higher because entirely | ||
| 354 | new shallow clones are required for each source revision change. | ||
| 355 | |||
| 356 | Over time, numerous shallow clones may cumulatively transfer | ||
| 357 | the same amount of data as an initial full bare clone. | ||
| 358 | This is especially the case with very large repositories. | ||
| 359 | |||
| 360 | Existing initial full bare clones, created without this setting, | ||
| 361 | will still be utilized. | ||
| 362 | |||
| 363 | If the Git error "Server does not allow request for unadvertised object" | ||
| 364 | occurs, an initial full bare clone is fetched automatically. | ||
| 365 | This may happen if the Git server does not allow the request | ||
| 366 | or if the Git client has issues with this functionality. | ||
| 367 | |||
| 368 | See also :term:`BB_GIT_SHALLOW_DEPTH` and | ||
| 369 | :term:`BB_GENERATE_SHALLOW_TARBALLS`. | ||
| 370 | |||
| 371 | Example usage:: | ||
| 372 | |||
| 373 | BB_GIT_SHALLOW ?= "1" | ||
| 374 | |||
| 375 | # Keep only the top commit | ||
| 376 | BB_GIT_SHALLOW_DEPTH ?= "1" | ||
| 377 | |||
| 378 | # This defaults to enabled if both BB_GIT_SHALLOW and | ||
| 379 | # BB_GENERATE_MIRROR_TARBALLS are enabled | ||
| 380 | BB_GENERATE_SHALLOW_TARBALLS ?= "1" | ||
| 381 | |||
| 382 | :term:`BB_GIT_SHALLOW_DEPTH` | ||
| 383 | When used with :term:`BB_GENERATE_SHALLOW_TARBALLS`, this variable sets | ||
| 384 | the number of commits to include in generated shallow mirror tarballs. | ||
| 385 | With a depth of 1, only the commit referenced in :term:`SRCREV` is | ||
| 386 | included in the shallow mirror tarball. Increasing the depth includes | ||
| 387 | additional parent commits, working back through the commit history. | ||
| 388 | |||
| 389 | If this variable is unset, bitbake will default to a depth of 1 when | ||
| 390 | generating shallow mirror tarballs. | ||
| 391 | |||
| 392 | For example usage, see :term:`BB_GIT_SHALLOW`. | ||
| 393 | |||
| 394 | :term:`BB_GLOBAL_PYMODULES` | ||
| 395 | Specifies the list of Python modules to place in the global namespace. | ||
| 396 | It is intended that only the core layer should set this and it is meant | ||
| 397 | to be a very small list, typically just ``os`` and ``sys``. | ||
| 398 | :term:`BB_GLOBAL_PYMODULES` is expected to be set before the first | ||
| 399 | ``addpylib`` directive. | ||
| 400 | See also ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:extending python library code`". | ||
| 401 | |||
| 402 | :term:`BB_HASHCHECK_FUNCTION` | ||
| 403 | Specifies the name of the function to call during the "setscene" part | ||
| 404 | of the task's execution in order to validate the list of task hashes. | ||
| 405 | The function returns the list of setscene tasks that should be | ||
| 406 | executed. | ||
| 407 | |||
| 408 | At this point in the execution of the code, the objective is to | ||
| 409 | quickly verify if a given setscene function is likely to work or not. | ||
| 410 | It's easier to check the list of setscene functions in one pass than | ||
| 411 | to call many individual tasks. The returned list need not be | ||
| 412 | completely accurate. A given setscene task can still later fail. | ||
| 413 | However, the more accurate the data returned, the more efficient the | ||
| 414 | build will be. | ||
| 415 | |||
| 416 | :term:`BB_HASHCONFIG_IGNORE_VARS` | ||
| 417 | Lists variables that are excluded from base configuration checksum, | ||
| 418 | which is used to determine if the cache can be reused. | ||
| 419 | |||
| 420 | One of the ways BitBake determines whether to re-parse the main | ||
| 421 | metadata is through checksums of the variables in the datastore of | ||
| 422 | the base configuration data. There are variables that you typically | ||
| 423 | want to exclude when checking whether or not to re-parse and thus | ||
| 424 | rebuild the cache. As an example, you would usually exclude ``TIME`` | ||
| 425 | and ``DATE`` because these variables are always changing. If you did | ||
| 426 | not exclude them, BitBake would never reuse the cache. | ||
| 427 | |||
| 428 | :term:`BB_HASHSERVE` | ||
| 429 | Specifies the Hash Equivalence server to use. | ||
| 430 | |||
| 431 | If set to ``auto``, BitBake automatically starts its own server | ||
| 432 | over a UNIX domain socket. An option is to connect this server | ||
| 433 | to an upstream one, by setting :term:`BB_HASHSERVE_UPSTREAM`. | ||
| 434 | |||
| 435 | If set to ``unix://path``, BitBake will connect to an existing | ||
| 436 | hash server available over a UNIX domain socket. | ||
| 437 | |||
| 438 | If set to ``host:port``, BitBake will connect to a remote server on the | ||
| 439 | specified host. This allows multiple clients to share the same | ||
| 440 | hash equivalence data. | ||
| 441 | |||
| 442 | The remote server can be started manually through | ||
| 443 | the ``bin/bitbake-hashserv`` script provided by BitBake, | ||
| 444 | which supports UNIX domain sockets too. This script also allows | ||
| 445 | to start the server in read-only mode, to avoid accepting | ||
| 446 | equivalences that correspond to Share State caches that are | ||
| 447 | only available on specific clients. | ||
| 448 | |||
| 449 | :term:`BB_HASHSERVE_UPSTREAM` | ||
| 450 | Specifies an upstream Hash Equivalence server. | ||
| 451 | |||
| 452 | This optional setting is only useful when a local Hash Equivalence | ||
| 453 | server is started (setting :term:`BB_HASHSERVE` to ``auto``), | ||
| 454 | and you wish the local server to query an upstream server for | ||
| 455 | Hash Equivalence data. | ||
| 456 | |||
| 457 | Example usage:: | ||
| 458 | |||
| 459 | BB_HASHSERVE_UPSTREAM = "hashserv.yoctoproject.org:8686" | ||
| 460 | |||
| 461 | :term:`BB_INVALIDCONF` | ||
| 462 | Used in combination with the ``ConfigParsed`` event to trigger | ||
| 463 | re-parsing the base metadata (i.e. all the recipes). The | ||
| 464 | ``ConfigParsed`` event can set the variable to trigger the re-parse. | ||
| 465 | You must be careful to avoid recursive loops with this functionality. | ||
| 466 | |||
| 467 | :term:`BB_LOADFACTOR_MAX` | ||
| 468 | Setting this to a value will cause BitBake to check the system load | ||
| 469 | average before executing new tasks. If the load average is above the | ||
| 470 | the number of CPUs multipled by this factor, no new task will be started | ||
| 471 | unless there is no task executing. A value of "1.5" has been found to | ||
| 472 | work reasonably. This is helpful for systems which don't have pressure | ||
| 473 | regulation enabled, which is more granular. Pressure values take | ||
| 474 | precedence over loadfactor. | ||
| 475 | |||
| 476 | :term:`BB_LOGCONFIG` | ||
| 477 | Specifies the name of a config file that contains the user logging | ||
| 478 | configuration. See | ||
| 479 | :ref:`bitbake-user-manual/bitbake-user-manual-execution:logging` | ||
| 480 | for additional information | ||
| 481 | |||
| 482 | :term:`BB_LOGFMT` | ||
| 483 | Specifies the name of the log files saved into | ||
| 484 | ``${``\ :term:`T`\ ``}``. By default, the :term:`BB_LOGFMT` | ||
| 485 | variable is undefined and the log filenames get created using the | ||
| 486 | following form:: | ||
| 487 | |||
| 488 | log.{task}.{pid} | ||
| 489 | |||
| 490 | If you want to force log files to take a specific name, you can set this | ||
| 491 | variable in a configuration file. | ||
| 492 | |||
| 493 | :term:`BB_MULTI_PROVIDER_ALLOWED` | ||
| 494 | Allows you to suppress BitBake warnings caused when building two | ||
| 495 | separate recipes that provide the same output. | ||
| 496 | |||
| 497 | BitBake normally issues a warning when building two different recipes | ||
| 498 | where each provides the same output. This scenario is usually | ||
| 499 | something the user does not want. However, cases do exist where it | ||
| 500 | makes sense, particularly in the ``virtual/*`` namespace. You can use | ||
| 501 | this variable to suppress BitBake's warnings. | ||
| 502 | |||
| 503 | To use the variable, list provider names (e.g. recipe names, | ||
| 504 | ``virtual/kernel``, and so forth). | ||
| 505 | |||
| 506 | :term:`BB_NICE_LEVEL` | ||
| 507 | Allows BitBake to run at a specific priority (i.e. nice level). | ||
| 508 | System permissions usually mean that BitBake can reduce its priority | ||
| 509 | but not raise it again. See :term:`BB_TASK_NICE_LEVEL` for | ||
| 510 | additional information. | ||
| 511 | |||
| 512 | :term:`BB_NO_NETWORK` | ||
| 513 | Disables network access in the BitBake fetcher modules. With this | ||
| 514 | access disabled, any command that attempts to access the network | ||
| 515 | becomes an error. | ||
| 516 | |||
| 517 | Disabling network access is useful for testing source mirrors, | ||
| 518 | running builds when not connected to the Internet, and when operating | ||
| 519 | in certain kinds of firewall environments. | ||
| 520 | |||
| 521 | :term:`BB_NUMBER_PARSE_THREADS` | ||
| 522 | Sets the number of threads BitBake uses when parsing. By default, the | ||
| 523 | number of threads is equal to the number of cores on the system. | ||
| 524 | |||
| 525 | :term:`BB_NUMBER_THREADS` | ||
| 526 | The maximum number of tasks BitBake should run in parallel at any one | ||
| 527 | time. If your host development system supports multiple cores, a good | ||
| 528 | rule of thumb is to set this variable to twice the number of cores. | ||
| 529 | |||
| 530 | :term:`BB_ORIGENV` | ||
| 531 | Contains a copy of the original external environment in which BitBake | ||
| 532 | was run. The copy is taken before any variable values configured to | ||
| 533 | pass through from the external environment are filtered into BitBake's | ||
| 534 | datastore. | ||
| 535 | |||
| 536 | .. note:: | ||
| 537 | |||
| 538 | The contents of this variable is a datastore object that can be | ||
| 539 | queried using the normal datastore operations. | ||
| 540 | |||
| 541 | :term:`BB_PRESERVE_ENV` | ||
| 542 | Disables environment filtering and instead allows all variables through | ||
| 543 | from the external environment into BitBake's datastore. | ||
| 544 | |||
| 545 | .. note:: | ||
| 546 | |||
| 547 | You must set this variable in the external environment in order | ||
| 548 | for it to work. | ||
| 549 | |||
| 550 | :term:`BB_PRESSURE_MAX_CPU` | ||
| 551 | Specifies a maximum CPU pressure threshold, above which BitBake's | ||
| 552 | scheduler will not start new tasks (providing there is at least | ||
| 553 | one active task). If no value is set, CPU pressure is not | ||
| 554 | monitored when starting tasks. | ||
| 555 | |||
| 556 | The pressure data is calculated based upon what Linux kernels since | ||
| 557 | version 4.20 expose under ``/proc/pressure``. The threshold represents | ||
| 558 | the difference in "total" pressure from the previous second. The | ||
| 559 | minimum value is 1.0 (extremely slow builds) and the maximum is | ||
| 560 | 1000000 (a pressure value unlikely to ever be reached). See | ||
| 561 | https://docs.kernel.org/accounting/psi.html for more information. | ||
| 562 | |||
| 563 | A default value to limit the CPU pressure to be set in ``conf/local.conf`` | ||
| 564 | could be:: | ||
| 565 | |||
| 566 | BB_PRESSURE_MAX_CPU = "15000" | ||
| 567 | |||
| 568 | Multiple values should be tested on the build host to determine what suits | ||
| 569 | best, depending on the need for performance versus load average during | ||
| 570 | the build. | ||
| 571 | |||
| 572 | .. note:: | ||
| 573 | |||
| 574 | You may see numerous messages printed by BitBake in case the | ||
| 575 | :term:`BB_PRESSURE_MAX_CPU` is too low:: | ||
| 576 | |||
| 577 | Pressure status changed to CPU: True, IO: False, Mem: False (CPU: 1105.9/2.0, IO: 0.0/2.0, Mem: 0.0/2.0) - using 1/64 bitbake threads | ||
| 578 | |||
| 579 | This means that the :term:`BB_PRESSURE_MAX_CPU` should be increased to | ||
| 580 | a reasonable value for limiting the CPU pressure on the system. | ||
| 581 | Monitor the varying value after ``CPU:`` above to set a sensible value. | ||
| 582 | |||
| 583 | :term:`BB_PRESSURE_MAX_IO` | ||
| 584 | Specifies a maximum I/O pressure threshold, above which BitBake's | ||
| 585 | scheduler will not start new tasks (providing there is at least | ||
| 586 | one active task). If no value is set, I/O pressure is not | ||
| 587 | monitored when starting tasks. | ||
| 588 | |||
| 589 | The pressure data is calculated based upon what Linux kernels since | ||
| 590 | version 4.20 expose under ``/proc/pressure``. The threshold represents | ||
| 591 | the difference in "total" pressure from the previous second. The | ||
| 592 | minimum value is 1.0 (extremely slow builds) and the maximum is | ||
| 593 | 1000000 (a pressure value unlikely to ever be reached). See | ||
| 594 | https://docs.kernel.org/accounting/psi.html for more information. | ||
| 595 | |||
| 596 | At this point in time, experiments show that IO pressure tends to | ||
| 597 | be short-lived and regulating just the CPU with | ||
| 598 | :term:`BB_PRESSURE_MAX_CPU` can help to reduce it. | ||
| 599 | |||
| 600 | A default value to limit the IO pressure to be set in ``conf/local.conf`` | ||
| 601 | could be:: | ||
| 602 | |||
| 603 | BB_PRESSURE_MAX_IO = "15000" | ||
| 604 | |||
| 605 | Multiple values should be tested on the build host to determine what suits | ||
| 606 | best, depending on the need for performance versus I/O usage during the | ||
| 607 | build. | ||
| 608 | |||
| 609 | .. note:: | ||
| 610 | |||
| 611 | You may see numerous messages printed by BitBake in case the | ||
| 612 | :term:`BB_PRESSURE_MAX_IO` is too low:: | ||
| 613 | |||
| 614 | Pressure status changed to CPU: None, IO: True, Mem: False (CPU: 2236.0/None, IO: 153.6/2.0, Mem: 0.0/2.0) - using 19/64 bitbake threads | ||
| 615 | |||
| 616 | This means that the :term:`BB_PRESSURE_MAX_IO` should be increased to | ||
| 617 | a reasonable value for limiting the I/O pressure on the system. | ||
| 618 | Monitor the varying value after ``IO:`` above to set a sensible value. | ||
| 619 | |||
| 620 | :term:`BB_PRESSURE_MAX_MEMORY` | ||
| 621 | Specifies a maximum memory pressure threshold, above which BitBake's | ||
| 622 | scheduler will not start new tasks (providing there is at least | ||
| 623 | one active task). If no value is set, memory pressure is not | ||
| 624 | monitored when starting tasks. | ||
| 625 | |||
| 626 | The pressure data is calculated based upon what Linux kernels since | ||
| 627 | version 4.20 expose under ``/proc/pressure``. The threshold represents | ||
| 628 | the difference in "total" pressure from the previous second. The | ||
| 629 | minimum value is 1.0 (extremely slow builds) and the maximum is | ||
| 630 | 1000000 (a pressure value unlikely to ever be reached). See | ||
| 631 | https://docs.kernel.org/accounting/psi.html for more information. | ||
| 632 | |||
| 633 | Memory pressure is experienced when time is spent swapping, | ||
| 634 | refaulting pages from the page cache or performing direct reclaim. | ||
| 635 | This is why memory pressure is rarely seen, but setting this variable | ||
| 636 | might be useful as a last resort to prevent OOM errors if they are | ||
| 637 | occurring during builds. | ||
| 638 | |||
| 639 | A default value to limit the memory pressure to be set in | ||
| 640 | ``conf/local.conf`` could be:: | ||
| 641 | |||
| 642 | BB_PRESSURE_MAX_MEMORY = "15000" | ||
| 643 | |||
| 644 | Multiple values should be tested on the build host to determine what suits | ||
| 645 | best, depending on the need for performance versus memory consumption | ||
| 646 | during the build. | ||
| 647 | |||
| 648 | .. note:: | ||
| 649 | |||
| 650 | You may see numerous messages printed by BitBake in case the | ||
| 651 | :term:`BB_PRESSURE_MAX_MEMORY` is too low:: | ||
| 652 | |||
| 653 | Pressure status changed to CPU: None, IO: False, Mem: True (CPU: 29.5/None, IO: 0.0/2.0, Mem: 2553.3/2.0) - using 17/64 bitbake threads | ||
| 654 | |||
| 655 | This means that the :term:`BB_PRESSURE_MAX_MEMORY` should be increased to | ||
| 656 | a reasonable value for limiting the memory pressure on the system. | ||
| 657 | Monitor the varying value after ``Mem:`` above to set a sensible value. | ||
| 658 | |||
| 659 | :term:`BB_RUNFMT` | ||
| 660 | Specifies the name of the executable script files (i.e. run files) | ||
| 661 | saved into ``${``\ :term:`T`\ ``}``. By default, the | ||
| 662 | :term:`BB_RUNFMT` variable is undefined and the run filenames get | ||
| 663 | created using the following form:: | ||
| 664 | |||
| 665 | run.{func}.{pid} | ||
| 666 | |||
| 667 | If you want to force run files to take a specific name, you can set this | ||
| 668 | variable in a configuration file. | ||
| 669 | |||
| 670 | :term:`BB_RUNTASK` | ||
| 671 | Contains the name of the currently executing task. The value includes | ||
| 672 | the "do\_" prefix. For example, if the currently executing task is | ||
| 673 | ``do_config``, the value is "do_config". | ||
| 674 | |||
| 675 | :term:`BB_SCHEDULER` | ||
| 676 | Selects the name of the scheduler to use for the scheduling of | ||
| 677 | BitBake tasks. Three options exist: | ||
| 678 | |||
| 679 | - *basic* --- the basic framework from which everything derives. Using | ||
| 680 | this option causes tasks to be ordered numerically as they are | ||
| 681 | parsed. | ||
| 682 | |||
| 683 | - *speed* --- executes tasks first that have more tasks depending on | ||
| 684 | them. The "speed" option is the default. | ||
| 685 | |||
| 686 | - *completion* --- causes the scheduler to try to complete a given | ||
| 687 | recipe once its build has started. | ||
| 688 | |||
| 689 | :term:`BB_SCHEDULERS` | ||
| 690 | Defines custom schedulers to import. Custom schedulers need to be | ||
| 691 | derived from the ``RunQueueScheduler`` class. | ||
| 692 | |||
| 693 | For information how to select a scheduler, see the | ||
| 694 | :term:`BB_SCHEDULER` variable. | ||
| 695 | |||
| 696 | :term:`BB_SETSCENE_DEPVALID` | ||
| 697 | Specifies a function BitBake calls that determines whether BitBake | ||
| 698 | requires a setscene dependency to be met. | ||
| 699 | |||
| 700 | When running a setscene task, BitBake needs to know which | ||
| 701 | dependencies of that setscene task also need to be run. Whether | ||
| 702 | dependencies also need to be run is highly dependent on the metadata. | ||
| 703 | The function specified by this variable returns a "True" or "False" | ||
| 704 | depending on whether the dependency needs to be met. | ||
| 705 | |||
| 706 | :term:`BB_SIGNATURE_EXCLUDE_FLAGS` | ||
| 707 | Lists variable flags (varflags) that can be safely excluded from | ||
| 708 | checksum and dependency data for keys in the datastore. When | ||
| 709 | generating checksum or dependency data for keys in the datastore, the | ||
| 710 | flags set against that key are normally included in the checksum. | ||
| 711 | |||
| 712 | For more information on varflags, see the | ||
| 713 | ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:variable flags`" | ||
| 714 | section. | ||
| 715 | |||
| 716 | :term:`BB_SIGNATURE_HANDLER` | ||
| 717 | Defines the name of the signature handler BitBake uses. The signature | ||
| 718 | handler defines the way stamp files are created and handled, if and | ||
| 719 | how the signature is incorporated into the stamps, and how the | ||
| 720 | signature itself is generated. | ||
| 721 | |||
| 722 | A new signature handler can be added by injecting a class derived | ||
| 723 | from the ``SignatureGenerator`` class into the global namespace. | ||
| 724 | |||
| 725 | :term:`BB_SRCREV_POLICY` | ||
| 726 | Defines the behavior of the fetcher when it interacts with source | ||
| 727 | control systems and dynamic source revisions. The | ||
| 728 | :term:`BB_SRCREV_POLICY` variable is useful when working without a | ||
| 729 | network. | ||
| 730 | |||
| 731 | The variable can be set using one of two policies: | ||
| 732 | |||
| 733 | - *cache* --- retains the value the system obtained previously rather | ||
| 734 | than querying the source control system each time. | ||
| 735 | |||
| 736 | - *clear* --- queries the source controls system every time. With this | ||
| 737 | policy, there is no cache. The "clear" policy is the default. | ||
| 738 | |||
| 739 | :term:`BB_STRICT_CHECKSUM` | ||
| 740 | Sets a more strict checksum mechanism for non-local URLs. Setting | ||
| 741 | this variable to a value causes BitBake to report an error if it | ||
| 742 | encounters a non-local URL that does not have at least one checksum | ||
| 743 | specified. | ||
| 744 | |||
| 745 | :term:`BB_TASK_IONICE_LEVEL` | ||
| 746 | Allows adjustment of a task's Input/Output priority. During | ||
| 747 | Autobuilder testing, random failures can occur for tasks due to I/O | ||
| 748 | starvation. These failures occur during various QEMU runtime | ||
| 749 | timeouts. You can use the :term:`BB_TASK_IONICE_LEVEL` variable to adjust | ||
| 750 | the I/O priority of these tasks. | ||
| 751 | |||
| 752 | .. note:: | ||
| 753 | |||
| 754 | This variable works similarly to the :term:`BB_TASK_NICE_LEVEL` | ||
| 755 | variable except with a task's I/O priorities. | ||
| 756 | |||
| 757 | Set the variable as follows:: | ||
| 758 | |||
| 759 | BB_TASK_IONICE_LEVEL = "class.prio" | ||
| 760 | |||
| 761 | For *class*, the default value is "2", which is a best effort. You can use | ||
| 762 | "1" for realtime and "3" for idle. If you want to use realtime, you | ||
| 763 | must have superuser privileges. | ||
| 764 | |||
| 765 | For *prio*, you can use any value from "0", which is the highest | ||
| 766 | priority, to "7", which is the lowest. The default value is "4". You | ||
| 767 | do not need any special privileges to use this range of priority | ||
| 768 | values. | ||
| 769 | |||
| 770 | .. note:: | ||
| 771 | |||
| 772 | In order for your I/O priority settings to take effect, you need the | ||
| 773 | Budget Fair Queuing (BFQ) Scheduler selected for the backing block | ||
| 774 | device. To select the scheduler, use the following command form where | ||
| 775 | device is the device (e.g. sda, sdb, and so forth):: | ||
| 776 | |||
| 777 | $ sudo sh -c "echo bfq > /sys/block/device/queue/scheduler" | ||
| 778 | |||
| 779 | :term:`BB_TASK_NICE_LEVEL` | ||
| 780 | Allows specific tasks to change their priority (i.e. nice level). | ||
| 781 | |||
| 782 | You can use this variable in combination with task overrides to raise | ||
| 783 | or lower priorities of specific tasks. For example, on the `Yocto | ||
| 784 | Project <https://www.yoctoproject.org>`__ autobuilder, QEMU emulation | ||
| 785 | in images is given a higher priority as compared to build tasks to | ||
| 786 | ensure that images do not suffer timeouts on loaded systems. | ||
| 787 | |||
| 788 | :term:`BB_TASKHASH` | ||
| 789 | Within an executing task, this variable holds the hash of the task as | ||
| 790 | returned by the currently enabled signature generator. | ||
| 791 | |||
| 792 | :term:`BB_USE_HOME_NPMRC` | ||
| 793 | Controls whether or not BitBake uses the user's .npmrc file within their | ||
| 794 | home directory within the npm fetcher. This can be used for authentication | ||
| 795 | of private NPM registries, among other uses. This is turned off by default | ||
| 796 | and requires the user to explicitly set it to "1" to enable. | ||
| 797 | |||
| 798 | :term:`BB_VERBOSE_LOGS` | ||
| 799 | Controls how verbose BitBake is during builds. If set, shell scripts | ||
| 800 | echo commands and shell script output appears on standard out | ||
| 801 | (stdout). | ||
| 802 | |||
| 803 | :term:`BB_WORKERCONTEXT` | ||
| 804 | Specifies if the current context is executing a task. BitBake sets | ||
| 805 | this variable to "1" when a task is being executed. The value is not | ||
| 806 | set when the task is in server context during parsing or event | ||
| 807 | handling. | ||
| 808 | |||
| 809 | :term:`BBCLASSEXTEND` | ||
| 810 | Allows you to extend a recipe so that it builds variants of the | ||
| 811 | software. Some examples of these variants for recipes from the | ||
| 812 | OpenEmbedded-Core metadata are "natives" such as ``quilt-native``, | ||
| 813 | which is a copy of Quilt built to run on the build system; "crosses" | ||
| 814 | such as ``gcc-cross``, which is a compiler built to run on the build | ||
| 815 | machine but produces binaries that run on the target ``MACHINE``; | ||
| 816 | "nativesdk", which targets the SDK machine instead of ``MACHINE``; | ||
| 817 | and "mulitlibs" in the form "``multilib:``\ multilib_name". | ||
| 818 | |||
| 819 | To build a different variant of the recipe with a minimal amount of | ||
| 820 | code, it usually is as simple as adding the variable to your recipe. | ||
| 821 | Here are two examples. The "native" variants are from the | ||
| 822 | OpenEmbedded-Core metadata:: | ||
| 823 | |||
| 824 | BBCLASSEXTEND =+ "native nativesdk" | ||
| 825 | BBCLASSEXTEND =+ "multilib:multilib_name" | ||
| 826 | |||
| 827 | .. note:: | ||
| 828 | |||
| 829 | Internally, the :term:`BBCLASSEXTEND` mechanism generates recipe | ||
| 830 | variants by rewriting variable values and applying overrides such | ||
| 831 | as ``_class-native``. For example, to generate a native version of | ||
| 832 | a recipe, a :term:`DEPENDS` on "foo" is | ||
| 833 | rewritten to a :term:`DEPENDS` on "foo-native". | ||
| 834 | |||
| 835 | Even when using :term:`BBCLASSEXTEND`, the recipe is only parsed once. | ||
| 836 | Parsing once adds some limitations. For example, it is not | ||
| 837 | possible to include a different file depending on the variant, | ||
| 838 | since ``include`` statements are processed when the recipe is | ||
| 839 | parsed. | ||
| 840 | |||
| 841 | :term:`BBDEBUG` | ||
| 842 | Sets the BitBake debug output level to a specific value as | ||
| 843 | incremented by the ``-D`` command line option. | ||
| 844 | |||
| 845 | .. note:: | ||
| 846 | |||
| 847 | You must set this variable in the external environment in order | ||
| 848 | for it to work. | ||
| 849 | |||
| 850 | :term:`BBFILE_COLLECTIONS` | ||
| 851 | Lists the names of configured layers. These names are used to find | ||
| 852 | the other ``BBFILE_*`` variables. Typically, each layer appends its | ||
| 853 | name to this variable in its ``conf/layer.conf`` file. | ||
| 854 | |||
| 855 | :term:`BBFILE_PATTERN` | ||
| 856 | Variable that expands to match files from | ||
| 857 | :term:`BBFILES` in a particular layer. This | ||
| 858 | variable is used in the ``conf/layer.conf`` file and must be suffixed | ||
| 859 | with the name of the specific layer (e.g. | ||
| 860 | ``BBFILE_PATTERN_emenlow``). | ||
| 861 | |||
| 862 | :term:`BBFILE_PRIORITY` | ||
| 863 | Assigns the priority for recipe files in each layer. | ||
| 864 | |||
| 865 | This variable is used in the ``conf/layer.conf`` file and must be | ||
| 866 | suffixed with a `_` followed by the name of the specific layer (e.g. | ||
| 867 | ``BBFILE_PRIORITY_emenlow``). Colon as separator is not supported. | ||
| 868 | |||
| 869 | This variable is useful in situations where the same recipe appears | ||
| 870 | in more than one layer. Setting this variable allows you to | ||
| 871 | prioritize a layer against other layers that contain the same recipe | ||
| 872 | --- effectively letting you control the precedence for the multiple | ||
| 873 | layers. The precedence established through this variable stands | ||
| 874 | regardless of a recipe's version (:term:`PV` variable). | ||
| 875 | For example, a layer that has a recipe with a higher :term:`PV` value but | ||
| 876 | for which the :term:`BBFILE_PRIORITY` is set to have a lower precedence | ||
| 877 | still has a lower precedence. | ||
| 878 | |||
| 879 | A larger value for the :term:`BBFILE_PRIORITY` variable results in a | ||
| 880 | higher precedence. For example, the value 6 has a higher precedence | ||
| 881 | than the value 5. If not specified, the :term:`BBFILE_PRIORITY` variable | ||
| 882 | is set based on layer dependencies (see the :term:`LAYERDEPENDS` variable | ||
| 883 | for more information). The default priority, if unspecified for a | ||
| 884 | layer with no dependencies, is the lowest defined priority + 1 (or 1 | ||
| 885 | if no priorities are defined). | ||
| 886 | |||
| 887 | .. tip:: | ||
| 888 | |||
| 889 | You can use the command bitbake-layers show-layers to list all | ||
| 890 | configured layers along with their priorities. | ||
| 891 | |||
| 892 | :term:`BBFILES` | ||
| 893 | A space-separated list of recipe files BitBake uses to build | ||
| 894 | software. | ||
| 895 | |||
| 896 | When specifying recipe files, you can pattern match using Python's | ||
| 897 | `glob <https://docs.python.org/3/library/glob.html>`_ syntax. | ||
| 898 | For details on the syntax, see the documentation by following the | ||
| 899 | previous link. | ||
| 900 | |||
| 901 | :term:`BBFILES_DYNAMIC` | ||
| 902 | Activates content depending on presence of identified layers. You | ||
| 903 | identify the layers by the collections that the layers define. | ||
| 904 | |||
| 905 | Use the :term:`BBFILES_DYNAMIC` variable to avoid ``.bbappend`` files whose | ||
| 906 | corresponding ``.bb`` file is in a layer that attempts to modify other | ||
| 907 | layers through ``.bbappend`` but does not want to introduce a hard | ||
| 908 | dependency on those other layers. | ||
| 909 | |||
| 910 | Additionally you can prefix the rule with "!" to add ``.bbappend`` and | ||
| 911 | ``.bb`` files in case a layer is not present. Use this avoid hard | ||
| 912 | dependency on those other layers. | ||
| 913 | |||
| 914 | Use the following form for :term:`BBFILES_DYNAMIC`:: | ||
| 915 | |||
| 916 | collection_name:filename_pattern | ||
| 917 | |||
| 918 | The following example identifies two collection names and two filename | ||
| 919 | patterns:: | ||
| 920 | |||
| 921 | BBFILES_DYNAMIC += "\ | ||
| 922 | clang-layer:${LAYERDIR}/bbappends/meta-clang/*/*/*.bbappend \ | ||
| 923 | core:${LAYERDIR}/bbappends/openembedded-core/meta/*/*/*.bbappend \ | ||
| 924 | " | ||
| 925 | |||
| 926 | When the collection name is prefixed with "!" it will add the file pattern in case | ||
| 927 | the layer is absent:: | ||
| 928 | |||
| 929 | BBFILES_DYNAMIC += "\ | ||
| 930 | !clang-layer:${LAYERDIR}/backfill/meta-clang/*/*/*.bb \ | ||
| 931 | " | ||
| 932 | |||
| 933 | This next example shows an error message that occurs because invalid | ||
| 934 | entries are found, which cause parsing to fail:: | ||
| 935 | |||
| 936 | ERROR: BBFILES_DYNAMIC entries must be of the form {!}<collection name>:<filename pattern>, not: | ||
| 937 | /work/my-layer/bbappends/meta-security-isafw/*/*/*.bbappend | ||
| 938 | /work/my-layer/bbappends/openembedded-core/meta/*/*/*.bbappend | ||
| 939 | |||
| 940 | :term:`BBINCLUDED` | ||
| 941 | Contains a space-separated list of all of all files that BitBake's | ||
| 942 | parser included during parsing of the current file. | ||
| 943 | |||
| 944 | :term:`BBINCLUDELOGS` | ||
| 945 | If set to a value, enables printing the task log when reporting a | ||
| 946 | failed task. | ||
| 947 | |||
| 948 | :term:`BBINCLUDELOGS_LINES` | ||
| 949 | If :term:`BBINCLUDELOGS` is set, specifies | ||
| 950 | the maximum number of lines from the task log file to print when | ||
| 951 | reporting a failed task. If you do not set :term:`BBINCLUDELOGS_LINES`, | ||
| 952 | the entire log is printed. | ||
| 953 | |||
| 954 | :term:`BBLAYERS` | ||
| 955 | Lists the layers to enable during the build. This variable is defined | ||
| 956 | in the ``bblayers.conf`` configuration file in the build directory. | ||
| 957 | Here is an example:: | ||
| 958 | |||
| 959 | BBLAYERS = " \ | ||
| 960 | /home/scottrif/poky/meta \ | ||
| 961 | /home/scottrif/poky/meta-yocto \ | ||
| 962 | /home/scottrif/poky/meta-yocto-bsp \ | ||
| 963 | /home/scottrif/poky/meta-mykernel \ | ||
| 964 | " | ||
| 965 | |||
| 966 | This example enables four layers, one of which is a custom, user-defined | ||
| 967 | layer named ``meta-mykernel``. | ||
| 968 | |||
| 969 | :term:`BBLAYERS_FETCH_DIR` | ||
| 970 | Sets the base location where layers are stored. This setting is used | ||
| 971 | in conjunction with ``bitbake-layers layerindex-fetch`` and tells | ||
| 972 | ``bitbake-layers`` where to place the fetched layers. | ||
| 973 | |||
| 974 | :term:`BBMASK` | ||
| 975 | Prevents BitBake from processing recipes and recipe append files. | ||
| 976 | |||
| 977 | You can use the :term:`BBMASK` variable to "hide" these ``.bb`` and | ||
| 978 | ``.bbappend`` files. BitBake ignores any recipe or recipe append | ||
| 979 | files that match any of the expressions. It is as if BitBake does not | ||
| 980 | see them at all. Consequently, matching files are not parsed or | ||
| 981 | otherwise used by BitBake. | ||
| 982 | |||
| 983 | The values you provide are passed to Python's regular expression | ||
| 984 | compiler. Consequently, the syntax follows Python's Regular | ||
| 985 | Expression (re) syntax. The expressions are compared against the full | ||
| 986 | paths to the files. For complete syntax information, see Python's | ||
| 987 | documentation at http://docs.python.org/3/library/re.html. | ||
| 988 | |||
| 989 | The following example uses a complete regular expression to tell | ||
| 990 | BitBake to ignore all recipe and recipe append files in the | ||
| 991 | ``meta-ti/recipes-misc/`` directory:: | ||
| 992 | |||
| 993 | BBMASK = "meta-ti/recipes-misc/" | ||
| 994 | |||
| 995 | If you want to mask out multiple directories or recipes, you can | ||
| 996 | specify multiple regular expression fragments. This next example | ||
| 997 | masks out multiple directories and individual recipes:: | ||
| 998 | |||
| 999 | BBMASK += "/meta-ti/recipes-misc/ meta-ti/recipes-ti/packagegroup/" | ||
| 1000 | BBMASK += "/meta-oe/recipes-support/" | ||
| 1001 | BBMASK += "/meta-foo/.*/openldap" | ||
| 1002 | BBMASK += "opencv.*\.bbappend" | ||
| 1003 | BBMASK += "lzma" | ||
| 1004 | |||
| 1005 | .. note:: | ||
| 1006 | |||
| 1007 | When specifying a directory name, use the trailing slash character | ||
| 1008 | to ensure you match just that directory name. | ||
| 1009 | |||
| 1010 | :term:`BBMULTICONFIG` | ||
| 1011 | Enables BitBake to perform multiple configuration builds and lists | ||
| 1012 | each separate configuration (multiconfig). You can use this variable | ||
| 1013 | to cause BitBake to build multiple targets where each target has a | ||
| 1014 | separate configuration. Define :term:`BBMULTICONFIG` in your | ||
| 1015 | ``conf/local.conf`` configuration file. | ||
| 1016 | |||
| 1017 | As an example, the following line specifies three multiconfigs, each | ||
| 1018 | having a separate configuration file:: | ||
| 1019 | |||
| 1020 | BBMULTIFONFIG = "configA configB configC" | ||
| 1021 | |||
| 1022 | Each configuration file you use must reside in the | ||
| 1023 | build directory within a directory named ``conf/multiconfig`` (e.g. | ||
| 1024 | build_directory\ ``/conf/multiconfig/configA.conf``). | ||
| 1025 | |||
| 1026 | For information on how to use :term:`BBMULTICONFIG` in an environment | ||
| 1027 | that supports building targets with multiple configurations, see the | ||
| 1028 | ":ref:`bitbake-user-manual/bitbake-user-manual-intro:executing a multiple configuration build`" | ||
| 1029 | section. | ||
| 1030 | |||
| 1031 | :term:`BBPATH` | ||
| 1032 | A colon-separated list used by BitBake to locate class (``.bbclass``) | ||
| 1033 | and configuration (``.conf``) files. This variable is analogous to the | ||
| 1034 | ``PATH`` variable. | ||
| 1035 | |||
| 1036 | If you run BitBake from a directory outside of the build directory, | ||
| 1037 | you must be sure to set :term:`BBPATH` to point to the build directory. | ||
| 1038 | Set the variable as you would any environment variable and then run | ||
| 1039 | BitBake:: | ||
| 1040 | |||
| 1041 | $ BBPATH="build_directory" | ||
| 1042 | $ export BBPATH | ||
| 1043 | $ bitbake target | ||
| 1044 | |||
| 1045 | :term:`BBSERVER` | ||
| 1046 | Points to the server that runs memory-resident BitBake. The variable | ||
| 1047 | is only used when you employ memory-resident BitBake. | ||
| 1048 | |||
| 1049 | :term:`BBTARGETS` | ||
| 1050 | Allows you to use a configuration file to add to the list of | ||
| 1051 | command-line target recipes you want to build. | ||
| 1052 | |||
| 1053 | :term:`BITBAKE_UI` | ||
| 1054 | Used to specify the UI module to use when running BitBake. Using this | ||
| 1055 | variable is equivalent to using the ``-u`` command-line option. | ||
| 1056 | |||
| 1057 | .. note:: | ||
| 1058 | |||
| 1059 | You must set this variable in the external environment in order | ||
| 1060 | for it to work. | ||
| 1061 | |||
| 1062 | :term:`BUILDNAME` | ||
| 1063 | A name assigned to the build. The name defaults to a datetime stamp | ||
| 1064 | of when the build was started but can be defined by the metadata. | ||
| 1065 | |||
| 1066 | :term:`BZRDIR` | ||
| 1067 | The directory in which files checked out of a Bazaar system are | ||
| 1068 | stored. | ||
| 1069 | |||
| 1070 | :term:`CACHE` | ||
| 1071 | Specifies the directory BitBake uses to store a cache of the metadata | ||
| 1072 | so it does not need to be parsed every time BitBake is started. | ||
| 1073 | |||
| 1074 | :term:`CVSDIR` | ||
| 1075 | The directory in which files checked out under the CVS system are | ||
| 1076 | stored. | ||
| 1077 | |||
| 1078 | :term:`DEFAULT_PREFERENCE` | ||
| 1079 | Specifies a weak bias for recipe selection priority. | ||
| 1080 | |||
| 1081 | The most common usage of this is variable is to set it to "-1" within | ||
| 1082 | a recipe for a development version of a piece of software. Using the | ||
| 1083 | variable in this way causes the stable version of the recipe to build | ||
| 1084 | by default in the absence of :term:`PREFERRED_VERSION` being used to | ||
| 1085 | build the development version. | ||
| 1086 | |||
| 1087 | .. note:: | ||
| 1088 | |||
| 1089 | The bias provided by DEFAULT_PREFERENCE is weak and is overridden by | ||
| 1090 | :term:`BBFILE_PRIORITY` if that variable is different between two | ||
| 1091 | layers that contain different versions of the same recipe. | ||
| 1092 | |||
| 1093 | :term:`DEPENDS` | ||
| 1094 | Lists a recipe's build-time dependencies (i.e. other recipe files). | ||
| 1095 | |||
| 1096 | Consider this simple example for two recipes named "a" and "b" that | ||
| 1097 | produce similarly named packages. In this example, the :term:`DEPENDS` | ||
| 1098 | statement appears in the "a" recipe:: | ||
| 1099 | |||
| 1100 | DEPENDS = "b" | ||
| 1101 | |||
| 1102 | Here, the dependency is such that the ``do_configure`` task for recipe "a" | ||
| 1103 | depends on the ``do_populate_sysroot`` task of recipe "b". This means | ||
| 1104 | anything that recipe "b" puts into sysroot is available when recipe "a" is | ||
| 1105 | configuring itself. | ||
| 1106 | |||
| 1107 | For information on runtime dependencies, see the :term:`RDEPENDS` | ||
| 1108 | variable. | ||
| 1109 | |||
| 1110 | :term:`DESCRIPTION` | ||
| 1111 | A long description for the recipe. | ||
| 1112 | |||
| 1113 | :term:`DL_DIR` | ||
| 1114 | The central download directory used by the build process to store | ||
| 1115 | downloads. By default, :term:`DL_DIR` gets files suitable for mirroring for | ||
| 1116 | everything except Git repositories. If you want tarballs of Git | ||
| 1117 | repositories, use the :term:`BB_GENERATE_MIRROR_TARBALLS` variable. | ||
| 1118 | |||
| 1119 | :term:`EXCLUDE_FROM_WORLD` | ||
| 1120 | Directs BitBake to exclude a recipe from world builds (i.e. | ||
| 1121 | ``bitbake world``). During world builds, BitBake locates, parses and | ||
| 1122 | builds all recipes found in every layer exposed in the | ||
| 1123 | ``bblayers.conf`` configuration file. | ||
| 1124 | |||
| 1125 | To exclude a recipe from a world build using this variable, set the | ||
| 1126 | variable to "1" in the recipe. Set it to "0" to add it back to world build. | ||
| 1127 | |||
| 1128 | .. note:: | ||
| 1129 | |||
| 1130 | Recipes added to :term:`EXCLUDE_FROM_WORLD` may still be built during a world | ||
| 1131 | build in order to satisfy dependencies of other recipes. Adding a | ||
| 1132 | recipe to :term:`EXCLUDE_FROM_WORLD` only ensures that the recipe is not | ||
| 1133 | explicitly added to the list of build targets in a world build. | ||
| 1134 | |||
| 1135 | :term:`FAKEROOT` | ||
| 1136 | Contains the command to use when running a shell script in a fakeroot | ||
| 1137 | environment. The :term:`FAKEROOT` variable is obsolete and has been | ||
| 1138 | replaced by the other ``FAKEROOT*`` variables. See these entries in | ||
| 1139 | the glossary for more information. | ||
| 1140 | |||
| 1141 | :term:`FAKEROOTBASEENV` | ||
| 1142 | Lists environment variables to set when executing the command defined | ||
| 1143 | by :term:`FAKEROOTCMD` that starts the | ||
| 1144 | bitbake-worker process in the fakeroot environment. | ||
| 1145 | |||
| 1146 | :term:`FAKEROOTCMD` | ||
| 1147 | Contains the command that starts the bitbake-worker process in the | ||
| 1148 | fakeroot environment. | ||
| 1149 | |||
| 1150 | :term:`FAKEROOTDIRS` | ||
| 1151 | Lists directories to create before running a task in the fakeroot | ||
| 1152 | environment. | ||
| 1153 | |||
| 1154 | :term:`FAKEROOTENV` | ||
| 1155 | Lists environment variables to set when running a task in the | ||
| 1156 | fakeroot environment. For additional information on environment | ||
| 1157 | variables and the fakeroot environment, see the | ||
| 1158 | :term:`FAKEROOTBASEENV` variable. | ||
| 1159 | |||
| 1160 | :term:`FAKEROOTNOENV` | ||
| 1161 | Lists environment variables to set when running a task that is not in | ||
| 1162 | the fakeroot environment. For additional information on environment | ||
| 1163 | variables and the fakeroot environment, see the | ||
| 1164 | :term:`FAKEROOTENV` variable. | ||
| 1165 | |||
| 1166 | :term:`FETCHCMD` | ||
| 1167 | Defines the command the BitBake fetcher module executes when running | ||
| 1168 | fetch operations. You need to use an override suffix when you use the | ||
| 1169 | variable (e.g. ``FETCHCMD_git`` or ``FETCHCMD_svn``). | ||
| 1170 | |||
| 1171 | :term:`FILE` | ||
| 1172 | Points at the current file. BitBake sets this variable during the | ||
| 1173 | parsing process to identify the file being parsed. BitBake also sets | ||
| 1174 | this variable when a recipe is being executed to identify the recipe | ||
| 1175 | file. | ||
| 1176 | |||
| 1177 | :term:`FILESPATH` | ||
| 1178 | Specifies directories BitBake uses when searching for patches and | ||
| 1179 | files. The "local" fetcher module uses these directories when | ||
| 1180 | handling ``file://`` URLs. The variable behaves like a shell ``PATH`` | ||
| 1181 | environment variable. The value is a colon-separated list of | ||
| 1182 | directories that are searched left-to-right in order. | ||
| 1183 | |||
| 1184 | :term:`FILE_LAYERNAME` | ||
| 1185 | During parsing and task execution, this is set to the name of the | ||
| 1186 | layer containing the recipe file. Code can use this to identify which | ||
| 1187 | layer a recipe is from. | ||
| 1188 | |||
| 1189 | :term:`GITDIR` | ||
| 1190 | The directory in which a local copy of a Git repository is stored | ||
| 1191 | when it is cloned. | ||
| 1192 | |||
| 1193 | :term:`HGDIR` | ||
| 1194 | The directory in which files checked out of a Mercurial system are | ||
| 1195 | stored. | ||
| 1196 | |||
| 1197 | :term:`HOMEPAGE` | ||
| 1198 | Website where more information about the software the recipe is | ||
| 1199 | building can be found. | ||
| 1200 | |||
| 1201 | :term:`INHERIT` | ||
| 1202 | Causes the named class or classes to be inherited globally. Anonymous | ||
| 1203 | functions in the class or classes are not executed for the base | ||
| 1204 | configuration and in each individual recipe. The OpenEmbedded build | ||
| 1205 | system ignores changes to :term:`INHERIT` in individual recipes. | ||
| 1206 | |||
| 1207 | For more information on :term:`INHERIT`, see the | ||
| 1208 | ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:\`\`inherit\`\` configuration directive`" | ||
| 1209 | section. | ||
| 1210 | |||
| 1211 | :term:`LAYERDEPENDS` | ||
| 1212 | Lists the layers, separated by spaces, upon which this recipe | ||
| 1213 | depends. Optionally, you can specify a specific layer version for a | ||
| 1214 | dependency by adding it to the end of the layer name with a colon, | ||
| 1215 | (e.g. "anotherlayer:3" to be compared against | ||
| 1216 | :term:`LAYERVERSION`\ ``_anotherlayer`` in | ||
| 1217 | this case). BitBake produces an error if any dependency is missing or | ||
| 1218 | the version numbers do not match exactly (if specified). | ||
| 1219 | |||
| 1220 | You use this variable in the ``conf/layer.conf`` file. You must also | ||
| 1221 | use the specific layer name as a suffix to the variable (e.g. | ||
| 1222 | ``LAYERDEPENDS_mylayer``). | ||
| 1223 | |||
| 1224 | :term:`LAYERDIR` | ||
| 1225 | When used inside the ``layer.conf`` configuration file, this variable | ||
| 1226 | provides the path of the current layer. This variable is not | ||
| 1227 | available outside of ``layer.conf`` and references are expanded | ||
| 1228 | immediately when parsing of the file completes. | ||
| 1229 | |||
| 1230 | :term:`LAYERDIR_RE` | ||
| 1231 | When used inside the ``layer.conf`` configuration file, this variable | ||
| 1232 | provides the path of the current layer, escaped for use in a regular | ||
| 1233 | expression (:term:`BBFILE_PATTERN`). This | ||
| 1234 | variable is not available outside of ``layer.conf`` and references | ||
| 1235 | are expanded immediately when parsing of the file completes. | ||
| 1236 | |||
| 1237 | :term:`LAYERSERIES_COMPAT` | ||
| 1238 | Lists the versions of the OpenEmbedded-Core (OE-Core) for which | ||
| 1239 | a layer is compatible. Using the :term:`LAYERSERIES_COMPAT` variable | ||
| 1240 | allows the layer maintainer to indicate which combinations of the | ||
| 1241 | layer and OE-Core can be expected to work. The variable gives the | ||
| 1242 | system a way to detect when a layer has not been tested with new | ||
| 1243 | releases of OE-Core (e.g. the layer is not maintained). | ||
| 1244 | |||
| 1245 | To specify the OE-Core versions for which a layer is compatible, use | ||
| 1246 | this variable in your layer's ``conf/layer.conf`` configuration file. | ||
| 1247 | For the list, use the Yocto Project release name (e.g. "kirkstone", | ||
| 1248 | "mickledore"). To specify multiple OE-Core versions for the layer, use | ||
| 1249 | a space-separated list:: | ||
| 1250 | |||
| 1251 | LAYERSERIES_COMPAT_layer_root_name = "kirkstone mickledore" | ||
| 1252 | |||
| 1253 | .. note:: | ||
| 1254 | |||
| 1255 | Setting :term:`LAYERSERIES_COMPAT` is required by the Yocto Project | ||
| 1256 | Compatible version 2 standard. | ||
| 1257 | The OpenEmbedded build system produces a warning if the variable | ||
| 1258 | is not set for any given layer. | ||
| 1259 | |||
| 1260 | :term:`LAYERVERSION` | ||
| 1261 | Optionally specifies the version of a layer as a single number. You | ||
| 1262 | can use this variable within | ||
| 1263 | :term:`LAYERDEPENDS` for another layer in | ||
| 1264 | order to depend on a specific version of the layer. | ||
| 1265 | |||
| 1266 | You use this variable in the ``conf/layer.conf`` file. You must also | ||
| 1267 | use the specific layer name as a suffix to the variable (e.g. | ||
| 1268 | ``LAYERDEPENDS_mylayer``). | ||
| 1269 | |||
| 1270 | :term:`LICENSE` | ||
| 1271 | The list of source licenses for the recipe. | ||
| 1272 | |||
| 1273 | :term:`MIRRORS` | ||
| 1274 | Specifies additional paths from which BitBake gets source code. When | ||
| 1275 | the build system searches for source code, it first tries the local | ||
| 1276 | download directory. If that location fails, the build system tries | ||
| 1277 | locations defined by :term:`PREMIRRORS`, the | ||
| 1278 | upstream source, and then locations specified by :term:`MIRRORS` in that | ||
| 1279 | order. | ||
| 1280 | |||
| 1281 | :term:`OVERRIDES` | ||
| 1282 | A colon-separated list that BitBake uses to control what variables are | ||
| 1283 | overridden after BitBake parses recipes and configuration files. | ||
| 1284 | |||
| 1285 | Following is a simple example that uses an overrides list based on | ||
| 1286 | machine architectures: OVERRIDES = "arm:x86:mips:powerpc" You can | ||
| 1287 | find information on how to use :term:`OVERRIDES` in the | ||
| 1288 | ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:conditional syntax | ||
| 1289 | (overrides)`" section. | ||
| 1290 | |||
| 1291 | :term:`P4DIR` | ||
| 1292 | The directory in which a local copy of a Perforce depot is stored | ||
| 1293 | when it is fetched. | ||
| 1294 | |||
| 1295 | :term:`PACKAGES` | ||
| 1296 | The list of packages the recipe creates. | ||
| 1297 | |||
| 1298 | :term:`PACKAGES_DYNAMIC` | ||
| 1299 | A promise that your recipe satisfies runtime dependencies for | ||
| 1300 | optional modules that are found in other recipes. | ||
| 1301 | :term:`PACKAGES_DYNAMIC` does not actually satisfy the dependencies, it | ||
| 1302 | only states that they should be satisfied. For example, if a hard, | ||
| 1303 | runtime dependency (:term:`RDEPENDS`) of another | ||
| 1304 | package is satisfied during the build through the | ||
| 1305 | :term:`PACKAGES_DYNAMIC` variable, but a package with the module name is | ||
| 1306 | never actually produced, then the other package will be broken. | ||
| 1307 | |||
| 1308 | :term:`PE` | ||
| 1309 | The epoch of the recipe. By default, this variable is unset. The | ||
| 1310 | variable is used to make upgrades possible when the versioning scheme | ||
| 1311 | changes in some backwards incompatible way. | ||
| 1312 | |||
| 1313 | :term:`PERSISTENT_DIR` | ||
| 1314 | Specifies the directory BitBake uses to store data that should be | ||
| 1315 | preserved between builds. In particular, the data stored is the data | ||
| 1316 | that uses BitBake's persistent data API and the data used by the PR | ||
| 1317 | Server and PR Service. | ||
| 1318 | |||
| 1319 | :term:`PF` | ||
| 1320 | Specifies the recipe or package name and includes all version and | ||
| 1321 | revision numbers (i.e. ``eglibc-2.13-r20+svnr15508/`` and | ||
| 1322 | ``bash-4.2-r1/``). | ||
| 1323 | |||
| 1324 | :term:`PN` | ||
| 1325 | The recipe name. | ||
| 1326 | |||
| 1327 | :term:`PR` | ||
| 1328 | The revision of the recipe. | ||
| 1329 | |||
| 1330 | :term:`PREFERRED_PROVIDER` | ||
| 1331 | Determines which recipe should be given preference when multiple | ||
| 1332 | recipes provide the same item. You should always suffix the variable | ||
| 1333 | with the name of the provided item, and you should set it to the | ||
| 1334 | :term:`PN` of the recipe to which you want to give | ||
| 1335 | precedence. Some examples:: | ||
| 1336 | |||
| 1337 | PREFERRED_PROVIDER_virtual/kernel ?= "linux-yocto" | ||
| 1338 | PREFERRED_PROVIDER_virtual/xserver = "xserver-xf86" | ||
| 1339 | PREFERRED_PROVIDER_virtual/libgl ?= "mesa" | ||
| 1340 | |||
| 1341 | :term:`PREFERRED_PROVIDERS` | ||
| 1342 | Determines which recipe should be given preference for cases where | ||
| 1343 | multiple recipes provide the same item. Functionally, | ||
| 1344 | :term:`PREFERRED_PROVIDERS` is identical to | ||
| 1345 | :term:`PREFERRED_PROVIDER`. However, the :term:`PREFERRED_PROVIDERS` variable | ||
| 1346 | lets you define preferences for multiple situations using the following | ||
| 1347 | form:: | ||
| 1348 | |||
| 1349 | PREFERRED_PROVIDERS = "xxx:yyy aaa:bbb ..." | ||
| 1350 | |||
| 1351 | This form is a convenient replacement for the following:: | ||
| 1352 | |||
| 1353 | PREFERRED_PROVIDER_xxx = "yyy" | ||
| 1354 | PREFERRED_PROVIDER_aaa = "bbb" | ||
| 1355 | |||
| 1356 | :term:`PREFERRED_VERSION` | ||
| 1357 | If there are multiple versions of a recipe available, this variable | ||
| 1358 | determines which version should be given preference. You must always | ||
| 1359 | suffix the variable with the :term:`PN` you want to | ||
| 1360 | select, and you should set :term:`PV` accordingly for | ||
| 1361 | precedence. | ||
| 1362 | |||
| 1363 | The :term:`PREFERRED_VERSION` variable supports limited wildcard use | ||
| 1364 | through the "``%``" character. You can use the character to match any | ||
| 1365 | number of characters, which can be useful when specifying versions | ||
| 1366 | that contain long revision numbers that potentially change. Here are | ||
| 1367 | two examples:: | ||
| 1368 | |||
| 1369 | PREFERRED_VERSION_python = "2.7.3" | ||
| 1370 | PREFERRED_VERSION_linux-yocto = "4.12%" | ||
| 1371 | |||
| 1372 | .. important:: | ||
| 1373 | |||
| 1374 | The use of the " % " character is limited in that it only works at the | ||
| 1375 | end of the string. You cannot use the wildcard character in any other | ||
| 1376 | location of the string. | ||
| 1377 | |||
| 1378 | If a recipe with the specified version is not available, a warning | ||
| 1379 | message will be shown. See :term:`REQUIRED_VERSION` if you want this | ||
| 1380 | to be an error instead. | ||
| 1381 | |||
| 1382 | :term:`PREMIRRORS` | ||
| 1383 | Specifies additional paths from which BitBake gets source code. When | ||
| 1384 | the build system searches for source code, it first tries the local | ||
| 1385 | download directory. If that location fails, the build system tries | ||
| 1386 | locations defined by :term:`PREMIRRORS`, the upstream source, and then | ||
| 1387 | locations specified by :term:`MIRRORS` in that order. | ||
| 1388 | |||
| 1389 | Typically, you would add a specific server for the build system to | ||
| 1390 | attempt before any others by adding something like the following to | ||
| 1391 | your configuration:: | ||
| 1392 | |||
| 1393 | PREMIRRORS:prepend = "\ | ||
| 1394 | git://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \ | ||
| 1395 | ftp://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \ | ||
| 1396 | http://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \ | ||
| 1397 | https://.*/.* http://downloads.yoctoproject.org/mirror/sources/" | ||
| 1398 | |||
| 1399 | These changes cause the build system to intercept Git, FTP, HTTP, and | ||
| 1400 | HTTPS requests and direct them to the ``http://`` sources mirror. You can | ||
| 1401 | use ``file://`` URLs to point to local directories or network shares as | ||
| 1402 | well. | ||
| 1403 | |||
| 1404 | :term:`PROVIDES` | ||
| 1405 | A list of aliases by which a particular recipe can be known. By | ||
| 1406 | default, a recipe's own :term:`PN` is implicitly already in its | ||
| 1407 | :term:`PROVIDES` list. If a recipe uses :term:`PROVIDES`, the additional | ||
| 1408 | aliases are synonyms for the recipe and can be useful satisfying | ||
| 1409 | dependencies of other recipes during the build as specified by | ||
| 1410 | :term:`DEPENDS`. | ||
| 1411 | |||
| 1412 | Consider the following example :term:`PROVIDES` statement from a recipe | ||
| 1413 | file ``libav_0.8.11.bb``:: | ||
| 1414 | |||
| 1415 | PROVIDES += "libpostproc" | ||
| 1416 | |||
| 1417 | The :term:`PROVIDES` statement results in the "libav" recipe also being known | ||
| 1418 | as "libpostproc". | ||
| 1419 | |||
| 1420 | In addition to providing recipes under alternate names, the | ||
| 1421 | :term:`PROVIDES` mechanism is also used to implement virtual targets. A | ||
| 1422 | virtual target is a name that corresponds to some particular | ||
| 1423 | functionality (e.g. a Linux kernel). Recipes that provide the | ||
| 1424 | functionality in question list the virtual target in :term:`PROVIDES`. | ||
| 1425 | Recipes that depend on the functionality in question can include the | ||
| 1426 | virtual target in :term:`DEPENDS` to leave the | ||
| 1427 | choice of provider open. | ||
| 1428 | |||
| 1429 | Conventionally, virtual targets have names on the form | ||
| 1430 | "virtual/function" (e.g. "virtual/kernel"). The slash is simply part | ||
| 1431 | of the name and has no syntactical significance. | ||
| 1432 | |||
| 1433 | :term:`PRSERV_HOST` | ||
| 1434 | The network based :term:`PR` service host and port. | ||
| 1435 | |||
| 1436 | Following is an example of how the :term:`PRSERV_HOST` variable is set:: | ||
| 1437 | |||
| 1438 | PRSERV_HOST = "localhost:0" | ||
| 1439 | |||
| 1440 | You must set the variable if you want to automatically start a local PR | ||
| 1441 | service. You can set :term:`PRSERV_HOST` to other values to use a remote PR | ||
| 1442 | service. | ||
| 1443 | |||
| 1444 | :term:`PV` | ||
| 1445 | The version of the recipe. | ||
| 1446 | |||
| 1447 | :term:`RDEPENDS` | ||
| 1448 | Lists a package's runtime dependencies (i.e. other packages) that | ||
| 1449 | must be installed in order for the built package to run correctly. If | ||
| 1450 | a package in this list cannot be found during the build, you will get | ||
| 1451 | a build error. | ||
| 1452 | |||
| 1453 | Because the :term:`RDEPENDS` variable applies to packages being built, | ||
| 1454 | you should always use the variable in a form with an attached package | ||
| 1455 | name. For example, suppose you are building a development package | ||
| 1456 | that depends on the ``perl`` package. In this case, you would use the | ||
| 1457 | following :term:`RDEPENDS` statement:: | ||
| 1458 | |||
| 1459 | RDEPENDS:${PN}-dev += "perl" | ||
| 1460 | |||
| 1461 | In the example, the development package depends on the ``perl`` package. | ||
| 1462 | Thus, the :term:`RDEPENDS` variable has the ``${PN}-dev`` package name as part | ||
| 1463 | of the variable. | ||
| 1464 | |||
| 1465 | BitBake supports specifying versioned dependencies. Although the | ||
| 1466 | syntax varies depending on the packaging format, BitBake hides these | ||
| 1467 | differences from you. Here is the general syntax to specify versions | ||
| 1468 | with the :term:`RDEPENDS` variable:: | ||
| 1469 | |||
| 1470 | RDEPENDS:${PN} = "package (operator version)" | ||
| 1471 | |||
| 1472 | For ``operator``, you can specify the following:: | ||
| 1473 | |||
| 1474 | = | ||
| 1475 | < | ||
| 1476 | > | ||
| 1477 | <= | ||
| 1478 | >= | ||
| 1479 | |||
| 1480 | For example, the following sets up a dependency on version 1.2 or | ||
| 1481 | greater of the package ``foo``:: | ||
| 1482 | |||
| 1483 | RDEPENDS:${PN} = "foo (>= 1.2)" | ||
| 1484 | |||
| 1485 | For information on build-time dependencies, see the :term:`DEPENDS` | ||
| 1486 | variable. | ||
| 1487 | |||
| 1488 | :term:`REPODIR` | ||
| 1489 | The directory in which a local copy of a ``google-repo`` directory is | ||
| 1490 | stored when it is synced. | ||
| 1491 | |||
| 1492 | :term:`REQUIRED_VERSION` | ||
| 1493 | If there are multiple versions of a recipe available, this variable | ||
| 1494 | determines which version should be given preference. :term:`REQUIRED_VERSION` | ||
| 1495 | works in exactly the same manner as :term:`PREFERRED_VERSION`, except | ||
| 1496 | that if the specified version is not available then an error message | ||
| 1497 | is shown and the build fails immediately. | ||
| 1498 | |||
| 1499 | If both :term:`REQUIRED_VERSION` and :term:`PREFERRED_VERSION` are set for | ||
| 1500 | the same recipe, the :term:`REQUIRED_VERSION` value applies. | ||
| 1501 | |||
| 1502 | :term:`RPROVIDES` | ||
| 1503 | A list of package name aliases that a package also provides. These | ||
| 1504 | aliases are useful for satisfying runtime dependencies of other | ||
| 1505 | packages both during the build and on the target (as specified by | ||
| 1506 | :term:`RDEPENDS`). | ||
| 1507 | |||
| 1508 | As with all package-controlling variables, you must always use the | ||
| 1509 | variable in conjunction with a package name override. Here is an | ||
| 1510 | example:: | ||
| 1511 | |||
| 1512 | RPROVIDES:${PN} = "widget-abi-2" | ||
| 1513 | |||
| 1514 | :term:`RRECOMMENDS` | ||
| 1515 | A list of packages that extends the usability of a package being | ||
| 1516 | built. The package being built does not depend on this list of | ||
| 1517 | packages in order to successfully build, but needs them for the | ||
| 1518 | extended usability. To specify runtime dependencies for packages, see | ||
| 1519 | the :term:`RDEPENDS` variable. | ||
| 1520 | |||
| 1521 | BitBake supports specifying versioned recommends. Although the syntax | ||
| 1522 | varies depending on the packaging format, BitBake hides these | ||
| 1523 | differences from you. Here is the general syntax to specify versions | ||
| 1524 | with the :term:`RRECOMMENDS` variable:: | ||
| 1525 | |||
| 1526 | RRECOMMENDS:${PN} = "package (operator version)" | ||
| 1527 | |||
| 1528 | For ``operator``, you can specify the following:: | ||
| 1529 | |||
| 1530 | = | ||
| 1531 | < | ||
| 1532 | > | ||
| 1533 | <= | ||
| 1534 | >= | ||
| 1535 | |||
| 1536 | For example, the following sets up a recommend on version | ||
| 1537 | 1.2 or greater of the package ``foo``:: | ||
| 1538 | |||
| 1539 | RRECOMMENDS:${PN} = "foo (>= 1.2)" | ||
| 1540 | |||
| 1541 | :term:`SECTION` | ||
| 1542 | The section in which packages should be categorized. | ||
| 1543 | |||
| 1544 | :term:`SRC_URI` | ||
| 1545 | The list of source files --- local or remote. This variable tells | ||
| 1546 | BitBake which bits to pull for the build and how to pull them. For | ||
| 1547 | example, if the recipe or append file needs to fetch a single tarball | ||
| 1548 | from the Internet, the recipe or append file uses a :term:`SRC_URI` | ||
| 1549 | entry that specifies that tarball. On the other hand, if the recipe or | ||
| 1550 | append file needs to fetch a tarball, apply two patches, and include | ||
| 1551 | a custom file, the recipe or append file needs an :term:`SRC_URI` | ||
| 1552 | variable that specifies all those sources. | ||
| 1553 | |||
| 1554 | The following list explains the available URI protocols. URI | ||
| 1555 | protocols are highly dependent on particular BitBake Fetcher | ||
| 1556 | submodules. Depending on the fetcher BitBake uses, various URL | ||
| 1557 | parameters are employed. For specifics on the supported Fetchers, see | ||
| 1558 | the :ref:`bitbake-user-manual/bitbake-user-manual-fetching:fetchers` | ||
| 1559 | section. | ||
| 1560 | |||
| 1561 | - ``az://``: Fetches files from an Azure Storage account using HTTPS. | ||
| 1562 | |||
| 1563 | - ``bzr://``: Fetches files from a Bazaar revision control | ||
| 1564 | repository. | ||
| 1565 | |||
| 1566 | - ``ccrc://``: Fetches files from a ClearCase repository. | ||
| 1567 | |||
| 1568 | - ``cvs://``: Fetches files from a CVS revision control | ||
| 1569 | repository. | ||
| 1570 | |||
| 1571 | - ``file://``: Fetches files, which are usually files shipped | ||
| 1572 | with the Metadata, from the local machine. | ||
| 1573 | The path is relative to the :term:`FILESPATH` | ||
| 1574 | variable. Thus, the build system searches, in order, from the | ||
| 1575 | following directories, which are assumed to be a subdirectories of | ||
| 1576 | the directory in which the recipe file (``.bb``) or append file | ||
| 1577 | (``.bbappend``) resides: | ||
| 1578 | |||
| 1579 | - ``${BPN}``: the base recipe name without any special suffix | ||
| 1580 | or version numbers. | ||
| 1581 | |||
| 1582 | - ``${BP}`` - ``${BPN}-${PV}``: the base recipe name and | ||
| 1583 | version but without any special package name suffix. | ||
| 1584 | |||
| 1585 | - ``files``: files within a directory, which is named ``files`` | ||
| 1586 | and is also alongside the recipe or append file. | ||
| 1587 | |||
| 1588 | - ``ftp://``: Fetches files from the Internet using FTP. | ||
| 1589 | |||
| 1590 | - ``git://``: Fetches files from a Git revision control | ||
| 1591 | repository. | ||
| 1592 | |||
| 1593 | - ``gitsm://``: Fetches submodules from a Git revision control | ||
| 1594 | repository. | ||
| 1595 | |||
| 1596 | - ``hg://``: Fetches files from a Mercurial (``hg``) revision | ||
| 1597 | control repository. | ||
| 1598 | |||
| 1599 | - ``http://``: Fetches files from the Internet using HTTP. | ||
| 1600 | |||
| 1601 | - ``https://``: Fetches files from the Internet using HTTPS. | ||
| 1602 | |||
| 1603 | - ``npm://``: Fetches JavaScript modules from a registry. | ||
| 1604 | |||
| 1605 | - ``osc://``: Fetches files from an OSC (OpenSUSE Build service) | ||
| 1606 | revision control repository. | ||
| 1607 | |||
| 1608 | - ``p4://``: Fetches files from a Perforce (``p4``) revision | ||
| 1609 | control repository. | ||
| 1610 | |||
| 1611 | - ``repo://``: Fetches files from a repo (Git) repository. | ||
| 1612 | |||
| 1613 | - ``ssh://``: Fetches files from a secure shell. | ||
| 1614 | |||
| 1615 | - ``svn://``: Fetches files from a Subversion (``svn``) revision | ||
| 1616 | control repository. | ||
| 1617 | |||
| 1618 | Here are some additional options worth mentioning: | ||
| 1619 | |||
| 1620 | - ``downloadfilename``: Specifies the filename used when storing | ||
| 1621 | the downloaded file. | ||
| 1622 | |||
| 1623 | - ``name``: Specifies a name to be used for association with | ||
| 1624 | :term:`SRC_URI` checksums or :term:`SRCREV` when you have more than one | ||
| 1625 | file or git repository specified in :term:`SRC_URI`. For example:: | ||
| 1626 | |||
| 1627 | SRC_URI = "git://example.com/foo.git;branch=main;name=first \ | ||
| 1628 | git://example.com/bar.git;branch=main;name=second \ | ||
| 1629 | http://example.com/file.tar.gz;name=third" | ||
| 1630 | |||
| 1631 | SRCREV_first = "f1d2d2f924e986ac86fdf7b36c94bcdf32beec15" | ||
| 1632 | SRCREV_second = "e242ed3bffccdf271b7fbaf34ed72d089537b42f" | ||
| 1633 | SRC_URI[third.sha256sum] = "13550350a8681c84c861aac2e5b440161c2b33a3e4f302ac680ca5b686de48de" | ||
| 1634 | |||
| 1635 | - ``subdir``: Places the file (or extracts its contents) into the | ||
| 1636 | specified subdirectory. This option is useful for unusual tarballs | ||
| 1637 | or other archives that do not have their files already in a | ||
| 1638 | subdirectory within the archive. | ||
| 1639 | |||
| 1640 | - ``subpath``: Limits the checkout to a specific subpath of the | ||
| 1641 | tree when using the Git fetcher is used. | ||
| 1642 | |||
| 1643 | - ``unpack``: Controls whether or not to unpack the file if it is | ||
| 1644 | an archive. The default action is to unpack the file. | ||
| 1645 | |||
| 1646 | :term:`SRCDATE` | ||
| 1647 | The date of the source code used to build the package. This variable | ||
| 1648 | applies only if the source was fetched from a Source Code Manager | ||
| 1649 | (SCM). | ||
| 1650 | |||
| 1651 | :term:`SRCREV` | ||
| 1652 | The revision of the source code used to build the package. This | ||
| 1653 | variable applies only when using Subversion, Git, Mercurial and | ||
| 1654 | Bazaar. If you want to build a fixed revision and you want to avoid | ||
| 1655 | performing a query on the remote repository every time BitBake parses | ||
| 1656 | your recipe, you should specify a :term:`SRCREV` that is a full revision | ||
| 1657 | identifier and not just a tag. | ||
| 1658 | |||
| 1659 | :term:`SRCREV_FORMAT` | ||
| 1660 | Helps construct valid :term:`SRCREV` values when | ||
| 1661 | multiple source controlled URLs are used in | ||
| 1662 | :term:`SRC_URI`. | ||
| 1663 | |||
| 1664 | The system needs help constructing these values under these | ||
| 1665 | circumstances. Each component in the :term:`SRC_URI` is assigned a name | ||
| 1666 | and these are referenced in the :term:`SRCREV_FORMAT` variable. Consider | ||
| 1667 | an example with URLs named "machine" and "meta". In this case, | ||
| 1668 | :term:`SRCREV_FORMAT` could look like "machine_meta" and those names | ||
| 1669 | would have the SCM versions substituted into each position. Only one | ||
| 1670 | ``AUTOINC`` placeholder is added and if needed. And, this placeholder | ||
| 1671 | is placed at the start of the returned string. | ||
| 1672 | |||
| 1673 | :term:`STAMP` | ||
| 1674 | Specifies the base path used to create recipe stamp files. The path | ||
| 1675 | to an actual stamp file is constructed by evaluating this string and | ||
| 1676 | then appending additional information. | ||
| 1677 | |||
| 1678 | :term:`STAMPCLEAN` | ||
| 1679 | Specifies the base path used to create recipe stamp files. Unlike the | ||
| 1680 | :term:`STAMP` variable, :term:`STAMPCLEAN` can contain | ||
| 1681 | wildcards to match the range of files a clean operation should | ||
| 1682 | remove. BitBake uses a clean operation to remove any other stamps it | ||
| 1683 | should be removing when creating a new stamp. | ||
| 1684 | |||
| 1685 | :term:`SUMMARY` | ||
| 1686 | A short summary for the recipe, which is 72 characters or less. | ||
| 1687 | |||
| 1688 | :term:`SVNDIR` | ||
| 1689 | The directory in which files checked out of a Subversion system are | ||
| 1690 | stored. | ||
| 1691 | |||
| 1692 | :term:`T` | ||
| 1693 | Points to a directory were BitBake places temporary files, which | ||
| 1694 | consist mostly of task logs and scripts, when building a particular | ||
| 1695 | recipe. | ||
| 1696 | |||
| 1697 | :term:`TOPDIR` | ||
| 1698 | Points to the build directory. BitBake automatically sets this | ||
| 1699 | variable. | ||
diff --git a/bitbake/doc/bitbake-user-manual/figures/bb_multiconfig_files.png b/bitbake/doc/bitbake-user-manual/figures/bb_multiconfig_files.png deleted file mode 100644 index 041f06403b..0000000000 --- a/bitbake/doc/bitbake-user-manual/figures/bb_multiconfig_files.png +++ /dev/null | |||
| Binary files differ | |||
diff --git a/bitbake/doc/bitbake-user-manual/figures/bitbake-title.png b/bitbake/doc/bitbake-user-manual/figures/bitbake-title.png deleted file mode 100644 index cb290154da..0000000000 --- a/bitbake/doc/bitbake-user-manual/figures/bitbake-title.png +++ /dev/null | |||
| Binary files differ | |||
diff --git a/bitbake/doc/bitbake.1 b/bitbake/doc/bitbake.1 deleted file mode 100644 index 7fc1652ecd..0000000000 --- a/bitbake/doc/bitbake.1 +++ /dev/null | |||
| @@ -1,142 +0,0 @@ | |||
| 1 | .\" Hey, EMACS: -*- nroff -*- | ||
| 2 | .\" First parameter, NAME, should be all caps | ||
| 3 | .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection | ||
| 4 | .\" other parameters are allowed: see man(7), man(1) | ||
| 5 | .TH BITBAKE 1 "November 19, 2006" | ||
| 6 | .\" Please adjust this date whenever revising the manpage. | ||
| 7 | .\" | ||
| 8 | .\" Some roff macros, for reference: | ||
| 9 | .\" .nh disable hyphenation | ||
| 10 | .\" .hy enable hyphenation | ||
| 11 | .\" .ad l left justify | ||
| 12 | .\" .ad b justify to both left and right margins | ||
| 13 | .\" .nf disable filling | ||
| 14 | .\" .fi enable filling | ||
| 15 | .\" .br insert line break | ||
| 16 | .\" .sp <n> insert n+1 empty lines | ||
| 17 | .\" for manpage-specific macros, see man(7) | ||
| 18 | .SH NAME | ||
| 19 | BitBake \- simple tool for the execution of tasks | ||
| 20 | .SH SYNOPSIS | ||
| 21 | .B bitbake | ||
| 22 | .RI [ options ] " packagenames" | ||
| 23 | .br | ||
| 24 | .SH DESCRIPTION | ||
| 25 | This manual page documents briefly the | ||
| 26 | .B bitbake | ||
| 27 | command. | ||
| 28 | .PP | ||
| 29 | .\" TeX users may be more comfortable with the \fB<whatever>\fP and | ||
| 30 | .\" \fI<whatever>\fP escape sequences to invode bold face and italics, | ||
| 31 | .\" respectively. | ||
| 32 | \fBbitbake\fP is a program that executes the specified task (default is 'build') | ||
| 33 | for a given set of BitBake files. | ||
| 34 | .br | ||
| 35 | It expects that BBFILES is defined, which is a space separated list of files to | ||
| 36 | be executed. BBFILES does support wildcards. | ||
| 37 | .br | ||
| 38 | Default BBFILES are the .bb files in the current directory. | ||
| 39 | .SH OPTIONS | ||
| 40 | This program follow the usual GNU command line syntax, with long | ||
| 41 | options starting with two dashes (`-'). | ||
| 42 | .TP | ||
| 43 | .B \-h, \-\-help | ||
| 44 | Show summary of options. | ||
| 45 | .TP | ||
| 46 | .B \-\-version | ||
| 47 | Show version of program. | ||
| 48 | .TP | ||
| 49 | .B \-bBUILDFILE, \-\-buildfile=BUILDFILE | ||
| 50 | execute the task against this .bb file, rather than a package from BBFILES. | ||
| 51 | .TP | ||
| 52 | .B \-k, \-\-continue | ||
| 53 | continue as much as possible after an error. While the target that failed, and | ||
| 54 | those that depend on it, cannot be remade, the other dependencies of these | ||
| 55 | targets can be processed all the same. | ||
| 56 | .TP | ||
| 57 | .B \-a, \-\-tryaltconfigs | ||
| 58 | continue with builds by trying to use alternative providers where possible. | ||
| 59 | .TP | ||
| 60 | .B \-f, \-\-force | ||
| 61 | force run of specified cmd, regardless of stamp status | ||
| 62 | .TP | ||
| 63 | .B \-i, \-\-interactive | ||
| 64 | drop into the interactive mode also called the BitBake shell. | ||
| 65 | .TP | ||
| 66 | .B \-cCMD, \-\-cmd=CMD | ||
| 67 | Specify task to execute. Note that this only executes the specified task for | ||
| 68 | the providee and the packages it depends on, i.e. 'compile' does not implicitly | ||
| 69 | call stage for the dependencies (IOW: use only if you know what you are doing). | ||
| 70 | Depending on the base.bbclass a listtasks task is defined and will show | ||
| 71 | available tasks. | ||
| 72 | .TP | ||
| 73 | .B \-rFILE, \-\-read=FILE | ||
| 74 | read the specified file before bitbake.conf | ||
| 75 | .TP | ||
| 76 | .B \-v, \-\-verbose | ||
| 77 | output more chit-chat to the terminal | ||
| 78 | .TP | ||
| 79 | .B \-D, \-\-debug | ||
| 80 | Increase the debug level. You can specify this more than once. | ||
| 81 | .TP | ||
| 82 | .B \-n, \-\-dry-run | ||
| 83 | don't execute, just go through the motions | ||
| 84 | .TP | ||
| 85 | .B \-p, \-\-parse-only | ||
| 86 | quit after parsing the BB files (developers only) | ||
| 87 | .TP | ||
| 88 | .B \-s, \-\-show-versions | ||
| 89 | show current and preferred versions of all packages | ||
| 90 | .TP | ||
| 91 | .B \-e, \-\-environment | ||
| 92 | show the global or per-recipe environment (this is what used to be bbread) | ||
| 93 | .TP | ||
| 94 | .B \-g, \-\-graphviz | ||
| 95 | emit the dependency trees of the specified packages in the dot syntax | ||
| 96 | .TP | ||
| 97 | .B \-IIGNORED\_DOT\_DEPS, \-\-ignore-deps=IGNORED_DOT_DEPS | ||
| 98 | Stop processing at the given list of dependencies when generating dependency | ||
| 99 | graphs. This can help to make the graph more appealing | ||
| 100 | .TP | ||
| 101 | .B \-lDEBUG_DOMAINS, \-\-log-domains=DEBUG_DOMAINS | ||
| 102 | Show debug logging for the specified logging domains | ||
| 103 | .TP | ||
| 104 | .B \-P, \-\-profile | ||
| 105 | profile the command and print a report | ||
| 106 | .TP | ||
| 107 | .B \-uUI, \-\-ui=UI | ||
| 108 | User interface to use. Currently, knotty, taskexp or ncurses can be specified as UI. | ||
| 109 | .TP | ||
| 110 | .B \-tSERVERTYPE, \-\-servertype=SERVERTYPE | ||
| 111 | Choose which server to use, none, process or xmlrpc. | ||
| 112 | .TP | ||
| 113 | .B \-\-revisions-changed | ||
| 114 | Set the exit code depending on whether upstream floating revisions have changed or not. | ||
| 115 | .TP | ||
| 116 | .B \-\-server-only | ||
| 117 | Run bitbake without UI, the frontend can connect with bitbake server itself. | ||
| 118 | .TP | ||
| 119 | .B \-BBIND, \-\-bind=BIND | ||
| 120 | The name/address for the bitbake server to bind to. | ||
| 121 | .TP | ||
| 122 | .B \-\-no\-setscene | ||
| 123 | Do not run any setscene tasks, forces builds. | ||
| 124 | |||
| 125 | .SH ENVIRONMENT VARIABLES | ||
| 126 | bitbake uses the following environment variables to control its | ||
| 127 | operation: | ||
| 128 | .TP | ||
| 129 | .B BITBAKE_UI | ||
| 130 | The bitbake user interface; overridden by the \fB-u\fP commandline option. | ||
| 131 | |||
| 132 | .SH AUTHORS | ||
| 133 | BitBake was written by | ||
| 134 | Phil Blundell, | ||
| 135 | Holger Freyther, | ||
| 136 | Chris Larson, | ||
| 137 | Mickey Lauer, | ||
| 138 | Richard Purdie, | ||
| 139 | Holger Schurig | ||
| 140 | .PP | ||
| 141 | This manual page was written by Marcin Juszkiewicz <marcin@hrw.one.pl> | ||
| 142 | for the Debian project (but may be used by others). | ||
diff --git a/bitbake/doc/conf.py b/bitbake/doc/conf.py deleted file mode 100644 index f61241e28b..0000000000 --- a/bitbake/doc/conf.py +++ /dev/null | |||
| @@ -1,108 +0,0 @@ | |||
| 1 | # Configuration file for the Sphinx documentation builder. | ||
| 2 | # | ||
| 3 | # This file only contains a selection of the most common options. For a full | ||
| 4 | # list see the documentation: | ||
| 5 | # https://www.sphinx-doc.org/en/master/usage/configuration.html | ||
| 6 | |||
| 7 | # -- Path setup -------------------------------------------------------------- | ||
| 8 | |||
| 9 | # If extensions (or modules to document with autodoc) are in another directory, | ||
| 10 | # add these directories to sys.path here. If the directory is relative to the | ||
| 11 | # documentation root, use os.path.abspath to make it absolute, like shown here. | ||
| 12 | # | ||
| 13 | # import os | ||
| 14 | # import sys | ||
| 15 | # sys.path.insert(0, os.path.abspath('.')) | ||
| 16 | |||
| 17 | import sys | ||
| 18 | import datetime | ||
| 19 | |||
| 20 | from pathlib import Path | ||
| 21 | |||
| 22 | current_version = "dev" | ||
| 23 | |||
| 24 | # String used in sidebar | ||
| 25 | version = 'Version: ' + current_version | ||
| 26 | if current_version == 'dev': | ||
| 27 | version = 'Version: Current Development' | ||
| 28 | # Version seen in documentation_options.js and hence in js switchers code | ||
| 29 | release = current_version | ||
| 30 | |||
| 31 | # -- Project information ----------------------------------------------------- | ||
| 32 | |||
| 33 | project = 'Bitbake' | ||
| 34 | copyright = '2004-%s, Richard Purdie, Chris Larson, and Phil Blundell' \ | ||
| 35 | % datetime.datetime.now().year | ||
| 36 | author = 'Richard Purdie, Chris Larson, and Phil Blundell' | ||
| 37 | |||
| 38 | # external links and substitutions | ||
| 39 | extlinks = { | ||
| 40 | 'yocto_docs': ('https://docs.yoctoproject.org%s', None), | ||
| 41 | 'oe_lists': ('https://lists.openembedded.org%s', None), | ||
| 42 | } | ||
| 43 | |||
| 44 | # -- General configuration --------------------------------------------------- | ||
| 45 | |||
| 46 | # Add any Sphinx extension module names here, as strings. They can be | ||
| 47 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom | ||
| 48 | # ones. | ||
| 49 | extensions = [ | ||
| 50 | 'sphinx.ext.autosectionlabel', | ||
| 51 | 'sphinx.ext.extlinks', | ||
| 52 | 'sphinx.ext.autodoc', | ||
| 53 | ] | ||
| 54 | autosectionlabel_prefix_document = True | ||
| 55 | |||
| 56 | # Add any paths that contain templates here, relative to this directory. | ||
| 57 | templates_path = ['_templates'] | ||
| 58 | |||
| 59 | # List of patterns, relative to source directory, that match files and | ||
| 60 | # directories to ignore when looking for source files. | ||
| 61 | # This pattern also affects html_static_path and html_extra_path. | ||
| 62 | exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] | ||
| 63 | |||
| 64 | # master document name. The default changed from contents to index. so better | ||
| 65 | # set it ourselves. | ||
| 66 | master_doc = 'index' | ||
| 67 | |||
| 68 | # create substitution for project configuration variables | ||
| 69 | rst_prolog = """ | ||
| 70 | .. |project_name| replace:: %s | ||
| 71 | .. |copyright| replace:: %s | ||
| 72 | .. |author| replace:: %s | ||
| 73 | """ % (project, copyright, author) | ||
| 74 | |||
| 75 | # -- Options for HTML output ------------------------------------------------- | ||
| 76 | |||
| 77 | # The theme to use for HTML and HTML Help pages. See the documentation for | ||
| 78 | # a list of builtin themes. | ||
| 79 | # | ||
| 80 | try: | ||
| 81 | import sphinx_rtd_theme | ||
| 82 | html_theme = 'sphinx_rtd_theme' | ||
| 83 | except ImportError: | ||
| 84 | sys.stderr.write("The Sphinx sphinx_rtd_theme HTML theme was not found.\ | ||
| 85 | \nPlease make sure to install the sphinx_rtd_theme python package.\n") | ||
| 86 | sys.exit(1) | ||
| 87 | |||
| 88 | # Add any paths that contain custom static files (such as style sheets) here, | ||
| 89 | # relative to this directory. They are copied after the builtin static files, | ||
| 90 | # so a file named "default.css" will overwrite the builtin "default.css". | ||
| 91 | html_static_path = ['sphinx-static'] | ||
| 92 | |||
| 93 | # Add customm CSS and JS files | ||
| 94 | html_css_files = ['theme_overrides.css'] | ||
| 95 | html_js_files = ['switchers.js'] | ||
| 96 | |||
| 97 | # Hide 'Created using Sphinx' text | ||
| 98 | html_show_sphinx = False | ||
| 99 | |||
| 100 | # Add 'Last updated' on each page | ||
| 101 | html_last_updated_fmt = '%b %d, %Y' | ||
| 102 | |||
| 103 | # Remove the trailing 'dot' in section numbers | ||
| 104 | html_secnumber_suffix = " " | ||
| 105 | |||
| 106 | # autoconf needs the modules available to auto-generate documentation from the | ||
| 107 | # code | ||
| 108 | sys.path.insert(0, str(Path('..', 'lib').resolve())) | ||
diff --git a/bitbake/doc/genindex.rst b/bitbake/doc/genindex.rst deleted file mode 100644 index a4af06f656..0000000000 --- a/bitbake/doc/genindex.rst +++ /dev/null | |||
| @@ -1,3 +0,0 @@ | |||
| 1 | ===== | ||
| 2 | Index | ||
| 3 | ===== | ||
diff --git a/bitbake/doc/index.rst b/bitbake/doc/index.rst deleted file mode 100644 index 546ef36c16..0000000000 --- a/bitbake/doc/index.rst +++ /dev/null | |||
| @@ -1,40 +0,0 @@ | |||
| 1 | .. SPDX-License-Identifier: CC-BY-2.5 | ||
| 2 | |||
| 3 | =================== | ||
| 4 | BitBake User Manual | ||
| 5 | =================== | ||
| 6 | |||
| 7 | | | ||
| 8 | |||
| 9 | .. toctree:: | ||
| 10 | :caption: Table of Contents | ||
| 11 | :numbered: | ||
| 12 | |||
| 13 | bitbake-user-manual/bitbake-user-manual-intro | ||
| 14 | bitbake-user-manual/bitbake-user-manual-execution | ||
| 15 | bitbake-user-manual/bitbake-user-manual-metadata | ||
| 16 | bitbake-user-manual/bitbake-user-manual-ref-variables-context | ||
| 17 | bitbake-user-manual/bitbake-user-manual-fetching | ||
| 18 | bitbake-user-manual/bitbake-user-manual-ref-variables | ||
| 19 | bitbake-user-manual/bitbake-user-manual-library-functions | ||
| 20 | bitbake-user-manual/bitbake-user-manual-hello | ||
| 21 | |||
| 22 | .. toctree:: | ||
| 23 | :maxdepth: 1 | ||
| 24 | :hidden: | ||
| 25 | |||
| 26 | genindex | ||
| 27 | releases | ||
| 28 | |||
| 29 | ---- | ||
| 30 | |||
| 31 | .. include:: <xhtml1-lat1.txt> | ||
| 32 | |||
| 33 | | BitBake Community | ||
| 34 | | Copyright |copy| |copyright| | ||
| 35 | | <bitbake-devel@lists.openembedded.org> | ||
| 36 | |||
| 37 | This work is licensed under the Creative Commons Attribution License. To view a | ||
| 38 | copy of this license, visit http://creativecommons.org/licenses/by/2.5/ or send | ||
| 39 | a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, | ||
| 40 | California 94041, USA. | ||
diff --git a/bitbake/doc/releases.rst b/bitbake/doc/releases.rst deleted file mode 100644 index 676db66ec5..0000000000 --- a/bitbake/doc/releases.rst +++ /dev/null | |||
| @@ -1,193 +0,0 @@ | |||
| 1 | .. SPDX-License-Identifier: CC-BY-2.5 | ||
| 2 | |||
| 3 | ================================= | ||
| 4 | BitBake Supported Release Manuals | ||
| 5 | ================================= | ||
| 6 | |||
| 7 | ****************************** | ||
| 8 | Release Series 5.2 (walnascar) | ||
| 9 | ****************************** | ||
| 10 | |||
| 11 | - :yocto_docs:`BitBake 2.12 User Manual </bitbake/2.12/>` | ||
| 12 | |||
| 13 | ******************************* | ||
| 14 | Release Series 5.0 (scarthgap) | ||
| 15 | ******************************* | ||
| 16 | |||
| 17 | - :yocto_docs:`BitBake 2.8 User Manual </bitbake/2.8/>` | ||
| 18 | |||
| 19 | ****************************** | ||
| 20 | Release Series 4.0 (kirkstone) | ||
| 21 | ****************************** | ||
| 22 | |||
| 23 | - :yocto_docs:`BitBake 2.0 User Manual </bitbake/2.0/>` | ||
| 24 | |||
| 25 | ================================ | ||
| 26 | BitBake Outdated Release Manuals | ||
| 27 | ================================ | ||
| 28 | |||
| 29 | **************************** | ||
| 30 | Release Series 5.1 (styhead) | ||
| 31 | **************************** | ||
| 32 | |||
| 33 | - :yocto_docs:`BitBake 2.10 User Manual </bitbake/2.10/>` | ||
| 34 | |||
| 35 | ******************************* | ||
| 36 | Release Series 4.3 (nanbield) | ||
| 37 | ******************************* | ||
| 38 | |||
| 39 | - :yocto_docs:`BitBake 2.6 User Manual </bitbake/2.6/>` | ||
| 40 | |||
| 41 | ******************************* | ||
| 42 | Release Series 4.2 (mickledore) | ||
| 43 | ******************************* | ||
| 44 | |||
| 45 | - :yocto_docs:`BitBake 2.4 User Manual </bitbake/2.4/>` | ||
| 46 | |||
| 47 | ***************************** | ||
| 48 | Release Series 4.1 (langdale) | ||
| 49 | ***************************** | ||
| 50 | |||
| 51 | - :yocto_docs:`BitBake 2.2 User Manual </bitbake/2.2/>` | ||
| 52 | |||
| 53 | ****************************** | ||
| 54 | Release Series 3.4 (honister) | ||
| 55 | ****************************** | ||
| 56 | |||
| 57 | - :yocto_docs:`BitBake 1.52 User Manual </bitbake/1.52/>` | ||
| 58 | |||
| 59 | ****************************** | ||
| 60 | Release Series 3.3 (hardknott) | ||
| 61 | ****************************** | ||
| 62 | |||
| 63 | - :yocto_docs:`BitBake 1.50 User Manual </bitbake/1.50/>` | ||
| 64 | |||
| 65 | ******************************* | ||
| 66 | Release Series 3.2 (gatesgarth) | ||
| 67 | ******************************* | ||
| 68 | |||
| 69 | - :yocto_docs:`BitBake 1.48 User Manual </bitbake/1.48/>` | ||
| 70 | |||
| 71 | **************************** | ||
| 72 | Release Series 3.1 (dunfell) | ||
| 73 | **************************** | ||
| 74 | |||
| 75 | - :yocto_docs:`BitBake 1.46 User Manual </bitbake/1.46/>` | ||
| 76 | - :yocto_docs:`3.1 BitBake User Manual </3.1/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 77 | - :yocto_docs:`3.1.1 BitBake User Manual </3.1.1/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 78 | - :yocto_docs:`3.1.2 BitBake User Manual </3.1.2/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 79 | - :yocto_docs:`3.1.3 BitBake User Manual </3.1.3/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 80 | |||
| 81 | ************************* | ||
| 82 | Release Series 3.0 (zeus) | ||
| 83 | ************************* | ||
| 84 | |||
| 85 | - :yocto_docs:`3.0 BitBake User Manual </3.0/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 86 | - :yocto_docs:`3.0.1 BitBake User Manual </3.0.1/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 87 | - :yocto_docs:`3.0.2 BitBake User Manual </3.0.2/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 88 | - :yocto_docs:`3.0.3 BitBake User Manual </3.0.3/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 89 | - :yocto_docs:`3.0.4 BitBake User Manual </3.0.4/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 90 | |||
| 91 | **************************** | ||
| 92 | Release Series 2.7 (warrior) | ||
| 93 | **************************** | ||
| 94 | |||
| 95 | - :yocto_docs:`2.7 BitBake User Manual </2.7/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 96 | - :yocto_docs:`2.7.1 BitBake User Manual </2.7.1/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 97 | - :yocto_docs:`2.7.2 BitBake User Manual </2.7.2/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 98 | - :yocto_docs:`2.7.3 BitBake User Manual </2.7.3/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 99 | - :yocto_docs:`2.7.4 BitBake User Manual </2.7.4/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 100 | |||
| 101 | ************************* | ||
| 102 | Release Series 2.6 (thud) | ||
| 103 | ************************* | ||
| 104 | |||
| 105 | - :yocto_docs:`2.6 BitBake User Manual </2.6/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 106 | - :yocto_docs:`2.6.1 BitBake User Manual </2.6.1/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 107 | - :yocto_docs:`2.6.2 BitBake User Manual </2.6.2/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 108 | - :yocto_docs:`2.6.3 BitBake User Manual </2.6.3/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 109 | - :yocto_docs:`2.6.4 BitBake User Manual </2.6.4/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 110 | |||
| 111 | ************************* | ||
| 112 | Release Series 2.5 (sumo) | ||
| 113 | ************************* | ||
| 114 | |||
| 115 | - :yocto_docs:`2.5 Documentation </2.5>` | ||
| 116 | - :yocto_docs:`2.5.1 Documentation </2.5.1>` | ||
| 117 | - :yocto_docs:`2.5.2 Documentation </2.5.2>` | ||
| 118 | - :yocto_docs:`2.5.3 Documentation </2.5.3>` | ||
| 119 | |||
| 120 | ************************** | ||
| 121 | Release Series 2.4 (rocko) | ||
| 122 | ************************** | ||
| 123 | |||
| 124 | - :yocto_docs:`2.4 BitBake User Manual </2.4/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 125 | - :yocto_docs:`2.4.1 BitBake User Manual </2.4.1/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 126 | - :yocto_docs:`2.4.2 BitBake User Manual </2.4.2/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 127 | - :yocto_docs:`2.4.3 BitBake User Manual </2.4.3/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 128 | - :yocto_docs:`2.4.4 BitBake User Manual </2.4.4/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 129 | |||
| 130 | ************************* | ||
| 131 | Release Series 2.3 (pyro) | ||
| 132 | ************************* | ||
| 133 | |||
| 134 | - :yocto_docs:`2.3 BitBake User Manual </2.3/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 135 | - :yocto_docs:`2.3.1 BitBake User Manual </2.3.1/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 136 | - :yocto_docs:`2.3.2 BitBake User Manual </2.3.2/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 137 | - :yocto_docs:`2.3.3 BitBake User Manual </2.3.3/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 138 | - :yocto_docs:`2.3.4 BitBake User Manual </2.3.4/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 139 | |||
| 140 | ************************** | ||
| 141 | Release Series 2.2 (morty) | ||
| 142 | ************************** | ||
| 143 | |||
| 144 | - :yocto_docs:`2.2 BitBake User Manual </2.2/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 145 | - :yocto_docs:`2.2.1 BitBake User Manual </2.2.1/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 146 | - :yocto_docs:`2.2.2 BitBake User Manual </2.2.2/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 147 | - :yocto_docs:`2.2.3 BitBake User Manual </2.2.3/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 148 | |||
| 149 | **************************** | ||
| 150 | Release Series 2.1 (krogoth) | ||
| 151 | **************************** | ||
| 152 | |||
| 153 | - :yocto_docs:`2.1 BitBake User Manual </2.1/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 154 | - :yocto_docs:`2.1.1 BitBake User Manual </2.1.1/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 155 | - :yocto_docs:`2.1.2 BitBake User Manual </2.1.2/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 156 | - :yocto_docs:`2.1.3 BitBake User Manual </2.1.3/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 157 | |||
| 158 | *************************** | ||
| 159 | Release Series 2.0 (jethro) | ||
| 160 | *************************** | ||
| 161 | |||
| 162 | - :yocto_docs:`1.9 BitBake User Manual </1.9/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 163 | - :yocto_docs:`2.0 BitBake User Manual </2.0/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 164 | - :yocto_docs:`2.0.1 BitBake User Manual </2.0.1/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 165 | - :yocto_docs:`2.0.2 BitBake User Manual </2.0.2/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 166 | - :yocto_docs:`2.0.3 BitBake User Manual </2.0.3/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 167 | |||
| 168 | ************************* | ||
| 169 | Release Series 1.8 (fido) | ||
| 170 | ************************* | ||
| 171 | |||
| 172 | - :yocto_docs:`1.8 BitBake User Manual </1.8/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 173 | - :yocto_docs:`1.8.1 BitBake User Manual </1.8.1/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 174 | - :yocto_docs:`1.8.2 BitBake User Manual </1.8.2/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 175 | |||
| 176 | ************************** | ||
| 177 | Release Series 1.7 (dizzy) | ||
| 178 | ************************** | ||
| 179 | |||
| 180 | - :yocto_docs:`1.7 BitBake User Manual </1.7/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 181 | - :yocto_docs:`1.7.1 BitBake User Manual </1.7.1/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 182 | - :yocto_docs:`1.7.2 BitBake User Manual </1.7.2/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 183 | - :yocto_docs:`1.7.3 BitBake User Manual </1.7.3/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 184 | |||
| 185 | ************************** | ||
| 186 | Release Series 1.6 (daisy) | ||
| 187 | ************************** | ||
| 188 | |||
| 189 | - :yocto_docs:`1.6 BitBake User Manual </1.6/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 190 | - :yocto_docs:`1.6.1 BitBake User Manual </1.6.1/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 191 | - :yocto_docs:`1.6.2 BitBake User Manual </1.6.2/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 192 | - :yocto_docs:`1.6.3 BitBake User Manual </1.6.3/bitbake-user-manual/bitbake-user-manual.html>` | ||
| 193 | |||
diff --git a/bitbake/doc/sphinx-static/switchers.js b/bitbake/doc/sphinx-static/switchers.js deleted file mode 100644 index 32113cfa96..0000000000 --- a/bitbake/doc/sphinx-static/switchers.js +++ /dev/null | |||
| @@ -1,233 +0,0 @@ | |||
| 1 | (function() { | ||
| 2 | 'use strict'; | ||
| 3 | |||
| 4 | var all_versions = { | ||
| 5 | 'dev': 'dev (3.2)', | ||
| 6 | '3.1.2': '3.1.2', | ||
| 7 | '3.0.3': '3.0.3', | ||
| 8 | '2.7.4': '2.7.4', | ||
| 9 | }; | ||
| 10 | |||
| 11 | var all_doctypes = { | ||
| 12 | 'single': 'Individual Webpages', | ||
| 13 | 'mega': "All-in-one 'Mega' Manual", | ||
| 14 | }; | ||
| 15 | |||
| 16 | // Simple version comparision | ||
| 17 | // Return 1 if a > b | ||
| 18 | // Return -1 if a < b | ||
| 19 | // Return 0 if a == b | ||
| 20 | function ver_compare(a, b) { | ||
| 21 | if (a == "dev") { | ||
| 22 | return 1; | ||
| 23 | } | ||
| 24 | |||
| 25 | if (a === b) { | ||
| 26 | return 0; | ||
| 27 | } | ||
| 28 | |||
| 29 | var a_components = a.split("."); | ||
| 30 | var b_components = b.split("."); | ||
| 31 | |||
| 32 | var len = Math.min(a_components.length, b_components.length); | ||
| 33 | |||
| 34 | // loop while the components are equal | ||
| 35 | for (var i = 0; i < len; i++) { | ||
| 36 | // A bigger than B | ||
| 37 | if (parseInt(a_components[i]) > parseInt(b_components[i])) { | ||
| 38 | return 1; | ||
| 39 | } | ||
| 40 | |||
| 41 | // B bigger than A | ||
| 42 | if (parseInt(a_components[i]) < parseInt(b_components[i])) { | ||
| 43 | return -1; | ||
| 44 | } | ||
| 45 | } | ||
| 46 | |||
| 47 | // If one's a prefix of the other, the longer one is greater. | ||
| 48 | if (a_components.length > b_components.length) { | ||
| 49 | return 1; | ||
| 50 | } | ||
| 51 | |||
| 52 | if (a_components.length < b_components.length) { | ||
| 53 | return -1; | ||
| 54 | } | ||
| 55 | |||
| 56 | // Otherwise they are the same. | ||
| 57 | return 0; | ||
| 58 | } | ||
| 59 | |||
| 60 | function build_version_select(current_series, current_version) { | ||
| 61 | var buf = ['<select>']; | ||
| 62 | |||
| 63 | $.each(all_versions, function(version, title) { | ||
| 64 | var series = version.substr(0, 3); | ||
| 65 | if (series == current_series) { | ||
| 66 | if (version == current_version) | ||
| 67 | buf.push('<option value="' + version + '" selected="selected">' + title + '</option>'); | ||
| 68 | else | ||
| 69 | buf.push('<option value="' + version + '">' + title + '</option>'); | ||
| 70 | |||
| 71 | if (version != current_version) | ||
| 72 | buf.push('<option value="' + current_version + '" selected="selected">' + current_version + '</option>'); | ||
| 73 | } else { | ||
| 74 | buf.push('<option value="' + version + '">' + title + '</option>'); | ||
| 75 | } | ||
| 76 | }); | ||
| 77 | |||
| 78 | buf.push('</select>'); | ||
| 79 | return buf.join(''); | ||
| 80 | } | ||
| 81 | |||
| 82 | function build_doctype_select(current_doctype) { | ||
| 83 | var buf = ['<select>']; | ||
| 84 | |||
| 85 | $.each(all_doctypes, function(doctype, title) { | ||
| 86 | if (doctype == current_doctype) | ||
| 87 | buf.push('<option value="' + doctype + '" selected="selected">' + | ||
| 88 | all_doctypes[current_doctype] + '</option>'); | ||
| 89 | else | ||
| 90 | buf.push('<option value="' + doctype + '">' + title + '</option>'); | ||
| 91 | }); | ||
| 92 | if (!(current_doctype in all_doctypes)) { | ||
| 93 | // In case we're browsing a doctype that is not yet in all_doctypes. | ||
| 94 | buf.push('<option value="' + current_doctype + '" selected="selected">' + | ||
| 95 | current_doctype + '</option>'); | ||
| 96 | all_doctypes[current_doctype] = current_doctype; | ||
| 97 | } | ||
| 98 | buf.push('</select>'); | ||
| 99 | return buf.join(''); | ||
| 100 | } | ||
| 101 | |||
| 102 | function navigate_to_first_existing(urls) { | ||
| 103 | // Navigate to the first existing URL in urls. | ||
| 104 | var url = urls.shift(); | ||
| 105 | |||
| 106 | // Web browsers won't redirect file:// urls to file urls using ajax but | ||
| 107 | // its useful for local testing | ||
| 108 | if (url.startsWith("file://")) { | ||
| 109 | window.location.href = url; | ||
| 110 | return; | ||
| 111 | } | ||
| 112 | |||
| 113 | if (urls.length == 0) { | ||
| 114 | window.location.href = url; | ||
| 115 | return; | ||
| 116 | } | ||
| 117 | $.ajax({ | ||
| 118 | url: url, | ||
| 119 | success: function() { | ||
| 120 | window.location.href = url; | ||
| 121 | }, | ||
| 122 | error: function() { | ||
| 123 | navigate_to_first_existing(urls); | ||
| 124 | } | ||
| 125 | }); | ||
| 126 | } | ||
| 127 | |||
| 128 | function get_docroot_url() { | ||
| 129 | var url = window.location.href; | ||
| 130 | var root = DOCUMENTATION_OPTIONS.URL_ROOT; | ||
| 131 | |||
| 132 | var urlarray = url.split('/'); | ||
| 133 | // Trim off anything after '/' | ||
| 134 | urlarray.pop(); | ||
| 135 | var depth = (root.match(/\.\.\//g) || []).length; | ||
| 136 | for (var i = 0; i < depth; i++) { | ||
| 137 | urlarray.pop(); | ||
| 138 | } | ||
| 139 | |||
| 140 | return urlarray.join('/') + '/'; | ||
| 141 | } | ||
| 142 | |||
| 143 | function on_version_switch() { | ||
| 144 | var selected_version = $(this).children('option:selected').attr('value'); | ||
| 145 | var url = window.location.href; | ||
| 146 | var current_version = DOCUMENTATION_OPTIONS.VERSION; | ||
| 147 | var docroot = get_docroot_url() | ||
| 148 | |||
| 149 | var new_versionpath = selected_version + '/'; | ||
| 150 | if (selected_version == "dev") | ||
| 151 | new_versionpath = ''; | ||
| 152 | |||
| 153 | // dev versions have no version prefix | ||
| 154 | if (current_version == "dev") { | ||
| 155 | var new_url = docroot + new_versionpath + url.replace(docroot, ""); | ||
| 156 | var fallback_url = docroot + new_versionpath; | ||
| 157 | } else { | ||
| 158 | var new_url = url.replace('/' + current_version + '/', '/' + new_versionpath); | ||
| 159 | var fallback_url = new_url.replace(url.replace(docroot, ""), ""); | ||
| 160 | } | ||
| 161 | |||
| 162 | console.log(get_docroot_url()) | ||
| 163 | console.log(url + " to url " + new_url); | ||
| 164 | console.log(url + " to fallback " + fallback_url); | ||
| 165 | |||
| 166 | if (new_url != url) { | ||
| 167 | navigate_to_first_existing([ | ||
| 168 | new_url, | ||
| 169 | fallback_url, | ||
| 170 | 'https://www.yoctoproject.org/docs/', | ||
| 171 | ]); | ||
| 172 | } | ||
| 173 | } | ||
| 174 | |||
| 175 | function on_doctype_switch() { | ||
| 176 | var selected_doctype = $(this).children('option:selected').attr('value'); | ||
| 177 | var url = window.location.href; | ||
| 178 | if (selected_doctype == 'mega') { | ||
| 179 | var docroot = get_docroot_url() | ||
| 180 | var current_version = DOCUMENTATION_OPTIONS.VERSION; | ||
| 181 | // Assume manuals before 3.2 are using old docbook mega-manual | ||
| 182 | if (ver_compare(current_version, "3.2") < 0) { | ||
| 183 | var new_url = docroot + "mega-manual/mega-manual.html"; | ||
| 184 | } else { | ||
| 185 | var new_url = docroot + "singleindex.html"; | ||
| 186 | } | ||
| 187 | } else { | ||
| 188 | var new_url = url.replace("singleindex.html", "index.html") | ||
| 189 | } | ||
| 190 | |||
| 191 | if (new_url != url) { | ||
| 192 | navigate_to_first_existing([ | ||
| 193 | new_url, | ||
| 194 | 'https://www.yoctoproject.org/docs/', | ||
| 195 | ]); | ||
| 196 | } | ||
| 197 | } | ||
| 198 | |||
| 199 | // Returns the current doctype based upon the url | ||
| 200 | function doctype_segment_from_url(url) { | ||
| 201 | if (url.includes("singleindex") || url.includes("mega-manual")) | ||
| 202 | return "mega"; | ||
| 203 | return "single"; | ||
| 204 | } | ||
| 205 | |||
| 206 | $(document).ready(function() { | ||
| 207 | var release = DOCUMENTATION_OPTIONS.VERSION; | ||
| 208 | var current_doctype = doctype_segment_from_url(window.location.href); | ||
| 209 | var current_series = release.substr(0, 3); | ||
| 210 | var version_select = build_version_select(current_series, release); | ||
| 211 | |||
| 212 | $('.version_switcher_placeholder').html(version_select); | ||
| 213 | $('.version_switcher_placeholder select').bind('change', on_version_switch); | ||
| 214 | |||
| 215 | var doctype_select = build_doctype_select(current_doctype); | ||
| 216 | |||
| 217 | $('.doctype_switcher_placeholder').html(doctype_select); | ||
| 218 | $('.doctype_switcher_placeholder select').bind('change', on_doctype_switch); | ||
| 219 | |||
| 220 | if (ver_compare(release, "3.1") < 0) { | ||
| 221 | $('#outdated-warning').html('Version ' + release + ' of the project is now considered obsolete, please select and use a more recent version'); | ||
| 222 | $('#outdated-warning').css('padding', '.5em'); | ||
| 223 | } else if (release != "dev") { | ||
| 224 | $.each(all_versions, function(version, title) { | ||
| 225 | var series = version.substr(0, 3); | ||
| 226 | if (series == current_series && version != release) { | ||
| 227 | $('#outdated-warning').html('This document is for outdated version ' + release + ', you should select the latest release version in this series, ' + version + '.'); | ||
| 228 | $('#outdated-warning').css('padding', '.5em'); | ||
| 229 | } | ||
| 230 | }); | ||
| 231 | } | ||
| 232 | }); | ||
| 233 | })(); | ||
diff --git a/bitbake/doc/sphinx-static/theme_overrides.css b/bitbake/doc/sphinx-static/theme_overrides.css deleted file mode 100644 index e362677a7f..0000000000 --- a/bitbake/doc/sphinx-static/theme_overrides.css +++ /dev/null | |||
| @@ -1,162 +0,0 @@ | |||
| 1 | /* | ||
| 2 | SPDX-License-Identifier: CC-BY-2.0-UK | ||
| 3 | */ | ||
| 4 | |||
| 5 | body { | ||
| 6 | font-family: Verdana, Sans, sans-serif; | ||
| 7 | margin: 0em auto; | ||
| 8 | color: #333; | ||
| 9 | } | ||
| 10 | |||
| 11 | h1,h2,h3,h4,h5,h6,h7 { | ||
| 12 | font-family: Arial, Sans; | ||
| 13 | color: #00557D; | ||
| 14 | clear: both; | ||
| 15 | } | ||
| 16 | |||
| 17 | h1 { | ||
| 18 | font-size: 2em; | ||
| 19 | text-align: left; | ||
| 20 | padding: 0em 0em 0em 0em; | ||
| 21 | margin: 2em 0em 0em 0em; | ||
| 22 | } | ||
| 23 | |||
| 24 | h2.subtitle { | ||
| 25 | margin: 0.10em 0em 3.0em 0em; | ||
| 26 | padding: 0em 0em 0em 0em; | ||
| 27 | font-size: 1.8em; | ||
| 28 | padding-left: 20%; | ||
| 29 | font-weight: normal; | ||
| 30 | font-style: italic; | ||
| 31 | } | ||
| 32 | |||
| 33 | h2 { | ||
| 34 | margin: 2em 0em 0.66em 0em; | ||
| 35 | padding: 0.5em 0em 0em 0em; | ||
| 36 | font-size: 1.5em; | ||
| 37 | font-weight: bold; | ||
| 38 | } | ||
| 39 | |||
| 40 | h3.subtitle { | ||
| 41 | margin: 0em 0em 1em 0em; | ||
| 42 | padding: 0em 0em 0em 0em; | ||
| 43 | font-size: 142.14%; | ||
| 44 | text-align: right; | ||
| 45 | } | ||
| 46 | |||
| 47 | h3 { | ||
| 48 | margin: 1em 0em 0.5em 0em; | ||
| 49 | padding: 1em 0em 0em 0em; | ||
| 50 | font-size: 140%; | ||
| 51 | font-weight: bold; | ||
| 52 | } | ||
| 53 | |||
| 54 | h4 { | ||
| 55 | margin: 1em 0em 0.5em 0em; | ||
| 56 | padding: 1em 0em 0em 0em; | ||
| 57 | font-size: 120%; | ||
| 58 | font-weight: bold; | ||
| 59 | } | ||
| 60 | |||
| 61 | h5 { | ||
| 62 | margin: 1em 0em 0.5em 0em; | ||
| 63 | padding: 1em 0em 0em 0em; | ||
| 64 | font-size: 110%; | ||
| 65 | font-weight: bold; | ||
| 66 | } | ||
| 67 | |||
| 68 | h6 { | ||
| 69 | margin: 1em 0em 0em 0em; | ||
| 70 | padding: 1em 0em 0em 0em; | ||
| 71 | font-size: 110%; | ||
| 72 | font-weight: bold; | ||
| 73 | } | ||
| 74 | |||
| 75 | em { | ||
| 76 | font-weight: bold; | ||
| 77 | } | ||
| 78 | |||
| 79 | .pre { | ||
| 80 | font-size: medium; | ||
| 81 | font-family: Courier, monospace; | ||
| 82 | } | ||
| 83 | |||
| 84 | .wy-nav-content a { | ||
| 85 | text-decoration: underline; | ||
| 86 | color: #444; | ||
| 87 | background: transparent; | ||
| 88 | } | ||
| 89 | |||
| 90 | .wy-nav-content a:hover { | ||
| 91 | text-decoration: underline; | ||
| 92 | background-color: #dedede; | ||
| 93 | } | ||
| 94 | |||
| 95 | .wy-nav-content a:visited { | ||
| 96 | color: #444; | ||
| 97 | } | ||
| 98 | |||
| 99 | [alt='Permalink'] { color: #eee; } | ||
| 100 | [alt='Permalink']:hover { color: black; } | ||
| 101 | |||
| 102 | @media screen { | ||
| 103 | /* content column | ||
| 104 | * | ||
| 105 | * RTD theme's default is 800px as max width for the content, but we have | ||
| 106 | * tables with tons of columns, which need the full width of the view-port. | ||
| 107 | */ | ||
| 108 | |||
| 109 | .wy-nav-content{max-width: none; } | ||
| 110 | |||
| 111 | /* inline literal: drop the borderbox, padding and red color */ | ||
| 112 | code, .rst-content tt, .rst-content code { | ||
| 113 | color: inherit; | ||
| 114 | border: none; | ||
| 115 | padding: unset; | ||
| 116 | background: inherit; | ||
| 117 | font-size: 85%; | ||
| 118 | } | ||
| 119 | |||
| 120 | .rst-content tt.literal,.rst-content tt.literal,.rst-content code.literal { | ||
| 121 | color: inherit; | ||
| 122 | } | ||
| 123 | |||
| 124 | /* Admonition should be gray, not blue or green */ | ||
| 125 | .rst-content .note .admonition-title, | ||
| 126 | .rst-content .tip .admonition-title, | ||
| 127 | .rst-content .warning .admonition-title, | ||
| 128 | .rst-content .caution .admonition-title, | ||
| 129 | .rst-content .important .admonition-title { | ||
| 130 | background: #f0f0f2; | ||
| 131 | color: #00557D; | ||
| 132 | |||
| 133 | } | ||
| 134 | |||
| 135 | .rst-content .note, | ||
| 136 | .rst-content .tip, | ||
| 137 | .rst-content .important, | ||
| 138 | .rst-content .warning, | ||
| 139 | .rst-content .caution { | ||
| 140 | background: #f0f0f2; | ||
| 141 | } | ||
| 142 | |||
| 143 | /* Remove the icon in front of note/tip element, and before the logo */ | ||
| 144 | .icon-home:before, .rst-content .admonition-title:before { | ||
| 145 | display: none | ||
| 146 | } | ||
| 147 | |||
| 148 | /* a custom informalexample container is used in some doc */ | ||
| 149 | .informalexample { | ||
| 150 | border: 1px solid; | ||
| 151 | border-color: #aaa; | ||
| 152 | margin: 1em 0em; | ||
| 153 | padding: 1em; | ||
| 154 | page-break-inside: avoid; | ||
| 155 | } | ||
| 156 | |||
| 157 | /* Remove the blue background in the top left corner, around the logo */ | ||
| 158 | .wy-side-nav-search { | ||
| 159 | background: inherit; | ||
| 160 | } | ||
| 161 | |||
| 162 | } | ||
diff --git a/bitbake/doc/template/Vera.ttf b/bitbake/doc/template/Vera.ttf deleted file mode 100644 index 58cd6b5e61..0000000000 --- a/bitbake/doc/template/Vera.ttf +++ /dev/null | |||
| Binary files differ | |||
diff --git a/bitbake/doc/template/VeraMoBd.ttf b/bitbake/doc/template/VeraMoBd.ttf deleted file mode 100644 index 9be6547ed6..0000000000 --- a/bitbake/doc/template/VeraMoBd.ttf +++ /dev/null | |||
| Binary files differ | |||
diff --git a/bitbake/doc/template/VeraMono.ttf b/bitbake/doc/template/VeraMono.ttf deleted file mode 100644 index 139f0b4311..0000000000 --- a/bitbake/doc/template/VeraMono.ttf +++ /dev/null | |||
| Binary files differ | |||
diff --git a/bitbake/doc/template/draft.png b/bitbake/doc/template/draft.png deleted file mode 100644 index 53051a9ddd..0000000000 --- a/bitbake/doc/template/draft.png +++ /dev/null | |||
| Binary files differ | |||
