intro.rst 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. .. SPDX-License-Identifier: CC-BY-SA-2.0-UK
  2. ************
  3. Introduction
  4. ************
  5. eSDK Introduction
  6. =================
  7. Welcome to the Yocto Project Application Development and the Extensible
  8. Software Development Kit (eSDK) manual. This manual
  9. explains how to use both the Yocto Project extensible and standard
  10. SDKs to develop applications and images.
  11. All SDKs consist of the following:
  12. - *Cross-Development Toolchain*: This toolchain contains a compiler,
  13. debugger, and various associated tools.
  14. - *Libraries, Headers, and Symbols*: The libraries, headers, and
  15. symbols are specific to the image (i.e. they match the image
  16. against which the SDK was built).
  17. - *Environment Setup Script*: This ``*.sh`` file, once sourced, sets up the
  18. cross-development environment by defining variables and preparing for
  19. SDK use.
  20. Additionally, an extensible SDK has tools that allow you to easily add
  21. new applications and libraries to an image, modify the source of an
  22. existing component, test changes on the target hardware, and easily
  23. integrate an application into the :term:`OpenEmbedded Build System`.
  24. You can use an SDK to independently develop and test code that is
  25. destined to run on some target machine. SDKs are completely
  26. self-contained. The binaries are linked against their own copy of
  27. ``libc``, which results in no dependencies on the target system. To
  28. achieve this, the pointer to the dynamic loader is configured at install
  29. time since that path cannot be dynamically altered. This is the reason
  30. for a wrapper around the ``populate_sdk`` and ``populate_sdk_ext``
  31. archives.
  32. Another feature of the SDKs is that only one set of cross-compiler
  33. toolchain binaries are produced for any given architecture. This feature
  34. takes advantage of the fact that the target hardware can be passed to
  35. ``gcc`` as a set of compiler options. Those options are set up by the
  36. environment script and contained in variables such as
  37. :term:`CC` and
  38. :term:`LD`. This reduces the space needed
  39. for the tools. Understand, however, that every target still needs its own
  40. sysroot because those binaries are target-specific.
  41. The SDK development environment consists of the following:
  42. - The self-contained SDK, which is an architecture-specific
  43. cross-toolchain and matching sysroots (target and native) all built
  44. by the OpenEmbedded build system (e.g. the SDK). The toolchain and
  45. sysroots are based on a :term:`Metadata`
  46. configuration and extensions, which allows you to cross-develop on
  47. the host machine for the target hardware. Additionally, the
  48. extensible SDK contains the ``devtool`` functionality.
  49. - The Quick EMUlator (QEMU), which lets you simulate target hardware.
  50. QEMU is not literally part of the SDK. You must build and include
  51. this emulator separately. However, QEMU plays an important role in
  52. the development process that revolves around use of the SDK.
  53. In summary, the extensible and standard SDK share many features.
  54. However, the extensible SDK has powerful development tools to help you
  55. more quickly develop applications. Here is a table that summarizes
  56. the primary differences between the standard and extensible SDK types
  57. when considering which to build:
  58. +-----------------------+-----------------------+-----------------------+
  59. | *Feature* | *Standard SDK* | *Extensible SDK* |
  60. +=======================+=======================+=======================+
  61. | Toolchain | Yes | Yes [1]_ |
  62. +-----------------------+-----------------------+-----------------------+
  63. | Debugger | Yes | Yes [1]_ |
  64. +-----------------------+-----------------------+-----------------------+
  65. | Size | 100+ MBytes | 1+ GBytes (or 300+ |
  66. | | | MBytes for minimal |
  67. | | | w/toolchain) |
  68. +-----------------------+-----------------------+-----------------------+
  69. | ``devtool`` | No | Yes |
  70. +-----------------------+-----------------------+-----------------------+
  71. | Build Images | No | Yes |
  72. +-----------------------+-----------------------+-----------------------+
  73. | Updateable | No | Yes |
  74. +-----------------------+-----------------------+-----------------------+
  75. | Managed Sysroot [2]_ | No | Yes |
  76. +-----------------------+-----------------------+-----------------------+
  77. | Installed Packages | No [3]_ | Yes [4]_ |
  78. +-----------------------+-----------------------+-----------------------+
  79. | Construction | Packages | Shared State |
  80. +-----------------------+-----------------------+-----------------------+
  81. .. [1] Extensible SDK contains the toolchain and debugger if :term:`SDK_EXT_TYPE`
  82. is "full" or :term:`SDK_INCLUDE_TOOLCHAIN` is "1", which is the default.
  83. .. [2] Sysroot is managed through the use of ``devtool``. Thus, it is less
  84. likely that you will corrupt your SDK sysroot when you try to add
  85. additional libraries.
  86. .. [3] You can add runtime package management to the standard SDK but it is not
  87. supported by default.
  88. .. [4] You must build and make the shared state available to extensible SDK
  89. users for "packages" you want to enable users to install.
  90. The Cross-Development Toolchain
  91. -------------------------------
  92. The :term:`Cross-Development Toolchain` consists
  93. of a cross-compiler, cross-linker, and cross-debugger that are used to
  94. develop user-space applications for targeted hardware; in addition,
  95. the extensible SDK comes with built-in ``devtool``
  96. functionality. This toolchain is created by running a SDK installer
  97. script or through a :term:`Build Directory` that is based on
  98. your metadata configuration or extension for your targeted device. The
  99. cross-toolchain works with a matching target sysroot.
  100. Sysroots
  101. --------
  102. The native and target sysroots contain needed headers and libraries for
  103. generating binaries that run on the target architecture. The target
  104. sysroot is based on the target root filesystem image that is built by
  105. the OpenEmbedded build system and uses the same metadata configuration
  106. used to build the cross-toolchain.
  107. The QEMU Emulator
  108. -----------------
  109. The QEMU emulator allows you to simulate your hardware while running
  110. your application or image. QEMU is not part of the SDK but is
  111. automatically installed and available if you have done any one of
  112. the following:
  113. - cloned the ``poky`` Git repository to create a
  114. :term:`Source Directory` and sourced the environment setup script.
  115. - downloaded a Yocto Project release and unpacked it to
  116. create a Source Directory and sourced the environment setup
  117. script.
  118. - installed the cross-toolchain tarball and
  119. sourced the toolchain's setup environment script.
  120. SDK Development Model
  121. =====================
  122. Fundamentally, the SDK fits into the development process as follows:
  123. .. image:: figures/sdk-environment.png
  124. :width: 100%
  125. The SDK is installed on any machine and can be used to develop applications,
  126. images, and kernels. An SDK can even be used by a QA Engineer or Release
  127. Engineer. The fundamental concept is that the machine that has the SDK
  128. installed does not have to be associated with the machine that has the
  129. Yocto Project installed. A developer can independently compile and test
  130. an object on their machine and then, when the object is ready for
  131. integration into an image, they can simply make it available to the
  132. machine that has the Yocto Project. Once the object is available, the
  133. image can be rebuilt using the Yocto Project to produce the modified
  134. image.
  135. You just need to follow these general steps:
  136. #. *Install the SDK for your target hardware:* For information on how to
  137. install the SDK, see the ":ref:`sdk-manual/using:installing the sdk`"
  138. section.
  139. #. *Download or Build the Target Image:* The Yocto Project supports
  140. several target architectures and has many pre-built kernel images and
  141. root filesystem images.
  142. If you are going to develop your application on hardware, go to the
  143. :yocto_dl:`machines </releases/yocto/&DISTRO_REL_LATEST_TAG;/machines/>` download area and choose a
  144. target machine area from which to download the kernel image and root
  145. filesystem. This download area could have several files in it that
  146. support development using actual hardware. For example, the area
  147. might contain ``.hddimg`` files that combine the kernel image with
  148. the filesystem, boot loaders, and so forth. Be sure to get the files
  149. you need for your particular development process.
  150. If you are going to develop your application and then run and test it
  151. using the QEMU emulator, go to the
  152. :yocto_dl:`machines/qemu </releases/yocto/&DISTRO_REL_LATEST_TAG;/machines/qemu>` download area. From this
  153. area, go down into the directory for your target architecture (e.g.
  154. ``qemux86_64`` for an Intel-based 64-bit architecture). Download the
  155. kernel, root filesystem, and any other files you need for your
  156. process.
  157. .. note::
  158. To use the root filesystem in QEMU, you need to extract it. See the
  159. ":ref:`sdk-manual/appendix-obtain:extracting the root filesystem`"
  160. section for information on how to do this extraction.
  161. #. *Develop and Test your Application:* At this point, you have the
  162. tools to develop your application. If you need to separately install
  163. and use the QEMU emulator, you can go to `QEMU Home
  164. Page <https://wiki.qemu.org/Main_Page>`__ to download and learn about
  165. the emulator. See the ":doc:`/dev-manual/qemu`" chapter in the
  166. Yocto Project Development Tasks Manual for information on using QEMU
  167. within the Yocto Project.
  168. The remainder of this manual describes how to use the extensible and
  169. standard SDKs. There is also information in appendix form describing
  170. how you can build, install, and modify an SDK.