blob: aa06358a07301c859c76b8c5cf16ccd74186c671 [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<appendix id='sdk-appendix-obtain'>
6
7<title>Obtaining the SDK</title>
8
9<section id='sdk-locating-pre-built-sdk-installers'>
10 <title>Locating Pre-Built SDK Installers</title>
11
12 <para>
13 You can use existing, pre-built toolchains by locating and running
14 an SDK installer script that ships with the Yocto Project.
15 Using this method, you select and download an architecture-specific
Patrick Williamsc0f7c042017-02-23 20:41:17 -060016 SDK installer and then run the script to hand-install the
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050017 toolchain.
18 </para>
19
20 <para>
Brad Bishopd7bf8c12018-02-25 22:55:05 -050021 Follow these steps to locate and hand-install the toolchain:
22 <orderedlist>
23 <listitem><para>
24 <emphasis>Go to the Installers Directory:</emphasis>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050025 Go to <ulink url='&YOCTO_TOOLCHAIN_DL_URL;'></ulink>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050026 </para></listitem>
Brad Bishopd7bf8c12018-02-25 22:55:05 -050027 <listitem><para>
28 <emphasis>Open the Folder for Your Development System:</emphasis>
29 Open the folder that matches your host development system
30 (i.e. <filename>i686</filename> for 32-bit machines or
31 <filename>x86_64</filename> for 64-bit machines).
32 </para></listitem>
33 <listitem><para>
34 <emphasis>Locate and Download the SDK Installer:</emphasis>
35 You need to find and download the installer appropriate for
36 your development system, target hardware, and image type.
37 </para>
38
39 <para>The installer files (<filename>*.sh</filename>) follow
40 this naming convention:
41 <literallayout class='monospaced'>
42 poky-eglibc-<replaceable>host_system</replaceable>-core-image-<replaceable>type</replaceable>-<replaceable>arch</replaceable>-toolchain-ext-<replaceable>release</replaceable>.sh
43
44 Where:
45 <replaceable>host_system</replaceable> is a string representing your development system:
46 i686 or x86_64.
47
48 <replaceable>type</replaceable> is a string representing either a "sato" or "minimal"
49 image.
50
51 <replaceable>arch</replaceable> is a string representing the target architecture:
52 aarch64, armv5e, core2-64, coretexa8hf-neon, i586, mips3242,
53 mips64, or ppc7400.
54
55 <replaceable>release</replaceable> is the version of Yocto Project.
56
57 NOTE:
58 The standard SDK installer does not have the "-ext" string as
59 part of the filename.
60
61 </literallayout>
62 The toolchains provided by the Yocto Project are based off of
63 the <filename>core-image-sato</filename> and
64 <filename>core-image-minimal</filename> images and contain
65 libraries appropriate for developing against those images.
66 </para>
67
68 <para>For example, if your host development system is a
69 64-bit x86 system and you are need an extended SDK for a
70 64-bit core2 target, go into the <filename>x86_64</filename>
71 folder and download the following installer:
Patrick Williamsc0f7c042017-02-23 20:41:17 -060072 <literallayout class='monospaced'>
73 poky-glibc-x86_64-core-image-sato-core2-64-toolchain-ext-&DISTRO;.sh
74 </literallayout>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050075 </para></listitem>
Brad Bishopd7bf8c12018-02-25 22:55:05 -050076 <listitem><para>
77 <emphasis>Run the Installer:</emphasis>
78 Be sure you have execution privileges and run the installer.
79 Following is an example from the <filename>Downloads</filename>
80 directory:
81 <literallayout class='monospaced'>
82 $ ~/Downloads/poky-glibc-x86_64-core-image-sato-core2-64-toolchain-ext-&DISTRO;.sh
83 </literallayout>
84 During execution of the script, you choose the root location
85 for the toolchain.
86 See the
87 "<link linkend='sdk-installed-standard-sdk-directory-structure'>Installed Standard SDK Directory Structure</link>"
88 section and the
89 "<link linkend='sdk-installed-extensible-sdk-directory-structure'>Installed Extensible SDK Directory Structure</link>"
90 section for more information.
91 </para></listitem>
92 </orderedlist>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050093 </para>
94</section>
95
96<section id='sdk-building-an-sdk-installer'>
97 <title>Building an SDK Installer</title>
98
99 <para>
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600100 As an alternative to locating and downloading a SDK installer,
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500101 you can build the SDK installer.
102 Follow these steps:
103 <orderedlist>
104 <listitem><para>
105 <emphasis>Set Up the Build Environment:</emphasis>
106 Be sure you are set up to use BitBake in a shell.
107 See the
Brad Bishop316dfdd2018-06-25 12:45:53 -0400108 "<ulink url='&YOCTO_DOCS_DEV_URL;#setting-up-the-development-host-to-use-the-yocto-project'>Preparing the Build Host</ulink>"
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500109 section in the Yocto Project Development Tasks Manual for
110 information on how to get a build host ready that is either a
111 native Linux machine or a machine that uses CROPS.
112 </para></listitem>
113 <listitem><para>
114 <emphasis>Clone the <filename>poky</filename> Repository:</emphasis>
115 You need to have a local copy of the Yocto Project
116 <ulink url='&YOCTO_DOCS_REF_URL;#source-directory'>Source Directory</ulink>
117 (i.e. a local <filename>poky</filename> repository).
118 See the
119 "<ulink url='&YOCTO_DOCS_DEV_URL;#cloning-the-poky-repository'>Cloning the <filename>poky</filename> Repository</ulink>"
120 and possibly the
121 "<ulink url='&YOCTO_DOCS_DEV_URL;#checking-out-by-branch-in-poky'>Checking Out by Branch in Poky</ulink>"
122 and
123 "<ulink url='&YOCTO_DOCS_DEV_URL;#checkout-out-by-tag-in-poky'>Checking Out by Tag in Poky</ulink>"
124 sections all in the Yocto Project Development Tasks Manual for
125 information on how to clone the <filename>poky</filename>
126 repository and check out the appropriate branch for your work.
127 </para></listitem>
128 <listitem><para>
129 <emphasis>Initialize the Build Environment:</emphasis>
130 While in the root directory of the Source Directory (i.e.
131 <filename>poky</filename>), run the
132 <ulink url='&YOCTO_DOCS_REF_URL;#structure-core-script'><filename>&OE_INIT_FILE;</filename></ulink>
133 environment setup script to define the OpenEmbedded
134 build environment on your build host.
135 <literallayout class='monospaced'>
136 $ source &OE_INIT_FILE;
137 </literallayout>
138 Among other things, the script creates the
139 <ulink url='&YOCTO_DOCS_REF_URL;#build-directory'>Build Directory</ulink>,
140 which is <filename>build</filename> in this case
141 and is located in the
142 <ulink url='&YOCTO_DOCS_REF_URL;#source-directory'>Source Directory</ulink>.
143 After the script runs, your current working directory
144 is set to the <filename>build</filename> directory.
145 </para></listitem>
146 <listitem><para>
147 <emphasis>Make Sure You Are Building an Installer for the Correct Machine:</emphasis>
148 Check to be sure that your
149 <ulink url='&YOCTO_DOCS_REF_URL;#var-MACHINE'><filename>MACHINE</filename></ulink>
150 variable in the <filename>local.conf</filename> file in your
151 <ulink url='&YOCTO_DOCS_REF_URL;#build-directory'>Build Directory</ulink>
152 matches the architecture for which you are building.
153 </para></listitem>
154 <listitem><para>
155 <emphasis>Make Sure Your SDK Machine is Correctly Set:</emphasis>
156 If you are building a toolchain designed to run on an
157 architecture that differs from your current development host
158 machine (i.e. the build machine), be sure that the
159 <ulink url='&YOCTO_DOCS_REF_URL;#var-SDKMACHINE'><filename>SDKMACHINE</filename></ulink>
160 variable in the <filename>local.conf</filename> file in your
161 Build Directory is correctly set.
162 </para></listitem>
163 <listitem><para>
164 <emphasis>Build the SDK Installer:</emphasis>
165 To build the SDK installer for a standard SDK and populate
166 the SDK image, use the following command form.
167 Be sure to replace <replaceable>image</replaceable> with
168 an image (e.g. "core-image-sato"):
169 <literallayout class='monospaced'>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500170 $ bitbake <replaceable>image</replaceable> -c populate_sdk
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500171 </literallayout>
172 You can do the same for the extensible SDK using this command
173 form:
174 <literallayout class='monospaced'>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500175 $ bitbake <replaceable>image</replaceable> -c populate_sdk_ext
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500176 </literallayout>
177 These commands result in a SDK installer that contains the
178 sysroot that matches your target root filesystem.</para>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500179
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500180 <para>When the <filename>bitbake</filename> command completes,
181 the SDK installer will be in
182 <filename>tmp/deploy/sdk</filename> in the Build Directory.
183 <note><title>Notes</title>
184 <itemizedlist>
185 <listitem><para>
186 By default, this toolchain does not build static
187 binaries.
188 If you want to use the toolchain to build these
189 types of libraries, you need to be sure your SDK
190 has the appropriate static development libraries.
191 Use the
192 <ulink url='&YOCTO_DOCS_REF_URL;#var-TOOLCHAIN_TARGET_TASK'><filename>TOOLCHAIN_TARGET_TASK</filename></ulink>
193 variable inside your <filename>local.conf</filename>
194 file to install the appropriate library packages
195 in the SDK.
196 Following is an example using
197 <filename>libc</filename> static development
198 libraries:
199 <literallayout class='monospaced'>
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500200 TOOLCHAIN_TARGET_TASK_append = " libc-staticdev"
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500201 </literallayout>
202 </para></listitem>
203 <listitem><para>
204 For additional information on building the
205 installer, see the
Brad Bishop316dfdd2018-06-25 12:45:53 -0400206 <ulink url='https://wiki.yoctoproject.org/wiki/TipsAndTricks/RunningEclipseAgainstBuiltImage'>Cookbook guide to Making an <trademark class='trade'>Eclipse</trademark> Debug Capable Image</ulink>
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500207 wiki page.
208 </para></listitem>
209 </itemizedlist>
210 </note>
211 </para></listitem>
212 <listitem><para>
213 <emphasis>Run the Installer:</emphasis>
214 You can now run the SDK installer from
215 <filename>tmp/deploy/sdk</filename> in the Build Directory.
216 Following is an example:
217 <literallayout class='monospaced'>
218 $ cd ~/poky/build/tmp/deploy/sdk
219 $ ./poky-glibc-x86_64-core-image-sato-core2-64-toolchain-ext-&DISTRO;.sh
220 </literallayout>
221 During execution of the script, you choose the root location
222 for the toolchain.
223 See the
224 "<link linkend='sdk-installed-standard-sdk-directory-structure'>Installed Standard SDK Directory Structure</link>"
225 section and the
226 "<link linkend='sdk-installed-extensible-sdk-directory-structure'>Installed Extensible SDK Directory Structure</link>"
227 section for more information.
228 </para></listitem>
229 </orderedlist>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500230 </para>
231</section>
232
233<section id='sdk-extracting-the-root-filesystem'>
234 <title>Extracting the Root Filesystem</title>
235
236 <para>
237 After installing the toolchain, for some use cases you
238 might need to separately extract a root filesystem:
239 <itemizedlist>
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500240 <listitem><para>
241 You want to boot the image using NFS.
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500242 </para></listitem>
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500243 <listitem><para>
244 You want to use the root filesystem as the
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500245 target sysroot.
246 For example, the Eclipse IDE environment with the Eclipse
247 Yocto Plug-in installed allows you to use QEMU to boot
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500248 under NFS.
249 </para></listitem>
250 <listitem><para>
251 You want to develop your target application
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500252 using the root filesystem as the target sysroot.
253 </para></listitem>
254 </itemizedlist>
255 </para>
256
257 <para>
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500258 Follow these steps to extract the root filesystem:
259 <orderedlist>
260 <listitem><para>
261 <emphasis>Locate and Download the Tarball for the Pre-Built
262 Root Filesystem Image File:</emphasis>
263 You need to find and download the root filesystem image
264 file that is appropriate for your target system.
265 These files are kept in the
266 <ulink url='&YOCTO_DL_URL;/releases/yocto/yocto-&DISTRO;/machines/'>Index of Releases</ulink>
267 in the "machines" directory.</para>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500268
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500269 <para>The "machines" directory contains tarballs
270 (<filename>*.tar.bz2</filename>) for supported machines.
271 The directory also contains flattened root filesystem
272 image files (<filename>*.ext4</filename>), which you can use
273 with QEMU directly.</para>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500274
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500275 <para>The pre-built root filesystem image files
276 follow these naming conventions:
277 <literallayout class='monospaced'>
278 core-image-<replaceable>profile</replaceable>-<replaceable>arch</replaceable>.tar.bz2
279
280 Where:
281 <replaceable>profile</replaceable> is the filesystem image's profile:
282 lsb, lsb-dev, lsb-sdk, lsb-qt3, minimal, minimal-dev, sato,
283 sato-dev, sato-sdk, minimal-initramfs, or sdk-ptest. For
284 information on these types of image profiles, see the
285 "Images" chapter in the Yocto Project Reference Manual.
286
287 <replaceable>arch</replaceable> is a string representing the target architecture:
288 beaglebone, edgerouter, genericx86, genericx86-64, mpc8315e-rdb,
289 qemuarm, qemuarm64, qemumips, qemumips64, qemuppc, qemux86, or
290 qemux86-64.
291
292 </literallayout>
293 The root filesystems provided by the Yocto Project are based
294 off of the <filename>core-image-sato</filename> and
295 <filename>core-image-minimal</filename> images.
296 </para>
297
298 <para>For example, if your target hardware system is a
299 BeagleBone board and your image is a
300 <filename>core-image-minimal</filename> image, you need
301 to download the following root filesystem image file:
302 <literallayout class='monospaced'>
303 core-image-minimal-beaglebone.tar.bz2
304 </literallayout>
305 </para></listitem>
306 <listitem><para>
307 <emphasis>Initialize the Cross-Development Environment:</emphasis>
308 You must <filename>source</filename>
309 the cross-development environment setup script to establish
310 necessary environment variables.</para>
311
312 <para>This script is located in the top-level directory in
313 which you installed the toolchain (e.g.
314 <filename>poky_sdk</filename>).</para>
315
316 <para>Following is an example for the Core2 64-bit
317 architecture:
318 <literallayout class='monospaced'>
319 $ source ~/poky_sdk/environment-setup-core2-64-poky-linux
320 </literallayout>
321 </para></listitem>
322 <listitem><para>
323 <emphasis>Extract the Root Filesystem:</emphasis>
324 Use the <filename>runqemu-extract-sdk</filename> command
325 and provide the root filesystem image.</para>
326
327 <para>Following is an example command that extracts the root
328 filesystem from a previously built root filesystem image that
329 was downloaded from the
Brad Bishop316dfdd2018-06-25 12:45:53 -0400330 <ulink url='&YOCTO_DOCS_OM_URL;#index-downloads'>Index of Releases</ulink>.
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500331 This command extracts the root filesystem into the
332 <filename>core2-64-sato</filename> directory:
333 <literallayout class='monospaced'>
334 $ runqemu-extract-sdk ~/Downloads/core-image-sato-core2-64.tar.bz2 ~/core2-64-sato
335 </literallayout>
336 You could now point to the target sysroot at
337 <filename>core2-64-sato</filename>.
338 </para></listitem>
339 </orderedlist>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500340 </para>
341</section>
342
343<section id='sdk-installed-standard-sdk-directory-structure'>
344 <title>Installed Standard SDK Directory Structure</title>
345
346 <para>
347 The following figure shows the resulting directory structure after
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600348 you install the Standard SDK by running the <filename>*.sh</filename>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500349 SDK installation script:
350 </para>
351
352 <para>
353 <imagedata fileref="figures/sdk-installed-standard-sdk-directory.png" scale="60" align="center" />
354 </para>
355
356 <para>
357 The installed SDK consists of an environment setup script for the SDK,
358 a configuration file for the target, a version file for the target,
359 and the root filesystem (<filename>sysroots</filename>) needed to
360 develop objects for the target system.
361 </para>
362
363 <para>
364 Within the figure, italicized text is used to indicate replaceable
365 portions of the file or directory name.
366 For example,
367 <replaceable>install_dir</replaceable>/<replaceable>version</replaceable>
368 is the directory where the SDK is installed.
369 By default, this directory is <filename>/opt/poky/</filename>.
370 And, <replaceable>version</replaceable> represents the specific
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600371 snapshot of the SDK (e.g. <filename>&DISTRO;</filename>).
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500372 Furthermore, <replaceable>target</replaceable> represents the target
373 architecture (e.g. <filename>i586</filename>) and
374 <replaceable>host</replaceable> represents the development system's
375 architecture (e.g. <filename>x86_64</filename>).
376 Thus, the complete names of the two directories within the
377 <filename>sysroots</filename> could be
378 <filename>i586-poky-linux</filename> and
379 <filename>x86_64-pokysdk-linux</filename> for the target and host,
380 respectively.
381 </para>
382</section>
383
384<section id='sdk-installed-extensible-sdk-directory-structure'>
385 <title>Installed Extensible SDK Directory Structure</title>
386
387 <para>
388 The following figure shows the resulting directory structure after
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600389 you install the Extensible SDK by running the <filename>*.sh</filename>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500390 SDK installation script:
391 </para>
392
393 <para>
394 <imagedata fileref="figures/sdk-installed-extensible-sdk-directory.png" scale="60" align="center" />
395 </para>
396
397 <para>
398 The installed directory structure for the extensible SDK is quite
399 different than the installed structure for the standard SDK.
400 The extensible SDK does not separate host and target parts in the
401 same manner as does the standard SDK.
402 The extensible SDK uses an embedded copy of the OpenEmbedded
403 build system, which has its own sysroots.
404 </para>
405
406 <para>
407 Of note in the directory structure are an environment setup script
408 for the SDK, a configuration file for the target, a version file for
409 the target, and a log file for the OpenEmbedded build system
410 preparation script run by the installer.
411 </para>
412
413 <para>
414 Within the figure, italicized text is used to indicate replaceable
415 portions of the file or directory name.
416 For example,
417 <replaceable>install_dir</replaceable> is the directory where the SDK
418 is installed, which is <filename>poky_sdk</filename> by default.
419 <replaceable>target</replaceable> represents the target
420 architecture (e.g. <filename>i586</filename>) and
421 <replaceable>host</replaceable> represents the development system's
422 architecture (e.g. <filename>x86_64</filename>).
423 </para>
424</section>
425
426</appendix>
427<!--
428vim: expandtab tw=80 ts=4
429-->