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 | <chapter id='sdk-extensible'> |
| 6 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 7 | <title>Using the Extensible SDK</title> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 8 | |
| 9 | <para> |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 10 | This chapter describes the extensible SDK and how to install it. |
| 11 | Information covers the pieces of the SDK, how to install it, and |
| 12 | presents a look at using the <filename>devtool</filename> |
| 13 | functionality. |
| 14 | The extensible SDK makes it easy to add new applications and libraries |
| 15 | to an image, modify the source for an existing component, test |
| 16 | changes on the target hardware, and ease integration into the rest of |
| 17 | the |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 18 | <ulink url='&YOCTO_DOCS_REF_URL;#build-system-term'>OpenEmbedded build system</ulink>. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 19 | <note> |
| 20 | For a side-by-side comparison of main features supported for an |
| 21 | extensible SDK as compared to a standard SDK, see the |
| 22 | "<link linkend='sdk-manual-intro'>Introduction</link>" |
| 23 | section. |
| 24 | </note> |
| 25 | </para> |
| 26 | |
| 27 | <para> |
| 28 | In addition to the functionality available through |
| 29 | <filename>devtool</filename>, you can alternatively make use of the |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 30 | toolchain directly, for example from Makefile and Autotools. |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 31 | See the |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 32 | "<link linkend='sdk-working-projects'>Using the SDK Toolchain Directly</link>" |
| 33 | chapter for more information. |
| 34 | </para> |
| 35 | |
| 36 | <section id='sdk-extensible-sdk-intro'> |
| 37 | <title>Why use the Extensible SDK and What is in It?</title> |
| 38 | |
| 39 | <para> |
| 40 | The extensible SDK provides a cross-development toolchain and |
| 41 | libraries tailored to the contents of a specific image. |
| 42 | You would use the Extensible SDK if you want a toolchain experience |
| 43 | supplemented with the powerful set of <filename>devtool</filename> |
| 44 | commands tailored for the Yocto Project environment. |
| 45 | </para> |
| 46 | |
| 47 | <para> |
| 48 | The installed extensible SDK consists of several files and |
| 49 | directories. |
| 50 | Basically, it contains an SDK environment setup script, some |
| 51 | configuration files, an internal build system, and the |
| 52 | <filename>devtool</filename> functionality. |
| 53 | </para> |
| 54 | </section> |
| 55 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 56 | <section id='sdk-installing-the-extensible-sdk'> |
| 57 | <title>Installing the Extensible SDK</title> |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 58 | |
| 59 | <para> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 60 | The first thing you need to do is install the SDK on your |
| 61 | <ulink url='&YOCTO_DOCS_REF_URL;#hardware-build-system-term'>Build Host</ulink> |
| 62 | by running the <filename>*.sh</filename> installation script. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 63 | </para> |
| 64 | |
| 65 | <para> |
| 66 | You can download a tarball installer, which includes the |
| 67 | pre-built toolchain, the <filename>runqemu</filename> |
| 68 | script, the internal build system, <filename>devtool</filename>, |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 69 | and support files from the appropriate |
| 70 | <ulink url='&YOCTO_TOOLCHAIN_DL_URL;'>toolchain</ulink> |
| 71 | directory within the Index of Releases. |
| 72 | Toolchains are available for several 32-bit and 64-bit |
| 73 | architectures with the <filename>x86_64</filename> directories, |
| 74 | respectively. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 75 | The toolchains the Yocto Project provides are based off the |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 76 | <filename>core-image-sato</filename> and |
| 77 | <filename>core-image-minimal</filename> images and contain |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 78 | libraries appropriate for developing against that image. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 79 | </para> |
| 80 | |
| 81 | <para> |
| 82 | The names of the tarball installer scripts are such that a |
| 83 | string representing the host system appears first in the |
| 84 | filename and then is immediately followed by a string |
| 85 | representing the target architecture. |
| 86 | An extensible SDK has the string "-ext" as part of the name. |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 87 | Following is the general form: |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 88 | <literallayout class='monospaced'> |
| 89 | poky-glibc-<replaceable>host_system</replaceable>-<replaceable>image_type</replaceable>-<replaceable>arch</replaceable>-toolchain-ext-<replaceable>release_version</replaceable>.sh |
| 90 | |
| 91 | Where: |
| 92 | <replaceable>host_system</replaceable> is a string representing your development system: |
| 93 | |
| 94 | i686 or x86_64. |
| 95 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 96 | <replaceable>image_type</replaceable> is the image for which the SDK was built: |
| 97 | |
| 98 | core-image-sato or core-image-minimal |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 99 | |
| 100 | <replaceable>arch</replaceable> is a string representing the tuned target architecture: |
| 101 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 102 | aarch64, armv5e, core2-64, i586, mips32r2, mips64, ppc7400, or cortexa8hf-neon |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 103 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 104 | <replaceable>release_version</replaceable> is a string representing the release number of the Yocto Project: |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 105 | |
| 106 | &DISTRO;, &DISTRO;+snapshot |
| 107 | </literallayout> |
| 108 | For example, the following SDK installer is for a 64-bit |
| 109 | development host system and a i586-tuned target architecture |
| 110 | based off the SDK for <filename>core-image-sato</filename> and |
| 111 | using the current &DISTRO; snapshot: |
| 112 | <literallayout class='monospaced'> |
| 113 | poky-glibc-x86_64-core-image-sato-i586-toolchain-ext-&DISTRO;.sh |
| 114 | </literallayout> |
| 115 | <note> |
| 116 | As an alternative to downloading an SDK, you can build the |
| 117 | SDK installer. |
| 118 | For information on building the installer, see the |
| 119 | "<link linkend='sdk-building-an-sdk-installer'>Building an SDK Installer</link>" |
| 120 | section. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 121 | </note> |
| 122 | </para> |
| 123 | |
| 124 | <para> |
| 125 | The SDK and toolchains are self-contained and by default are |
| 126 | installed into the <filename>poky_sdk</filename> folder in your |
| 127 | home directory. |
| 128 | You can choose to install the extensible SDK in any location when |
| 129 | you run the installer. |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 130 | However, because files need to be written under that directory |
| 131 | during the normal course of operation, the location you choose |
| 132 | for installation must be writable for whichever |
| 133 | users need to use the SDK. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 134 | </para> |
| 135 | |
| 136 | <para> |
| 137 | The following command shows how to run the installer given a |
| 138 | toolchain tarball for a 64-bit x86 development host system and |
| 139 | a 64-bit x86 target architecture. |
| 140 | The example assumes the SDK installer is located in |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 141 | <filename>~/Downloads/</filename> and has execution rights. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 142 | <note> |
| 143 | If you do not have write permissions for the directory |
| 144 | into which you are installing the SDK, the installer |
| 145 | notifies you and exits. |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 146 | For that case, set up the proper permissions in the directory |
| 147 | and run the installer again. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 148 | </note> |
| 149 | <literallayout class='monospaced'> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 150 | $ ./Downloads/poky-glibc-x86_64-core-image-minimal-core2-64-toolchain-ext-2.5.sh |
| 151 | Poky (Yocto Project Reference Distro) Extensible SDK installer version 2.5 |
| 152 | ========================================================================== |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 153 | Enter target directory for SDK (default: ~/poky_sdk): |
Brad Bishop | d89cb5f | 2019-04-10 09:02:41 -0400 | [diff] [blame] | 154 | You are about to install the SDK to "/home/scottrif/poky_sdk". Proceed [Y/n]? Y |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 155 | Extracting SDK..............done |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 156 | Setting it up... |
| 157 | Extracting buildtools... |
| 158 | Preparing build system... |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 159 | Parsing recipes: 100% |##################################################################| Time: 0:00:52 |
| 160 | Initialising tasks: 100% |###############################################################| Time: 0:00:00 |
| 161 | Checking sstate mirror object availability: 100% |#######################################| Time: 0:00:00 |
| 162 | Loading cache: 100% |####################################################################| Time: 0:00:00 |
| 163 | Initialising tasks: 100% |###############################################################| Time: 0:00:00 |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 164 | done |
| 165 | SDK has been successfully set up and is ready to be used. |
| 166 | Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g. |
| 167 | $ . /home/scottrif/poky_sdk/environment-setup-core2-64-poky-linux |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 168 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 169 | </literallayout> |
| 170 | </para> |
| 171 | </section> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 172 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 173 | <section id='sdk-running-the-extensible-sdk-environment-setup-script'> |
| 174 | <title>Running the Extensible SDK Environment Setup Script</title> |
| 175 | |
| 176 | <para> |
| 177 | Once you have the SDK installed, you must run the SDK environment |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 178 | setup script before you can actually use the SDK. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 179 | This setup script resides in the directory you chose when you |
| 180 | installed the SDK, which is either the default |
| 181 | <filename>poky_sdk</filename> directory or the directory you |
| 182 | chose during installation. |
| 183 | </para> |
| 184 | |
| 185 | <para> |
| 186 | Before running the script, be sure it is the one that matches the |
| 187 | architecture for which you are developing. |
| 188 | Environment setup scripts begin with the string |
| 189 | "<filename>environment-setup</filename>" and include as part of |
| 190 | their name the tuned target architecture. |
| 191 | As an example, the following commands set the working directory |
| 192 | to where the SDK was installed and then source the environment |
| 193 | setup script. |
| 194 | In this example, the setup script is for an IA-based |
| 195 | target machine using i586 tuning: |
| 196 | <literallayout class='monospaced'> |
| 197 | $ cd /home/scottrif/poky_sdk |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 198 | $ source environment-setup-core2-64-poky-linux |
| 199 | SDK environment now set up; additionally you may now run devtool to perform development tasks. |
| 200 | Run devtool --help for further details. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 201 | </literallayout> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 202 | Running the setup script defines many environment variables needed |
| 203 | in order to use the SDK (e.g. <filename>PATH</filename>, |
| 204 | <ulink url='&YOCTO_DOCS_REF_URL;#var-CC'><filename>CC</filename></ulink>, |
| 205 | <ulink url='&YOCTO_DOCS_REF_URL;#var-LD'><filename>LD</filename></ulink>, |
| 206 | and so forth). |
| 207 | If you want to see all the environment variables the script |
| 208 | exports, examine the installation file itself. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 209 | </para> |
| 210 | </section> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 211 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 212 | <section id='using-devtool-in-your-sdk-workflow'> |
| 213 | <title>Using <filename>devtool</filename> in Your SDK Workflow</title> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 214 | |
| 215 | <para> |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 216 | The cornerstone of the extensible SDK is a command-line tool |
| 217 | called <filename>devtool</filename>. |
| 218 | This tool provides a number of features that help |
| 219 | you build, test and package software within the extensible SDK, and |
| 220 | optionally integrate it into an image built by the OpenEmbedded |
| 221 | build system. |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 222 | <note><title>Tip</title> |
| 223 | The use of <filename>devtool</filename> is not limited to |
| 224 | the extensible SDK. |
| 225 | You can use <filename>devtool</filename> to help you easily |
| 226 | develop any project whose build output must be part of an |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 227 | image built using the build system. |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 228 | </note> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 229 | </para> |
| 230 | |
| 231 | <para> |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 232 | The <filename>devtool</filename> command line is organized |
| 233 | similarly to |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 234 | <ulink url='&YOCTO_DOCS_OM_URL;#git'>Git</ulink> in that it |
| 235 | has a number of sub-commands for each function. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 236 | You can run <filename>devtool --help</filename> to see all the |
| 237 | commands. |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 238 | <note> |
| 239 | See the |
| 240 | "<ulink url='&YOCTO_DOCS_REF_URL;#ref-devtool-reference'><filename>devtool</filename> Quick Reference</ulink>" |
| 241 | in the Yocto Project Reference Manual for a |
| 242 | <filename>devtool</filename> quick reference. |
| 243 | </note> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 244 | </para> |
| 245 | |
| 246 | <para> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 247 | Three <filename>devtool</filename> subcommands exist that provide |
| 248 | entry-points into development: |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 249 | <itemizedlist> |
| 250 | <listitem><para> |
| 251 | <emphasis><filename>devtool add</filename></emphasis>: |
| 252 | Assists in adding new software to be built. |
| 253 | </para></listitem> |
| 254 | <listitem><para> |
| 255 | <emphasis><filename>devtool modify</filename></emphasis>: |
| 256 | Sets up an environment to enable you to modify the source of |
| 257 | an existing component. |
| 258 | </para></listitem> |
| 259 | <listitem><para> |
| 260 | <emphasis><filename>devtool upgrade</filename></emphasis>: |
| 261 | Updates an existing recipe so that you can build it for |
| 262 | an updated set of source files. |
| 263 | </para></listitem> |
| 264 | </itemizedlist> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 265 | As with the build system, "recipes" represent software packages |
| 266 | within <filename>devtool</filename>. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 267 | When you use <filename>devtool add</filename>, a recipe is |
| 268 | automatically created. |
| 269 | When you use <filename>devtool modify</filename>, the specified |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 270 | existing recipe is used in order to determine where to get the |
| 271 | source code and how to patch it. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 272 | In both cases, an environment is set up so that when you build the |
| 273 | recipe a source tree that is under your control is used in order to |
| 274 | allow you to make changes to the source as desired. |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 275 | By default, new recipes and the source go into a "workspace" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 276 | directory under the SDK. |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 277 | </para> |
| 278 | |
| 279 | <para> |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 280 | The remainder of this section presents the |
| 281 | <filename>devtool add</filename>, |
| 282 | <filename>devtool modify</filename>, and |
| 283 | <filename>devtool upgrade</filename> workflows. |
| 284 | </para> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 285 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 286 | <section id='sdk-use-devtool-to-add-an-application'> |
| 287 | <title>Use <filename>devtool add</filename> to Add an Application</title> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 288 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 289 | <para> |
| 290 | The <filename>devtool add</filename> command generates |
| 291 | a new recipe based on existing source code. |
| 292 | This command takes advantage of the |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 293 | <ulink url='&YOCTO_DOCS_REF_URL;#devtool-the-workspace-layer-structure'>workspace</ulink> |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 294 | layer that many <filename>devtool</filename> commands |
| 295 | use. |
| 296 | The command is flexible enough to allow you to extract source |
| 297 | code into both the workspace or a separate local Git repository |
| 298 | and to use existing code that does not need to be extracted. |
| 299 | </para> |
| 300 | |
| 301 | <para> |
| 302 | Depending on your particular scenario, the arguments and options |
| 303 | you use with <filename>devtool add</filename> form different |
| 304 | combinations. |
| 305 | The following diagram shows common development flows |
| 306 | you would use with the <filename>devtool add</filename> |
| 307 | command: |
| 308 | </para> |
| 309 | |
| 310 | <para> |
| 311 | <imagedata fileref="figures/sdk-devtool-add-flow.png" align="center" /> |
| 312 | </para> |
| 313 | |
| 314 | <para> |
| 315 | <orderedlist> |
| 316 | <listitem><para><emphasis>Generating the New Recipe</emphasis>: |
| 317 | The top part of the flow shows three scenarios by which |
| 318 | you could use <filename>devtool add</filename> to |
| 319 | generate a recipe based on existing source code.</para> |
| 320 | |
| 321 | <para>In a shared development environment, it is |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 322 | typical for other developers to be responsible for |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 323 | various areas of source code. |
| 324 | As a developer, you are probably interested in using |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 325 | that source code as part of your development within |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 326 | the Yocto Project. |
| 327 | All you need is access to the code, a recipe, and a |
| 328 | controlled area in which to do your work.</para> |
| 329 | |
| 330 | <para>Within the diagram, three possible scenarios |
| 331 | feed into the <filename>devtool add</filename> workflow: |
| 332 | <itemizedlist> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 333 | <listitem><para> |
| 334 | <emphasis>Left</emphasis>: |
| 335 | The left scenario in the figure represents a |
| 336 | common situation where the source code does not |
| 337 | exist locally and needs to be extracted. |
| 338 | In this situation, the source code is extracted |
| 339 | to the default workspace - you do not |
| 340 | want the files in some specific location |
| 341 | outside of the workspace. |
| 342 | Thus, everything you need will be located in |
| 343 | the workspace: |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 344 | <literallayout class='monospaced'> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 345 | $ devtool add <replaceable>recipe fetchuri</replaceable> |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 346 | </literallayout> |
| 347 | With this command, <filename>devtool</filename> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 348 | extracts the upstream source files into a local |
| 349 | Git repository within the |
| 350 | <filename>sources</filename> folder. |
| 351 | The command then creates a recipe named |
| 352 | <replaceable>recipe</replaceable> and a |
| 353 | corresponding append file in the workspace. |
| 354 | If you do not provide |
| 355 | <replaceable>recipe</replaceable>, the command |
| 356 | makes an attempt to determine the recipe name. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 357 | </para></listitem> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 358 | <listitem><para> |
| 359 | <emphasis>Middle</emphasis>: |
| 360 | The middle scenario in the figure also |
| 361 | represents a situation where the source code |
| 362 | does not exist locally. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 363 | In this case, the code is again upstream |
| 364 | and needs to be extracted to some |
| 365 | local area - this time outside of the default |
| 366 | workspace. |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 367 | <note> |
| 368 | If required, <filename>devtool</filename> |
| 369 | always creates |
| 370 | a Git repository locally during the |
| 371 | extraction. |
| 372 | </note> |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 373 | Furthermore, the first positional argument |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 374 | <replaceable>srctree</replaceable> in this |
| 375 | case identifies where the |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 376 | <filename>devtool add</filename> command |
| 377 | will locate the extracted code outside of the |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 378 | workspace. |
| 379 | You need to specify an empty directory: |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 380 | <literallayout class='monospaced'> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 381 | $ devtool add <replaceable>recipe srctree fetchuri</replaceable> |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 382 | </literallayout> |
| 383 | In summary, the source code is pulled from |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 384 | <replaceable>fetchuri</replaceable> and |
| 385 | extracted into the location defined by |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 386 | <replaceable>srctree</replaceable> as a local |
| 387 | Git repository.</para> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 388 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 389 | <para>Within workspace, |
| 390 | <filename>devtool</filename> creates a |
| 391 | recipe named <replaceable>recipe</replaceable> |
| 392 | along with an associated append file. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 393 | </para></listitem> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 394 | <listitem><para> |
| 395 | <emphasis>Right</emphasis>: |
| 396 | The right scenario in the figure represents a |
| 397 | situation where the |
| 398 | <replaceable>srctree</replaceable> has been |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 399 | previously prepared outside of the |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 400 | <filename>devtool</filename> workspace.</para> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 401 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 402 | <para>The following command provides a new |
| 403 | recipe name and identifies the existing source |
| 404 | tree location: |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 405 | <literallayout class='monospaced'> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 406 | $ devtool add <replaceable>recipe srctree</replaceable> |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 407 | </literallayout> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 408 | The command examines the source code and |
| 409 | creates a recipe named |
| 410 | <replaceable>recipe</replaceable> for the code |
| 411 | and places the recipe into the workspace. |
| 412 | </para> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 413 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 414 | <para>Because the extracted source code already |
| 415 | exists, <filename>devtool</filename> does not |
| 416 | try to relocate the source code into the |
| 417 | workspace - only the new recipe is placed |
| 418 | in the workspace.</para> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 419 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 420 | <para>Aside from a recipe folder, the command |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 421 | also creates an associated append folder and |
| 422 | places an initial |
| 423 | <filename>*.bbappend</filename> file within. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 424 | </para></listitem> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 425 | </itemizedlist> |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 426 | </para></listitem> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 427 | <listitem><para> |
| 428 | <emphasis>Edit the Recipe</emphasis>: |
| 429 | You can use <filename>devtool edit-recipe</filename> |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 430 | to open up the editor as defined by the |
| 431 | <filename>$EDITOR</filename> environment variable |
| 432 | and modify the file: |
| 433 | <literallayout class='monospaced'> |
| 434 | $ devtool edit-recipe <replaceable>recipe</replaceable> |
| 435 | </literallayout> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 436 | From within the editor, you can make modifications to |
| 437 | the recipe that take affect when you build it later. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 438 | </para></listitem> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 439 | <listitem><para> |
| 440 | <emphasis>Build the Recipe or Rebuild the Image</emphasis>: |
| 441 | The next step you take depends on what you are going |
| 442 | to do with the new code.</para> |
| 443 | |
| 444 | <para>If you need to eventually move the build output |
| 445 | to the target hardware, use the following |
| 446 | <filename>devtool</filename> command: |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 447 | <literallayout class='monospaced'> |
| 448 | $ devtool build <replaceable>recipe</replaceable> |
| 449 | </literallayout></para> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 450 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 451 | <para>On the other hand, if you want an image to |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 452 | contain the recipe's packages from the workspace |
| 453 | for immediate deployment onto a device (e.g. for |
| 454 | testing purposes), you can use |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 455 | the <filename>devtool build-image</filename> command: |
| 456 | <literallayout class='monospaced'> |
| 457 | $ devtool build-image <replaceable>image</replaceable> |
| 458 | </literallayout> |
| 459 | </para></listitem> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 460 | <listitem><para> |
| 461 | <emphasis>Deploy the Build Output</emphasis>: |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 462 | When you use the <filename>devtool build</filename> |
| 463 | command to build out your recipe, you probably want to |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 464 | see if the resulting build output works as expected |
| 465 | on the target hardware. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 466 | <note> |
| 467 | This step assumes you have a previously built |
| 468 | image that is already either running in QEMU or |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 469 | is running on actual hardware. |
| 470 | Also, it is assumed that for deployment of the |
| 471 | image to the target, SSH is installed in the image |
| 472 | and, if the image is running on real hardware, |
| 473 | you have network access to and from your |
| 474 | development machine. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 475 | </note> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 476 | You can deploy your build output to that target |
| 477 | hardware by using the |
| 478 | <filename>devtool deploy-target</filename> command: |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 479 | <literallayout class='monospaced'> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 480 | $ devtool deploy-target <replaceable>recipe target</replaceable> |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 481 | </literallayout> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 482 | The <replaceable>target</replaceable> is a live target |
| 483 | machine running as an SSH server.</para> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 484 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 485 | <para>You can, of course, also deploy the image you |
| 486 | build to actual hardware by using the |
| 487 | <filename>devtool build-image</filename> command. |
| 488 | However, <filename>devtool</filename> does not provide |
| 489 | a specific command that allows you to deploy the |
| 490 | image to actual hardware. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 491 | </para></listitem> |
| 492 | <listitem><para> |
| 493 | <emphasis>Finish Your Work With the Recipe</emphasis>: |
| 494 | The <filename>devtool finish</filename> command creates |
| 495 | any patches corresponding to commits in the local |
| 496 | Git repository, moves the new recipe to a more permanent |
| 497 | layer, and then resets the recipe so that the recipe is |
| 498 | built normally rather than from the workspace. |
| 499 | <literallayout class='monospaced'> |
| 500 | $ devtool finish <replaceable>recipe layer</replaceable> |
| 501 | </literallayout> |
| 502 | <note> |
| 503 | Any changes you want to turn into patches must be |
| 504 | committed to the Git repository in the source tree. |
| 505 | </note></para> |
| 506 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 507 | <para>As mentioned, the |
| 508 | <filename>devtool finish</filename> command moves the |
| 509 | final recipe to its permanent layer. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 510 | </para> |
| 511 | |
| 512 | <para>As a final process of the |
| 513 | <filename>devtool finish</filename> command, the state |
| 514 | of the standard layers and the upstream source is |
| 515 | restored so that you can build the recipe from those |
| 516 | areas rather than the workspace. |
| 517 | <note> |
| 518 | You can use the <filename>devtool reset</filename> |
| 519 | command to put things back should you decide you |
| 520 | do not want to proceed with your work. |
| 521 | If you do use this command, realize that the source |
| 522 | tree is preserved. |
| 523 | </note> |
| 524 | </para></listitem> |
| 525 | </orderedlist> |
| 526 | </para> |
| 527 | </section> |
| 528 | |
| 529 | <section id='sdk-devtool-use-devtool-modify-to-modify-the-source-of-an-existing-component'> |
| 530 | <title>Use <filename>devtool modify</filename> to Modify the Source of an Existing Component</title> |
| 531 | |
| 532 | <para> |
| 533 | The <filename>devtool modify</filename> command prepares the |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 534 | way to work on existing code that already has a local recipe in |
| 535 | place that is used to build the software. |
| 536 | The command is flexible enough to allow you to extract code |
| 537 | from an upstream source, specify the existing recipe, and |
| 538 | keep track of and gather any patch files from other developers |
| 539 | that are associated with the code. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 540 | </para> |
| 541 | |
| 542 | <para> |
| 543 | Depending on your particular scenario, the arguments and options |
| 544 | you use with <filename>devtool modify</filename> form different |
| 545 | combinations. |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 546 | The following diagram shows common development flows for the |
| 547 | <filename>devtool modify</filename> command: |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 548 | </para> |
| 549 | |
| 550 | <para> |
| 551 | <imagedata fileref="figures/sdk-devtool-modify-flow.png" align="center" /> |
| 552 | </para> |
| 553 | |
| 554 | <para> |
| 555 | <orderedlist> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 556 | <listitem><para> |
| 557 | <emphasis>Preparing to Modify the Code</emphasis>: |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 558 | The top part of the flow shows three scenarios by which |
| 559 | you could use <filename>devtool modify</filename> to |
| 560 | prepare to work on source files. |
| 561 | Each scenario assumes the following: |
| 562 | <itemizedlist> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 563 | <listitem><para> |
| 564 | The recipe exists locally in a layer external |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 565 | to the <filename>devtool</filename> workspace. |
| 566 | </para></listitem> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 567 | <listitem><para> |
| 568 | The source files exist either upstream in an |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 569 | un-extracted state or locally in a previously |
| 570 | extracted state. |
| 571 | </para></listitem> |
| 572 | </itemizedlist> |
| 573 | The typical situation is where another developer has |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 574 | created a layer for use with the Yocto Project and |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 575 | their recipe already resides in that layer. |
| 576 | Furthermore, their source code is readily available |
| 577 | either upstream or locally. |
| 578 | <itemizedlist> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 579 | <listitem><para> |
| 580 | <emphasis>Left</emphasis>: |
| 581 | The left scenario in the figure represents a |
| 582 | common situation where the source code does |
| 583 | not exist locally and it needs to be extracted |
| 584 | from an upstream source. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 585 | In this situation, the source is extracted |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 586 | into the default <filename>devtool</filename> |
| 587 | workspace location. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 588 | The recipe, in this scenario, is in its own |
| 589 | layer outside the workspace |
| 590 | (i.e. |
| 591 | <filename>meta-</filename><replaceable>layername</replaceable>). |
| 592 | </para> |
| 593 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 594 | <para>The following command identifies the |
| 595 | recipe and, by default, extracts the source |
| 596 | files: |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 597 | <literallayout class='monospaced'> |
| 598 | $ devtool modify <replaceable>recipe</replaceable> |
| 599 | </literallayout> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 600 | Once <filename>devtool</filename>locates the |
| 601 | recipe, <filename>devtool</filename> uses the |
| 602 | recipe's |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 603 | <ulink url='&YOCTO_DOCS_REF_URL;#var-SRC_URI'><filename>SRC_URI</filename></ulink> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 604 | statements to locate the source code and any |
| 605 | local patch files from other developers.</para> |
| 606 | |
| 607 | <para>With this scenario, no |
| 608 | <replaceable>srctree</replaceable> argument |
| 609 | exists. |
| 610 | Consequently, the default behavior of the |
| 611 | <filename>devtool modify</filename> command is |
| 612 | to extract the source files pointed to by the |
| 613 | <filename>SRC_URI</filename> statements into a |
| 614 | local Git structure. |
| 615 | Furthermore, the location for the extracted |
| 616 | source is the default area within the |
| 617 | <filename>devtool</filename> workspace. |
| 618 | The result is that the command sets up both |
| 619 | the source code and an append file within the |
| 620 | workspace while the recipe remains in its |
Brad Bishop | 96ff198 | 2019-08-19 13:50:42 -0400 | [diff] [blame] | 621 | original location.</para> |
| 622 | |
| 623 | <para>Additionally, if you have any non-patch |
| 624 | local files (i.e. files referred to with |
| 625 | <filename>file://</filename> entries in |
| 626 | <filename>SRC_URI</filename> statement excluding |
| 627 | <filename>*.patch/</filename> or |
| 628 | <filename>*.diff</filename>), these files are |
| 629 | copied to an |
| 630 | <filename>oe-local-files</filename> folder |
| 631 | under the newly created source tree. |
| 632 | Copying the files here gives you a convenient |
| 633 | area from which you can modify the files. |
| 634 | Any changes or additions you make to those |
| 635 | files are incorporated into the build the next |
| 636 | time you build the software just as are other |
| 637 | changes you might have made to the source. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 638 | </para></listitem> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 639 | <listitem><para> |
| 640 | <emphasis>Middle</emphasis>: |
| 641 | The middle scenario in the figure represents a |
| 642 | situation where the source code also does not |
| 643 | exist locally. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 644 | In this case, the code is again upstream |
| 645 | and needs to be extracted to some |
| 646 | local area as a Git repository. |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 647 | The recipe, in this scenario, is again local |
| 648 | and in its own layer outside the workspace. |
| 649 | </para> |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 650 | |
| 651 | <para>The following command tells |
Brad Bishop | 96ff198 | 2019-08-19 13:50:42 -0400 | [diff] [blame] | 652 | <filename>devtool</filename> the recipe with |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 653 | which to work and, in this case, identifies a |
| 654 | local area for the extracted source files that |
Brad Bishop | 96ff198 | 2019-08-19 13:50:42 -0400 | [diff] [blame] | 655 | exists outside of the default |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 656 | <filename>devtool</filename> workspace: |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 657 | <literallayout class='monospaced'> |
| 658 | $ devtool modify <replaceable>recipe srctree</replaceable> |
| 659 | </literallayout> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 660 | <note> |
| 661 | You cannot provide a URL for |
| 662 | <replaceable>srctree</replaceable> using |
| 663 | the <filename>devtool</filename> command. |
| 664 | </note> |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 665 | As with all extractions, the command uses |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 666 | the recipe's <filename>SRC_URI</filename> |
| 667 | statements to locate the source files and any |
| 668 | associated patch files. |
Brad Bishop | 96ff198 | 2019-08-19 13:50:42 -0400 | [diff] [blame] | 669 | Non-patch files are copied to an |
| 670 | <filename>oe-local-files</filename> folder |
| 671 | under the newly created source tree.</para> |
| 672 | |
| 673 | <para>Once the files are located, the command |
| 674 | by default extracts them into |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 675 | <replaceable>srctree</replaceable>.</para> |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 676 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 677 | <para>Within workspace, |
| 678 | <filename>devtool</filename> creates an append |
| 679 | file for the recipe. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 680 | The recipe remains in its original location but |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 681 | the source files are extracted to the location |
| 682 | you provide with |
| 683 | <replaceable>srctree</replaceable>. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 684 | </para></listitem> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 685 | <listitem><para> |
| 686 | <emphasis>Right</emphasis>: |
| 687 | The right scenario in the figure represents a |
| 688 | situation where the source tree |
| 689 | (<replaceable>srctree</replaceable>) already |
| 690 | exists locally as a previously extracted Git |
| 691 | structure outside of the |
| 692 | <filename>devtool</filename> workspace. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 693 | In this example, the recipe also exists |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 694 | elsewhere locally in its own layer. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 695 | </para> |
| 696 | |
| 697 | <para>The following command tells |
| 698 | <filename>devtool</filename> the recipe |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 699 | with which to work, uses the "-n" option to |
| 700 | indicate source does not need to be extracted, |
| 701 | and uses <replaceable>srctree</replaceable> to |
| 702 | point to the previously extracted source files: |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 703 | <literallayout class='monospaced'> |
| 704 | $ devtool modify -n <replaceable>recipe srctree</replaceable> |
| 705 | </literallayout> |
| 706 | </para> |
| 707 | |
Brad Bishop | 96ff198 | 2019-08-19 13:50:42 -0400 | [diff] [blame] | 708 | <para>If an <filename>oe-local-files</filename> |
| 709 | subdirectory happens to exist and it contains |
| 710 | non-patch files, the files are used. |
| 711 | However, if the subdirectory does not exist and |
| 712 | you run the <filename>devtool finish</filename> |
| 713 | command, any non-patch files that might exist |
| 714 | next to the recipe are removed because it |
| 715 | appears to <filename>devtool</filename> that |
| 716 | you have deleted those files.</para> |
| 717 | |
| 718 | <para>Once the |
| 719 | <filename>devtool modify</filename> command |
| 720 | finishes, it creates only an append file for |
| 721 | the recipe in the <filename>devtool</filename> |
| 722 | workspace. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 723 | The recipe and the source code remain in their |
| 724 | original locations. |
| 725 | </para></listitem> |
| 726 | </itemizedlist> |
| 727 | </para></listitem> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 728 | <listitem><para> |
| 729 | <emphasis>Edit the Source</emphasis>: |
| 730 | Once you have used the |
| 731 | <filename>devtool modify</filename> command, you are |
| 732 | free to make changes to the source files. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 733 | You can use any editor you like to make and save |
| 734 | your source code modifications. |
| 735 | </para></listitem> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 736 | <listitem><para> |
| 737 | <emphasis>Build the Recipe or Rebuild the Image</emphasis>: |
| 738 | The next step you take depends on what you are going |
| 739 | to do with the new code.</para> |
| 740 | |
| 741 | <para>If you need to eventually move the build output |
| 742 | to the target hardware, use the following |
| 743 | <filename>devtool</filename> command: |
| 744 | <literallayout class='monospaced'> |
| 745 | $ devtool build <replaceable>recipe</replaceable> |
| 746 | </literallayout></para> |
| 747 | |
| 748 | <para>On the other hand, if you want an image to |
| 749 | contain the recipe's packages from the workspace |
| 750 | for immediate deployment onto a device (e.g. for |
| 751 | testing purposes), you can use |
| 752 | the <filename>devtool build-image</filename> command: |
| 753 | <literallayout class='monospaced'> |
| 754 | $ devtool build-image <replaceable>image</replaceable> |
| 755 | </literallayout> |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 756 | </para></listitem> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 757 | <listitem><para> |
| 758 | <emphasis>Deploy the Build Output</emphasis>: |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 759 | When you use the <filename>devtool build</filename> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 760 | command to build out your recipe, you probably want to |
| 761 | see if the resulting build output works as expected |
| 762 | on target hardware. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 763 | <note> |
| 764 | This step assumes you have a previously built |
| 765 | image that is already either running in QEMU or |
| 766 | running on actual hardware. |
| 767 | Also, it is assumed that for deployment of the image |
| 768 | to the target, SSH is installed in the image and if |
| 769 | the image is running on real hardware that you have |
| 770 | network access to and from your development machine. |
| 771 | </note> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 772 | You can deploy your build output to that target |
| 773 | hardware by using the |
| 774 | <filename>devtool deploy-target</filename> command: |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 775 | <literallayout class='monospaced'> |
| 776 | $ devtool deploy-target <replaceable>recipe target</replaceable> |
| 777 | </literallayout> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 778 | The <replaceable>target</replaceable> is a live target |
| 779 | machine running as an SSH server.</para> |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 780 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 781 | <para>You can, of course, use other methods to deploy |
| 782 | the image you built using the |
| 783 | <filename>devtool build-image</filename> command to |
| 784 | actual hardware. |
| 785 | <filename>devtool</filename> does not provide |
| 786 | a specific command to deploy the image to actual |
| 787 | hardware. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 788 | </para></listitem> |
| 789 | <listitem><para> |
| 790 | <emphasis>Finish Your Work With the Recipe</emphasis>: |
| 791 | The <filename>devtool finish</filename> command creates |
| 792 | any patches corresponding to commits in the local |
| 793 | Git repository, updates the recipe to point to them |
| 794 | (or creates a <filename>.bbappend</filename> file to do |
| 795 | so, depending on the specified destination layer), and |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 796 | then resets the recipe so that the recipe is built |
| 797 | normally rather than from the workspace. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 798 | <literallayout class='monospaced'> |
| 799 | $ devtool finish <replaceable>recipe layer</replaceable> |
| 800 | </literallayout> |
| 801 | <note> |
| 802 | Any changes you want to turn into patches must be |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 803 | staged and committed within the local Git |
| 804 | repository before you use the |
| 805 | <filename>devtool finish</filename> command. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 806 | </note></para> |
| 807 | |
| 808 | <para>Because there is no need to move the recipe, |
| 809 | <filename>devtool finish</filename> either updates the |
| 810 | original recipe in the original layer or the command |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 811 | creates a <filename>.bbappend</filename> file in a |
| 812 | different layer as provided by |
Brad Bishop | 96ff198 | 2019-08-19 13:50:42 -0400 | [diff] [blame] | 813 | <replaceable>layer</replaceable>. |
| 814 | Any work you did in the |
| 815 | <filename>oe-local-files</filename> directory is |
| 816 | preserved in the original files next to the recipe |
| 817 | during the <filename>devtool finish</filename> |
| 818 | command.</para> |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 819 | |
| 820 | <para>As a final process of the |
| 821 | <filename>devtool finish</filename> command, the state |
| 822 | of the standard layers and the upstream source is |
| 823 | restored so that you can build the recipe from those |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 824 | areas rather than from the workspace. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 825 | <note> |
| 826 | You can use the <filename>devtool reset</filename> |
| 827 | command to put things back should you decide you |
| 828 | do not want to proceed with your work. |
| 829 | If you do use this command, realize that the source |
| 830 | tree is preserved. |
| 831 | </note> |
| 832 | </para></listitem> |
| 833 | </orderedlist> |
| 834 | </para> |
| 835 | </section> |
| 836 | |
| 837 | <section id='sdk-devtool-use-devtool-upgrade-to-create-a-version-of-the-recipe-that-supports-a-newer-version-of-the-software'> |
| 838 | <title>Use <filename>devtool upgrade</filename> to Create a Version of the Recipe that Supports a Newer Version of the Software</title> |
| 839 | |
| 840 | <para> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 841 | The <filename>devtool upgrade</filename> command upgrades |
| 842 | an existing recipe to that of a more up-to-date version |
| 843 | found upstream. |
| 844 | Throughout the life of software, recipes continually undergo |
| 845 | version upgrades by their upstream publishers. |
| 846 | You can use the <filename>devtool upgrade</filename> |
| 847 | workflow to make sure your recipes you are using for builds |
| 848 | are up-to-date with their upstream counterparts. |
| 849 | <note> |
| 850 | Several methods exist by which you can upgrade recipes - |
| 851 | <filename>devtool upgrade</filename> happens to be one. |
| 852 | You can read about all the methods by which you can |
| 853 | upgrade recipes in the |
| 854 | "<ulink url='&YOCTO_DOCS_DEV_URL;#gs-upgrading-recipes'>Upgrading Recipes</ulink>" |
| 855 | section of the Yocto Project Development Tasks Manual. |
| 856 | </note> |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 857 | </para> |
| 858 | |
| 859 | <para> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 860 | The <filename>devtool upgrade</filename> command is flexible |
| 861 | enough to allow you to specify source code revision and |
| 862 | versioning schemes, extract code into or out of the |
| 863 | <filename>devtool</filename> |
| 864 | <ulink url='&YOCTO_DOCS_REF_URL;#devtool-the-workspace-layer-structure'>workspace</ulink>, |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 865 | and work with any source file forms that the |
| 866 | <ulink url='&YOCTO_DOCS_BB_URL;#bb-fetchers'>fetchers</ulink> |
| 867 | support. |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 868 | </para> |
| 869 | |
| 870 | <para> |
| 871 | The following diagram shows the common development flow |
| 872 | used with the <filename>devtool upgrade</filename> command: |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 873 | </para> |
| 874 | |
| 875 | <para> |
| 876 | <imagedata fileref="figures/sdk-devtool-upgrade-flow.png" align="center" /> |
| 877 | </para> |
| 878 | |
| 879 | <para> |
| 880 | <orderedlist> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 881 | <listitem><para> |
| 882 | <emphasis>Initiate the Upgrade</emphasis>: |
| 883 | The top part of the flow shows the typical scenario by |
| 884 | which you use the <filename>devtool upgrade</filename> |
| 885 | command. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 886 | The following conditions exist: |
| 887 | <itemizedlist> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 888 | <listitem><para> |
| 889 | The recipe exists in a local layer external |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 890 | to the <filename>devtool</filename> workspace. |
| 891 | </para></listitem> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 892 | <listitem><para> |
| 893 | The source files for the new release |
| 894 | exist in the same location pointed to by |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 895 | <ulink url='&YOCTO_DOCS_REF_URL;#var-SRC_URI'><filename>SRC_URI</filename></ulink> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 896 | in the recipe (e.g. a tarball with the new |
| 897 | version number in the name, or as a different |
| 898 | revision in the upstream Git repository). |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 899 | </para></listitem> |
| 900 | </itemizedlist> |
| 901 | A common situation is where third-party software has |
| 902 | undergone a revision so that it has been upgraded. |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 903 | The recipe you have access to is likely in your own |
| 904 | layer. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 905 | Thus, you need to upgrade the recipe to use the |
| 906 | newer version of the software: |
| 907 | <literallayout class='monospaced'> |
| 908 | $ devtool upgrade -V <replaceable>version recipe</replaceable> |
| 909 | </literallayout> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 910 | By default, the <filename>devtool upgrade</filename> |
| 911 | command extracts source code into the |
| 912 | <filename>sources</filename> directory in the |
| 913 | <ulink url='&YOCTO_DOCS_REF_URL;#devtool-the-workspace-layer-structure'>workspace</ulink>. |
| 914 | If you want the code extracted to any other location, |
| 915 | you need to provide the |
| 916 | <replaceable>srctree</replaceable> positional argument |
| 917 | with the command as follows: |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 918 | <literallayout class='monospaced'> |
| 919 | $ devtool upgrade -V <replaceable>version recipe srctree</replaceable> |
| 920 | </literallayout> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 921 | <note> |
| 922 | In this example, the "-V" option specifies the new |
| 923 | version. |
| 924 | If you don't use "-V", the command upgrades the |
| 925 | recipe to the latest version. |
| 926 | </note> |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 927 | If the source files pointed to by the |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 928 | <filename>SRC_URI</filename> statement in the recipe |
| 929 | are in a Git repository, you must provide the "-S" |
| 930 | option and specify a revision for the software.</para> |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 931 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 932 | <para>Once <filename>devtool</filename> locates the |
| 933 | recipe, it uses the <filename>SRC_URI</filename> |
| 934 | variable to locate the source code and any local patch |
| 935 | files from other developers. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 936 | The result is that the command sets up the source |
| 937 | code, the new version of the recipe, and an append file |
Brad Bishop | 96ff198 | 2019-08-19 13:50:42 -0400 | [diff] [blame] | 938 | all within the workspace.</para> |
| 939 | |
| 940 | <para>Additionally, if you have any non-patch |
| 941 | local files (i.e. files referred to with |
| 942 | <filename>file://</filename> entries in |
| 943 | <filename>SRC_URI</filename> statement excluding |
| 944 | <filename>*.patch/</filename> or |
| 945 | <filename>*.diff</filename>), these files are |
| 946 | copied to an |
| 947 | <filename>oe-local-files</filename> folder |
| 948 | under the newly created source tree. |
| 949 | Copying the files here gives you a convenient |
| 950 | area from which you can modify the files. |
| 951 | Any changes or additions you make to those |
| 952 | files are incorporated into the build the next |
| 953 | time you build the software just as are other |
| 954 | changes you might have made to the source. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 955 | </para></listitem> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 956 | <listitem><para> |
| 957 | <emphasis>Resolve any Conflicts created by the Upgrade</emphasis>: |
| 958 | Conflicts could exist due to the software being |
| 959 | upgraded to a new version. |
| 960 | Conflicts occur if your recipe specifies some patch |
| 961 | files in <filename>SRC_URI</filename> that conflict |
| 962 | with changes made in the new version of the software. |
| 963 | For such cases, you need to resolve the conflicts |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 964 | by editing the source and following the normal |
| 965 | <filename>git rebase</filename> conflict resolution |
| 966 | process.</para> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 967 | |
| 968 | <para>Before moving onto the next step, be sure to |
| 969 | resolve any such conflicts created through use of a |
| 970 | newer or different version of the software. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 971 | </para></listitem> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 972 | <listitem><para> |
| 973 | <emphasis>Build the Recipe or Rebuild the Image</emphasis>: |
| 974 | The next step you take depends on what you are going |
| 975 | to do with the new code.</para> |
| 976 | |
| 977 | <para>If you need to eventually move the build output |
| 978 | to the target hardware, use the following |
| 979 | <filename>devtool</filename> command: |
| 980 | <literallayout class='monospaced'> |
| 981 | $ devtool build <replaceable>recipe</replaceable> |
| 982 | </literallayout></para> |
| 983 | |
| 984 | <para>On the other hand, if you want an image to |
| 985 | contain the recipe's packages from the workspace |
| 986 | for immediate deployment onto a device (e.g. for |
| 987 | testing purposes), you can use |
| 988 | the <filename>devtool build-image</filename> command: |
| 989 | <literallayout class='monospaced'> |
| 990 | $ devtool build-image <replaceable>image</replaceable> |
| 991 | </literallayout> |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 992 | </para></listitem> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 993 | <listitem><para> |
| 994 | <emphasis>Deploy the Build Output</emphasis>: |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 995 | When you use the <filename>devtool build</filename> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 996 | command or <filename>bitbake</filename> to build |
| 997 | your recipe, you probably want to see if the resulting |
| 998 | build output works as expected on target hardware. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 999 | <note> |
| 1000 | This step assumes you have a previously built |
| 1001 | image that is already either running in QEMU or |
| 1002 | running on actual hardware. |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1003 | Also, it is assumed that for deployment of the |
| 1004 | image to the target, SSH is installed in the image |
| 1005 | and if the image is running on real hardware that |
| 1006 | you have network access to and from your |
| 1007 | development machine. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1008 | </note> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1009 | You can deploy your build output to that target |
| 1010 | hardware by using the |
| 1011 | <filename>devtool deploy-target</filename> command: |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1012 | <literallayout class='monospaced'> |
| 1013 | $ devtool deploy-target <replaceable>recipe target</replaceable> |
| 1014 | </literallayout> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1015 | The <replaceable>target</replaceable> is a live target |
| 1016 | machine running as an SSH server.</para> |
| 1017 | |
| 1018 | <para>You can, of course, also deploy the image you |
| 1019 | build using the |
| 1020 | <filename>devtool build-image</filename> command |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1021 | to actual hardware. |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1022 | However, <filename>devtool</filename> does not provide |
| 1023 | a specific command that allows you to do this. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1024 | </para></listitem> |
| 1025 | <listitem><para> |
| 1026 | <emphasis>Finish Your Work With the Recipe</emphasis>: |
| 1027 | The <filename>devtool finish</filename> command creates |
| 1028 | any patches corresponding to commits in the local |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1029 | Git repository, moves the new recipe to a more |
| 1030 | permanent layer, and then resets the recipe so that |
| 1031 | the recipe is built normally rather than from the |
Brad Bishop | 96ff198 | 2019-08-19 13:50:42 -0400 | [diff] [blame] | 1032 | workspace.</para> |
| 1033 | |
| 1034 | <para>Any work you did in the |
| 1035 | <filename>oe-local-files</filename> directory is |
| 1036 | preserved in the original files next to the recipe |
| 1037 | during the <filename>devtool finish</filename> |
| 1038 | command.</para> |
| 1039 | |
| 1040 | <para> |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1041 | If you specify a destination layer that is the same as |
| 1042 | the original source, then the old version of the |
Brad Bishop | 96ff198 | 2019-08-19 13:50:42 -0400 | [diff] [blame] | 1043 | recipe and associated files are removed prior to |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1044 | adding the new version. |
| 1045 | <literallayout class='monospaced'> |
| 1046 | $ devtool finish <replaceable>recipe layer</replaceable> |
| 1047 | </literallayout> |
| 1048 | <note> |
| 1049 | Any changes you want to turn into patches must be |
| 1050 | committed to the Git repository in the source tree. |
| 1051 | </note></para> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1052 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1053 | <para>As a final process of the |
| 1054 | <filename>devtool finish</filename> command, the state |
| 1055 | of the standard layers and the upstream source is |
| 1056 | restored so that you can build the recipe from those |
| 1057 | areas rather than the workspace. |
| 1058 | <note> |
| 1059 | You can use the <filename>devtool reset</filename> |
| 1060 | command to put things back should you decide you |
| 1061 | do not want to proceed with your work. |
| 1062 | If you do use this command, realize that the source |
| 1063 | tree is preserved. |
| 1064 | </note> |
| 1065 | </para></listitem> |
| 1066 | </orderedlist> |
| 1067 | </para> |
| 1068 | </section> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1069 | </section> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1070 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1071 | <section id='sdk-a-closer-look-at-devtool-add'> |
| 1072 | <title>A Closer Look at <filename>devtool add</filename></title> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1073 | |
| 1074 | <para> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1075 | The <filename>devtool add</filename> command automatically creates |
| 1076 | a recipe based on the source tree you provide with the command. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1077 | Currently, the command has support for the following: |
| 1078 | <itemizedlist> |
| 1079 | <listitem><para> |
| 1080 | Autotools (<filename>autoconf</filename> and |
| 1081 | <filename>automake</filename>) |
| 1082 | </para></listitem> |
| 1083 | <listitem><para> |
| 1084 | CMake |
| 1085 | </para></listitem> |
| 1086 | <listitem><para> |
| 1087 | Scons |
| 1088 | </para></listitem> |
| 1089 | <listitem><para> |
| 1090 | <filename>qmake</filename> |
| 1091 | </para></listitem> |
| 1092 | <listitem><para> |
| 1093 | Plain <filename>Makefile</filename> |
| 1094 | </para></listitem> |
| 1095 | <listitem><para> |
| 1096 | Out-of-tree kernel module |
| 1097 | </para></listitem> |
| 1098 | <listitem><para> |
| 1099 | Binary package (i.e. "-b" option) |
| 1100 | </para></listitem> |
| 1101 | <listitem><para> |
| 1102 | Node.js module |
| 1103 | </para></listitem> |
| 1104 | <listitem><para> |
| 1105 | Python modules that use <filename>setuptools</filename> |
| 1106 | or <filename>distutils</filename> |
| 1107 | </para></listitem> |
| 1108 | </itemizedlist> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1109 | </para> |
| 1110 | |
| 1111 | <para> |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1112 | Apart from binary packages, the determination of how a source tree |
| 1113 | should be treated is automatic based on the files present within |
| 1114 | that source tree. |
| 1115 | For example, if a <filename>CMakeLists.txt</filename> file is found, |
| 1116 | then the source tree is assumed to be using |
| 1117 | CMake and is treated accordingly. |
| 1118 | <note> |
| 1119 | In most cases, you need to edit the automatically generated |
| 1120 | recipe in order to make it build properly. |
| 1121 | Typically, you would go through several edit and build cycles |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1122 | until the recipe successfully builds. |
| 1123 | Once the recipe builds, you could use possible further |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1124 | iterations to test the recipe on the target device. |
| 1125 | </note> |
| 1126 | </para> |
| 1127 | |
| 1128 | <para> |
| 1129 | The remainder of this section covers specifics regarding how parts |
| 1130 | of the recipe are generated. |
| 1131 | </para> |
| 1132 | |
| 1133 | <section id='sdk-name-and-version'> |
| 1134 | <title>Name and Version</title> |
| 1135 | |
| 1136 | <para> |
| 1137 | If you do not specify a name and version on the command |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1138 | line, <filename>devtool add</filename> uses various metadata |
| 1139 | within the source tree in an attempt to determine |
| 1140 | the name and version of the software being built. |
| 1141 | Based on what the tool determines, <filename>devtool</filename> |
| 1142 | sets the name of the created recipe file accordingly. |
| 1143 | </para> |
| 1144 | |
| 1145 | <para> |
| 1146 | If <filename>devtool</filename> cannot determine the name and |
| 1147 | version, the command prints an error. |
| 1148 | For such cases, you must re-run the command and provide |
| 1149 | the name and version, just the name, or just the version as |
| 1150 | part of the command line. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1151 | </para> |
| 1152 | |
| 1153 | <para> |
| 1154 | Sometimes the name or version determined from the source tree |
| 1155 | might be incorrect. |
| 1156 | For such a case, you must reset the recipe: |
| 1157 | <literallayout class='monospaced'> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1158 | $ devtool reset -n <replaceable>recipename</replaceable> |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1159 | </literallayout> |
| 1160 | After running the <filename>devtool reset</filename> command, |
| 1161 | you need to run <filename>devtool add</filename> again and |
| 1162 | provide the name or the version. |
| 1163 | </para> |
| 1164 | </section> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1165 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1166 | <section id='sdk-dependency-detection-and-mapping'> |
| 1167 | <title>Dependency Detection and Mapping</title> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1168 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1169 | <para> |
| 1170 | The <filename>devtool add</filename> command attempts to |
| 1171 | detect build-time dependencies and map them to other recipes |
| 1172 | in the system. |
| 1173 | During this mapping, the command fills in the names of those |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1174 | recipes as part of the |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1175 | <ulink url='&YOCTO_DOCS_REF_URL;#var-DEPENDS'><filename>DEPENDS</filename></ulink> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1176 | variable within the recipe. |
| 1177 | If a dependency cannot be mapped, <filename>devtool</filename> |
| 1178 | places a comment in the recipe indicating such. |
| 1179 | The inability to map a dependency can result from naming not |
| 1180 | being recognized or because the dependency simply is not |
| 1181 | available. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1182 | For cases where the dependency is not available, you must use |
| 1183 | the <filename>devtool add</filename> command to add an |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1184 | additional recipe that satisfies the dependency. |
| 1185 | Once you add that recipe, you need to update the |
| 1186 | <filename>DEPENDS</filename> variable in the original recipe |
| 1187 | to include the new recipe. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1188 | </para> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1189 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1190 | <para> |
| 1191 | If you need to add runtime dependencies, you can do so by |
| 1192 | adding the following to your recipe: |
| 1193 | <literallayout class='monospaced'> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1194 | RDEPENDS_${PN} += "<replaceable>dependency1 dependency2 ...</replaceable>" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1195 | </literallayout> |
| 1196 | <note> |
| 1197 | The <filename>devtool add</filename> command often cannot |
| 1198 | distinguish between mandatory and optional dependencies. |
| 1199 | Consequently, some of the detected dependencies might |
| 1200 | in fact be optional. |
| 1201 | When in doubt, consult the documentation or the configure |
| 1202 | script for the software the recipe is building for further |
| 1203 | details. |
| 1204 | In some cases, you might find you can substitute the |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1205 | dependency with an option that disables the associated |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1206 | functionality passed to the configure script. |
| 1207 | </note> |
| 1208 | </para> |
| 1209 | </section> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1210 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1211 | <section id='sdk-license-detection'> |
| 1212 | <title>License Detection</title> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1213 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1214 | <para> |
| 1215 | The <filename>devtool add</filename> command attempts to |
| 1216 | determine if the software you are adding is able to be |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1217 | distributed under a common, open-source license. |
| 1218 | If so, the command sets the |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1219 | <ulink url='&YOCTO_DOCS_REF_URL;#var-LICENSE'><filename>LICENSE</filename></ulink> |
| 1220 | value accordingly. |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1221 | You should double-check the value added by the command against |
| 1222 | the documentation or source files for the software you are |
| 1223 | building and, if necessary, update that |
| 1224 | <filename>LICENSE</filename> value. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1225 | </para> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1226 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1227 | <para> |
| 1228 | The <filename>devtool add</filename> command also sets the |
| 1229 | <ulink url='&YOCTO_DOCS_REF_URL;#var-LIC_FILES_CHKSUM'><filename>LIC_FILES_CHKSUM</filename></ulink> |
| 1230 | value to point to all files that appear to be license-related. |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1231 | Realize that license statements often appear in comments at |
| 1232 | the top of source files or within the documentation. |
| 1233 | In such cases, the command does not recognize those license |
| 1234 | statements. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1235 | Consequently, you might need to amend the |
| 1236 | <filename>LIC_FILES_CHKSUM</filename> variable to point to one |
| 1237 | or more of those comments if present. |
| 1238 | Setting <filename>LIC_FILES_CHKSUM</filename> is particularly |
| 1239 | important for third-party software. |
| 1240 | The mechanism attempts to ensure correct licensing should you |
| 1241 | upgrade the recipe to a newer upstream version in future. |
| 1242 | Any change in licensing is detected and you receive an error |
| 1243 | prompting you to check the license text again. |
| 1244 | </para> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1245 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1246 | <para> |
| 1247 | If the <filename>devtool add</filename> command cannot |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1248 | determine licensing information, <filename>devtool</filename> |
| 1249 | sets the <filename>LICENSE</filename> value to "CLOSED" and |
| 1250 | leaves the <filename>LIC_FILES_CHKSUM</filename> value unset. |
| 1251 | This behavior allows you to continue with development even |
| 1252 | though the settings are unlikely to be correct in all cases. |
| 1253 | You should check the documentation or source files for the |
| 1254 | software you are building to determine the actual license. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1255 | </para> |
| 1256 | </section> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1257 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1258 | <section id='sdk-adding-makefile-only-software'> |
| 1259 | <title>Adding Makefile-Only Software</title> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1260 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1261 | <para> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1262 | The use of Make by itself is very common in both proprietary |
| 1263 | and open-source software. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1264 | Unfortunately, Makefiles are often not written with |
| 1265 | cross-compilation in mind. |
| 1266 | Thus, <filename>devtool add</filename> often cannot do very |
| 1267 | much to ensure that these Makefiles build correctly. |
| 1268 | It is very common, for example, to explicitly call |
| 1269 | <filename>gcc</filename> instead of using the |
| 1270 | <ulink url='&YOCTO_DOCS_REF_URL;#var-CC'><filename>CC</filename></ulink> |
| 1271 | variable. |
| 1272 | Usually, in a cross-compilation environment, |
| 1273 | <filename>gcc</filename> is the compiler for the build host |
| 1274 | and the cross-compiler is named something similar to |
| 1275 | <filename>arm-poky-linux-gnueabi-gcc</filename> and might |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1276 | require arguments (e.g. to point to the associated sysroot |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1277 | for the target machine). |
| 1278 | </para> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1279 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1280 | <para> |
| 1281 | When writing a recipe for Makefile-only software, keep the |
| 1282 | following in mind: |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1283 | <itemizedlist> |
| 1284 | <listitem><para> |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1285 | You probably need to patch the Makefile to use |
| 1286 | variables instead of hardcoding tools within the |
| 1287 | toolchain such as <filename>gcc</filename> and |
| 1288 | <filename>g++</filename>. |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1289 | </para></listitem> |
| 1290 | <listitem><para> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1291 | The environment in which Make runs is set up with |
| 1292 | various standard variables for compilation (e.g. |
| 1293 | <filename>CC</filename>, <filename>CXX</filename>, and |
| 1294 | so forth) in a similar manner to the environment set |
| 1295 | up by the SDK's environment setup script. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1296 | One easy way to see these variables is to run the |
| 1297 | <filename>devtool build</filename> command on the |
| 1298 | recipe and then look in |
| 1299 | <filename>oe-logs/run.do_compile</filename>. |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1300 | Towards the top of this file, a list of environment |
| 1301 | variables exists that are being set. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1302 | You can take advantage of these variables within the |
| 1303 | Makefile. |
| 1304 | </para></listitem> |
| 1305 | <listitem><para> |
| 1306 | If the Makefile sets a default for a variable using "=", |
| 1307 | that default overrides the value set in the environment, |
| 1308 | which is usually not desirable. |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1309 | For this case, you can either patch the Makefile |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1310 | so it sets the default using the "?=" operator, or |
| 1311 | you can alternatively force the value on the |
| 1312 | <filename>make</filename> command line. |
| 1313 | To force the value on the command line, add the |
| 1314 | variable setting to |
| 1315 | <ulink url='&YOCTO_DOCS_REF_URL;#var-EXTRA_OEMAKE'><filename>EXTRA_OEMAKE</filename></ulink> |
| 1316 | or |
| 1317 | <ulink url='&YOCTO_DOCS_REF_URL;#var-PACKAGECONFIG_CONFARGS'><filename>PACKAGECONFIG_CONFARGS</filename></ulink> |
| 1318 | within the recipe. |
| 1319 | Here is an example using <filename>EXTRA_OEMAKE</filename>: |
| 1320 | <literallayout class='monospaced'> |
| 1321 | EXTRA_OEMAKE += "'CC=${CC}' 'CXX=${CXX}'" |
| 1322 | </literallayout> |
| 1323 | In the above example, single quotes are used around the |
| 1324 | variable settings as the values are likely to contain |
| 1325 | spaces because required default options are passed to |
| 1326 | the compiler. |
| 1327 | </para></listitem> |
| 1328 | <listitem><para> |
| 1329 | Hardcoding paths inside Makefiles is often problematic |
| 1330 | in a cross-compilation environment. |
| 1331 | This is particularly true because those hardcoded paths |
| 1332 | often point to locations on the build host and thus |
| 1333 | will either be read-only or will introduce |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1334 | contamination into the cross-compilation because they |
| 1335 | are specific to the build host rather than the target. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1336 | Patching the Makefile to use prefix variables or other |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1337 | path variables is usually the way to handle this |
| 1338 | situation. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1339 | </para></listitem> |
| 1340 | <listitem><para> |
| 1341 | Sometimes a Makefile runs target-specific commands such |
| 1342 | as <filename>ldconfig</filename>. |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1343 | For such cases, you might be able to apply patches that |
| 1344 | remove these commands from the Makefile. |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1345 | </para></listitem> |
| 1346 | </itemizedlist> |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1347 | </para> |
| 1348 | </section> |
| 1349 | |
| 1350 | <section id='sdk-adding-native-tools'> |
| 1351 | <title>Adding Native Tools</title> |
| 1352 | |
| 1353 | <para> |
| 1354 | Often, you need to build additional tools that run on the |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1355 | <ulink url='&YOCTO_DOCS_REF_URL;#hardware-build-system-term'>build host</ulink> |
| 1356 | as opposed to the target. |
| 1357 | You should indicate this requirement by using one of the |
| 1358 | following methods when you run |
| 1359 | <filename>devtool add</filename>: |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1360 | <itemizedlist> |
| 1361 | <listitem><para> |
| 1362 | Specify the name of the recipe such that it ends |
| 1363 | with "-native". |
| 1364 | Specifying the name like this produces a recipe that |
| 1365 | only builds for the build host. |
| 1366 | </para></listitem> |
| 1367 | <listitem><para> |
| 1368 | Specify the "‐‐also-native" option with the |
| 1369 | <filename>devtool add</filename> command. |
| 1370 | Specifying this option creates a recipe file that still |
| 1371 | builds for the target but also creates a variant with |
| 1372 | a "-native" suffix that builds for the build host. |
| 1373 | </para></listitem> |
| 1374 | </itemizedlist> |
| 1375 | <note> |
| 1376 | If you need to add a tool that is shipped as part of a |
| 1377 | source tree that builds code for the target, you can |
| 1378 | typically accomplish this by building the native and target |
| 1379 | parts separately rather than within the same compilation |
| 1380 | process. |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1381 | Realize though that with the "‐‐also-native" |
| 1382 | option, you can add the tool using just one recipe file. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1383 | </note> |
| 1384 | </para> |
| 1385 | </section> |
| 1386 | |
| 1387 | <section id='sdk-adding-node-js-modules'> |
| 1388 | <title>Adding Node.js Modules</title> |
| 1389 | |
| 1390 | <para> |
| 1391 | You can use the <filename>devtool add</filename> command two |
| 1392 | different ways to add Node.js modules: 1) Through |
| 1393 | <filename>npm</filename> and, 2) from a repository or local |
| 1394 | source. |
| 1395 | </para> |
| 1396 | |
| 1397 | <para> |
| 1398 | Use the following form to add Node.js modules through |
| 1399 | <filename>npm</filename>: |
| 1400 | <literallayout class='monospaced'> |
| 1401 | $ devtool add "npm://registry.npmjs.org;name=forever;version=0.15.1" |
| 1402 | </literallayout> |
| 1403 | The name and version parameters are mandatory. |
| 1404 | Lockdown and shrinkwrap files are generated and pointed to by |
| 1405 | the recipe in order to freeze the version that is fetched for |
| 1406 | the dependencies according to the first time. |
| 1407 | This also saves checksums that are verified on future fetches. |
| 1408 | Together, these behaviors ensure the reproducibility and |
| 1409 | integrity of the build. |
| 1410 | <note><title>Notes</title> |
| 1411 | <itemizedlist> |
| 1412 | <listitem><para> |
| 1413 | You must use quotes around the URL. |
| 1414 | The <filename>devtool add</filename> does not require |
| 1415 | the quotes, but the shell considers ";" as a splitter |
| 1416 | between multiple commands. |
| 1417 | Thus, without the quotes, |
| 1418 | <filename>devtool add</filename> does not receive the |
| 1419 | other parts, which results in several "command not |
| 1420 | found" errors. |
| 1421 | </para></listitem> |
| 1422 | <listitem><para> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1423 | In order to support adding Node.js modules, a |
| 1424 | <filename>nodejs</filename> recipe must be part |
| 1425 | of your SDK. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1426 | </para></listitem> |
| 1427 | </itemizedlist> |
| 1428 | </note> |
| 1429 | </para> |
| 1430 | |
| 1431 | <para> |
| 1432 | As mentioned earlier, you can also add Node.js modules |
| 1433 | directly from a repository or local source tree. |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1434 | To add modules this way, use <filename>devtool add</filename> |
| 1435 | in the following form: |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1436 | <literallayout class='monospaced'> |
| 1437 | $ devtool add https://github.com/diversario/node-ssdp |
| 1438 | </literallayout> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1439 | In this example, <filename>devtool</filename> fetches the |
| 1440 | specified Git repository, detects the code as Node.js |
| 1441 | code, fetches dependencies using <filename>npm</filename>, and |
| 1442 | sets |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1443 | <ulink url='&YOCTO_DOCS_REF_URL;#var-SRC_URI'><filename>SRC_URI</filename></ulink> |
| 1444 | accordingly. |
| 1445 | </para> |
| 1446 | </section> |
| 1447 | </section> |
| 1448 | |
| 1449 | <section id='sdk-working-with-recipes'> |
| 1450 | <title>Working With Recipes</title> |
| 1451 | |
| 1452 | <para> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1453 | When building a recipe using the |
| 1454 | <filename>devtool build</filename> command, the typical build |
| 1455 | progresses as follows: |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1456 | <orderedlist> |
| 1457 | <listitem><para> |
| 1458 | Fetch the source |
| 1459 | </para></listitem> |
| 1460 | <listitem><para> |
| 1461 | Unpack the source |
| 1462 | </para></listitem> |
| 1463 | <listitem><para> |
| 1464 | Configure the source |
| 1465 | </para></listitem> |
| 1466 | <listitem><para> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1467 | Compile the source |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1468 | </para></listitem> |
| 1469 | <listitem><para> |
| 1470 | Install the build output |
| 1471 | </para></listitem> |
| 1472 | <listitem><para> |
| 1473 | Package the installed output |
| 1474 | </para></listitem> |
| 1475 | </orderedlist> |
| 1476 | For recipes in the workspace, fetching and unpacking is disabled |
| 1477 | as the source tree has already been prepared and is persistent. |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1478 | Each of these build steps is defined as a function (task), usually |
| 1479 | with a "do_" prefix (e.g. |
| 1480 | <ulink url='&YOCTO_DOCS_REF_URL;#ref-tasks-fetch'><filename>do_fetch</filename></ulink>, |
| 1481 | <ulink url='&YOCTO_DOCS_REF_URL;#ref-tasks-unpack'><filename>do_unpack</filename></ulink>, |
| 1482 | and so forth). |
| 1483 | These functions are typically shell scripts but can instead be |
| 1484 | written in Python. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1485 | </para> |
| 1486 | |
| 1487 | <para> |
| 1488 | If you look at the contents of a recipe, you will see that the |
| 1489 | recipe does not include complete instructions for building the |
| 1490 | software. |
| 1491 | Instead, common functionality is encapsulated in classes inherited |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1492 | with the <filename>inherit</filename> directive. |
| 1493 | This technique leaves the recipe to describe just the things that |
| 1494 | are specific to the software being built. |
| 1495 | A |
| 1496 | <ulink url='&YOCTO_DOCS_REF_URL;#ref-classes-base'><filename>base</filename></ulink> |
| 1497 | class exists that is implicitly inherited by all recipes and |
| 1498 | provides the functionality that most recipes typically need. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1499 | </para> |
| 1500 | |
| 1501 | <para> |
| 1502 | The remainder of this section presents information useful when |
| 1503 | working with recipes. |
| 1504 | </para> |
| 1505 | |
| 1506 | <section id='sdk-finding-logs-and-work-files'> |
| 1507 | <title>Finding Logs and Work Files</title> |
| 1508 | |
| 1509 | <para> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1510 | After the first run of the <filename>devtool build</filename> |
| 1511 | command, recipes that were previously created using the |
| 1512 | <filename>devtool add</filename> command or whose sources were |
| 1513 | modified using the <filename>devtool modify</filename> |
| 1514 | command contain symbolic links created within the source tree: |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1515 | <itemizedlist> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1516 | <listitem><para> |
| 1517 | <filename>oe-logs</filename>: |
| 1518 | This link points to the directory in which log files |
| 1519 | and run scripts for each build step are created. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1520 | </para></listitem> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1521 | <listitem><para> |
| 1522 | <filename>oe-workdir</filename>: |
| 1523 | This link points to the temporary work area for the |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1524 | recipe. |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1525 | The following locations under |
| 1526 | <filename>oe-workdir</filename> are particularly |
| 1527 | useful: |
| 1528 | <itemizedlist> |
| 1529 | <listitem><para> |
| 1530 | <filename>image/</filename>: |
| 1531 | Contains all of the files installed during |
| 1532 | the |
| 1533 | <ulink url='&YOCTO_DOCS_REF_URL;#ref-tasks-install'><filename>do_install</filename></ulink> |
| 1534 | stage. |
| 1535 | Within a recipe, this directory is referred |
| 1536 | to by the expression |
| 1537 | <filename>${</filename><ulink url='&YOCTO_DOCS_REF_URL;#var-D'><filename>D</filename></ulink><filename>}</filename>. |
| 1538 | </para></listitem> |
| 1539 | <listitem><para> |
| 1540 | <filename>sysroot-destdir/</filename>: |
| 1541 | Contains a subset of files installed within |
| 1542 | <filename>do_install</filename> that have |
| 1543 | been put into the shared sysroot. |
| 1544 | For more information, see the |
| 1545 | "<link linkend='sdk-sharing-files-between-recipes'>Sharing Files Between Recipes</link>" |
| 1546 | section. |
| 1547 | </para></listitem> |
| 1548 | <listitem><para> |
| 1549 | <filename>packages-split/</filename>: |
| 1550 | Contains subdirectories for each package |
| 1551 | produced by the recipe. |
| 1552 | For more information, see the |
| 1553 | "<link linkend='sdk-packaging'>Packaging</link>" |
| 1554 | section. |
| 1555 | </para></listitem> |
| 1556 | </itemizedlist> |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1557 | </para></listitem> |
| 1558 | </itemizedlist> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1559 | You can use these links to get more information on what is |
| 1560 | happening at each build step. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1561 | </para> |
| 1562 | </section> |
| 1563 | |
| 1564 | <section id='sdk-setting-configure-arguments'> |
| 1565 | <title>Setting Configure Arguments</title> |
| 1566 | |
| 1567 | <para> |
| 1568 | If the software your recipe is building uses GNU autoconf, |
| 1569 | then a fixed set of arguments is passed to it to enable |
| 1570 | cross-compilation plus any extras specified by |
| 1571 | <ulink url='&YOCTO_DOCS_REF_URL;#var-EXTRA_OECONF'><filename>EXTRA_OECONF</filename></ulink> |
| 1572 | or |
| 1573 | <ulink url='&YOCTO_DOCS_REF_URL;#var-PACKAGECONFIG_CONFARGS'><filename>PACKAGECONFIG_CONFARGS</filename></ulink> |
| 1574 | set within the recipe. |
| 1575 | If you wish to pass additional options, add them to |
| 1576 | <filename>EXTRA_OECONF</filename> or |
| 1577 | <filename>PACKAGECONFIG_CONFARGS</filename>. |
| 1578 | Other supported build tools have similar variables |
| 1579 | (e.g. |
| 1580 | <ulink url='&YOCTO_DOCS_REF_URL;#var-EXTRA_OECMAKE'><filename>EXTRA_OECMAKE</filename></ulink> |
| 1581 | for CMake, |
| 1582 | <ulink url='&YOCTO_DOCS_REF_URL;#var-EXTRA_OESCONS'><filename>EXTRA_OESCONS</filename></ulink> |
| 1583 | for Scons, and so forth). |
| 1584 | If you need to pass anything on the <filename>make</filename> |
| 1585 | command line, you can use <filename>EXTRA_OEMAKE</filename> or the |
| 1586 | <ulink url='&YOCTO_DOCS_REF_URL;#var-PACKAGECONFIG_CONFARGS'><filename>PACKAGECONFIG_CONFARGS</filename></ulink> |
| 1587 | variables to do so. |
| 1588 | </para> |
| 1589 | |
| 1590 | <para> |
| 1591 | You can use the <filename>devtool configure-help</filename> command |
| 1592 | to help you set the arguments listed in the previous paragraph. |
| 1593 | The command determines the exact options being passed, and shows |
| 1594 | them to you along with any custom arguments specified through |
| 1595 | <filename>EXTRA_OECONF</filename> or |
| 1596 | <filename>PACKAGECONFIG_CONFARGS</filename>. |
| 1597 | If applicable, the command also shows you the output of the |
| 1598 | configure script's "‐‐help" option as a reference. |
| 1599 | </para> |
| 1600 | </section> |
| 1601 | |
| 1602 | <section id='sdk-sharing-files-between-recipes'> |
| 1603 | <title>Sharing Files Between Recipes</title> |
| 1604 | |
| 1605 | <para> |
| 1606 | Recipes often need to use files provided by other recipes on |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1607 | the |
| 1608 | <ulink url='&YOCTO_DOCS_REF_URL;#hardware-build-system-term'>build host</ulink>. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1609 | For example, an application linking to a common library needs |
| 1610 | access to the library itself and its associated headers. |
| 1611 | The way this access is accomplished within the extensible SDK is |
| 1612 | through the sysroot. |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1613 | One sysroot exists per "machine" for which the SDK is being |
| 1614 | built. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1615 | In practical terms, this means a sysroot exists for the target |
| 1616 | machine, and a sysroot exists for the build host. |
| 1617 | </para> |
| 1618 | |
| 1619 | <para> |
| 1620 | Recipes should never write files directly into the sysroot. |
| 1621 | Instead, files should be installed into standard locations |
| 1622 | during the |
| 1623 | <ulink url='&YOCTO_DOCS_REF_URL;#ref-tasks-install'><filename>do_install</filename></ulink> |
| 1624 | task within the |
| 1625 | <filename>${</filename><ulink url='&YOCTO_DOCS_REF_URL;#var-D'><filename>D</filename></ulink><filename>}</filename> |
| 1626 | directory. |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1627 | A subset of these files automatically goes into the sysroot. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1628 | The reason for this limitation is that almost all files that go |
| 1629 | into the sysroot are cataloged in manifests in order to ensure |
| 1630 | they can be removed later when a recipe is modified or removed. |
| 1631 | Thus, the sysroot is able to remain free from stale files. |
| 1632 | </para> |
| 1633 | </section> |
| 1634 | |
| 1635 | <section id='sdk-packaging'> |
| 1636 | <title>Packaging</title> |
| 1637 | |
| 1638 | <para> |
| 1639 | Packaging is not always particularly relevant within the |
| 1640 | extensible SDK. |
| 1641 | However, if you examine how build output gets into the final image |
| 1642 | on the target device, it is important to understand packaging |
| 1643 | because the contents of the image are expressed in terms of |
| 1644 | packages and not recipes. |
| 1645 | </para> |
| 1646 | |
| 1647 | <para> |
| 1648 | During the |
| 1649 | <ulink url='&YOCTO_DOCS_REF_URL;#ref-tasks-package'><filename>do_package</filename></ulink> |
| 1650 | task, files installed during the |
| 1651 | <ulink url='&YOCTO_DOCS_REF_URL;#ref-tasks-install'><filename>do_install</filename></ulink> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1652 | task are split into one main package, which is almost always |
| 1653 | named the same as the recipe, and into several other packages. |
| 1654 | This separation exists because not all of those installed files |
| 1655 | are useful in every image. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1656 | For example, you probably do not need any of the documentation |
| 1657 | installed in a production image. |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1658 | Consequently, for each recipe the documentation files are |
| 1659 | separated into a <filename>-doc</filename> package. |
| 1660 | Recipes that package software containing optional modules or |
| 1661 | plugins might undergo additional package splitting as well. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1662 | </para> |
| 1663 | |
| 1664 | <para> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1665 | After building a recipe, you can see where files have gone by |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1666 | looking in the <filename>oe-workdir/packages-split</filename> |
| 1667 | directory, which contains a subdirectory for each package. |
| 1668 | Apart from some advanced cases, the |
| 1669 | <ulink url='&YOCTO_DOCS_REF_URL;#var-PACKAGES'><filename>PACKAGES</filename></ulink> |
| 1670 | and |
| 1671 | <ulink url='&YOCTO_DOCS_REF_URL;#var-FILES'><filename>FILES</filename></ulink> |
| 1672 | variables controls splitting. |
| 1673 | The <filename>PACKAGES</filename> variable lists all of the |
| 1674 | packages to be produced, while the <filename>FILES</filename> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1675 | variable specifies which files to include in each package by |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1676 | using an override to specify the package. |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1677 | For example, <filename>FILES_${PN}</filename> specifies the |
| 1678 | files to go into the main package (i.e. the main package has |
| 1679 | the same name as the recipe and |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1680 | <filename>${</filename><ulink url='&YOCTO_DOCS_REF_URL;#var-PN'><filename>PN</filename></ulink><filename>}</filename> |
| 1681 | evaluates to the recipe name). |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1682 | The order of the <filename>PACKAGES</filename> value is |
| 1683 | significant. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1684 | For each installed file, the first package whose |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1685 | <filename>FILES</filename> value matches the file is the |
| 1686 | package into which the file goes. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1687 | Defaults exist for both the <filename>PACKAGES</filename> and |
| 1688 | <filename>FILES</filename> variables. |
| 1689 | Consequently, you might find you do not even need to set these |
| 1690 | variables in your recipe unless the software the recipe is |
| 1691 | building installs files into non-standard locations. |
| 1692 | </para> |
| 1693 | </section> |
| 1694 | </section> |
| 1695 | |
| 1696 | <section id='sdk-restoring-the-target-device-to-its-original-state'> |
| 1697 | <title>Restoring the Target Device to its Original State</title> |
| 1698 | |
| 1699 | <para> |
| 1700 | If you use the <filename>devtool deploy-target</filename> |
| 1701 | command to write a recipe's build output to the target, and |
| 1702 | you are working on an existing component of the system, then you |
| 1703 | might find yourself in a situation where you need to restore the |
| 1704 | original files that existed prior to running the |
| 1705 | <filename>devtool deploy-target</filename> command. |
| 1706 | Because the <filename>devtool deploy-target</filename> command |
| 1707 | backs up any files it overwrites, you can use the |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1708 | <filename>devtool undeploy-target</filename> command to restore |
| 1709 | those files and remove any other files the recipe deployed. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1710 | Consider the following example: |
| 1711 | <literallayout class='monospaced'> |
| 1712 | $ devtool undeploy-target lighttpd root@192.168.7.2 |
| 1713 | </literallayout> |
| 1714 | If you have deployed multiple applications, you can remove them |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1715 | all using the "-a" option thus restoring the target device to its |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1716 | original state: |
| 1717 | <literallayout class='monospaced'> |
| 1718 | $ devtool undeploy-target -a root@192.168.7.2 |
| 1719 | </literallayout> |
| 1720 | Information about files deployed to the target as well as any |
| 1721 | backed up files are stored on the target itself. |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1722 | This storage, of course, requires some additional space |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1723 | on the target machine. |
| 1724 | <note> |
| 1725 | The <filename>devtool deploy-target</filename> and |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1726 | <filename>devtool undeploy-target</filename> commands do not |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1727 | currently interact with any package management system on the |
| 1728 | target device (e.g. RPM or OPKG). |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1729 | Consequently, you should not intermingle |
| 1730 | <filename>devtool deploy-target</filename> and package |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1731 | manager operations on the target device. |
| 1732 | Doing so could result in a conflicting set of files. |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1733 | </note> |
| 1734 | </para> |
| 1735 | </section> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1736 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1737 | <section id='sdk-installing-additional-items-into-the-extensible-sdk'> |
| 1738 | <title>Installing Additional Items Into the Extensible SDK</title> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1739 | |
| 1740 | <para> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1741 | Out of the box the extensible SDK typically only comes with a small |
| 1742 | number of tools and libraries. |
| 1743 | A minimal SDK starts mostly empty and is populated on-demand. |
| 1744 | Sometimes you must explicitly install extra items into the SDK. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1745 | If you need these extra items, you can first search for the items |
| 1746 | using the <filename>devtool search</filename> command. |
| 1747 | For example, suppose you need to link to libGL but you are not sure |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1748 | which recipe provides libGL. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1749 | You can use the following command to find out: |
| 1750 | <literallayout class='monospaced'> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1751 | $ devtool search libGL |
| 1752 | mesa A free implementation of the OpenGL API |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1753 | </literallayout> |
| 1754 | Once you know the recipe (i.e. <filename>mesa</filename> in this |
| 1755 | example), you can install it: |
| 1756 | <literallayout class='monospaced'> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1757 | $ devtool sdk-install mesa |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1758 | </literallayout> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1759 | By default, the <filename>devtool sdk-install</filename> command |
| 1760 | assumes the item is available in pre-built form from your SDK |
| 1761 | provider. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1762 | If the item is not available and it is acceptable to build the item |
| 1763 | from source, you can add the "-s" option as follows: |
| 1764 | <literallayout class='monospaced'> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1765 | $ devtool sdk-install -s mesa |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1766 | </literallayout> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1767 | It is important to remember that building the item from source |
| 1768 | takes significantly longer than installing the pre-built artifact. |
| 1769 | Also, if no recipe exists for the item you want to add to the SDK, |
| 1770 | you must instead add the item using the |
| 1771 | <filename>devtool add</filename> command. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1772 | </para> |
| 1773 | </section> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1774 | |
Brad Bishop | d5ae7d9 | 2018-06-14 09:52:03 -0700 | [diff] [blame] | 1775 | <section id='sdk-applying-updates-to-an-installed-extensible-sdk'> |
| 1776 | <title>Applying Updates to an Installed Extensible SDK</title> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1777 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1778 | <para> |
Brad Bishop | d5ae7d9 | 2018-06-14 09:52:03 -0700 | [diff] [blame] | 1779 | If you are working with an installed extensible SDK that gets |
| 1780 | occasionally updated (e.g. a third-party SDK), then you will need |
| 1781 | to manually "pull down" the updates into the installed SDK. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1782 | </para> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1783 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1784 | <para> |
Brad Bishop | d5ae7d9 | 2018-06-14 09:52:03 -0700 | [diff] [blame] | 1785 | To update your installed SDK, use <filename>devtool</filename> as |
| 1786 | follows: |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1787 | <literallayout class='monospaced'> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1788 | $ devtool sdk-update |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1789 | </literallayout> |
| 1790 | The previous command assumes your SDK provider has set the default |
Brad Bishop | d5ae7d9 | 2018-06-14 09:52:03 -0700 | [diff] [blame] | 1791 | update URL for you through the |
| 1792 | <ulink url='&YOCTO_DOCS_REF_URL;#var-SDK_UPDATE_URL'><filename>SDK_UPDATE_URL</filename></ulink> |
| 1793 | variable as described in the |
| 1794 | "<link linkend='sdk-providing-updates-to-the-extensible-sdk-after-installation'>Providing Updates to the Extensible SDK After Installation</link>" |
| 1795 | section. |
| 1796 | If the SDK provider has not set that default URL, you need to |
| 1797 | specify it yourself in the command as follows: |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1798 | <literallayout class='monospaced'> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1799 | $ devtool sdk-update <replaceable>path_to_update_directory</replaceable> |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1800 | </literallayout> |
| 1801 | <note> |
Brad Bishop | d5ae7d9 | 2018-06-14 09:52:03 -0700 | [diff] [blame] | 1802 | The URL needs to point specifically to a published SDK and |
| 1803 | not to an SDK installer that you would download and install. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1804 | </note> |
| 1805 | </para> |
| 1806 | </section> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1807 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1808 | <section id='sdk-creating-a-derivative-sdk-with-additional-components'> |
| 1809 | <title>Creating a Derivative SDK With Additional Components</title> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1810 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1811 | <para> |
| 1812 | You might need to produce an SDK that contains your own custom |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1813 | libraries. |
| 1814 | A good example would be if you were a vendor with customers that |
| 1815 | use your SDK to build their own platform-specific software and |
| 1816 | those customers need an SDK that has custom libraries. |
| 1817 | In such a case, you can produce a derivative SDK based on the |
| 1818 | currently installed SDK fairly easily by following these steps: |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1819 | <orderedlist> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1820 | <listitem><para> |
| 1821 | If necessary, install an extensible SDK that |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1822 | you want to use as a base for your derivative SDK. |
| 1823 | </para></listitem> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1824 | <listitem><para> |
| 1825 | Source the environment script for the SDK. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1826 | </para></listitem> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1827 | <listitem><para> |
| 1828 | Add the extra libraries or other components you want by |
| 1829 | using the <filename>devtool add</filename> command. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1830 | </para></listitem> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1831 | <listitem><para> |
| 1832 | Run the <filename>devtool build-sdk</filename> command. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1833 | </para></listitem> |
| 1834 | </orderedlist> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1835 | The previous steps take the recipes added to the workspace and |
| 1836 | construct a new SDK installer that contains those recipes and the |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1837 | resulting binary artifacts. |
| 1838 | The recipes go into their own separate layer in the constructed |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1839 | derivative SDK, which leaves the workspace clean and ready for |
| 1840 | users to add their own recipes. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1841 | </para> |
| 1842 | </section> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1843 | </chapter> |
| 1844 | <!-- |
| 1845 | vim: expandtab tw=80 ts=4 |
| 1846 | --> |