sdk-appendix-customizing.xml 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430
  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. <appendix id='sdk-appendix-customizing'>
  5. <title>Customizing the Extensible SDK</title>
  6. <para>
  7. This appendix presents customizations you can apply to the extensible SDK.
  8. </para>
  9. <section id='sdk-configuring-the-extensible-sdk'>
  10. <title>Configuring the Extensible SDK</title>
  11. <para>
  12. The extensible SDK primarily consists of a pre-configured copy of
  13. the OpenEmbedded build system from which it was produced.
  14. Thus, the SDK's configuration is derived using that build system and
  15. the filters shown in the following list.
  16. When these filters are present, the OpenEmbedded build system applies
  17. them against <filename>local.conf</filename> and
  18. <filename>auto.conf</filename>:
  19. <itemizedlist>
  20. <listitem><para>
  21. Variables whose values start with "/" are excluded since the
  22. assumption is that those values are paths that are likely to
  23. be specific to the
  24. <ulink url='&YOCTO_DOCS_REF_URL;#hardware-build-system-term'>build host</ulink>.
  25. </para></listitem>
  26. <listitem><para>
  27. Variables listed in
  28. <ulink url='&YOCTO_DOCS_REF_URL;#var-SDK_LOCAL_CONF_BLACKLIST'><filename>SDK_LOCAL_CONF_BLACKLIST</filename></ulink>
  29. are excluded.
  30. These variables are not allowed through from the OpenEmbedded
  31. build system configuration into the extensible SDK
  32. configuration.
  33. Typically, these variables are specific to the machine on
  34. which the build system is running and could be problematic
  35. as part of the extensible SDK configuration.</para>
  36. <para>For a list of the variables excluded by default, see the
  37. <ulink url='&YOCTO_DOCS_REF_URL;#var-SDK_LOCAL_CONF_BLACKLIST'><filename>SDK_LOCAL_CONF_BLACKLIST</filename></ulink>
  38. in the glossary of the Yocto Project Reference Manual.
  39. </para></listitem>
  40. <listitem><para>
  41. Variables listed in
  42. <ulink url='&YOCTO_DOCS_REF_URL;#var-SDK_LOCAL_CONF_WHITELIST'><filename>SDK_LOCAL_CONF_WHITELIST</filename></ulink>
  43. are included.
  44. Including a variable in the value of
  45. <filename>SDK_LOCAL_CONF_WHITELIST</filename> overrides either
  46. of the previous two filters.
  47. The default value is blank.
  48. </para></listitem>
  49. <listitem><para>
  50. Classes inherited globally with
  51. <ulink url='&YOCTO_DOCS_REF_URL;#var-INHERIT'><filename>INHERIT</filename></ulink>
  52. that are listed in
  53. <ulink url='&YOCTO_DOCS_REF_URL;#var-SDK_INHERIT_BLACKLIST'><filename>SDK_INHERIT_BLACKLIST</filename></ulink>
  54. are disabled.
  55. Using <filename>SDK_INHERIT_BLACKLIST</filename> to disable
  56. these classes is the typical method to disable classes that
  57. are problematic or unnecessary in the SDK context.
  58. The default value blacklists the
  59. <ulink url='&YOCTO_DOCS_REF_URL;#ref-classes-buildhistory'><filename>buildhistory</filename></ulink>
  60. and
  61. <ulink url='&YOCTO_DOCS_REF_URL;#ref-classes-icecc'><filename>icecc</filename></ulink>
  62. classes.
  63. </para></listitem>
  64. </itemizedlist>
  65. Additionally, the contents of <filename>conf/sdk-extra.conf</filename>,
  66. when present, are appended to the end of
  67. <filename>conf/local.conf</filename> within the produced SDK, without
  68. any filtering.
  69. The <filename>sdk-extra.conf</filename> file is particularly useful
  70. if you want to set a variable value just for the SDK and not the
  71. OpenEmbedded build system used to create the SDK.
  72. </para>
  73. </section>
  74. <section id='adjusting-the-extensible-sdk-to-suit-your-build-hosts-setup'>
  75. <title>Adjusting the Extensible SDK to Suit Your Build Host's Setup</title>
  76. <para>
  77. In most cases, the extensible SDK defaults should work with your
  78. <ulink url='&YOCTO_DOCS_REF_URL;#hardware-build-system-term'>build host's</ulink>
  79. setup.
  80. However, some cases exist for which you might consider making
  81. adjustments:
  82. <itemizedlist>
  83. <listitem><para>
  84. If your SDK configuration inherits additional classes
  85. using the
  86. <ulink url='&YOCTO_DOCS_REF_URL;#var-INHERIT'><filename>INHERIT</filename></ulink>
  87. variable and you do not need or want those classes enabled in
  88. the SDK, you can blacklist them by adding them to the
  89. <ulink url='&YOCTO_DOCS_REF_URL;#var-SDK_INHERIT_BLACKLIST'><filename>SDK_INHERIT_BLACKLIST</filename></ulink>
  90. variable as described in the fourth bullet of the previous
  91. section.
  92. <note>
  93. The default value of
  94. <filename>SDK_INHERIT_BLACKLIST</filename> is set using
  95. the "?=" operator.
  96. Consequently, you will need to either define the entire
  97. list by using the "=" operator, or you will need to append
  98. a value using either "_append" or the "+=" operator.
  99. You can learn more about these operators in the
  100. "<ulink url='&YOCTO_DOCS_BB_URL;#basic-syntax'>Basic Syntax</ulink>"
  101. section of the BitBake User Manual.
  102. </note>.
  103. </para></listitem>
  104. <listitem><para>
  105. If you have classes or recipes that add additional tasks to
  106. the standard build flow (i.e. the tasks execute as the recipe
  107. builds as opposed to being called explicitly), then you need
  108. to do one of the following:
  109. <itemizedlist>
  110. <listitem><para>
  111. After ensuring the tasks are
  112. <ulink url='&YOCTO_DOCS_OM_URL;#shared-state-cache'>shared state</ulink>
  113. tasks (i.e. the output of the task is saved to and
  114. can be restored from the shared state cache) or
  115. ensuring the tasks are able to be produced quickly from
  116. a task that is a shared state task, add the task name
  117. to the value of
  118. <ulink url='&YOCTO_DOCS_REF_URL;#var-SDK_RECRDEP_TASKS'><filename>SDK_RECRDEP_TASKS</filename></ulink>.
  119. </para></listitem>
  120. <listitem><para>
  121. Disable the tasks if they are added by a class and
  122. you do not need the functionality the class provides
  123. in the extensible SDK.
  124. To disable the tasks, add the class to the
  125. <filename>SDK_INHERIT_BLACKLIST</filename> variable
  126. as described in the previous section.
  127. </para></listitem>
  128. </itemizedlist>
  129. </para></listitem>
  130. <listitem><para>
  131. Generally, you want to have a shared state mirror set up so
  132. users of the SDK can add additional items to the SDK after
  133. installation without needing to build the items from source.
  134. See the
  135. "<link linkend='sdk-providing-additional-installable-extensible-sdk-content'>Providing Additional Installable Extensible SDK Content</link>"
  136. section for information.
  137. </para></listitem>
  138. <listitem><para>
  139. If you want users of the SDK to be able to easily update the
  140. SDK, you need to set the
  141. <ulink url='&YOCTO_DOCS_REF_URL;#var-SDK_UPDATE_URL'><filename>SDK_UPDATE_URL</filename></ulink>
  142. variable.
  143. For more information, see the
  144. "<link linkend='sdk-providing-updates-to-the-extensible-sdk-after-installation'>Providing Updates to the Extensible SDK After Installation</link>"
  145. section.
  146. </para></listitem>
  147. <listitem><para>
  148. If you have adjusted the list of files and directories that
  149. appear in
  150. <ulink url='&YOCTO_DOCS_REF_URL;#var-COREBASE'><filename>COREBASE</filename></ulink>
  151. (other than layers that are enabled through
  152. <filename>bblayers.conf</filename>), then you must list these
  153. files in
  154. <ulink url='&YOCTO_DOCS_REF_URL;#var-COREBASE_FILES'><filename>COREBASE_FILES</filename></ulink>
  155. so that the files are copied into the SDK.
  156. </para></listitem>
  157. <listitem><para>
  158. If your OpenEmbedded build system setup uses a different
  159. environment setup script other than
  160. <ulink url='&YOCTO_DOCS_REF_URL;#structure-core-script'><filename>&OE_INIT_FILE;</filename></ulink>,
  161. then you must set
  162. <ulink url='&YOCTO_DOCS_REF_URL;#var-OE_INIT_ENV_SCRIPT'><filename>OE_INIT_ENV_SCRIPT</filename></ulink>
  163. to point to the environment setup script you use.
  164. <note>
  165. You must also reflect this change in the value used for the
  166. <filename>COREBASE_FILES</filename> variable as previously
  167. described.
  168. </note>
  169. </para></listitem>
  170. </itemizedlist>
  171. </para>
  172. </section>
  173. <section id='sdk-changing-the-sdk-installer-title'>
  174. <title>Changing the Extensible SDK Installer Title</title>
  175. <para>
  176. You can change the displayed title for the SDK installer by setting
  177. the
  178. <ulink url='&YOCTO_DOCS_REF_URL;#var-SDK_TITLE'><filename>SDK_TITLE</filename></ulink>
  179. variable.
  180. By default, this title is derived from
  181. <ulink url='&YOCTO_DOCS_REF_URL;#var-DISTRO_NAME'><filename>DISTRO_NAME</filename></ulink>
  182. when it is set.
  183. If the <filename>DISTRO_NAME</filename> variable is not set, the title
  184. is derived from the
  185. <ulink url='&YOCTO_DOCS_REF_URL;#var-DISTRO'><filename>DISTRO</filename></ulink>
  186. variable.
  187. </para>
  188. <para>
  189. The
  190. <ulink url='&YOCTO_DOCS_REF_URL;#ref-classes-populate-sdk-*'><filename>populate_sdk_ext</filename></ulink>
  191. class defines the default value of the <filename>SDK_TITLE</filename>
  192. variable as follows:
  193. <literallayout class='monospaced'>
  194. SDK_TITLE_task-populate-sdk-ext = "${@d.getVar('DISTRO_NAME') or d.getVar('DISTRO')} Extensible SDK"
  195. </literallayout>
  196. </para>
  197. </section>
  198. <section id='sdk-providing-updates-to-the-extensible-sdk-after-installation'>
  199. <title>Providing Updates to the Extensible SDK After Installation</title>
  200. <para>
  201. When you make changes to your configuration or to the metadata and
  202. if you want those changes to be reflected in installed SDKs, you need
  203. to perform additional steps.
  204. These steps make it possible for anyone using the installed SDKs to
  205. update the installed SDKs by using the
  206. <filename>devtool sdk-update</filename> command:
  207. <orderedlist>
  208. <listitem><para>
  209. Create a directory that can be shared over HTTP or HTTPS.
  210. This directory will contain the published SDK.
  211. </para></listitem>
  212. <listitem><para>
  213. Set the
  214. <ulink url='&YOCTO_DOCS_REF_URL;#var-SDK_UPDATE_URL'><filename>SDK_UPDATE_URL</filename></ulink>
  215. variable to point to the corresponding HTTP or HTTPS URL.
  216. Setting this variable causes any SDK built to default to that
  217. URL and thus, the user does not have to pass the URL to the
  218. <filename>devtool sdk-update</filename> command as described
  219. in the
  220. "<link linkend='sdk-applying-updates-to-an-installed-extensible-sdk'>Applying Updates to an Installed Extensible SDK</link>"
  221. section.
  222. </para></listitem>
  223. <listitem><para>
  224. Build the extensible SDK normally (i.e., use the
  225. <filename>bitbake -c populate_sdk_ext</filename> <replaceable>imagename</replaceable>
  226. command).
  227. </para></listitem>
  228. <listitem><para>
  229. Publish the SDK using the following command:
  230. <literallayout class='monospaced'>
  231. $ oe-publish-sdk <replaceable>some_path</replaceable>/sdk-installer.sh <replaceable>path_to_shared_http_directory</replaceable>
  232. </literallayout>
  233. You must repeat this step each time you rebuild the SDK
  234. with changes that you want to make available through the
  235. update mechanism.
  236. </para></listitem>
  237. </orderedlist>
  238. </para>
  239. <para>
  240. Completing the above steps allows users of the existing installed
  241. SDKs to simply run <filename>devtool sdk-update</filename> to
  242. retrieve and apply the latest updates.
  243. See the
  244. "<link linkend='sdk-applying-updates-to-an-installed-extensible-sdk'>Applying Updates to an Installed Extensible SDK</link>"
  245. section for further information.
  246. </para>
  247. </section>
  248. <section id='sdk-providing-additional-installable-extensible-sdk-content'>
  249. <title>Providing Additional Installable Extensible SDK Content</title>
  250. <para>
  251. If you want the users of the extensible SDK you are building to be
  252. able to add items to the SDK without needing to build the
  253. items from source, you need to do a number of things:
  254. <orderedlist>
  255. <listitem><para>
  256. Ensure the additional items you want the user to be able to
  257. install are actually built.
  258. You can ensure these items are built a number of different
  259. ways: 1) Build them explicitly, perhaps using one or more
  260. "meta" recipes that depend on lists of other recipes to keep
  261. things tidy, or 2) Build the "world" target and set
  262. <filename>EXCLUDE_FROM_WORLD_pn-</filename><replaceable>recipename</replaceable>
  263. for the recipes you do not want built.
  264. See the
  265. <ulink url='&YOCTO_DOCS_REF_URL;#var-EXCLUDE_FROM_WORLD'><filename>EXCLUDE_FROM_WORLD</filename></ulink>
  266. variable for additional information.
  267. </para></listitem>
  268. <listitem><para>
  269. Expose the <filename>sstate-cache</filename> directory
  270. produced by the build.
  271. Typically, you expose this directory over HTTP or HTTPS.
  272. </para></listitem>
  273. <listitem><para>
  274. Set the appropriate configuration so that the produced SDK
  275. knows how to find the configuration.
  276. The variable you need to set is
  277. <ulink url='&YOCTO_DOCS_REF_URL;#var-SSTATE_MIRRORS'><filename>SSTATE_MIRRORS</filename></ulink>:
  278. <literallayout class='monospaced'>
  279. SSTATE_MIRRORS = "file://.* http://<replaceable>example</replaceable>.com/<replaceable>some_path</replaceable>/sstate-cache/PATH"
  280. </literallayout>
  281. You can set the <filename>SSTATE_MIRRORS</filename> variable
  282. in two different places:
  283. <itemizedlist>
  284. <listitem><para>
  285. If the mirror value you are setting is appropriate to
  286. be set for both the OpenEmbedded build system that is
  287. actually building the SDK and the SDK itself (i.e. the
  288. mirror is accessible in both places or it will fail
  289. quickly on the OpenEmbedded build system side, and its
  290. contents will not interfere with the build), then you
  291. can set the variable in your
  292. <filename>local.conf</filename> or custom distro
  293. configuration file.
  294. You can then "whitelist" the variable through
  295. to the SDK by adding the following:
  296. <literallayout class='monospaced'>
  297. SDK_LOCAL_CONF_WHITELIST = "SSTATE_MIRRORS"
  298. </literallayout>
  299. </para></listitem>
  300. <listitem><para>
  301. Alternatively, if you just want to set the
  302. <filename>SSTATE_MIRRORS</filename> variable's value
  303. for the SDK alone, create a
  304. <filename>conf/sdk-extra.conf</filename> either in
  305. your
  306. <ulink url='&YOCTO_DOCS_REF_URL;#build-directory'>Build Directory</ulink>
  307. or within any layer and put your
  308. <filename>SSTATE_MIRRORS</filename> setting within
  309. that file.
  310. <note>
  311. This second option is the safest option should
  312. you have any doubts as to which method to use when
  313. setting <filename>SSTATE_MIRRORS</filename>.
  314. </note>
  315. </para></listitem>
  316. </itemizedlist>
  317. </para></listitem>
  318. </orderedlist>
  319. </para>
  320. </section>
  321. <section id='sdk-minimizing-the-size-of-the-extensible-sdk-installer-download'>
  322. <title>Minimizing the Size of the Extensible SDK Installer Download</title>
  323. <para>
  324. By default, the extensible SDK bundles the shared state artifacts for
  325. everything needed to reconstruct the image for which the SDK was built.
  326. This bundling can lead to an SDK installer file that is a Gigabyte or
  327. more in size.
  328. If the size of this file causes a problem, you can build an SDK that
  329. has just enough in it to install and provide access to the
  330. <filename>devtool command</filename> by setting the following in your
  331. configuration:
  332. <literallayout class='monospaced'>
  333. SDK_EXT_TYPE = "minimal"
  334. </literallayout>
  335. Setting
  336. <ulink url='&YOCTO_DOCS_REF_URL;#var-SDK_EXT_TYPE'><filename>SDK_EXT_TYPE</filename></ulink>
  337. to "minimal" produces an SDK installer that is around 35 Mbytes in
  338. size, which downloads and installs quickly.
  339. You need to realize, though, that the minimal installer does not
  340. install any libraries or tools out of the box.
  341. These must be installed either "on the fly" or through actions you
  342. perform using <filename>devtool</filename> or explicitly with the
  343. <filename>devtool sdk-install</filename> command.
  344. </para>
  345. <para>
  346. In most cases, when building a minimal SDK you will need to also enable
  347. bringing in the information on a wider range of packages produced by
  348. the system.
  349. This is particularly true so that <filename>devtool add</filename>
  350. is able to effectively map dependencies it discovers in a source tree
  351. to the appropriate recipes.
  352. Also so that the <filename>devtool search</filename> command
  353. is able to return useful results.
  354. </para>
  355. <para>
  356. To facilitate this wider range of information, you would additionally
  357. set the following:
  358. <literallayout class='monospaced'>
  359. SDK_INCLUDE_PKGDATA = "1"
  360. </literallayout>
  361. See the
  362. <ulink url='&YOCTO_DOCS_REF_URL;#var-SDK_INCLUDE_PKGDATA'><filename>SDK_INCLUDE_PKGDATA</filename></ulink>
  363. variable for additional information.
  364. </para>
  365. <para>
  366. Setting the <filename>SDK_INCLUDE_PKGDATA</filename> variable as
  367. shown causes the "world" target to be built so that information
  368. for all of the recipes included within it are available.
  369. Having these recipes available increases build time significantly and
  370. increases the size of the SDK installer by 30-80 Mbytes depending on
  371. how many recipes are included in your configuration.
  372. </para>
  373. <para>
  374. You can use
  375. <filename>EXCLUDE_FROM_WORLD_pn-</filename><replaceable>recipename</replaceable>
  376. for recipes you want to exclude.
  377. However, it is assumed that you would need to be building the "world"
  378. target if you want to provide additional items to the SDK.
  379. Consequently, building for "world" should not represent undue
  380. overhead in most cases.
  381. <note>
  382. If you set <filename>SDK_EXT_TYPE</filename> to "minimal",
  383. then providing a shared state mirror is mandatory so that items
  384. can be installed as needed.
  385. See the
  386. "<link linkend='sdk-providing-additional-installable-extensible-sdk-content'>Providing Additional Installable Extensible SDK Content</link>"
  387. section for more information.
  388. </note>
  389. </para>
  390. <para>
  391. You can explicitly control whether or not to include the toolchain
  392. when you build an SDK by setting the
  393. <ulink url='&YOCTO_DOCS_REF_URL;#var-SDK_INCLUDE_TOOLCHAIN'><filename>SDK_INCLUDE_TOOLCHAIN</filename></ulink>
  394. variable to "1".
  395. In particular, it is useful to include the toolchain when you
  396. have set <filename>SDK_EXT_TYPE</filename> to
  397. "minimal", which by default, excludes the toolchain.
  398. Also, it is helpful if you are building a small SDK for use with
  399. an IDE, such as <trademark class='trade'>Eclipse</trademark>, or some
  400. other tool where you do not want to take extra steps to install a
  401. toolchain.
  402. </para>
  403. </section>
  404. </appendix>
  405. <!--
  406. vim: expandtab tw=80 ts=4
  407. -->