sdk-appendix-customizing.xml 20 KB

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