sdk-appendix-customizing.xml 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399
  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. or
  146. <ulink url='&YOCTO_DOCS_REF_URL;#structure-memres-core-script'><filename>oe-init-build-env-memres</filename></ulink>,
  147. then you must set
  148. <ulink url='&YOCTO_DOCS_REF_URL;#var-OE_INIT_ENV_SCRIPT'><filename>OE_INIT_ENV_SCRIPT</filename></ulink>
  149. to point to the environment setup script you use.
  150. <note>
  151. You must also reflect this change in the value used for the
  152. <filename>COREBASE_FILES</filename> variable as previously
  153. described.
  154. </note>
  155. </para></listitem>
  156. </itemizedlist>
  157. </para>
  158. </section>
  159. <section id='sdk-changing-the-appearance-of-the-extensible-sdk'>
  160. <title>Changing the Appearance of the Extensible SDK</title>
  161. <para>
  162. You can change the title shown by the SDK installer by setting the
  163. <ulink url='&YOCTO_DOCS_REF_URL;#var-SDK_TITLE'><filename>SDK_TITLE</filename></ulink>
  164. variable.
  165. By default, this title is derived from
  166. <ulink url='&YOCTO_DOCS_REF_URL;#var-DISTRO_NAME'><filename>DISTRO_NAME</filename></ulink>
  167. when it is set.
  168. If the <filename>DISTRO_NAME</filename> variable is not set, the title
  169. is derived from the
  170. <ulink url='&YOCTO_DOCS_REF_URL;#var-DISTRO'><filename>DISTRO</filename></ulink>
  171. variable.
  172. </para>
  173. </section>
  174. <section id='sdk-providing-updates-after-installing-the-extensible-sdk'>
  175. <title>Providing Updates After Installing the Extensible SDK</title>
  176. <para>
  177. When you make changes to your configuration or to the metadata and
  178. if you want those changes to be reflected in installed SDKs, you need
  179. to perform additional steps to make it possible for those that use
  180. the SDK to update their installations with the
  181. <filename>devtool sdk-update</filename> command:
  182. <orderedlist>
  183. <listitem><para>
  184. Arrange to be created a directory that can be shared over
  185. HTTP or HTTPS.
  186. </para></listitem>
  187. <listitem><para>
  188. Set the
  189. <ulink url='&YOCTO_DOCS_REF_URL;#var-SDK_UPDATE_URL'><filename>SDK_UPDATE_URL</filename></ulink>
  190. variable to point to the corresponding HTTP or HTTPS URL.
  191. Setting this variable causes any SDK built to default to that
  192. URL and thus, the user does not have to pass the URL to the
  193. <filename>devtool sdk-update</filename> command.
  194. </para></listitem>
  195. <listitem><para>
  196. Build the extensible SDK normally (i.e., use the
  197. <filename>bitbake -c populate_sdk_ext</filename> <replaceable>imagename</replaceable>
  198. command).
  199. </para></listitem>
  200. <listitem><para>
  201. Publish the SDK using the following command:
  202. <literallayout class='monospaced'>
  203. $ oe-publish-sdk <replaceable>some_path</replaceable>/sdk-installer.sh <replaceable>path_to_shared/http_directory</replaceable>
  204. </literallayout>
  205. You must repeat this step each time you rebuild the SDK
  206. with changes that you want to make available through the
  207. update mechanism.
  208. </para></listitem>
  209. </orderedlist>
  210. </para>
  211. <para>
  212. Completing the above steps allows users of the existing SDKs to
  213. simply run <filename>devtool sdk-update</filename> to retrieve the
  214. latest updates.
  215. See the
  216. "<link linkend='sdk-updating-the-extensible-sdk'>Updating the Extensible SDK</link>"
  217. section for further information.
  218. </para>
  219. </section>
  220. <section id='sdk-providing-additional-installable-extensible-sdk-content'>
  221. <title>Providing Additional Installable Extensible SDK Content</title>
  222. <para>
  223. If you want the users of the extensible SDK you are building to be
  224. able to add items to the SDK without needing to build the
  225. items from source, you need to do a number of things:
  226. <orderedlist>
  227. <listitem><para>
  228. Ensure the additional items you want the user to be able to
  229. install are actually built.
  230. You can ensure these items are built a number of different
  231. ways: 1) Build them explicitly, perhaps using one or more
  232. "meta" recipes that depend on lists of other recipes to keep
  233. things tidy, or 2) Build the "world" target and set
  234. <filename>EXCLUDE_FROM_WORLD_pn-</filename><replaceable>recipename</replaceable>
  235. for the recipes you do not want built.
  236. See the
  237. <ulink url='&YOCTO_DOCS_REF_URL;#var-EXCLUDE_FROM_WORLD'><filename>EXCLUDE_FROM_WORLD</filename></ulink>
  238. variable for additional information.
  239. </para></listitem>
  240. <listitem><para>
  241. Expose the <filename>sstate-cache</filename> directory
  242. produced by the build.
  243. Typically, you expose this directory over HTTP or HTTPS.
  244. </para></listitem>
  245. <listitem><para>
  246. Set the appropriate configuration so that the produced SDK
  247. knows how to find the configuration.
  248. The variable you need to set is
  249. <ulink url='&YOCTO_DOCS_REF_URL;#var-SSTATE_MIRRORS'><filename>SSTATE_MIRRORS</filename></ulink>:
  250. <literallayout class='monospaced'>
  251. SSTATE_MIRRORS = "file://.* http://<replaceable>example</replaceable>.com/<replaceable>some_path</replaceable>/sstate-cache/PATH"
  252. </literallayout>
  253. You can set the <filename>SSTATE_MIRRORS</filename> variable
  254. in two different places:
  255. <itemizedlist>
  256. <listitem><para>
  257. If the mirror value you are setting is appropriate to
  258. be set for both the OpenEmbedded build system that is
  259. actually building the SDK and the SDK itself (i.e. the
  260. mirror is accessible in both places or it will fail
  261. quickly on the OpenEmbedded build system side, and its
  262. contents will not interfere with the build), then you
  263. can set the variable in your
  264. <filename>local.conf</filename> or custom distro
  265. configuration file.
  266. You can then "whitelist" the variable through
  267. to the SDK by adding the following:
  268. <literallayout class='monospaced'>
  269. SDK_LOCAL_CONF_WHITELIST = "SSTATE_MIRRORS"
  270. </literallayout>
  271. </para></listitem>
  272. <listitem><para>
  273. Alternatively, if you just want to set the
  274. <filename>SSTATE_MIRRORS</filename> variable's value
  275. for the SDK alone, create a
  276. <filename>conf/sdk-extra.conf</filename> either in
  277. your
  278. <ulink url='&YOCTO_DOCS_DEV_URL;#build-directory'>Build Directory</ulink>
  279. or within any layer and put your
  280. <filename>SSTATE_MIRRORS</filename> setting within
  281. that file.
  282. <note>
  283. This second option is the safest option should
  284. you have any doubts as to which method to use when
  285. setting <filename>SSTATE_MIRRORS</filename>.
  286. </note>
  287. </para></listitem>
  288. </itemizedlist>
  289. </para></listitem>
  290. </orderedlist>
  291. </para>
  292. </section>
  293. <section id='sdk-minimizing-the-size-of-the-extensible-sdk-installer-download'>
  294. <title>Minimizing the Size of the Extensible SDK Installer Download</title>
  295. <para>
  296. By default, the extensible SDK bundles the shared state artifacts for
  297. everything needed to reconstruct the image for which the SDK was built.
  298. This bundling can lead to an SDK installer file that is a Gigabyte or
  299. more in size.
  300. If the size of this file causes a problem, you can build an SDK that
  301. has just enough in it to install and provide access to the
  302. <filename>devtool command</filename> by setting the following in your
  303. configuration:
  304. <literallayout class='monospaced'>
  305. SDK_EXT_TYPE = "minimal"
  306. </literallayout>
  307. Setting
  308. <ulink url='&YOCTO_DOCS_REF_URL;#var-SDK_EXT_TYPE'><filename>SDK_EXT_TYPE</filename></ulink>
  309. to "minimal" produces an SDK installer that is around 35 Mbytes in
  310. size, which downloads and installs quickly.
  311. You need to realize, though, that the minimal installer does not
  312. install any libraries or tools out of the box.
  313. These must be installed either "on the fly" or through actions you
  314. perform using <filename>devtool</filename> or explicitly with the
  315. <filename>devtool sdk-install</filename> command.
  316. </para>
  317. <para>
  318. In most cases, when building a minimal SDK you will need to also enable
  319. bringing in the information on a wider range of packages produced by
  320. the system.
  321. This is particularly true so that <filename>devtool add</filename>
  322. is able to effectively map dependencies it discovers in a source tree
  323. to the appropriate recipes.
  324. Also so that the <filename>devtool search</filename> command
  325. is able to return useful results.
  326. </para>
  327. <para>
  328. To facilitate this wider range of information, you would additionally
  329. set the following:
  330. <literallayout class='monospaced'>
  331. SDK_INCLUDE_PKGDATA = "1"
  332. </literallayout>
  333. See the
  334. <ulink url='&YOCTO_DOCS_REF_URL;#var-SDK_INCLUDE_PKGDATA'><filename>SDK_INCLUDE_PKGDATA</filename></ulink>
  335. variable for additional information.
  336. </para>
  337. <para>
  338. Setting the <filename>SDK_INCLUDE_PKGDATA</filename> variable as
  339. shown causes the "world" target to be built so that information
  340. for all of the recipes included within it are available.
  341. Having these recipes available increases build time significantly and
  342. increases the size of the SDK installer by 30-80 Mbytes depending on
  343. how many recipes are included in your configuration.
  344. </para>
  345. <para>
  346. You can use
  347. <filename>EXCLUDE_FROM_WORLD_pn-</filename><replaceable>recipename</replaceable>
  348. for recipes you want to exclude.
  349. However, it is assumed that you would need to be building the "world"
  350. target if you want to provide additional items to the SDK.
  351. Consequently, building for "world" should not represent undue
  352. overhead in most cases.
  353. <note>
  354. If you set <filename>SDK_EXT_TYPE</filename> to "minimal",
  355. then providing a shared state mirror is mandatory so that items
  356. can be installed as needed.
  357. See the
  358. "<link linkend='sdk-providing-additional-installable-extensible-sdk-content'>Providing Additional Installable Extensible SDK Content</link>"
  359. section for more information.
  360. </note>
  361. </para>
  362. <para>
  363. You can explicitly control whether or not to include the toolchain
  364. when you build an SDK by setting the
  365. <ulink url='&YOCTO_DOCS_REF_URL;#var-SDK_INCLUDE_TOOLCHAIN'><filename>SDK_INCLUDE_TOOLCHAIN</filename></ulink>
  366. variable to "1".
  367. In particular, it is useful to include the toolchain when you
  368. have set <filename>SDK_EXT_TYPE</filename> to
  369. "minimal", which by default, excludes the toolchain.
  370. Also, it is helpful if you are building a small SDK for use with
  371. an IDE, such as Eclipse, or some other tool where you do not want
  372. to take extra steps to install a toolchain.
  373. </para>
  374. </section>
  375. </appendix>
  376. <!--
  377. vim: expandtab tw=80 ts=4
  378. -->