blob: 8642be61add22c00ff5ae4913e66a2e9d6b1b1fd [file] [log] [blame]
rjw1f884582022-01-06 17:20:42 +08001<!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>
12 Welcome to the Yocto Project Application Development and the
13 Extensible Software Development Kit (eSDK) manual.
14 This manual provides information that explains how to use both the
15 Yocto Project extensible and standard SDKs to develop
16 applications and images.
17 Additionally, the manual also provides information on how to use
18 the popular <trademark class='trade'>Eclipse</trademark> IDE as part
19 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>
29 </para>
30
31 <para>
32 All SDKs consist of the following:
33 <itemizedlist>
34 <listitem><para>
35 <emphasis>Cross-Development Toolchain</emphasis>:
36 This toolchain contains a compiler, debugger, and various
37 miscellaneous tools.
38 </para></listitem>
39 <listitem><para>
40 <emphasis>Libraries, Headers, and Symbols</emphasis>:
41 The libraries, headers, and symbols are specific to the image
42 (i.e. they match the image).
43 </para></listitem>
44 <listitem><para>
45 <emphasis>Environment Setup Script</emphasis>:
46 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>
51 </para>
52
53 <para>
54 Additionally, an extensible SDK has tools that allow you to easily add
55 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
58 <ulink url='&YOCTO_DOCS_REF_URL;#build-system-term'>OpenEmbedded build system</ulink>.
59 </para>
60
61 <para>
62 You can use an SDK to independently develop and test code
63 that is destined to run on some target machine.
64 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>
77 Another feature for the SDKs is that only one set of cross-compiler
78 toolchain binaries are produced for any given architecture.
79 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.
87 Understand, however, that every target still needs a sysroot because
88 those binaries are target-specific.
89 </para>
90
91 <para>
92 The SDK development environment consists of the following:
93 <itemizedlist>
94 <listitem><para>
95 The self-contained SDK, which is an
96 architecture-specific cross-toolchain and
97 matching sysroots (target and native) all built by the
98 OpenEmbedded build system (e.g. the SDK).
99 The toolchain and sysroots are based on a
100 <ulink url='&YOCTO_DOCS_REF_URL;#metadata'>Metadata</ulink>
101 configuration and extensions,
102 which allows you to cross-develop on the host machine for the
103 target hardware.
104 Additionally, the extensible SDK contains the
105 <filename>devtool</filename> functionality.
106 </para></listitem>
107 <listitem><para>
108 The Quick EMUlator (QEMU), which lets you simulate
109 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
113 process that revolves around use of the SDK.
114 </para></listitem>
115 <listitem><para>
116 The Eclipse IDE Yocto Plug-in.
117 This plug-in is available for you if you are an Eclipse
118 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>
123 <listitem><para>
124 Various performance-related
125 <ulink url='http://www.eclipse.org/linuxtools/index.php'>tools</ulink>
126 that can enhance your development experience.
127 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
133 <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'>
202 * 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.
203
204 ** 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.
205
206 *** You can add runtime package management to the standard SDK but it is not supported by default.
207
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
212 <section id='the-cross-development-toolchain'>
213 <title>The Cross-Development Toolchain</title>
214
215 <para>
216 The
217 <ulink url='&YOCTO_DOCS_REF_URL;#cross-development-toolchain'>Cross-Development Toolchain</ulink>
218 consists of a cross-compiler, cross-linker, and cross-debugger
219 that are used to develop user-space applications for targeted
220 hardware.
221 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
224 or through a
225 <ulink url='&YOCTO_DOCS_REF_URL;#build-directory'>Build Directory</ulink>
226 that is based on your metadata configuration or extension for
227 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
240 metadata configuration used to build the cross-toolchain.
241 </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.
250 QEMU is not part of the SDK but is made available a number of
251 different ways:
252 <itemizedlist>
253 <listitem><para>
254 If you have cloned the <filename>poky</filename> Git
255 repository to create a
256 <ulink url='&YOCTO_DOCS_REF_URL;#source-directory'>Source Directory</ulink>
257 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
262 it to create a Source Directory and you have sourced the
263 environment setup script, QEMU is installed and
264 automatically available.
265 </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'>
276 <title><trademark class='trade'>Eclipse</trademark> Yocto Plug-in</title>
277
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.
289 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.
296 These tools have been deprecated with the release of the
297 Eclipse Yocto Plug-in.
298 </note>
299 </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
305 "<link linkend='sdk-eclipse-project'>Developing Applications Using <trademark class='trade'>Eclipse</trademark></link>"
306 Chapter.
307 </para>
308 </section>
309
310 <section id='performance-enhancing-tools'>
311 <title>Performance Enhancing Tools</title>
312
313 <para>
314 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>.
319 </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
338 Yocto Project.
339 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>
346 <listitem><para>
347 <emphasis>Install the SDK for your target hardware:</emphasis>
348 For information on how to install the SDK, see the
349 "<link linkend='sdk-installing-the-sdk'>Installing the SDK</link>"
350 section.
351 </para></listitem>
352 <listitem><para>
353 <emphasis>Download or Build the Target Image:</emphasis>
354 The Yocto Project supports several target architectures
355 and has many pre-built kernel images and root filesystem
356 images.</para>
357
358 <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>
371
372 <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).
380 Download the kernel, root filesystem, and any other files you
381 need for your process.
382 <note>
383 To use the root filesystem in QEMU, you need to extract it.
384 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>
390 <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
395 <ulink url='http://wiki.qemu.org/Main_Page'>QEMU Home Page</ulink>
396 to download and learn about the emulator.
397 See the
398 "<ulink url='&YOCTO_DOCS_DEV_URL;#dev-manual-qemu'>Using the Quick EMUlator (QEMU)</ulink>"
399 chapter in the Yocto Project Development Tasks Manual
400 for information on using QEMU within the Yocto
401 Project.
402 </para></listitem>
403 </orderedlist>
404 </para>
405
406 <para>
407 The remainder of this manual describes how to use the extensible
408 and standard SDKs.
409 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-->