sdk-appendix-obtain.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  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. You can find SDK installers here:
  17. <itemizedlist>
  18. <listitem><para><emphasis>Standard SDK Installers:</emphasis>
  19. Go to <ulink url='&YOCTO_TOOLCHAIN_DL_URL;'></ulink>
  20. and find the folder that matches your host development system
  21. (i.e. <filename>i686</filename> for 32-bit machines or
  22. <filename>x86_64</filename> for 64-bit machines).</para>
  23. <para>Go into that folder and download the SDK installer
  24. whose name includes the appropriate target architecture.
  25. The toolchains provided by the Yocto Project are based off of
  26. the <filename>core-image-sato</filename> image and contain
  27. libraries appropriate for developing against that image.
  28. For example, if your host development system is a 64-bit x86
  29. system and you are going to use your cross-toolchain for a
  30. 32-bit x86 target, go into the <filename>x86_64</filename>
  31. folder and download the following installer:
  32. <literallayout class='monospaced'>
  33. poky-glibc-x86_64-core-image-sato-i586-toolchain-&DISTRO;.sh
  34. </literallayout>
  35. </para></listitem>
  36. <listitem><para><emphasis>Extensible SDK Installers:</emphasis>
  37. Installers for the extensible SDK are also located in
  38. <ulink url='&YOCTO_TOOLCHAIN_DL_URL;'></ulink>.
  39. These installers have the string
  40. <filename>ext</filename> as part of their names:
  41. <literallayout class='monospaced'>
  42. poky-glibc-x86_64-core-image-sato-core2-64-toolchain-ext-&DISTRO;.sh
  43. </literallayout>
  44. </para></listitem>
  45. </itemizedlist>
  46. </para>
  47. </section>
  48. <section id='sdk-building-an-sdk-installer'>
  49. <title>Building an SDK Installer</title>
  50. <para>
  51. As an alternative to locating and downloading a SDK installer,
  52. you can build the SDK installer assuming you have first sourced
  53. the environment setup script.
  54. See the
  55. "<ulink url='&YOCTO_DOCS_QS_URL;#qs-building-images'>Building Images</ulink>"
  56. section in the Yocto Project Quick Start for steps that show you
  57. how to set up the Yocto Project environment.
  58. In particular, you need to be sure the
  59. <ulink url='&YOCTO_DOCS_REF_URL;#var-MACHINE'><filename>MACHINE</filename></ulink>
  60. variable matches the architecture for which you are building and that
  61. the
  62. <ulink url='&YOCTO_DOCS_REF_URL;#var-SDKMACHINE'><filename>SDKMACHINE</filename></ulink>
  63. variable is correctly set if you are building a toolchain designed to
  64. run on an architecture that differs from your current development host
  65. machine (i.e. the build machine).
  66. </para>
  67. <para>
  68. To build the SDK installer for a standard SDK and populate
  69. the SDK image, use the following command:
  70. <literallayout class='monospaced'>
  71. $ bitbake <replaceable>image</replaceable> -c populate_sdk
  72. </literallayout>
  73. You can do the same for the extensible SDK using this command:
  74. <literallayout class='monospaced'>
  75. $ bitbake <replaceable>image</replaceable> -c populate_sdk_ext
  76. </literallayout>
  77. These commands result in a SDK installer that contains the sysroot
  78. that matches your target root filesystem.
  79. </para>
  80. <para>
  81. When the <filename>bitbake</filename> command completes, the SDK
  82. installer will be in
  83. <filename>tmp/deploy/sdk</filename> in the Build Directory.
  84. <note><title>Notes</title>
  85. <itemizedlist>
  86. <listitem><para>
  87. By default, this toolchain does not build static binaries.
  88. If you want to use the toolchain to build these types of
  89. libraries, you need to be sure your image has the
  90. appropriate static development libraries.
  91. Use the
  92. <ulink url='&YOCTO_DOCS_REF_URL;#var-IMAGE_INSTALL'><filename>IMAGE_INSTALL</filename></ulink>
  93. variable inside your <filename>local.conf</filename> file
  94. to install the appropriate library packages.
  95. Following is an example using <filename>glibc</filename>
  96. static development libraries:
  97. <literallayout class='monospaced'>
  98. IMAGE_INSTALL_append = " glibc-staticdev"
  99. </literallayout>
  100. </para></listitem>
  101. <listitem><para>
  102. For additional information on building the installer,
  103. see the
  104. <ulink url='https://wiki.yoctoproject.org/wiki/TipsAndTricks/RunningEclipseAgainstBuiltImage'>Cookbook guide to Making an Eclipse Debug Capable Image</ulink>
  105. wiki page.
  106. </para></listitem>
  107. </itemizedlist>
  108. </note>
  109. </para>
  110. </section>
  111. <section id='sdk-extracting-the-root-filesystem'>
  112. <title>Extracting the Root Filesystem</title>
  113. <para>
  114. After installing the toolchain, for some use cases you
  115. might need to separately extract a root filesystem:
  116. <itemizedlist>
  117. <listitem><para>You want to boot the image using NFS.
  118. </para></listitem>
  119. <listitem><para>You want to use the root filesystem as the
  120. target sysroot.
  121. For example, the Eclipse IDE environment with the Eclipse
  122. Yocto Plug-in installed allows you to use QEMU to boot
  123. under NFS.</para></listitem>
  124. <listitem><para>You want to develop your target application
  125. using the root filesystem as the target sysroot.
  126. </para></listitem>
  127. </itemizedlist>
  128. </para>
  129. <para>
  130. To extract the root filesystem, first <filename>source</filename>
  131. the cross-development environment setup script to establish
  132. necessary environment variables.
  133. If you built the toolchain in the Build Directory, you will find
  134. the toolchain environment script in the
  135. <filename>tmp</filename> directory.
  136. If you installed the toolchain by hand, the environment setup
  137. script is located in <filename>/opt/poky/&DISTRO;</filename>.
  138. </para>
  139. <para>
  140. After sourcing the environment script, use the
  141. <filename>runqemu-extract-sdk</filename> command and provide the
  142. filesystem image.
  143. </para>
  144. <para>
  145. Following is an example.
  146. The second command sets up the environment.
  147. In this case, the setup script is located in the
  148. <filename>/opt/poky/&DISTRO;</filename> directory.
  149. The third command extracts the root filesystem from a previously
  150. built filesystem that is located in the
  151. <filename>~/Downloads</filename> directory.
  152. Furthermore, this command extracts the root filesystem into the
  153. <filename>qemux86-sato</filename> directory:
  154. <literallayout class='monospaced'>
  155. $ cd ~
  156. $ source /opt/poky/&DISTRO;/environment-setup-i586-poky-linux
  157. $ runqemu-extract-sdk \
  158. ~/Downloads/core-image-sato-sdk-qemux86-2011091411831.rootfs.tar.bz2 \
  159. $HOME/qemux86-sato
  160. </literallayout>
  161. You could now point to the target sysroot at
  162. <filename>qemux86-sato</filename>.
  163. </para>
  164. </section>
  165. <section id='sdk-installed-standard-sdk-directory-structure'>
  166. <title>Installed Standard SDK Directory Structure</title>
  167. <para>
  168. The following figure shows the resulting directory structure after
  169. you install the Standard SDK by running the <filename>*.sh</filename>
  170. SDK installation script:
  171. </para>
  172. <para>
  173. <imagedata fileref="figures/sdk-installed-standard-sdk-directory.png" scale="60" align="center" />
  174. </para>
  175. <para>
  176. The installed SDK consists of an environment setup script for the SDK,
  177. a configuration file for the target, a version file for the target,
  178. and the root filesystem (<filename>sysroots</filename>) needed to
  179. develop objects for the target system.
  180. </para>
  181. <para>
  182. Within the figure, italicized text is used to indicate replaceable
  183. portions of the file or directory name.
  184. For example,
  185. <replaceable>install_dir</replaceable>/<replaceable>version</replaceable>
  186. is the directory where the SDK is installed.
  187. By default, this directory is <filename>/opt/poky/</filename>.
  188. And, <replaceable>version</replaceable> represents the specific
  189. snapshot of the SDK (e.g. <filename>&DISTRO;</filename>).
  190. Furthermore, <replaceable>target</replaceable> represents the target
  191. architecture (e.g. <filename>i586</filename>) and
  192. <replaceable>host</replaceable> represents the development system's
  193. architecture (e.g. <filename>x86_64</filename>).
  194. Thus, the complete names of the two directories within the
  195. <filename>sysroots</filename> could be
  196. <filename>i586-poky-linux</filename> and
  197. <filename>x86_64-pokysdk-linux</filename> for the target and host,
  198. respectively.
  199. </para>
  200. </section>
  201. <section id='sdk-installed-extensible-sdk-directory-structure'>
  202. <title>Installed Extensible SDK Directory Structure</title>
  203. <para>
  204. The following figure shows the resulting directory structure after
  205. you install the Extensible SDK by running the <filename>*.sh</filename>
  206. SDK installation script:
  207. </para>
  208. <para>
  209. <imagedata fileref="figures/sdk-installed-extensible-sdk-directory.png" scale="60" align="center" />
  210. </para>
  211. <para>
  212. The installed directory structure for the extensible SDK is quite
  213. different than the installed structure for the standard SDK.
  214. The extensible SDK does not separate host and target parts in the
  215. same manner as does the standard SDK.
  216. The extensible SDK uses an embedded copy of the OpenEmbedded
  217. build system, which has its own sysroots.
  218. </para>
  219. <para>
  220. Of note in the directory structure are an environment setup script
  221. for the SDK, a configuration file for the target, a version file for
  222. the target, and a log file for the OpenEmbedded build system
  223. preparation script run by the installer.
  224. </para>
  225. <para>
  226. Within the figure, italicized text is used to indicate replaceable
  227. portions of the file or directory name.
  228. For example,
  229. <replaceable>install_dir</replaceable> is the directory where the SDK
  230. is installed, which is <filename>poky_sdk</filename> by default.
  231. <replaceable>target</replaceable> represents the target
  232. architecture (e.g. <filename>i586</filename>) and
  233. <replaceable>host</replaceable> represents the development system's
  234. architecture (e.g. <filename>x86_64</filename>).
  235. </para>
  236. </section>
  237. </appendix>
  238. <!--
  239. vim: expandtab tw=80 ts=4
  240. -->