appendix-customizing.rst 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. .. SPDX-License-Identifier: CC-BY-SA-2.0-UK
  2. ***************************************************
  3. Customizing the Extensible SDK standalone installer
  4. ***************************************************
  5. This appendix describes customizations you can apply to the extensible
  6. SDK when using in the standalone installer version.
  7. .. note::
  8. It is also possible to use the Extensible SDK functionality directly in a
  9. Yocto build, avoiding separate installer artefacts. Please refer to
  10. ":ref:`sdk-manual/extensible:Installing the Extensible SDK`"
  11. Configuring the Extensible SDK
  12. ==============================
  13. The extensible SDK primarily consists of a pre-configured copy of the
  14. OpenEmbedded build system from which it was produced. Thus, the SDK's
  15. configuration is derived using that build system and the filters shown
  16. in the following list. When these filters are present, the OpenEmbedded
  17. build system applies them against ``local.conf`` and ``auto.conf``:
  18. - Variables whose values start with "/" are excluded since the
  19. assumption is that those values are paths that are likely to be
  20. specific to the :term:`Build Host`.
  21. - Variables listed in
  22. :term:`ESDK_LOCALCONF_REMOVE`
  23. are excluded. These variables are not allowed through from the
  24. OpenEmbedded build system configuration into the extensible SDK
  25. configuration. Typically, these variables are specific to the machine
  26. on which the build system is running and could be problematic as part
  27. of the extensible SDK configuration.
  28. For a list of the variables excluded by default, see the
  29. :term:`ESDK_LOCALCONF_REMOVE`
  30. in the glossary of the Yocto Project Reference Manual.
  31. - Variables listed in
  32. :term:`ESDK_LOCALCONF_ALLOW`
  33. are included. Including a variable in the value of
  34. :term:`ESDK_LOCALCONF_ALLOW` overrides either of the previous two
  35. filters. The default value is blank.
  36. - Classes inherited globally with
  37. :term:`INHERIT` that are listed in
  38. :term:`ESDK_CLASS_INHERIT_DISABLE`
  39. are disabled. Using :term:`ESDK_CLASS_INHERIT_DISABLE` to disable these
  40. classes is the typical method to disable classes that are problematic
  41. or unnecessary in the SDK context. The default value disables the
  42. :ref:`buildhistory <ref-classes-buildhistory>`
  43. and :ref:`icecc <ref-classes-icecc>` classes.
  44. Additionally, the contents of ``conf/sdk-extra.conf``, when present, are
  45. appended to the end of ``conf/local.conf`` within the produced SDK,
  46. without any filtering. The ``sdk-extra.conf`` file is particularly
  47. useful if you want to set a variable value just for the SDK and not the
  48. OpenEmbedded build system used to create the SDK.
  49. Adjusting the Extensible SDK to Suit Your Build Host's Setup
  50. ============================================================
  51. In most cases, the extensible SDK defaults should work with your :term:`Build
  52. Host`'s setup. However, there are cases when you might consider making
  53. adjustments:
  54. - If your SDK configuration inherits additional classes using the
  55. :term:`INHERIT` variable and you
  56. do not need or want those classes enabled in the SDK, you can
  57. disable them by adding them to the :term:`ESDK_CLASS_INHERIT_DISABLE`
  58. variable as described in the previous section.
  59. .. note::
  60. The default value of
  61. ESDK_CLASS_INHERIT_DISABLE
  62. is set using the "?=" operator. Consequently, you will need to
  63. either define the entire list by using the "=" operator, or you
  64. will need to append a value using either ":append" or the "+="
  65. operator. You can learn more about these operators in the
  66. ":ref:`bitbake:bitbake-user-manual/bitbake-user-manual-metadata:basic syntax`"
  67. section of the BitBake User Manual.
  68. - If you have classes or recipes that add additional tasks to the
  69. standard build flow (i.e. the tasks execute as the recipe builds as
  70. opposed to being called explicitly), then you need to do one of the
  71. following:
  72. - After ensuring the tasks are :ref:`shared
  73. state <overview-manual/concepts:shared state cache>` tasks (i.e. the
  74. output of the task is saved to and can be restored from the shared
  75. state cache) or ensuring the tasks are able to be produced quickly
  76. from a task that is a shared state task, add the task name to the
  77. value of
  78. :term:`SDK_RECRDEP_TASKS`.
  79. - Disable the tasks if they are added by a class and you do not need
  80. the functionality the class provides in the extensible SDK. To
  81. disable the tasks, add the class to the :term:`ESDK_CLASS_INHERIT_DISABLE`
  82. variable as described in the previous section.
  83. - Generally, you want to have a shared state mirror set up so users of
  84. the SDK can add additional items to the SDK after installation
  85. without needing to build the items from source. See the
  86. ":ref:`sdk-manual/appendix-customizing:providing additional installable extensible sdk content`"
  87. section for information.
  88. - If you want users of the SDK to be able to easily update the SDK, you
  89. need to set the
  90. :term:`SDK_UPDATE_URL`
  91. variable. For more information, see the
  92. ":ref:`sdk-manual/appendix-customizing:providing updates to the extensible sdk after installation`"
  93. section.
  94. - If you have adjusted the list of files and directories that appear in
  95. :term:`COREBASE` (other than
  96. layers that are enabled through ``bblayers.conf``), then you must
  97. list these files in
  98. :term:`COREBASE_FILES` so
  99. that the files are copied into the SDK.
  100. - If your OpenEmbedded build system setup uses a different environment
  101. setup script other than
  102. :ref:`structure-core-script`, then you must
  103. set
  104. :term:`OE_INIT_ENV_SCRIPT`
  105. to point to the environment setup script you use.
  106. .. note::
  107. You must also reflect this change in the value used for the
  108. :term:`COREBASE_FILES` variable as previously described.
  109. Changing the Extensible SDK Installer Title
  110. ===========================================
  111. You can change the displayed title for the SDK installer by setting the
  112. :term:`SDK_TITLE` variable and then
  113. rebuilding the SDK installer. For information on how to build an SDK
  114. installer, see the ":ref:`sdk-manual/appendix-obtain:building an sdk installer`"
  115. section.
  116. By default, this title is derived from
  117. :term:`DISTRO_NAME` when it is
  118. set. If the :term:`DISTRO_NAME` variable is not set, the title is derived
  119. from the :term:`DISTRO` variable.
  120. The
  121. :ref:`populate_sdk_base <ref-classes-populate-sdk-*>`
  122. class defines the default value of the :term:`SDK_TITLE` variable as
  123. follows::
  124. SDK_TITLE ??= "${@d.getVar('DISTRO_NAME') or d.getVar('DISTRO')} SDK"
  125. While there are several ways of changing this variable, an efficient method is
  126. to set the variable in your distribution's configuration file. Doing so
  127. creates an SDK installer title that applies across your distribution. As
  128. an example, assume you have your own layer for your distribution named
  129. "meta-mydistro" and you are using the same type of file hierarchy as
  130. does the default "poky" distribution. If so, you could update the
  131. :term:`SDK_TITLE` variable in the
  132. ``~/meta-mydistro/conf/distro/mydistro.conf`` file using the following
  133. form::
  134. SDK_TITLE = "your_title"
  135. Providing Updates to the Extensible SDK After Installation
  136. ==========================================================
  137. When you make changes to your configuration or to the metadata and if
  138. you want those changes to be reflected in installed SDKs, you need to
  139. perform additional steps. These steps make it possible for anyone using
  140. the installed SDKs to update the installed SDKs by using the
  141. ``devtool sdk-update`` command:
  142. 1. Create a directory that can be shared over HTTP or HTTPS. You can do
  143. this by setting up a web server such as an `Apache HTTP
  144. Server <https://en.wikipedia.org/wiki/Apache_HTTP_Server>`__ or
  145. `Nginx <https://en.wikipedia.org/wiki/Nginx>`__ server in the cloud
  146. to host the directory. This directory must contain the published SDK.
  147. 2. Set the
  148. :term:`SDK_UPDATE_URL`
  149. variable to point to the corresponding HTTP or HTTPS URL. Setting
  150. this variable causes any SDK built to default to that URL and thus,
  151. the user does not have to pass the URL to the ``devtool sdk-update``
  152. command as described in the
  153. ":ref:`sdk-manual/extensible:applying updates to an installed extensible sdk`"
  154. section.
  155. 3. Build the extensible SDK normally (i.e., use the
  156. ``bitbake -c populate_sdk_ext`` imagename command).
  157. 4. Publish the SDK using the following command::
  158. $ oe-publish-sdk some_path/sdk-installer.sh path_to_shared_http_directory
  159. You must
  160. repeat this step each time you rebuild the SDK with changes that you
  161. want to make available through the update mechanism.
  162. Completing the above steps allows users of the existing installed SDKs
  163. to simply run ``devtool sdk-update`` to retrieve and apply the latest
  164. updates. See the
  165. ":ref:`sdk-manual/extensible:applying updates to an installed extensible sdk`"
  166. section for further information.
  167. Changing the Default SDK Installation Directory
  168. ===============================================
  169. When you build the installer for the Extensible SDK, the default
  170. installation directory for the SDK is based on the
  171. :term:`DISTRO` and
  172. :term:`SDKEXTPATH` variables from
  173. within the
  174. :ref:`populate_sdk_base <ref-classes-populate-sdk-*>`
  175. class as follows::
  176. SDKEXTPATH ??= "~/${@d.getVar('DISTRO')}_sdk"
  177. You can
  178. change this default installation directory by specifically setting the
  179. :term:`SDKEXTPATH` variable.
  180. While there are several ways of setting this variable,
  181. the method that makes the most sense is to set the variable in your
  182. distribution's configuration file. Doing so creates an SDK installer
  183. default directory that applies across your distribution. As an example,
  184. assume you have your own layer for your distribution named
  185. "meta-mydistro" and you are using the same type of file hierarchy as
  186. does the default "poky" distribution. If so, you could update the
  187. :term:`SDKEXTPATH` variable in the
  188. ``~/meta-mydistro/conf/distro/mydistro.conf`` file using the following
  189. form::
  190. SDKEXTPATH = "some_path_for_your_installed_sdk"
  191. After building your installer, running it prompts the user for
  192. acceptance of the some_path_for_your_installed_sdk directory as the
  193. default location to install the Extensible SDK.
  194. Providing Additional Installable Extensible SDK Content
  195. =======================================================
  196. If you want the users of an extensible SDK you build to be able to add
  197. items to the SDK without requiring the users to build the items from
  198. source, you need to do a number of things:
  199. 1. Ensure the additional items you want the user to be able to install
  200. are already built:
  201. - Build the items explicitly. You could use one or more "meta"
  202. recipes that depend on lists of other recipes.
  203. - Build the "world" target and set
  204. ``EXCLUDE_FROM_WORLD:pn-``\ recipename for the recipes you do not
  205. want built. See the
  206. :term:`EXCLUDE_FROM_WORLD`
  207. variable for additional information.
  208. 2. Expose the ``sstate-cache`` directory produced by the build.
  209. Typically, you expose this directory by making it available through
  210. an `Apache HTTP
  211. Server <https://en.wikipedia.org/wiki/Apache_HTTP_Server>`__ or
  212. `Nginx <https://en.wikipedia.org/wiki/Nginx>`__ server.
  213. 3. Set the appropriate configuration so that the produced SDK knows how
  214. to find the configuration. The variable you need to set is
  215. :term:`SSTATE_MIRRORS`::
  216. SSTATE_MIRRORS = "file://.* https://example.com/some_path/sstate-cache/PATH"
  217. You can set the :term:`SSTATE_MIRRORS` variable in two different places:
  218. - If the mirror value you are setting is appropriate to be set for
  219. both the OpenEmbedded build system that is actually building the
  220. SDK and the SDK itself (i.e. the mirror is accessible in both
  221. places or it will fail quickly on the OpenEmbedded build system
  222. side, and its contents will not interfere with the build), then
  223. you can set the variable in your ``local.conf`` or custom distro
  224. configuration file. You can then pass the variable to the SDK by
  225. adding the following::
  226. ESDK_LOCALCONF_ALLOW = "SSTATE_MIRRORS"
  227. - Alternatively, if you just want to set the :term:`SSTATE_MIRRORS`
  228. variable's value for the SDK alone, create a ``conf/sdk-extra.conf``
  229. file either in your :term:`Build Directory` or within any
  230. layer and put your :term:`SSTATE_MIRRORS` setting within that file.
  231. .. note::
  232. This second option is the safest option should you have any
  233. doubts as to which method to use when setting
  234. :term:`SSTATE_MIRRORS`
  235. Minimizing the Size of the Extensible SDK Installer Download
  236. ============================================================
  237. By default, the extensible SDK bundles the shared state artifacts for
  238. everything needed to reconstruct the image for which the SDK was built.
  239. This bundling can lead to an SDK installer file that is a Gigabyte or
  240. more in size. If the size of this file causes a problem, you can build
  241. an SDK that has just enough in it to install and provide access to the
  242. ``devtool command`` by setting the following in your configuration::
  243. SDK_EXT_TYPE = "minimal"
  244. Setting
  245. :term:`SDK_EXT_TYPE` to
  246. "minimal" produces an SDK installer that is around 35 Mbytes in size,
  247. which downloads and installs quickly. You need to realize, though, that
  248. the minimal installer does not install any libraries or tools out of the
  249. box. These libraries and tools must be installed either "on the fly" or
  250. through actions you perform using ``devtool`` or explicitly with the
  251. ``devtool sdk-install`` command.
  252. In most cases, when building a minimal SDK you need to also enable
  253. bringing in the information on a wider range of packages produced by the
  254. system. Requiring this wider range of information is particularly true
  255. so that ``devtool add`` is able to effectively map dependencies it
  256. discovers in a source tree to the appropriate recipes. Additionally, the
  257. information enables the ``devtool search`` command to return useful
  258. results.
  259. To facilitate this wider range of information, you would need to set the
  260. following::
  261. SDK_INCLUDE_PKGDATA = "1"
  262. See the :term:`SDK_INCLUDE_PKGDATA` variable for additional information.
  263. Setting the :term:`SDK_INCLUDE_PKGDATA` variable as shown causes the "world"
  264. target to be built so that information for all of the recipes included
  265. within it are available. Having these recipes available increases build
  266. time significantly and increases the size of the SDK installer by 30-80
  267. Mbytes depending on how many recipes are included in your configuration.
  268. You can use ``EXCLUDE_FROM_WORLD:pn-``\ recipename for recipes you want
  269. to exclude. However, it is assumed that you would need to be building
  270. the "world" target if you want to provide additional items to the SDK.
  271. Consequently, building for "world" should not represent undue overhead
  272. in most cases.
  273. .. note::
  274. If you set
  275. SDK_EXT_TYPE
  276. to "minimal", then providing a shared state mirror is mandatory so
  277. that items can be installed as needed. See the
  278. :ref:`sdk-manual/appendix-customizing:providing additional installable extensible sdk content`
  279. section for more information.
  280. You can explicitly control whether or not to include the toolchain when
  281. you build an SDK by setting the
  282. :term:`SDK_INCLUDE_TOOLCHAIN`
  283. variable to "1". In particular, it is useful to include the toolchain
  284. when you have set :term:`SDK_EXT_TYPE` to "minimal", which by default,
  285. excludes the toolchain. Also, it is helpful if you are building a small
  286. SDK for use with an IDE or some other tool where you do not want to take
  287. extra steps to install a toolchain.