ref-tasks.xml 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146
  1. <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
  2. "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
  3. [<!ENTITY % poky SYSTEM "../poky.ent"> %poky; ] >
  4. <chapter id='ref-tasks'>
  5. <title>Tasks</title>
  6. <para>
  7. Tasks are units of execution for BitBake.
  8. Recipes (<filename>.bb</filename> files) use tasks to complete
  9. configuring, compiling, and packaging software.
  10. This chapter provides a reference of the tasks defined in the
  11. OpenEmbedded build system.
  12. </para>
  13. <section id='normal-recipe-build-tasks'>
  14. <title>Normal Recipe Build Tasks</title>
  15. <para>
  16. The following sections describe normal tasks associated with building
  17. a recipe.
  18. For more information on tasks and dependencies, see the
  19. "<ulink url='&YOCTO_DOCS_BB_URL;#tasks'>Tasks</ulink>" and
  20. "<ulink url='&YOCTO_DOCS_BB_URL;#dependencies'>Dependencies</ulink>"
  21. sections in the BitBake User Manual.
  22. </para>
  23. <section id='ref-tasks-build'>
  24. <title><filename>do_build</filename></title>
  25. <para>
  26. The default task for all recipes.
  27. This task depends on all other normal tasks
  28. required to build a recipe.
  29. </para>
  30. </section>
  31. <section id='ref-tasks-compile'>
  32. <title><filename>do_compile</filename></title>
  33. <para>
  34. Compiles the source code.
  35. This task runs with the current working directory set
  36. to
  37. <filename>${</filename><link linkend='var-B'><filename>B</filename></link><filename>}</filename>.
  38. </para>
  39. <para>
  40. The default behavior of this task is to run the
  41. <filename>oe_runmake</filename> function if a makefile
  42. (<filename>Makefile</filename>, <filename>makefile</filename>,
  43. or <filename>GNUmakefile</filename>) is found.
  44. If no such file is found, the <filename>do_compile</filename>
  45. task does nothing.
  46. </para>
  47. </section>
  48. <section id='ref-tasks-compile_ptest_base'>
  49. <title><filename>do_compile_ptest_base</filename></title>
  50. <para>
  51. Compiles the runtime test suite included in the software being
  52. built.
  53. </para>
  54. </section>
  55. <section id='ref-tasks-configure'>
  56. <title><filename>do_configure</filename></title>
  57. <para>
  58. Configures the source by enabling and disabling any build-time and
  59. configuration options for the software being built.
  60. The task runs with the current working directory set to
  61. <filename>${</filename><link linkend='var-B'><filename>B</filename></link><filename>}</filename>.
  62. </para>
  63. <para>
  64. The default behavior of this task is to run
  65. <filename>oe_runmake clean</filename> if a makefile
  66. (<filename>Makefile</filename>, <filename>makefile</filename>,
  67. or <filename>GNUmakefile</filename>) is found and
  68. <link linkend='var-CLEANBROKEN'><filename>CLEANBROKEN</filename></link>
  69. is not set to "1".
  70. If no such file is found or the <filename>CLEANBROKEN</filename>
  71. variable is set to "1", the <filename>do_configure</filename>
  72. task does nothing.
  73. </para>
  74. </section>
  75. <section id='ref-tasks-configure_ptest_base'>
  76. <title><filename>do_configure_ptest_base</filename></title>
  77. <para>
  78. Configures the runtime test suite included in the software being
  79. built.
  80. </para>
  81. </section>
  82. <section id='ref-tasks-deploy'>
  83. <title><filename>do_deploy</filename></title>
  84. <para>
  85. Writes output files that are to be deployed to
  86. <filename>${</filename><link linkend='var-DEPLOY_DIR_IMAGE'><filename>DEPLOY_DIR_IMAGE</filename></link><filename>}</filename>.
  87. The task runs with the current working directory set to
  88. <filename>${</filename><link linkend='var-B'><filename>B</filename></link><filename>}</filename>.
  89. </para>
  90. <para>
  91. Recipes implementing this task should inherit the
  92. <link linkend='ref-classes-deploy'><filename>deploy</filename></link>
  93. class and should write the output to
  94. <filename>${</filename><link linkend='var-DEPLOYDIR'><filename>DEPLOYDIR</filename></link><filename>}</filename>,
  95. which is not to be confused with <filename>${DEPLOY_DIR}</filename>.
  96. The <filename>deploy</filename> class sets up
  97. <filename>do_deploy</filename> as a shared state (sstate) task that
  98. can be accelerated through sstate use.
  99. The sstate mechanism takes care of copying the output from
  100. <filename>${DEPLOYDIR}</filename> to
  101. <filename>${DEPLOY_DIR_IMAGE}</filename>.
  102. <note>
  103. <title>Caution</title>
  104. Do not write the output directly to
  105. <filename>${DEPLOY_DIR_IMAGE}</filename>, as this causes
  106. the sstate mechanism to malfunction.
  107. </note>
  108. </para>
  109. <para>
  110. The <filename>do_deploy</filename> task is not added as a task
  111. by default and consequently needs to be added manually.
  112. If you want the task to run after
  113. <link linkend='ref-tasks-compile'><filename>do_compile</filename></link>,
  114. you can add it by doing the following:
  115. <literallayout class='monospaced'>
  116. addtask deploy after do_compile
  117. </literallayout>
  118. Adding <filename>do_deploy</filename> after other tasks works the
  119. same way.
  120. <note>
  121. You do not need to add <filename>before do_build</filename>
  122. to the <filename>addtask</filename> command (though it is
  123. harmless), because the
  124. <link linkend='ref-classes-base'><filename>base</filename></link>
  125. class contains the following:
  126. <literallayout class='monospaced'>
  127. do_build[recrdeptask] += "do_deploy"
  128. </literallayout>
  129. See the
  130. "<ulink url='&YOCTO_DOCS_BB_URL;#dependencies'>Dependencies</ulink>"
  131. section in the BitBake User Manual for more information.
  132. </note>
  133. </para>
  134. <para>
  135. If the <filename>do_deploy</filename> task re-executes, any
  136. previous output is removed (i.e. "cleaned").
  137. </para>
  138. </section>
  139. <section id='ref-tasks-distrodata'>
  140. <title><filename>do_distrodata</filename></title>
  141. <para>
  142. Provides information about the recipe.
  143. </para>
  144. <para>
  145. The <filename>distrodata</filename> task is included as part of the
  146. <link linkend='ref-classes-distrodata'><filename>distrodata</filename></link>
  147. class.
  148. </para>
  149. <para>
  150. To build the <filename>distrodata</filename> task, use the
  151. <filename>bitbake</filename> command with the "-c" option and
  152. task name:
  153. <literallayout class='monospaced'>
  154. $ bitbake core-image-minimal -c distrodata
  155. </literallayout>
  156. By default, the results are stored in
  157. <link linkend='var-LOG_DIR'><filename>$LOG_DIR</filename></link>
  158. (e.g. <filename>$BUILD_DIR/tmp/log</filename>).
  159. </para>
  160. </section>
  161. <section id='ref-tasks-fetch'>
  162. <title><filename>do_fetch</filename></title>
  163. <para>
  164. Fetches the source code.
  165. This task uses the
  166. <link linkend='var-SRC_URI'><filename>SRC_URI</filename></link>
  167. variable and the argument's prefix to determine the correct
  168. fetcher module.
  169. </para>
  170. </section>
  171. <section id='ref-tasks-image'>
  172. <title><filename>do_image</filename></title>
  173. <para>
  174. Starts the image generation process.
  175. The <filename>do_image</filename> task runs after the
  176. OpenEmbedded build system has run the
  177. <link linkend='ref-tasks-rootfs'><filename>do_rootfs</filename></link>
  178. task during which packages are identified for installation into
  179. the image and the root filesystem is created, complete with
  180. post-processing.
  181. </para>
  182. <para>
  183. The <filename>do_image</filename> task performs pre-processing
  184. on the image through the
  185. <link linkend='var-IMAGE_PREPROCESS_COMMAND'><filename>IMAGE_PREPROCESS_COMMAND</filename></link>
  186. and dynamically generates supporting
  187. <filename>do_image_*</filename> tasks as needed.
  188. </para>
  189. <para>
  190. For more information on image creation, see the
  191. "<ulink url='&YOCTO_DOCS_OM_URL;#image-generation-dev-environment'>Image Generation</ulink>"
  192. section in the Yocto Project Overview and Concepts Manual.
  193. </para>
  194. </section>
  195. <section id='ref-tasks-image-complete'>
  196. <title><filename>do_image_complete</filename></title>
  197. <para>
  198. Completes the image generation process.
  199. The <filename>do_image_complete</filename> task runs after the
  200. OpenEmbedded build system has run the
  201. <link linkend='ref-tasks-image'><filename>do_image</filename></link>
  202. task during which image pre-processing occurs and through
  203. dynamically generated <filename>do_image_*</filename> tasks the
  204. image is constructed.
  205. </para>
  206. <para>
  207. The <filename>do_image_complete</filename> task performs
  208. post-processing on the image through the
  209. <link linkend='var-IMAGE_POSTPROCESS_COMMAND'><filename>IMAGE_POSTPROCESS_COMMAND</filename></link>.
  210. </para>
  211. <para>
  212. For more information on image creation, see the
  213. "<ulink url='&YOCTO_DOCS_OM_URL;#image-generation-dev-environment'>Image Generation</ulink>"
  214. section in the Yocto Project Overview and Concepts Manual.
  215. </para>
  216. </section>
  217. <section id='ref-tasks-install'>
  218. <title><filename>do_install</filename></title>
  219. <para>
  220. Copies files that are to be packaged into the holding area
  221. <filename>${</filename><link linkend='var-D'><filename>D</filename></link><filename>}</filename>.
  222. This task runs with the current working directory set to
  223. <filename>${</filename><link linkend='var-B'><filename>B</filename></link><filename>}</filename>,
  224. which is the compilation directory.
  225. The <filename>do_install</filename> task, as well as other tasks
  226. that either directly or indirectly depend on the installed files
  227. (e.g.
  228. <link linkend='ref-tasks-package'><filename>do_package</filename></link>,
  229. <link linkend='ref-tasks-package_write_deb'><filename>do_package_write_*</filename></link>,
  230. and
  231. <link linkend='ref-tasks-rootfs'><filename>do_rootfs</filename></link>),
  232. run under
  233. <ulink url='&YOCTO_DOCS_OM_URL;#fakeroot-and-pseudo'>fakeroot</ulink>.
  234. <note>
  235. <title>Caution</title>
  236. <para>
  237. When installing files, be careful not to set the owner and
  238. group IDs of the installed files to unintended values.
  239. Some methods of copying files, notably when using the
  240. recursive <filename>cp</filename> command, can preserve the
  241. UID and/or GID of the original file, which is usually not
  242. what you want.
  243. The
  244. <link linkend='insane-host-user-contaminated'><filename>host-user-contaminated</filename></link>
  245. QA check checks for files that probably have the wrong
  246. ownership.
  247. </para>
  248. <para>
  249. Safe methods for installing files include the following:
  250. <itemizedlist>
  251. <listitem><para>
  252. The <filename>install</filename> utility.
  253. This utility is the preferred method.
  254. </para></listitem>
  255. <listitem><para>
  256. The <filename>cp</filename> command with the
  257. "--no-preserve=ownership" option.
  258. </para></listitem>
  259. <listitem><para>
  260. The <filename>tar</filename> command with the
  261. "--no-same-owner" option.
  262. See the <filename>bin_package.bbclass</filename>
  263. file in the <filename>meta/classes</filename>
  264. directory of the
  265. <link linkend='source-directory'>Source Directory</link>
  266. for an example.
  267. </para></listitem>
  268. </itemizedlist>
  269. </para>
  270. </note>
  271. </para>
  272. </section>
  273. <section id='ref-tasks-install_ptest_base'>
  274. <title><filename>do_install_ptest_base</filename></title>
  275. <para>
  276. Copies the runtime test suite files from the compilation directory
  277. to a holding area.
  278. </para>
  279. </section>
  280. <section id='ref-tasks-package'>
  281. <title><filename>do_package</filename></title>
  282. <para>
  283. Analyzes the content of the holding area
  284. <filename>${</filename><link linkend='var-D'><filename>D</filename></link><filename>}</filename>
  285. and splits the content into subsets based on available packages
  286. and files.
  287. This task makes use of the
  288. <link linkend='var-PACKAGES'><filename>PACKAGES</filename></link>
  289. and
  290. <link linkend='var-FILES'><filename>FILES</filename></link>
  291. variables.
  292. </para>
  293. <para>
  294. The <filename>do_package</filename> task, in conjunction with the
  295. <link linkend='ref-tasks-packagedata'><filename>do_packagedata</filename></link>
  296. task, also saves some important package metadata.
  297. For additional information, see the
  298. <link linkend='var-PKGDESTWORK'><filename>PKGDESTWORK</filename></link>
  299. variable and the
  300. "<ulink url='&YOCTO_DOCS_OM_URL;#automatically-added-runtime-dependencies'>Automatically Added Runtime Dependencies</ulink>"
  301. section in the Yocto Project Overview and Concepts Manual.
  302. </para>
  303. </section>
  304. <section id='ref-tasks-package_qa'>
  305. <title><filename>do_package_qa</filename></title>
  306. <para>
  307. Runs QA checks on packaged files.
  308. For more information on these checks, see the
  309. <link linkend='ref-classes-insane'><filename>insane</filename></link>
  310. class.
  311. </para>
  312. </section>
  313. <section id='ref-tasks-package_write_deb'>
  314. <title><filename>do_package_write_deb</filename></title>
  315. <para>
  316. Creates Debian packages (i.e. <filename>*.deb</filename> files) and
  317. places them in the
  318. <filename>${</filename><link linkend='var-DEPLOY_DIR_DEB'><filename>DEPLOY_DIR_DEB</filename></link><filename>}</filename>
  319. directory in the package feeds area.
  320. For more information, see the
  321. "<ulink url='&YOCTO_DOCS_OM_URL;#package-feeds-dev-environment'>Package Feeds</ulink>"
  322. section in the Yocto Project Overview and Concepts Manual.
  323. </para>
  324. </section>
  325. <section id='ref-tasks-package_write_ipk'>
  326. <title><filename>do_package_write_ipk</filename></title>
  327. <para>
  328. Creates IPK packages (i.e. <filename>*.ipk</filename> files) and
  329. places them in the
  330. <filename>${</filename><link linkend='var-DEPLOY_DIR_IPK'><filename>DEPLOY_DIR_IPK</filename></link><filename>}</filename>
  331. directory in the package feeds area.
  332. For more information, see the
  333. "<ulink url='&YOCTO_DOCS_OM_URL;#package-feeds-dev-environment'>Package Feeds</ulink>"
  334. section in the Yocto Project Overview and Concepts Manual.
  335. </para>
  336. </section>
  337. <section id='ref-tasks-package_write_rpm'>
  338. <title><filename>do_package_write_rpm</filename></title>
  339. <para>
  340. Creates RPM packages (i.e. <filename>*.rpm</filename> files) and
  341. places them in the
  342. <filename>${</filename><link linkend='var-DEPLOY_DIR_RPM'><filename>DEPLOY_DIR_RPM</filename></link><filename>}</filename>
  343. directory in the package feeds area.
  344. For more information, see the
  345. "<ulink url='&YOCTO_DOCS_OM_URL;#package-feeds-dev-environment'>Package Feeds</ulink>"
  346. section in the Yocto Project Overview and Concepts Manual.
  347. </para>
  348. </section>
  349. <section id='ref-tasks-package_write_tar'>
  350. <title><filename>do_package_write_tar</filename></title>
  351. <para>
  352. Creates tarballs and places them in the
  353. <filename>${</filename><link linkend='var-DEPLOY_DIR_TAR'><filename>DEPLOY_DIR_TAR</filename></link><filename>}</filename>
  354. directory in the package feeds area.
  355. For more information, see the
  356. "<ulink url='&YOCTO_DOCS_OM_URL;#package-feeds-dev-environment'>Package Feeds</ulink>"
  357. section in the Yocto Project Overview and Concepts Manual.
  358. </para>
  359. </section>
  360. <section id='ref-tasks-packagedata'>
  361. <title><filename>do_packagedata</filename></title>
  362. <para>
  363. Saves package metadata generated by the
  364. <link linkend='ref-tasks-package'><filename>do_package</filename></link>
  365. task in
  366. <link linkend='var-PKGDATA_DIR'><filename>PKGDATA_DIR</filename></link>
  367. to make it available globally.
  368. </para>
  369. </section>
  370. <section id='ref-tasks-patch'>
  371. <title><filename>do_patch</filename></title>
  372. <para>
  373. Locates patch files and applies them to the source code.
  374. </para>
  375. <para>
  376. After fetching and unpacking source files, the build system
  377. uses the recipe's
  378. <ulink url='&YOCTO_DOCS_REF_URL;#var-SRC_URI'><filename>SRC_URI</filename></ulink>
  379. statements to locate and apply patch files to the source code.
  380. <note>
  381. The build system uses the
  382. <ulink url='&YOCTO_DOCS_REF_URL;#var-FILESPATH'><filename>FILESPATH</filename></ulink>
  383. variable to determine the default set of directories when
  384. searching for patches.
  385. </note>
  386. Patch files, by default, are <filename>*.patch</filename> and
  387. <filename>*.diff</filename> files created and kept in a
  388. subdirectory of the directory holding the recipe file.
  389. For example, consider the
  390. <ulink url='&YOCTO_GIT_URL;/cgit/cgit.cgi/poky/tree/meta/recipes-connectivity/bluez5'><filename>bluez5</filename></ulink>
  391. recipe from the OE-Core layer (i.e.
  392. <filename>poky/meta</filename>):
  393. <literallayout class='monospaced'>
  394. poky/meta/recipes-connectivity/bluez5
  395. </literallayout>
  396. This recipe has two patch files located here:
  397. <literallayout class='monospaced'>
  398. poky/meta/recipes-connectivity/bluez5/bluez5
  399. </literallayout>
  400. </para>
  401. <para>
  402. In the <filename>bluez5</filename> recipe, the
  403. <filename>SRC_URI</filename> statements point to the source and
  404. patch files needed to build the package.
  405. <note>
  406. In the case for the <filename>bluez5_5.48.bb</filename>
  407. recipe, the <filename>SRC_URI</filename> statements are from an
  408. include file <filename>bluez5.inc</filename>.
  409. </note>
  410. </para>
  411. <para>
  412. As mentioned earlier, the build system treats files whose file
  413. types are <filename>.patch</filename> and
  414. <filename>.diff</filename> as patch files.
  415. However, you can use the "apply=yes" parameter with the
  416. <filename>SRC_URI</filename> statement to indicate any file as a
  417. patch file:
  418. <literallayout class='monospaced'>
  419. SRC_URI = " \
  420. git://<replaceable>path_to_repo</replaceable>/<replaceable>some_package</replaceable> \
  421. file://<replaceable>file</replaceable>;apply=yes \
  422. "
  423. </literallayout>
  424. </para>
  425. <para>
  426. Conversely, if you have a directory full of patch files and you
  427. want to exclude some so that the <filename>do_patch</filename>
  428. task does not apply them during the patch phase, you can use
  429. the "apply=no" parameter with the <filename>SRC_URI</filename>
  430. statement:
  431. <literallayout class='monospaced'>
  432. SRC_URI = " \
  433. git://<replaceable>path_to_repo</replaceable>/<replaceable>some_package</replaceable> \
  434. file://<replaceable>path_to_lots_of_patch_files</replaceable> \
  435. file://<replaceable>path_to_lots_of_patch_files</replaceable>/<replaceable>patch_file5</replaceable>;apply=no \
  436. "
  437. </literallayout>
  438. In the previous example, assuming all the files in the directory
  439. holding the patch files end with either <filename>.patch</filename>
  440. or <filename>.diff</filename>, every file would be applied as a
  441. patch by default except for the
  442. <replaceable>patch_file5</replaceable> patch.
  443. </para>
  444. <para>
  445. You can find out more about the patching process in the
  446. "<ulink url='&YOCTO_DOCS_OM_URL;#patching-dev-environment'>Patching</ulink>"
  447. section in the Yocto Project Overview and Concepts Manual and the
  448. "<ulink url='&YOCTO_DOCS_DEV_URL;#new-recipe-patching-code'>Patching Code</ulink>"
  449. section in the Yocto Project Development Tasks Manual.
  450. </para>
  451. </section>
  452. <section id='ref-tasks-populate_lic'>
  453. <title><filename>do_populate_lic</filename></title>
  454. <para>
  455. Writes license information for the recipe that is collected later
  456. when the image is constructed.
  457. </para>
  458. </section>
  459. <section id='ref-tasks-populate_sdk'>
  460. <title><filename>do_populate_sdk</filename></title>
  461. <para>
  462. Creates the file and directory structure for an installable SDK.
  463. See the
  464. "<ulink url='&YOCTO_DOCS_OM_URL;#sdk-generation-dev-environment'>SDK Generation</ulink>"
  465. section in the Yocto Project Overview and Concepts Manual for more
  466. information.
  467. </para>
  468. </section>
  469. <section id='ref-tasks-populate_sysroot'>
  470. <title><filename>do_populate_sysroot</filename></title>
  471. <para>
  472. Stages (copies) a subset of the files installed by the
  473. <link linkend='ref-tasks-install'><filename>do_install</filename></link>
  474. task into the appropriate sysroot.
  475. For information on how to access these files from other recipes,
  476. see the
  477. <link linkend='var-STAGING_DIR_HOST'><filename>STAGING_DIR*</filename></link>
  478. variables.
  479. Directories that would typically not be needed by other recipes at
  480. build time (e.g. <filename>/etc</filename>) are not copied by
  481. default.
  482. </para>
  483. <para>
  484. For information on what directories are copied by default, see the
  485. <link linkend='var-SYSROOT_DIRS'><filename>SYSROOT_DIRS*</filename></link>
  486. variables.
  487. You can change these variables inside your recipe if you need
  488. to make additional (or fewer) directories available to other
  489. recipes at build time.
  490. </para>
  491. <para>
  492. The <filename>do_populate_sysroot</filename> task is a
  493. shared state (sstate) task, which means that the task can
  494. be accelerated through sstate use.
  495. Realize also that if the task is re-executed, any previous output
  496. is removed (i.e. "cleaned").
  497. </para>
  498. </section>
  499. <section id='ref-tasks-prepare_recipe_sysroot'>
  500. <title><filename>do_prepare_recipe_sysroot</filename></title>
  501. <para>
  502. Installs the files into the individual recipe specific sysroots
  503. (i.e. <filename>recipe-sysroot</filename> and
  504. <filename>recipe-sysroot-native</filename> under
  505. <filename>${</filename><link linkend='var-WORKDIR'><filename>WORKDIR</filename></link><filename>}</filename>
  506. based upon the dependencies specified by
  507. <link linkend='var-DEPENDS'><filename>DEPENDS</filename></link>).
  508. See the
  509. "<link linkend='ref-classes-staging'><filename>staging</filename></link>"
  510. class for more information.
  511. </para>
  512. </section>
  513. <section id='ref-tasks-rm_work'>
  514. <title><filename>do_rm_work</filename></title>
  515. <para>
  516. Removes work files after the OpenEmbedded build system has
  517. finished with them.
  518. You can learn more by looking at the
  519. "<link linkend='ref-classes-rm-work'><filename>rm_work.bbclass</filename></link>"
  520. section.
  521. </para>
  522. </section>
  523. <section id='ref-tasks-unpack'>
  524. <title><filename>do_unpack</filename></title>
  525. <para>
  526. Unpacks the source code into a working directory pointed to
  527. by
  528. <filename>${</filename><link linkend='var-WORKDIR'><filename>WORKDIR</filename></link><filename>}</filename>.
  529. The
  530. <link linkend='var-S'><filename>S</filename></link> variable also
  531. plays a role in where unpacked source files ultimately reside.
  532. For more information on how source files are unpacked, see the
  533. "<ulink url='&YOCTO_DOCS_OM_URL;#source-fetching-dev-environment'>Source Fetching</ulink>"
  534. section in the Yocto Project Overview and Concepts Manual and also
  535. see the <filename>WORKDIR</filename> and
  536. <filename>S</filename> variable descriptions.
  537. </para>
  538. </section>
  539. </section>
  540. <section id='manually-called-tasks'>
  541. <title>Manually Called Tasks</title>
  542. <para>
  543. These tasks are typically manually triggered (e.g. by using the
  544. <filename>bitbake -c</filename> command-line option):
  545. </para>
  546. <section id='ref-tasks-checkpkg'>
  547. <title><filename>do_checkpkg</filename></title>
  548. <para>
  549. Provides information about the recipe including its upstream
  550. version and status.
  551. The upstream version and status reveals whether or not a version
  552. of the recipe exists upstream and a status of not updated, updated,
  553. or unknown.
  554. </para>
  555. <para>
  556. The <filename>checkpkg</filename> task is included as part of the
  557. <link linkend='ref-classes-distrodata'><filename>distrodata</filename></link>
  558. class.
  559. </para>
  560. <para>
  561. To build the <filename>checkpkg</filename> task, use the
  562. <filename>bitbake</filename> command with the "-c" option and
  563. task name:
  564. <literallayout class='monospaced'>
  565. $ bitbake core-image-minimal -c checkpkg
  566. </literallayout>
  567. By default, the results are stored in
  568. <link linkend='var-LOG_DIR'><filename>$LOG_DIR</filename></link>
  569. (e.g. <filename>$BUILD_DIR/tmp/log</filename>).
  570. </para>
  571. </section>
  572. <section id='ref-tasks-checkuri'>
  573. <title><filename>do_checkuri</filename></title>
  574. <para>
  575. Validates the
  576. <link linkend='var-SRC_URI'><filename>SRC_URI</filename></link>
  577. value.
  578. </para>
  579. </section>
  580. <section id='ref-tasks-clean'>
  581. <title><filename>do_clean</filename></title>
  582. <para>
  583. Removes all output files for a target from the
  584. <link linkend='ref-tasks-unpack'><filename>do_unpack</filename></link>
  585. task forward (i.e. <filename>do_unpack</filename>,
  586. <link linkend='ref-tasks-configure'><filename>do_configure</filename></link>,
  587. <link linkend='ref-tasks-compile'><filename>do_compile</filename></link>,
  588. <link linkend='ref-tasks-install'><filename>do_install</filename></link>,
  589. and
  590. <link linkend='ref-tasks-package'><filename>do_package</filename></link>).
  591. </para>
  592. <para>
  593. You can run this task using BitBake as follows:
  594. <literallayout class='monospaced'>
  595. $ bitbake -c clean <replaceable>recipe</replaceable>
  596. </literallayout>
  597. </para>
  598. <para>
  599. Running this task does not remove the
  600. <ulink url='&YOCTO_DOCS_OM_URL;#shared-state-cache'>sstate</ulink>
  601. cache files.
  602. Consequently, if no changes have been made and the recipe is
  603. rebuilt after cleaning, output files are simply restored from the
  604. sstate cache.
  605. If you want to remove the sstate cache files for the recipe,
  606. you need to use the
  607. <link linkend='ref-tasks-cleansstate'><filename>do_cleansstate</filename></link>
  608. task instead (i.e. <filename>bitbake -c cleansstate</filename> <replaceable>recipe</replaceable>).
  609. </para>
  610. </section>
  611. <section id='ref-tasks-cleanall'>
  612. <title><filename>do_cleanall</filename></title>
  613. <para>
  614. Removes all output files, shared state
  615. (<ulink url='&YOCTO_DOCS_OM_URL;#shared-state-cache'>sstate</ulink>)
  616. cache, and downloaded source files for a target (i.e. the contents
  617. of
  618. <link linkend='var-DL_DIR'><filename>DL_DIR</filename></link>).
  619. Essentially, the <filename>do_cleanall</filename> task is
  620. identical to the
  621. <link linkend='ref-tasks-cleansstate'><filename>do_cleansstate</filename></link>
  622. task with the added removal of downloaded source files.
  623. </para>
  624. <para>
  625. You can run this task using BitBake as follows:
  626. <literallayout class='monospaced'>
  627. $ bitbake -c cleanall <replaceable>recipe</replaceable>
  628. </literallayout>
  629. </para>
  630. <para>
  631. Typically, you would not normally use the
  632. <filename>cleanall</filename> task.
  633. Do so only if you want to start fresh with the
  634. <link linkend='ref-tasks-fetch'><filename>do_fetch</filename></link>
  635. task.
  636. </para>
  637. </section>
  638. <section id='ref-tasks-cleansstate'>
  639. <title><filename>do_cleansstate</filename></title>
  640. <para>
  641. Removes all output files and shared state
  642. (<ulink url='&YOCTO_DOCS_OM_URL;#shared-state-cache'>sstate</ulink>)
  643. cache for a target.
  644. Essentially, the <filename>do_cleansstate</filename> task is
  645. identical to the
  646. <link linkend='ref-tasks-clean'><filename>do_clean</filename></link>
  647. task with the added removal of shared state
  648. (<ulink url='&YOCTO_DOCS_OM_URL;#shared-state-cache'>sstate</ulink>)
  649. cache.
  650. </para>
  651. <para>
  652. You can run this task using BitBake as follows:
  653. <literallayout class='monospaced'>
  654. $ bitbake -c cleansstate <replaceable>recipe</replaceable>
  655. </literallayout>
  656. </para>
  657. <para>
  658. When you run the <filename>do_cleansstate</filename> task,
  659. the OpenEmbedded build system no longer uses any
  660. sstate.
  661. Consequently, building the recipe from scratch is guaranteed.
  662. <note>
  663. The <filename>do_cleansstate</filename> task cannot remove
  664. sstate from a remote sstate mirror.
  665. If you need to build a target from scratch using remote
  666. mirrors, use the "-f" option as follows:
  667. <literallayout class='monospaced'>
  668. $ bitbake -f -c do_cleansstate <replaceable>target</replaceable>
  669. </literallayout>
  670. </note>
  671. </para>
  672. </section>
  673. <section id='ref-tasks-devpyshell'>
  674. <title><filename>do_devpyshell</filename></title>
  675. <para>
  676. Starts a shell in which an interactive Python interpreter allows
  677. you to interact with the BitBake build environment.
  678. From within this shell, you can directly examine and set
  679. bits from the data store and execute functions as if within
  680. the BitBake environment.
  681. See the
  682. "<ulink url='&YOCTO_DOCS_DEV_URL;#platdev-appdev-devpyshell'>Using a Development Python Shell</ulink>"
  683. section in the Yocto Project Development Tasks Manual for more
  684. information about using <filename>devpyshell</filename>.
  685. </para>
  686. </section>
  687. <section id='ref-tasks-devshell'>
  688. <title><filename>do_devshell</filename></title>
  689. <para>
  690. Starts a shell whose environment is set up for
  691. development, debugging, or both.
  692. See the
  693. "<ulink url='&YOCTO_DOCS_DEV_URL;#platdev-appdev-devshell'>Using a Development Shell</ulink>"
  694. section in the Yocto Project Development Tasks Manual for more
  695. information about using <filename>devshell</filename>.
  696. </para>
  697. </section>
  698. <section id='ref-tasks-listtasks'>
  699. <title><filename>do_listtasks</filename></title>
  700. <para>
  701. Lists all defined tasks for a target.
  702. </para>
  703. </section>
  704. <section id='ref-tasks-package_index'>
  705. <title><filename>do_package_index</filename></title>
  706. <para>
  707. Creates or updates the index in the
  708. <ulink url='&YOCTO_DOCS_OM_URL;#package-feeds-dev-environment'>Package Feeds</ulink>
  709. area.
  710. <note>
  711. This task is not triggered with the
  712. <filename>bitbake -c</filename> command-line option as
  713. are the other tasks in this section.
  714. Because this task is specifically for the
  715. <filename>package-index</filename> recipe,
  716. you run it using
  717. <filename>bitbake package-index</filename>.
  718. </note>
  719. </para>
  720. </section>
  721. </section>
  722. <section id='image-related-tasks'>
  723. <title>Image-Related Tasks</title>
  724. <para>
  725. The following tasks are applicable to image recipes.
  726. </para>
  727. <section id='ref-tasks-bootimg'>
  728. <title><filename>do_bootimg</filename></title>
  729. <para>
  730. Creates a bootable live image.
  731. See the
  732. <link linkend='var-IMAGE_FSTYPES'><filename>IMAGE_FSTYPES</filename></link>
  733. variable for additional information on live image types.
  734. </para>
  735. </section>
  736. <section id='ref-tasks-bundle_initramfs'>
  737. <title><filename>do_bundle_initramfs</filename></title>
  738. <para>
  739. Combines an initial RAM disk (initramfs) image and kernel
  740. together to form a single image.
  741. The
  742. <link linkend='var-CONFIG_INITRAMFS_SOURCE'><filename>CONFIG_INITRAMFS_SOURCE</filename></link>
  743. variable has some more information about these types of images.
  744. </para>
  745. </section>
  746. <section id='ref-tasks-rootfs'>
  747. <title><filename>do_rootfs</filename></title>
  748. <para>
  749. Creates the root filesystem (file and directory structure) for an
  750. image.
  751. See the
  752. "<ulink url='&YOCTO_DOCS_OM_URL;#image-generation-dev-environment'>Image Generation</ulink>"
  753. section in the Yocto Project Overview and Concepts Manual for more
  754. information on how the root filesystem is created.
  755. </para>
  756. </section>
  757. <section id='ref-tasks-testimage'>
  758. <title><filename>do_testimage</filename></title>
  759. <para>
  760. Boots an image and performs runtime tests within the image.
  761. For information on automatically testing images, see the
  762. "<ulink url='&YOCTO_DOCS_DEV_URL;#performing-automated-runtime-testing'>Performing Automated Runtime Testing</ulink>"
  763. section in the Yocto Project Development Tasks Manual.
  764. </para>
  765. </section>
  766. <section id='ref-tasks-testimage_auto'>
  767. <title><filename>do_testimage_auto</filename></title>
  768. <para>
  769. Boots an image and performs runtime tests within the image
  770. immediately after it has been built.
  771. This task is enabled when you set
  772. <link linkend='var-TESTIMAGE_AUTO'><filename>TESTIMAGE_AUTO</filename></link>
  773. equal to "1".
  774. </para>
  775. <para>
  776. For information on automatically testing images, see the
  777. "<ulink url='&YOCTO_DOCS_DEV_URL;#performing-automated-runtime-testing'>Performing Automated Runtime Testing</ulink>"
  778. section in the Yocto Project Development Tasks Manual.
  779. </para>
  780. </section>
  781. </section>
  782. <section id='kernel-related-tasks'>
  783. <title>Kernel-Related Tasks</title>
  784. <para>
  785. The following tasks are applicable to kernel recipes.
  786. Some of these tasks (e.g. the
  787. <link linkend='ref-tasks-menuconfig'><filename>do_menuconfig</filename></link>
  788. task) are also applicable to recipes that use
  789. Linux kernel style configuration such as the BusyBox recipe.
  790. </para>
  791. <section id='ref-tasks-compile_kernelmodules'>
  792. <title><filename>do_compile_kernelmodules</filename></title>
  793. <para>
  794. Runs the step that builds the kernel modules (if needed).
  795. Building a kernel consists of two steps: 1) the kernel
  796. (<filename>vmlinux</filename>) is built, and 2) the modules
  797. are built (i.e. <filename>make modules</filename>).
  798. </para>
  799. </section>
  800. <section id='ref-tasks-diffconfig'>
  801. <title><filename>do_diffconfig</filename></title>
  802. <para>
  803. When invoked by the user, this task creates a file containing the
  804. differences between the original config as produced by
  805. <link linkend='ref-tasks-kernel_configme'><filename>do_kernel_configme</filename></link>
  806. task and the changes made by the user with other methods
  807. (i.e. using
  808. (<link linkend='ref-tasks-kernel_menuconfig'><filename>do_kernel_menuconfig</filename></link>).
  809. Once the file of differences is created, it can be used to create
  810. a config fragment that only contains the differences.
  811. You can invoke this task from the command line as follows:
  812. <literallayout class='monospaced'>
  813. $ bitbake linux-yocto -c diffconfig
  814. </literallayout>
  815. For more information, see the
  816. "<ulink url='&YOCTO_DOCS_KERNEL_DEV_URL;#creating-config-fragments'>Creating Configuration Fragments</ulink>"
  817. section in the Yocto Project Linux Kernel Development Manual.
  818. </para>
  819. </section>
  820. <section id='ref-tasks-kernel_checkout'>
  821. <title><filename>do_kernel_checkout</filename></title>
  822. <para>
  823. Converts the newly unpacked kernel source into a form with which
  824. the OpenEmbedded build system can work.
  825. Because the kernel source can be fetched in several different ways,
  826. the <filename>do_kernel_checkout</filename> task makes sure that
  827. subsequent tasks are given a clean working tree copy of the kernel
  828. with the correct branches checked out.
  829. </para>
  830. </section>
  831. <section id='ref-tasks-kernel_configcheck'>
  832. <title><filename>do_kernel_configcheck</filename></title>
  833. <para>
  834. Validates the configuration produced by the
  835. <link linkend='ref-tasks-kernel_menuconfig'><filename>do_kernel_menuconfig</filename></link>
  836. task.
  837. The <filename>do_kernel_configcheck</filename> task produces
  838. warnings when a requested configuration does not appear in the
  839. final <filename>.config</filename> file or when you override a
  840. policy configuration in a hardware configuration fragment.
  841. You can run this task explicitly and view the output by using
  842. the following command:
  843. <literallayout class='monospaced'>
  844. $ bitbake linux-yocto -c kernel_configcheck -f
  845. </literallayout>
  846. For more information, see the
  847. "<ulink url='&YOCTO_DOCS_KERNEL_DEV_URL;#validating-configuration'>Validating Configuration</ulink>"
  848. section in the Yocto Project Linux Kernel Development Manual.
  849. </para>
  850. </section>
  851. <section id='ref-tasks-kernel_configme'>
  852. <title><filename>do_kernel_configme</filename></title>
  853. <para>
  854. After the kernel is patched by the
  855. <link linkend='ref-tasks-patch'><filename>do_patch</filename></link>
  856. task, the <filename>do_kernel_configme</filename> task assembles
  857. and merges all the kernel config fragments into a merged
  858. configuration that can then be passed to the kernel configuration
  859. phase proper.
  860. This is also the time during which user-specified defconfigs
  861. are applied if present, and where configuration modes such as
  862. <filename>--allnoconfig</filename> are applied.
  863. </para>
  864. </section>
  865. <section id='ref-tasks-kernel_menuconfig'>
  866. <title><filename>do_kernel_menuconfig</filename></title>
  867. <para>
  868. Invoked by the user to manipulate the
  869. <filename>.config</filename> file used to build a linux-yocto
  870. recipe.
  871. This task starts the Linux kernel configuration tool, which you
  872. then use to modify the kernel configuration.
  873. <note>
  874. You can also invoke this tool from the command line as
  875. follows:
  876. <literallayout class='monospaced'>
  877. $ bitbake linux-yocto -c menuconfig
  878. </literallayout>
  879. </note>
  880. See the
  881. "<ulink url='&YOCTO_DOCS_KERNEL_DEV_URL;#using-menuconfig'>Using <filename>menuconfig</filename></ulink>"
  882. section in the Yocto Project Linux Kernel Development Manual
  883. for more information on this configuration tool.
  884. </para>
  885. </section>
  886. <section id='ref-tasks-kernel_metadata'>
  887. <title><filename>do_kernel_metadata</filename></title>
  888. <para>
  889. Collects all the features required for a given kernel build,
  890. whether the features come from
  891. <link linkend='var-SRC_URI'><filename>SRC_URI</filename></link>
  892. or from Git repositories.
  893. After collection, the <filename>do_kernel_metadata</filename> task
  894. processes the features into a series of config fragments and
  895. patches, which can then be applied by subsequent tasks such as
  896. <link linkend='ref-tasks-patch'><filename>do_patch</filename></link>
  897. and
  898. <link linkend='ref-tasks-kernel_configme'><filename>do_kernel_configme</filename></link>.
  899. </para>
  900. </section>
  901. <section id='ref-tasks-menuconfig'>
  902. <title><filename>do_menuconfig</filename></title>
  903. <para>
  904. Runs <filename>make menuconfig</filename> for the kernel.
  905. For information on <filename>menuconfig</filename>, see the
  906. "<ulink url='&YOCTO_DOCS_KERNEL_DEV_URL;#using-menuconfig'>Using&nbsp;&nbsp;<filename>menuconfig</filename></ulink>"
  907. section in the Yocto Project Linux Kernel Development Manual.
  908. </para>
  909. </section>
  910. <section id='ref-tasks-savedefconfig'>
  911. <title><filename>do_savedefconfig</filename></title>
  912. <para>
  913. When invoked by the user, creates a defconfig file that can be
  914. used instead of the default defconfig.
  915. The saved defconfig contains the differences between the default
  916. defconfig and the changes made by the user using other methods
  917. (i.e. the
  918. <link linkend='ref-tasks-kernel_menuconfig'><filename>do_kernel_menuconfig</filename></link>
  919. task.
  920. You can invoke the task using the following command:
  921. <literallayout class='monospaced'>
  922. $ bitbake linux-yocto -c savedefconfig
  923. </literallayout>
  924. </para>
  925. </section>
  926. <section id='ref-tasks-shared_workdir'>
  927. <title><filename>do_shared_workdir</filename></title>
  928. <para>
  929. After the kernel has been compiled but before the kernel modules
  930. have been compiled, this task copies files required for module
  931. builds and which are generated from the kernel build into the
  932. shared work directory.
  933. With these copies successfully copied, the
  934. <link linkend='ref-tasks-compile_kernelmodules'><filename>do_compile_kernelmodules</filename></link>
  935. task can successfully build the kernel modules in the next step
  936. of the build.
  937. </para>
  938. </section>
  939. <section id='ref-tasks-sizecheck'>
  940. <title><filename>do_sizecheck</filename></title>
  941. <para>
  942. After the kernel has been built, this task checks the size of the
  943. stripped kernel image against
  944. <link linkend='var-KERNEL_IMAGE_MAXSIZE'><filename>KERNEL_IMAGE_MAXSIZE</filename></link>.
  945. If that variable was set and the size of the stripped kernel
  946. exceeds that size, the kernel build produces a warning to that
  947. effect.
  948. </para>
  949. </section>
  950. <section id='ref-tasks-strip'>
  951. <title><filename>do_strip</filename></title>
  952. <para>
  953. If
  954. <filename>KERNEL_IMAGE_STRIP_EXTRA_SECTIONS</filename> is defined,
  955. this task strips the sections named in that variable from
  956. <filename>vmlinux</filename>.
  957. This stripping is typically used to remove nonessential sections
  958. such as <filename>.comment</filename> sections from a
  959. size-sensitive configuration.
  960. </para>
  961. </section>
  962. <section id='ref-tasks-validate_branches'>
  963. <title><filename>do_validate_branches</filename></title>
  964. <para>
  965. After the kernel is unpacked but before it is patched, this task
  966. makes sure that the machine and metadata branches as specified
  967. by the <link linkend='var-SRCREV'><filename>SRCREV</filename></link>
  968. variables actually exist on the specified branches.
  969. If these branches do not exist and
  970. <link linkend='var-AUTOREV'><filename>AUTOREV</filename></link>
  971. is not being used, the <filename>do_validate_branches</filename>
  972. task fails during the build.
  973. </para>
  974. </section>
  975. </section>
  976. <section id='miscellaneous-tasks'>
  977. <title>Miscellaneous Tasks</title>
  978. <para>
  979. The following sections describe miscellaneous tasks.
  980. </para>
  981. <section id='ref-tasks-spdx'>
  982. <title><filename>do_spdx</filename></title>
  983. <para>
  984. A build stage that takes the source code and scans it on a remote
  985. FOSSOLOGY server in order to produce an SPDX document.
  986. This task applies only to the
  987. <link linkend='ref-classes-spdx'><filename>spdx</filename></link>
  988. class.
  989. </para>
  990. </section>
  991. </section>
  992. </chapter>
  993. <!--
  994. vim: expandtab tw=80 ts=4
  995. -->