sdk-appendix-obtain.xml 21 KB

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