sdk-intro.xml 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  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. <chapter id='sdk-intro'>
  5. <title>Introduction</title>
  6. <section id='sdk-manual-intro'>
  7. <title>Introduction</title>
  8. <para>
  9. Welcome to the Yocto Project Software Development Kit (SDK)
  10. Developer's Guide.
  11. This manual provides information that explains how to use both the
  12. Yocto Project extensible and standard SDKs to develop
  13. applications and images.
  14. Additionally, the manual also provides information on how to use
  15. the popular <trademark class='trade'>Eclipse</trademark> IDE as part
  16. of your application development workflow within the SDK environment.
  17. <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>
  26. </para>
  27. <para>
  28. All SDKs consist of the following:
  29. <itemizedlist>
  30. <listitem><para><emphasis>Cross-Development Toolchain</emphasis>:
  31. This toolchain contains a compiler, debugger, and various
  32. miscellaneous tools.
  33. </para></listitem>
  34. <listitem><para><emphasis>Libraries, Headers, and Symbols</emphasis>:
  35. The libraries, headers, and symbols are specific to the image
  36. (i.e. they match the image).
  37. </para></listitem>
  38. <listitem><para><emphasis>Environment Setup Script</emphasis>:
  39. This <filename>*.sh</filename> file, once run, sets up the
  40. cross-development environment by defining variables and
  41. preparing for SDK use.
  42. </para></listitem>
  43. </itemizedlist>
  44. </para>
  45. <para>
  46. Additionally an extensible SDK has tools that allow you to easily add
  47. new applications and libraries to an image, modify the source of an
  48. existing component, test changes on the target hardware, and easily
  49. integrate an application into the
  50. <ulink url='&YOCTO_DOCS_DEV_URL;#build-system-term'>OpenEmbedded build system</ulink>.
  51. </para>
  52. <para>
  53. You can use an SDK to independently develop and test code
  54. that is destined to run on some target machine.
  55. SDKs are completely self-contained.
  56. The binaries are linked against their own copy of
  57. <filename>libc</filename>, which results in no dependencies
  58. on the target system.
  59. To achieve this, the pointer to the dynamic loader is
  60. configured at install time since that path cannot be dynamically
  61. altered.
  62. This is the reason for a wrapper around the
  63. <filename>populate_sdk</filename> and
  64. <filename>populate_sdk_ext</filename> archives.
  65. </para>
  66. <para>
  67. Another feature for the SDKs is that only one set of cross-compiler
  68. toolchain binaries are produced for any given architecture.
  69. This feature takes advantage of the fact that the target hardware can
  70. be passed to <filename>gcc</filename> as a set of compiler options.
  71. Those options are set up by the environment script and contained in
  72. variables such as
  73. <ulink url='&YOCTO_DOCS_REF_URL;#var-CC'><filename>CC</filename></ulink>
  74. and
  75. <ulink url='&YOCTO_DOCS_REF_URL;#var-LD'><filename>LD</filename></ulink>.
  76. This reduces the space needed for the tools.
  77. Understand, however, that a sysroot is still needed for every target
  78. since those binaries are target-specific.
  79. </para>
  80. <para>
  81. The SDK development environment consists of the following:
  82. <itemizedlist>
  83. <listitem><para>The self-contained SDK, which is an
  84. architecture-specific cross-toolchain and
  85. matching sysroots (target and native) all built by the
  86. OpenEmbedded build system (e.g. the SDK).
  87. The toolchain and sysroots are based on a
  88. <ulink url='&YOCTO_DOCS_DEV_URL;#metadata'>Metadata</ulink>
  89. configuration and extensions,
  90. which allows you to cross-develop on the host machine for the
  91. target hardware.
  92. Additionally, the extensible SDK contains the
  93. <filename>devtool</filename> functionality.
  94. </para></listitem>
  95. <listitem><para>The Quick EMUlator (QEMU), which lets you simulate
  96. target hardware.
  97. QEMU is not literally part of the SDK.
  98. You must build and include this emulator separately.
  99. However, QEMU plays an important role in the development
  100. process that revolves around use of the SDK.
  101. </para></listitem>
  102. <listitem><para>The Eclipse IDE Yocto Plug-in.
  103. This plug-in is available for you if you are an Eclipse
  104. user.
  105. In the same manner as QEMU, the plug-in is not literally part
  106. of the SDK but is rather available for use as part of the
  107. development process.
  108. </para></listitem>
  109. <listitem><para>Various performance-related
  110. <ulink url='http://www.eclipse.org/linuxtools/index.php'>tools</ulink>
  111. that can enhance your development experience.
  112. These tools are also separate from the actual SDK but can be
  113. independently obtained and used in the development process.
  114. </para></listitem>
  115. </itemizedlist>
  116. </para>
  117. <para>
  118. In summary, the extensible and standard SDK share many features.
  119. However, the extensible SDK has powerful development tools to help you
  120. more quickly develop applications.
  121. Following is a table that summarizes the primary differences between
  122. the standard and extensible SDK types when considering which to
  123. build:
  124. <informaltable frame='none'>
  125. <tgroup cols='3' align='left' colsep='1' rowsep='1'>
  126. <colspec colname='c1' colwidth='1*'/>
  127. <colspec colname='c2' colwidth='1*'/>
  128. <colspec colname='c3' colwidth='1*'/>
  129. <thead>
  130. <row>
  131. <entry align="left"><emphasis>Feature</emphasis></entry>
  132. <entry align="left"><emphasis>Standard SDK</emphasis></entry>
  133. <entry align="left"><emphasis>Extensible SDK</emphasis></entry>
  134. </row>
  135. </thead>
  136. <tbody>
  137. <row>
  138. <entry align="left">Toolchain</entry>
  139. <entry align="left">Yes</entry>
  140. <entry align="left">Yes*</entry>
  141. </row>
  142. <row>
  143. <entry align="left">Debugger</entry>
  144. <entry align="left">Yes</entry>
  145. <entry align="left">Yes*</entry>
  146. </row>
  147. <row>
  148. <entry align="left">Size</entry>
  149. <entry align="left">100+ MBytes</entry>
  150. <entry align="left">1+ GBytes (or 300+ MBytes for minimal w/toolchain)</entry>
  151. </row>
  152. <row>
  153. <entry align="left"><filename>devtool</filename></entry>
  154. <entry align="left">No</entry>
  155. <entry align="left">Yes</entry>
  156. </row>
  157. <row>
  158. <entry align="left">Build Images</entry>
  159. <entry align="left">No</entry>
  160. <entry align="left">Yes</entry>
  161. </row>
  162. <row>
  163. <entry align="left">Updateable</entry>
  164. <entry align="left">No</entry>
  165. <entry align="left">Yes</entry>
  166. </row>
  167. <row>
  168. <entry align="left">Managed Sysroot**</entry>
  169. <entry align="left">No</entry>
  170. <entry align="left">Yes</entry>
  171. </row>
  172. <row>
  173. <entry align="left">Installed Packages</entry>
  174. <entry align="left">No***</entry>
  175. <entry align="left">Yes****</entry>
  176. </row>
  177. <row>
  178. <entry align="left">Construction</entry>
  179. <entry align="left">Packages</entry>
  180. <entry align="left">Shared State</entry>
  181. </row>
  182. </tbody>
  183. </tgroup>
  184. </informaltable>
  185. <literallayout class='monospaced'>
  186. * Extensible SDK will contain 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.
  187. ** Sysroot is managed through use of <filename>devtool</filename>. Thus, it is less likely that you will corrupt your SDK sysroot when you try to add additional libraries.
  188. *** Runtime package management can be added to the standard SDK but it is not supported by default.
  189. **** You must build and make the shared state available to extensible SDK users for "packages" you want to enable users to install.
  190. </literallayout>
  191. </para>
  192. <section id='the-cross-development-toolchain'>
  193. <title>The Cross-Development Toolchain</title>
  194. <para>
  195. The
  196. <ulink url='&YOCTO_DOCS_DEV_URL;#cross-development-toolchain'>Cross-Development Toolchain</ulink>
  197. consists of a cross-compiler, cross-linker, and cross-debugger
  198. that are used to develop user-space applications for targeted
  199. hardware.
  200. Additionally, for an extensible SDK, the toolchain also has
  201. built-in <filename>devtool</filename> functionality.
  202. This toolchain is created by running a SDK installer script
  203. or through a
  204. <ulink url='&YOCTO_DOCS_DEV_URL;#build-directory'>Build Directory</ulink>
  205. that is based on your Metadata configuration or extension for
  206. your targeted device.
  207. The cross-toolchain works with a matching target sysroot.
  208. </para>
  209. </section>
  210. <section id='sysroot'>
  211. <title>Sysroots</title>
  212. <para>
  213. The native and target sysroots contain needed headers and libraries
  214. for generating binaries that run on the target architecture.
  215. The target sysroot is based on the target root filesystem image
  216. that is built by the OpenEmbedded build system and uses the same
  217. Metadata configuration used to build the cross-toolchain.
  218. </para>
  219. </section>
  220. <section id='the-qemu-emulator'>
  221. <title>The QEMU Emulator</title>
  222. <para>
  223. The QEMU emulator allows you to simulate your hardware while
  224. running your application or image.
  225. QEMU is not part of the SDK but is made available a number of ways:
  226. <itemizedlist>
  227. <listitem><para>
  228. If you have cloned the <filename>poky</filename> Git
  229. repository to create a
  230. <ulink url='&YOCTO_DOCS_DEV_URL;#source-directory'>Source Directory</ulink>
  231. and you have sourced the environment setup script, QEMU is
  232. installed and automatically available.
  233. </para></listitem>
  234. <listitem><para>
  235. If you have downloaded a Yocto Project release and unpacked
  236. it to create a
  237. <ulink url='&YOCTO_DOCS_DEV_URL;#source-directory'>Source Directory</ulink>
  238. and you have sourced the environment setup script, QEMU is
  239. installed and automatically available.
  240. </para></listitem>
  241. <listitem><para>
  242. If you have installed the cross-toolchain tarball and you
  243. have sourced the toolchain's setup environment script, QEMU
  244. is also installed and automatically available.
  245. </para></listitem>
  246. </itemizedlist>
  247. </para>
  248. </section>
  249. <section id='eclipse-overview'>
  250. <title>Eclipse Yocto Plug-in</title>
  251. <para>
  252. The Eclipse IDE is a popular development environment and it fully
  253. supports development using the Yocto Project.
  254. When you install and configure the Eclipse Yocto Project Plug-in
  255. into the Eclipse IDE, you maximize your Yocto Project experience.
  256. Installing and configuring the Plug-in results in an environment
  257. that has extensions specifically designed to let you more easily
  258. develop software.
  259. These extensions allow for cross-compilation, deployment, and
  260. execution of your output into a QEMU emulation session.
  261. You can also perform cross-debugging and profiling.
  262. The environment also supports many performance-related
  263. <ulink url='http://www.eclipse.org/linuxtools/index.php'>tools</ulink>
  264. that enhance your development experience.
  265. <note>
  266. Previous releases of the Eclipse Yocto Plug-in supported
  267. "user-space tools" (i.e. LatencyTOP, PowerTOP, Perf, SystemTap,
  268. and Lttng-ust) that also added to the development experience.
  269. These tools have been deprecated beginning with this release
  270. of the plug-in.
  271. </note>
  272. </para>
  273. <para>
  274. For information about the application development workflow that
  275. uses the Eclipse IDE and for a detailed example of how to install
  276. and configure the Eclipse Yocto Project Plug-in, see the
  277. "<link linkend='sdk-developing-applications-using-eclipse'>Developing Applications Using <trademark class='trade'>Eclipse</trademark></link>"
  278. section.
  279. </para>
  280. </section>
  281. <section id='performance-enhancing-tools'>
  282. <title>Performance Enhancing Tools</title>
  283. <para>
  284. Supported performance enhancing tools are available that let you
  285. profile, debug, and perform tracing on your projects developed
  286. using Eclipse.
  287. For information on these tools see
  288. <ulink url='http://www.eclipse.org/linuxtools/'>http://www.eclipse.org/linuxtools/</ulink>.
  289. </para>
  290. </section>
  291. </section>
  292. <section id='sdk-development-model'>
  293. <title>SDK Development Model</title>
  294. <para>
  295. Fundamentally, the SDK fits into the development process as follows:
  296. <imagedata fileref="figures/sdk-environment.png" align="center" width="6in" depth="5in" scalefit="100" />
  297. The SDK is installed on any machine and can be used to develop
  298. applications, images, and kernels.
  299. An SDK can even be used by a QA Engineer or Release Engineer.
  300. The fundamental concept is that the machine that has the SDK installed
  301. does not have to be associated with the machine that has the
  302. Yocto Project installed.
  303. A developer can independently compile and test an object on their
  304. machine and then, when the object is ready for integration into an
  305. image, they can simply make it available to the machine that has the
  306. Yocto Project.
  307. Once the object is available, the image can be rebuilt using the
  308. Yocto Project to produce the modified image.
  309. </para>
  310. <para>
  311. You just need to follow these general steps:
  312. <orderedlist>
  313. <listitem><para><emphasis>Install the SDK for your target hardware:</emphasis>
  314. For information on how to install the SDK, see the
  315. "<link linkend='sdk-installing-the-sdk'>Installing the SDK</link>"
  316. section.</para></listitem>
  317. <listitem><para><emphasis>Download or Build the Target Image:</emphasis>
  318. The Yocto Project supports several target architectures
  319. and has many pre-built kernel images and root filesystem
  320. images.</para>
  321. <para>If you are going to develop your application on
  322. hardware, go to the
  323. <ulink url='&YOCTO_MACHINES_DL_URL;'><filename>machines</filename></ulink>
  324. download area and choose a target machine area
  325. from which to download the kernel image and root filesystem.
  326. This download area could have several files in it that
  327. support development using actual hardware.
  328. For example, the area might contain
  329. <filename>.hddimg</filename> files that combine the
  330. kernel image with the filesystem, boot loaders, and
  331. so forth.
  332. Be sure to get the files you need for your particular
  333. development process.</para>
  334. <para>If you are going to develop your application and
  335. then run and test it using the QEMU emulator, go to the
  336. <ulink url='&YOCTO_QEMU_DL_URL;'><filename>machines/qemu</filename></ulink>
  337. download area.
  338. From this area, go down into the directory for your
  339. target architecture (e.g. <filename>qemux86_64</filename>
  340. for an <trademark class='registered'>Intel</trademark>-based
  341. 64-bit architecture).
  342. Download kernel, root filesystem, and any other files you
  343. need for your process.
  344. <note>
  345. To use the root filesystem in QEMU, you
  346. need to extract it.
  347. See the
  348. "<link linkend='sdk-extracting-the-root-filesystem'>Extracting the Root Filesystem</link>"
  349. section for information on how to extract the root
  350. filesystem.
  351. </note>
  352. </para></listitem>
  353. <listitem><para><emphasis>Develop and Test your
  354. Application:</emphasis> At this point, you have the tools
  355. to develop your application.
  356. If you need to separately install and use the QEMU
  357. emulator, you can go to
  358. <ulink url='http://wiki.qemu.org/Main_Page'>QEMU Home Page</ulink>
  359. to download and learn about the emulator.
  360. See the
  361. "<ulink url='&YOCTO_DOCS_DEV_URL;#dev-manual-qemu'>Using the Quick EMUlator (QEMU)</ulink>"
  362. chapter in the Yocto Project Development Manual
  363. for information on using QEMU within the Yocto
  364. Project.</para></listitem>
  365. </orderedlist>
  366. </para>
  367. <para>
  368. The remainder of this manual describes how to use both the standard
  369. SDK and the extensible SDK.
  370. Information also exists in appendix form that describes how you can
  371. build, install, and modify an SDK.
  372. </para>
  373. </section>
  374. </chapter>
  375. <!--
  376. vim: expandtab tw=80 ts=4
  377. -->