sdk-intro.xml 20 KB

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