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