ref-bitbake-runtask.html 4.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  4. <title>6.5. Running a Task</title>
  5. <link rel="stylesheet" type="text/css" href="../book.css">
  6. <meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
  7. <link rel="home" href="index.html" title="The Yocto Project Reference Manual">
  8. <link rel="up" href="ref-bitbake.html" title="Chapter 6. BitBake">
  9. <link rel="prev" href="ref-bitbake-tasklist.html" title="6.4. The Task List">
  10. <link rel="next" href="ref-bitbake-commandline.html" title="6.6. BitBake Command Line">
  11. </head>
  12. <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="section" title="6.5. Running a Task">
  13. <div class="titlepage"><div><div><h2 class="title" style="clear: both">
  14. <a name="ref-bitbake-runtask"></a>6.5. Running a Task</h2></div></div></div>
  15. <p>
  16. Tasks can either be a shell task or a Python task.
  17. For shell tasks, BitBake writes a shell script to
  18. <code class="filename">${WORKDIR}/temp/run.do_taskname.pid</code> and then executes the script.
  19. The generated shell script contains all the exported variables, and the shell functions
  20. with all variables expanded.
  21. Output from the shell script goes to the file <code class="filename">${WORKDIR}/temp/log.do_taskname.pid</code>.
  22. Looking at the expanded shell functions in the run file and the output in the log files
  23. is a useful debugging technique.
  24. </p>
  25. <p>
  26. For Python tasks, BitBake executes the task internally and logs information to the
  27. controlling terminal.
  28. Future versions of BitBake will write the functions to files similar to the way
  29. shell tasks are handled.
  30. Logging will be handled in way similar to shell tasks as well.
  31. </p>
  32. <p>
  33. Once all the tasks have been completed BitBake exits.
  34. </p>
  35. <p>
  36. When running a task, BitBake tightly controls the execution environment
  37. of the build tasks to make sure unwanted contamination from the build machine
  38. cannot influence the build.
  39. Consequently, if you do want something to get passed into the build
  40. task's environment, you must take a few steps:
  41. </p>
  42. <div class="orderedlist"><ol class="orderedlist" type="1">
  43. <li class="listitem">
  44. <p>Tell BitBake to load what you want from the environment
  45. into the data store.
  46. You can do so through the <code class="filename">BB_ENV_EXTRAWHITE</code>
  47. variable.
  48. For example, assume you want to prevent the build system from
  49. accessing your <code class="filename">$HOME/.ccache</code> directory.
  50. The following command tells BitBake to load
  51. <code class="filename">CCACHE_DIR</code> from the environment into the data
  52. store:
  53. </p>
  54. <pre class="literallayout">
  55. export BB_ENV_EXTRAWHITE="$BB_ENV_EXTRAWHITE CCACHE_DIR"
  56. </pre>
  57. </li>
  58. <li class="listitem">
  59. <p>Tell BitBake to export what you have loaded into the
  60. environment store to the task environment of every running task.
  61. Loading something from the environment into the data store
  62. (previous step) only makes it available in the datastore.
  63. To export it to the task environment of every running task,
  64. use a command similar to the following in your
  65. <code class="filename">local.conf</code> or distro configuration file:
  66. </p>
  67. <pre class="literallayout">
  68. export CCACHE_DIR
  69. </pre>
  70. </li>
  71. </ol></div>
  72. <p>
  73. </p>
  74. <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
  75. <h3 class="title">Note</h3>
  76. A side effect of the previous steps is that BitBake records the variable
  77. as a dependency of the build process in things like the shared state
  78. checksums.
  79. If doing so results in unnecessary rebuilds of tasks, you can whitelist the
  80. variable so that the shared state code ignores the dependency when it creates
  81. checksums.
  82. For information on this process, see the <code class="filename">BB_HASHBASE_WHITELIST</code>
  83. example in the "<a class="link" href="checksums.html" title="3.2.2. Checksums (Signatures)">Checksums (Signatures)</a>" section.
  84. </div>
  85. </div></body>
  86. </html>