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