blob: 8642be61add22c00ff5ae4913e66a2e9d6b1b1fd [file] [log] [blame]
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05001<!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-intro'>
6<title>Introduction</title>
7
8<section id='sdk-manual-intro'>
9 <title>Introduction</title>
10
11 <para>
Brad Bishopd7bf8c12018-02-25 22:55:05 -050012 Welcome to the Yocto Project Application Development and the
13 Extensible Software Development Kit (eSDK) manual.
Patrick Williamsc0f7c042017-02-23 20:41:17 -060014 This manual provides information that explains how to use both the
15 Yocto Project extensible and standard SDKs to develop
16 applications and images.
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050017 Additionally, the manual also provides information on how to use
18 the popular <trademark class='trade'>Eclipse</trademark> IDE as part
Patrick Williamsc0f7c042017-02-23 20:41:17 -060019 of your application development workflow within the SDK environment.
20 <note>
21 Prior to the 2.0 Release of the Yocto Project, application
22 development was primarily accomplished through the use of the
23 Application Development Toolkit (ADT) and the availability
24 of stand-alone cross-development toolchains and other tools.
25 With the 2.1 Release of the Yocto Project, application development
26 has transitioned to within a tool-rich extensible SDK and the more
27 traditional standard SDK.
28 </note>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050029 </para>
30
31 <para>
Patrick Williamsc0f7c042017-02-23 20:41:17 -060032 All SDKs consist of the following:
33 <itemizedlist>
Brad Bishop316dfdd2018-06-25 12:45:53 -040034 <listitem><para>
35 <emphasis>Cross-Development Toolchain</emphasis>:
Patrick Williamsc0f7c042017-02-23 20:41:17 -060036 This toolchain contains a compiler, debugger, and various
37 miscellaneous tools.
38 </para></listitem>
Brad Bishop316dfdd2018-06-25 12:45:53 -040039 <listitem><para>
40 <emphasis>Libraries, Headers, and Symbols</emphasis>:
Patrick Williamsc0f7c042017-02-23 20:41:17 -060041 The libraries, headers, and symbols are specific to the image
42 (i.e. they match the image).
43 </para></listitem>
Brad Bishop316dfdd2018-06-25 12:45:53 -040044 <listitem><para>
45 <emphasis>Environment Setup Script</emphasis>:
Patrick Williamsc0f7c042017-02-23 20:41:17 -060046 This <filename>*.sh</filename> file, once run, sets up the
47 cross-development environment by defining variables and
48 preparing for SDK use.
49 </para></listitem>
50 </itemizedlist>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050051 </para>
52
53 <para>
Brad Bishop316dfdd2018-06-25 12:45:53 -040054 Additionally, an extensible SDK has tools that allow you to easily add
Patrick Williamsc0f7c042017-02-23 20:41:17 -060055 new applications and libraries to an image, modify the source of an
56 existing component, test changes on the target hardware, and easily
57 integrate an application into the
Brad Bishopd7bf8c12018-02-25 22:55:05 -050058 <ulink url='&YOCTO_DOCS_REF_URL;#build-system-term'>OpenEmbedded build system</ulink>.
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050059 </para>
60
61 <para>
Patrick Williamsc0f7c042017-02-23 20:41:17 -060062 You can use an SDK to independently develop and test code
63 that is destined to run on some target machine.
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050064 SDKs are completely self-contained.
65 The binaries are linked against their own copy of
66 <filename>libc</filename>, which results in no dependencies
67 on the target system.
68 To achieve this, the pointer to the dynamic loader is
69 configured at install time since that path cannot be dynamically
70 altered.
71 This is the reason for a wrapper around the
72 <filename>populate_sdk</filename> and
73 <filename>populate_sdk_ext</filename> archives.
74 </para>
75
76 <para>
Patrick Williamsc0f7c042017-02-23 20:41:17 -060077 Another feature for the SDKs is that only one set of cross-compiler
78 toolchain binaries are produced for any given architecture.
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050079 This feature takes advantage of the fact that the target hardware can
80 be passed to <filename>gcc</filename> as a set of compiler options.
81 Those options are set up by the environment script and contained in
82 variables such as
83 <ulink url='&YOCTO_DOCS_REF_URL;#var-CC'><filename>CC</filename></ulink>
84 and
85 <ulink url='&YOCTO_DOCS_REF_URL;#var-LD'><filename>LD</filename></ulink>.
86 This reduces the space needed for the tools.
Brad Bishop316dfdd2018-06-25 12:45:53 -040087 Understand, however, that every target still needs a sysroot because
88 those binaries are target-specific.
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050089 </para>
90
91 <para>
Patrick Williamsc0f7c042017-02-23 20:41:17 -060092 The SDK development environment consists of the following:
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050093 <itemizedlist>
Brad Bishop316dfdd2018-06-25 12:45:53 -040094 <listitem><para>
95 The self-contained SDK, which is an
Patrick Williamsc0f7c042017-02-23 20:41:17 -060096 architecture-specific cross-toolchain and
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050097 matching sysroots (target and native) all built by the
Patrick Williamsc0f7c042017-02-23 20:41:17 -060098 OpenEmbedded build system (e.g. the SDK).
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050099 The toolchain and sysroots are based on a
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500100 <ulink url='&YOCTO_DOCS_REF_URL;#metadata'>Metadata</ulink>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500101 configuration and extensions,
102 which allows you to cross-develop on the host machine for the
103 target hardware.
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600104 Additionally, the extensible SDK contains the
105 <filename>devtool</filename> functionality.
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500106 </para></listitem>
Brad Bishop316dfdd2018-06-25 12:45:53 -0400107 <listitem><para>
108 The Quick EMUlator (QEMU), which lets you simulate
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500109 target hardware.
110 QEMU is not literally part of the SDK.
111 You must build and include this emulator separately.
112 However, QEMU plays an important role in the development
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600113 process that revolves around use of the SDK.
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500114 </para></listitem>
Brad Bishop316dfdd2018-06-25 12:45:53 -0400115 <listitem><para>
116 The Eclipse IDE Yocto Plug-in.
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600117 This plug-in is available for you if you are an Eclipse
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500118 user.
119 In the same manner as QEMU, the plug-in is not literally part
120 of the SDK but is rather available for use as part of the
121 development process.
122 </para></listitem>
Brad Bishop316dfdd2018-06-25 12:45:53 -0400123 <listitem><para>
124 Various performance-related
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600125 <ulink url='http://www.eclipse.org/linuxtools/index.php'>tools</ulink>
126 that can enhance your development experience.
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500127 These tools are also separate from the actual SDK but can be
128 independently obtained and used in the development process.
129 </para></listitem>
130 </itemizedlist>
131 </para>
132
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600133 <para>
134 In summary, the extensible and standard SDK share many features.
135 However, the extensible SDK has powerful development tools to help you
136 more quickly develop applications.
137 Following is a table that summarizes the primary differences between
138 the standard and extensible SDK types when considering which to
139 build:
140 <informaltable frame='none'>
141 <tgroup cols='3' align='left' colsep='1' rowsep='1'>
142 <colspec colname='c1' colwidth='1*'/>
143 <colspec colname='c2' colwidth='1*'/>
144 <colspec colname='c3' colwidth='1*'/>
145 <thead>
146 <row>
147 <entry align="left"><emphasis>Feature</emphasis></entry>
148 <entry align="left"><emphasis>Standard SDK</emphasis></entry>
149 <entry align="left"><emphasis>Extensible SDK</emphasis></entry>
150 </row>
151 </thead>
152 <tbody>
153 <row>
154 <entry align="left">Toolchain</entry>
155 <entry align="left">Yes</entry>
156 <entry align="left">Yes*</entry>
157 </row>
158 <row>
159 <entry align="left">Debugger</entry>
160 <entry align="left">Yes</entry>
161 <entry align="left">Yes*</entry>
162 </row>
163 <row>
164 <entry align="left">Size</entry>
165 <entry align="left">100+ MBytes</entry>
166 <entry align="left">1+ GBytes (or 300+ MBytes for minimal w/toolchain)</entry>
167 </row>
168 <row>
169 <entry align="left"><filename>devtool</filename></entry>
170 <entry align="left">No</entry>
171 <entry align="left">Yes</entry>
172 </row>
173 <row>
174 <entry align="left">Build Images</entry>
175 <entry align="left">No</entry>
176 <entry align="left">Yes</entry>
177 </row>
178 <row>
179 <entry align="left">Updateable</entry>
180 <entry align="left">No</entry>
181 <entry align="left">Yes</entry>
182 </row>
183 <row>
184 <entry align="left">Managed Sysroot**</entry>
185 <entry align="left">No</entry>
186 <entry align="left">Yes</entry>
187 </row>
188 <row>
189 <entry align="left">Installed Packages</entry>
190 <entry align="left">No***</entry>
191 <entry align="left">Yes****</entry>
192 </row>
193 <row>
194 <entry align="left">Construction</entry>
195 <entry align="left">Packages</entry>
196 <entry align="left">Shared State</entry>
197 </row>
198 </tbody>
199 </tgroup>
200 </informaltable>
201 <literallayout class='monospaced'>
Brad Bishop316dfdd2018-06-25 12:45:53 -0400202 * Extensible SDK contains the toolchain and debugger if <ulink url='&YOCTO_DOCS_REF_URL;#var-SDK_EXT_TYPE'><filename>SDK_EXT_TYPE</filename></ulink> is "full" or <ulink url='&YOCTO_DOCS_REF_URL;#var-SDK_INCLUDE_TOOLCHAIN'><filename>SDK_INCLUDE_TOOLCHAIN</filename></ulink> is "1", which is the default.
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600203
Brad Bishop316dfdd2018-06-25 12:45:53 -0400204 ** Sysroot is managed through the use of <filename>devtool</filename>. Thus, it is less likely that you will corrupt your SDK sysroot when you try to add additional libraries.
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600205
Brad Bishop316dfdd2018-06-25 12:45:53 -0400206 *** You can add runtime package management to the standard SDK but it is not supported by default.
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600207
208 **** You must build and make the shared state available to extensible SDK users for "packages" you want to enable users to install.
209 </literallayout>
210 </para>
211
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500212 <section id='the-cross-development-toolchain'>
213 <title>The Cross-Development Toolchain</title>
214
215 <para>
216 The
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500217 <ulink url='&YOCTO_DOCS_REF_URL;#cross-development-toolchain'>Cross-Development Toolchain</ulink>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500218 consists of a cross-compiler, cross-linker, and cross-debugger
219 that are used to develop user-space applications for targeted
220 hardware.
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600221 Additionally, for an extensible SDK, the toolchain also has
222 built-in <filename>devtool</filename> functionality.
223 This toolchain is created by running a SDK installer script
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500224 or through a
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500225 <ulink url='&YOCTO_DOCS_REF_URL;#build-directory'>Build Directory</ulink>
Brad Bishop316dfdd2018-06-25 12:45:53 -0400226 that is based on your metadata configuration or extension for
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500227 your targeted device.
228 The cross-toolchain works with a matching target sysroot.
229 </para>
230 </section>
231
232 <section id='sysroot'>
233 <title>Sysroots</title>
234
235 <para>
236 The native and target sysroots contain needed headers and libraries
237 for generating binaries that run on the target architecture.
238 The target sysroot is based on the target root filesystem image
239 that is built by the OpenEmbedded build system and uses the same
Brad Bishop316dfdd2018-06-25 12:45:53 -0400240 metadata configuration used to build the cross-toolchain.
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500241 </para>
242 </section>
243
244 <section id='the-qemu-emulator'>
245 <title>The QEMU Emulator</title>
246
247 <para>
248 The QEMU emulator allows you to simulate your hardware while
249 running your application or image.
Brad Bishop316dfdd2018-06-25 12:45:53 -0400250 QEMU is not part of the SDK but is made available a number of
251 different ways:
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500252 <itemizedlist>
253 <listitem><para>
254 If you have cloned the <filename>poky</filename> Git
255 repository to create a
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500256 <ulink url='&YOCTO_DOCS_REF_URL;#source-directory'>Source Directory</ulink>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500257 and you have sourced the environment setup script, QEMU is
258 installed and automatically available.
259 </para></listitem>
260 <listitem><para>
261 If you have downloaded a Yocto Project release and unpacked
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500262 it to create a Source Directory and you have sourced the
263 environment setup script, QEMU is installed and
264 automatically available.
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500265 </para></listitem>
266 <listitem><para>
267 If you have installed the cross-toolchain tarball and you
268 have sourced the toolchain's setup environment script, QEMU
269 is also installed and automatically available.
270 </para></listitem>
271 </itemizedlist>
272 </para>
273 </section>
274
275 <section id='eclipse-overview'>
Brad Bishop316dfdd2018-06-25 12:45:53 -0400276 <title><trademark class='trade'>Eclipse</trademark> Yocto Plug-in</title>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500277
278 <para>
279 The Eclipse IDE is a popular development environment and it fully
280 supports development using the Yocto Project.
281 When you install and configure the Eclipse Yocto Project Plug-in
282 into the Eclipse IDE, you maximize your Yocto Project experience.
283 Installing and configuring the Plug-in results in an environment
284 that has extensions specifically designed to let you more easily
285 develop software.
286 These extensions allow for cross-compilation, deployment, and
287 execution of your output into a QEMU emulation session.
288 You can also perform cross-debugging and profiling.
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600289 The environment also supports many performance-related
290 <ulink url='http://www.eclipse.org/linuxtools/index.php'>tools</ulink>
291 that enhance your development experience.
292 <note>
293 Previous releases of the Eclipse Yocto Plug-in supported
294 "user-space tools" (i.e. LatencyTOP, PowerTOP, Perf, SystemTap,
295 and Lttng-ust) that also added to the development experience.
Brad Bishop316dfdd2018-06-25 12:45:53 -0400296 These tools have been deprecated with the release of the
297 Eclipse Yocto Plug-in.
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600298 </note>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500299 </para>
300
301 <para>
302 For information about the application development workflow that
303 uses the Eclipse IDE and for a detailed example of how to install
304 and configure the Eclipse Yocto Project Plug-in, see the
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500305 "<link linkend='sdk-eclipse-project'>Developing Applications Using <trademark class='trade'>Eclipse</trademark></link>"
306 Chapter.
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500307 </para>
308 </section>
309
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600310 <section id='performance-enhancing-tools'>
311 <title>Performance Enhancing Tools</title>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500312
313 <para>
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600314 Supported performance enhancing tools are available that let you
315 profile, debug, and perform tracing on your projects developed
316 using Eclipse.
317 For information on these tools see
318 <ulink url='http://www.eclipse.org/linuxtools/'>http://www.eclipse.org/linuxtools/</ulink>.
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500319 </para>
320 </section>
321</section>
322
323<section id='sdk-development-model'>
324 <title>SDK Development Model</title>
325
326 <para>
327 Fundamentally, the SDK fits into the development process as follows:
328 <imagedata fileref="figures/sdk-environment.png" align="center" width="6in" depth="5in" scalefit="100" />
329 The SDK is installed on any machine and can be used to develop
330 applications, images, and kernels.
331 An SDK can even be used by a QA Engineer or Release Engineer.
332 The fundamental concept is that the machine that has the SDK installed
333 does not have to be associated with the machine that has the
334 Yocto Project installed.
335 A developer can independently compile and test an object on their
336 machine and then, when the object is ready for integration into an
337 image, they can simply make it available to the machine that has the
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600338 Yocto Project.
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500339 Once the object is available, the image can be rebuilt using the
340 Yocto Project to produce the modified image.
341 </para>
342
343 <para>
344 You just need to follow these general steps:
345 <orderedlist>
Brad Bishop316dfdd2018-06-25 12:45:53 -0400346 <listitem><para>
347 <emphasis>Install the SDK for your target hardware:</emphasis>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500348 For information on how to install the SDK, see the
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600349 "<link linkend='sdk-installing-the-sdk'>Installing the SDK</link>"
Brad Bishop316dfdd2018-06-25 12:45:53 -0400350 section.
351 </para></listitem>
352 <listitem><para>
353 <emphasis>Download or Build the Target Image:</emphasis>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500354 The Yocto Project supports several target architectures
355 and has many pre-built kernel images and root filesystem
356 images.</para>
Brad Bishop316dfdd2018-06-25 12:45:53 -0400357
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500358 <para>If you are going to develop your application on
359 hardware, go to the
360 <ulink url='&YOCTO_MACHINES_DL_URL;'><filename>machines</filename></ulink>
361 download area and choose a target machine area
362 from which to download the kernel image and root filesystem.
363 This download area could have several files in it that
364 support development using actual hardware.
365 For example, the area might contain
366 <filename>.hddimg</filename> files that combine the
367 kernel image with the filesystem, boot loaders, and
368 so forth.
369 Be sure to get the files you need for your particular
370 development process.</para>
Brad Bishop316dfdd2018-06-25 12:45:53 -0400371
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500372 <para>If you are going to develop your application and
373 then run and test it using the QEMU emulator, go to the
374 <ulink url='&YOCTO_QEMU_DL_URL;'><filename>machines/qemu</filename></ulink>
375 download area.
376 From this area, go down into the directory for your
377 target architecture (e.g. <filename>qemux86_64</filename>
378 for an <trademark class='registered'>Intel</trademark>-based
379 64-bit architecture).
Brad Bishop316dfdd2018-06-25 12:45:53 -0400380 Download the kernel, root filesystem, and any other files you
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500381 need for your process.
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600382 <note>
Brad Bishop316dfdd2018-06-25 12:45:53 -0400383 To use the root filesystem in QEMU, you need to extract it.
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600384 See the
385 "<link linkend='sdk-extracting-the-root-filesystem'>Extracting the Root Filesystem</link>"
386 section for information on how to extract the root
387 filesystem.
388 </note>
389 </para></listitem>
Brad Bishop316dfdd2018-06-25 12:45:53 -0400390 <listitem><para>
391 <emphasis>Develop and Test your Application:</emphasis>
392 At this point, you have the tools to develop your application.
393 If you need to separately install and use the QEMU emulator,
394 you can go to
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500395 <ulink url='http://wiki.qemu.org/Main_Page'>QEMU Home Page</ulink>
396 to download and learn about the emulator.
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600397 See the
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500398 "<ulink url='&YOCTO_DOCS_DEV_URL;#dev-manual-qemu'>Using the Quick EMUlator (QEMU)</ulink>"
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500399 chapter in the Yocto Project Development Tasks Manual
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500400 for information on using QEMU within the Yocto
Brad Bishop316dfdd2018-06-25 12:45:53 -0400401 Project.
402 </para></listitem>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500403 </orderedlist>
404 </para>
405
406 <para>
Brad Bishop316dfdd2018-06-25 12:45:53 -0400407 The remainder of this manual describes how to use the extensible
408 and standard SDKs.
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500409 Information also exists in appendix form that describes how you can
410 build, install, and modify an SDK.
411 </para>
412</section>
413
414</chapter>
415<!--
416vim: expandtab tw=80 ts=4
417-->