blob: 9169fe9c0523f0868ed0868d833152fa30a5a561 [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 Williamsc0f7c042017-02-23 20:41:17 -060017 <note>
18 Prior to the 2.0 Release of the Yocto Project, application
19 development was primarily accomplished through the use of the
20 Application Development Toolkit (ADT) and the availability
21 of stand-alone cross-development toolchains and other tools.
22 With the 2.1 Release of the Yocto Project, application development
23 has transitioned to within a tool-rich extensible SDK and the more
24 traditional standard SDK.
25 </note>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050026 </para>
27
28 <para>
Patrick Williamsc0f7c042017-02-23 20:41:17 -060029 All SDKs consist of the following:
30 <itemizedlist>
Brad Bishop316dfdd2018-06-25 12:45:53 -040031 <listitem><para>
32 <emphasis>Cross-Development Toolchain</emphasis>:
Patrick Williamsc0f7c042017-02-23 20:41:17 -060033 This toolchain contains a compiler, debugger, and various
34 miscellaneous tools.
35 </para></listitem>
Brad Bishop316dfdd2018-06-25 12:45:53 -040036 <listitem><para>
37 <emphasis>Libraries, Headers, and Symbols</emphasis>:
Patrick Williamsc0f7c042017-02-23 20:41:17 -060038 The libraries, headers, and symbols are specific to the image
39 (i.e. they match the image).
40 </para></listitem>
Brad Bishop316dfdd2018-06-25 12:45:53 -040041 <listitem><para>
42 <emphasis>Environment Setup Script</emphasis>:
Patrick Williamsc0f7c042017-02-23 20:41:17 -060043 This <filename>*.sh</filename> file, once run, sets up the
44 cross-development environment by defining variables and
45 preparing for SDK use.
46 </para></listitem>
47 </itemizedlist>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050048 </para>
49
50 <para>
Brad Bishop316dfdd2018-06-25 12:45:53 -040051 Additionally, an extensible SDK has tools that allow you to easily add
Patrick Williamsc0f7c042017-02-23 20:41:17 -060052 new applications and libraries to an image, modify the source of an
53 existing component, test changes on the target hardware, and easily
54 integrate an application into the
Brad Bishopd7bf8c12018-02-25 22:55:05 -050055 <ulink url='&YOCTO_DOCS_REF_URL;#build-system-term'>OpenEmbedded build system</ulink>.
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050056 </para>
57
58 <para>
Patrick Williamsc0f7c042017-02-23 20:41:17 -060059 You can use an SDK to independently develop and test code
60 that is destined to run on some target machine.
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050061 SDKs are completely self-contained.
62 The binaries are linked against their own copy of
63 <filename>libc</filename>, which results in no dependencies
64 on the target system.
65 To achieve this, the pointer to the dynamic loader is
66 configured at install time since that path cannot be dynamically
67 altered.
68 This is the reason for a wrapper around the
69 <filename>populate_sdk</filename> and
70 <filename>populate_sdk_ext</filename> archives.
71 </para>
72
73 <para>
Patrick Williamsc0f7c042017-02-23 20:41:17 -060074 Another feature for the SDKs is that only one set of cross-compiler
75 toolchain binaries are produced for any given architecture.
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050076 This feature takes advantage of the fact that the target hardware can
77 be passed to <filename>gcc</filename> as a set of compiler options.
78 Those options are set up by the environment script and contained in
79 variables such as
80 <ulink url='&YOCTO_DOCS_REF_URL;#var-CC'><filename>CC</filename></ulink>
81 and
82 <ulink url='&YOCTO_DOCS_REF_URL;#var-LD'><filename>LD</filename></ulink>.
83 This reduces the space needed for the tools.
Brad Bishop316dfdd2018-06-25 12:45:53 -040084 Understand, however, that every target still needs a sysroot because
85 those binaries are target-specific.
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050086 </para>
87
88 <para>
Patrick Williamsc0f7c042017-02-23 20:41:17 -060089 The SDK development environment consists of the following:
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050090 <itemizedlist>
Brad Bishop316dfdd2018-06-25 12:45:53 -040091 <listitem><para>
92 The self-contained SDK, which is an
Patrick Williamsc0f7c042017-02-23 20:41:17 -060093 architecture-specific cross-toolchain and
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050094 matching sysroots (target and native) all built by the
Patrick Williamsc0f7c042017-02-23 20:41:17 -060095 OpenEmbedded build system (e.g. the SDK).
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050096 The toolchain and sysroots are based on a
Brad Bishopd7bf8c12018-02-25 22:55:05 -050097 <ulink url='&YOCTO_DOCS_REF_URL;#metadata'>Metadata</ulink>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050098 configuration and extensions,
99 which allows you to cross-develop on the host machine for the
100 target hardware.
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600101 Additionally, the extensible SDK contains the
102 <filename>devtool</filename> functionality.
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500103 </para></listitem>
Brad Bishop316dfdd2018-06-25 12:45:53 -0400104 <listitem><para>
105 The Quick EMUlator (QEMU), which lets you simulate
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500106 target hardware.
107 QEMU is not literally part of the SDK.
108 You must build and include this emulator separately.
109 However, QEMU plays an important role in the development
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600110 process that revolves around use of the SDK.
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500111 </para></listitem>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500112 </itemizedlist>
113 </para>
114
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600115 <para>
116 In summary, the extensible and standard SDK share many features.
117 However, the extensible SDK has powerful development tools to help you
118 more quickly develop applications.
119 Following is a table that summarizes the primary differences between
120 the standard and extensible SDK types when considering which to
121 build:
122 <informaltable frame='none'>
123 <tgroup cols='3' align='left' colsep='1' rowsep='1'>
124 <colspec colname='c1' colwidth='1*'/>
125 <colspec colname='c2' colwidth='1*'/>
126 <colspec colname='c3' colwidth='1*'/>
127 <thead>
128 <row>
129 <entry align="left"><emphasis>Feature</emphasis></entry>
130 <entry align="left"><emphasis>Standard SDK</emphasis></entry>
131 <entry align="left"><emphasis>Extensible SDK</emphasis></entry>
132 </row>
133 </thead>
134 <tbody>
135 <row>
136 <entry align="left">Toolchain</entry>
137 <entry align="left">Yes</entry>
138 <entry align="left">Yes*</entry>
139 </row>
140 <row>
141 <entry align="left">Debugger</entry>
142 <entry align="left">Yes</entry>
143 <entry align="left">Yes*</entry>
144 </row>
145 <row>
146 <entry align="left">Size</entry>
147 <entry align="left">100+ MBytes</entry>
148 <entry align="left">1+ GBytes (or 300+ MBytes for minimal w/toolchain)</entry>
149 </row>
150 <row>
151 <entry align="left"><filename>devtool</filename></entry>
152 <entry align="left">No</entry>
153 <entry align="left">Yes</entry>
154 </row>
155 <row>
156 <entry align="left">Build Images</entry>
157 <entry align="left">No</entry>
158 <entry align="left">Yes</entry>
159 </row>
160 <row>
161 <entry align="left">Updateable</entry>
162 <entry align="left">No</entry>
163 <entry align="left">Yes</entry>
164 </row>
165 <row>
166 <entry align="left">Managed Sysroot**</entry>
167 <entry align="left">No</entry>
168 <entry align="left">Yes</entry>
169 </row>
170 <row>
171 <entry align="left">Installed Packages</entry>
172 <entry align="left">No***</entry>
173 <entry align="left">Yes****</entry>
174 </row>
175 <row>
176 <entry align="left">Construction</entry>
177 <entry align="left">Packages</entry>
178 <entry align="left">Shared State</entry>
179 </row>
180 </tbody>
181 </tgroup>
182 </informaltable>
183 <literallayout class='monospaced'>
Brad Bishop316dfdd2018-06-25 12:45:53 -0400184 * 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 -0600185
Brad Bishop316dfdd2018-06-25 12:45:53 -0400186 ** 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 -0600187
Brad Bishop316dfdd2018-06-25 12:45:53 -0400188 *** You can add runtime package management to the standard SDK but it is not supported by default.
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600189
190 **** You must build and make the shared state available to extensible SDK users for "packages" you want to enable users to install.
191 </literallayout>
192 </para>
193
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500194 <section id='the-cross-development-toolchain'>
195 <title>The Cross-Development Toolchain</title>
196
197 <para>
198 The
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500199 <ulink url='&YOCTO_DOCS_REF_URL;#cross-development-toolchain'>Cross-Development Toolchain</ulink>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500200 consists of a cross-compiler, cross-linker, and cross-debugger
201 that are used to develop user-space applications for targeted
202 hardware.
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600203 Additionally, for an extensible SDK, the toolchain also has
204 built-in <filename>devtool</filename> functionality.
205 This toolchain is created by running a SDK installer script
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500206 or through a
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500207 <ulink url='&YOCTO_DOCS_REF_URL;#build-directory'>Build Directory</ulink>
Brad Bishop316dfdd2018-06-25 12:45:53 -0400208 that is based on your metadata configuration or extension for
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500209 your targeted device.
210 The cross-toolchain works with a matching target sysroot.
211 </para>
212 </section>
213
214 <section id='sysroot'>
215 <title>Sysroots</title>
216
217 <para>
218 The native and target sysroots contain needed headers and libraries
219 for generating binaries that run on the target architecture.
220 The target sysroot is based on the target root filesystem image
221 that is built by the OpenEmbedded build system and uses the same
Brad Bishop316dfdd2018-06-25 12:45:53 -0400222 metadata configuration used to build the cross-toolchain.
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500223 </para>
224 </section>
225
226 <section id='the-qemu-emulator'>
227 <title>The QEMU Emulator</title>
228
229 <para>
230 The QEMU emulator allows you to simulate your hardware while
231 running your application or image.
Brad Bishop316dfdd2018-06-25 12:45:53 -0400232 QEMU is not part of the SDK but is made available a number of
233 different ways:
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500234 <itemizedlist>
235 <listitem><para>
236 If you have cloned the <filename>poky</filename> Git
237 repository to create a
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500238 <ulink url='&YOCTO_DOCS_REF_URL;#source-directory'>Source Directory</ulink>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500239 and you have sourced the environment setup script, QEMU is
240 installed and automatically available.
241 </para></listitem>
242 <listitem><para>
243 If you have downloaded a Yocto Project release and unpacked
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500244 it to create a Source Directory and you have sourced the
245 environment setup script, QEMU is installed and
246 automatically available.
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500247 </para></listitem>
248 <listitem><para>
249 If you have installed the cross-toolchain tarball and you
250 have sourced the toolchain's setup environment script, QEMU
251 is also installed and automatically available.
252 </para></listitem>
253 </itemizedlist>
254 </para>
255 </section>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500256</section>
257
258<section id='sdk-development-model'>
259 <title>SDK Development Model</title>
260
261 <para>
262 Fundamentally, the SDK fits into the development process as follows:
263 <imagedata fileref="figures/sdk-environment.png" align="center" width="6in" depth="5in" scalefit="100" />
264 The SDK is installed on any machine and can be used to develop
265 applications, images, and kernels.
266 An SDK can even be used by a QA Engineer or Release Engineer.
267 The fundamental concept is that the machine that has the SDK installed
268 does not have to be associated with the machine that has the
269 Yocto Project installed.
270 A developer can independently compile and test an object on their
271 machine and then, when the object is ready for integration into an
272 image, they can simply make it available to the machine that has the
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600273 Yocto Project.
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500274 Once the object is available, the image can be rebuilt using the
275 Yocto Project to produce the modified image.
276 </para>
277
278 <para>
279 You just need to follow these general steps:
280 <orderedlist>
Brad Bishop316dfdd2018-06-25 12:45:53 -0400281 <listitem><para>
282 <emphasis>Install the SDK for your target hardware:</emphasis>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500283 For information on how to install the SDK, see the
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600284 "<link linkend='sdk-installing-the-sdk'>Installing the SDK</link>"
Brad Bishop316dfdd2018-06-25 12:45:53 -0400285 section.
286 </para></listitem>
287 <listitem><para>
288 <emphasis>Download or Build the Target Image:</emphasis>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500289 The Yocto Project supports several target architectures
290 and has many pre-built kernel images and root filesystem
291 images.</para>
Brad Bishop316dfdd2018-06-25 12:45:53 -0400292
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500293 <para>If you are going to develop your application on
294 hardware, go to the
295 <ulink url='&YOCTO_MACHINES_DL_URL;'><filename>machines</filename></ulink>
296 download area and choose a target machine area
297 from which to download the kernel image and root filesystem.
298 This download area could have several files in it that
299 support development using actual hardware.
300 For example, the area might contain
301 <filename>.hddimg</filename> files that combine the
302 kernel image with the filesystem, boot loaders, and
303 so forth.
304 Be sure to get the files you need for your particular
305 development process.</para>
Brad Bishop316dfdd2018-06-25 12:45:53 -0400306
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500307 <para>If you are going to develop your application and
308 then run and test it using the QEMU emulator, go to the
309 <ulink url='&YOCTO_QEMU_DL_URL;'><filename>machines/qemu</filename></ulink>
310 download area.
311 From this area, go down into the directory for your
312 target architecture (e.g. <filename>qemux86_64</filename>
313 for an <trademark class='registered'>Intel</trademark>-based
314 64-bit architecture).
Brad Bishop316dfdd2018-06-25 12:45:53 -0400315 Download the kernel, root filesystem, and any other files you
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500316 need for your process.
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600317 <note>
Brad Bishop316dfdd2018-06-25 12:45:53 -0400318 To use the root filesystem in QEMU, you need to extract it.
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600319 See the
320 "<link linkend='sdk-extracting-the-root-filesystem'>Extracting the Root Filesystem</link>"
321 section for information on how to extract the root
322 filesystem.
323 </note>
324 </para></listitem>
Brad Bishop316dfdd2018-06-25 12:45:53 -0400325 <listitem><para>
326 <emphasis>Develop and Test your Application:</emphasis>
327 At this point, you have the tools to develop your application.
328 If you need to separately install and use the QEMU emulator,
329 you can go to
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500330 <ulink url='http://wiki.qemu.org/Main_Page'>QEMU Home Page</ulink>
331 to download and learn about the emulator.
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600332 See the
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500333 "<ulink url='&YOCTO_DOCS_DEV_URL;#dev-manual-qemu'>Using the Quick EMUlator (QEMU)</ulink>"
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500334 chapter in the Yocto Project Development Tasks Manual
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500335 for information on using QEMU within the Yocto
Brad Bishop316dfdd2018-06-25 12:45:53 -0400336 Project.
337 </para></listitem>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500338 </orderedlist>
339 </para>
340
341 <para>
Brad Bishop316dfdd2018-06-25 12:45:53 -0400342 The remainder of this manual describes how to use the extensible
343 and standard SDKs.
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500344 Information also exists in appendix form that describes how you can
345 build, install, and modify an SDK.
346 </para>
347</section>
348
349</chapter>
350<!--
351vim: expandtab tw=80 ts=4
352-->