blob: 2f94aaf874173698128d0b547574e37526393b33 [file] [log] [blame]
Andrew Geisslerf0343792020-11-18 10:42:21 -06001.. SPDX-License-Identifier: CC-BY-SA-2.0-UK
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002
3************
4Introduction
5************
6
Andrew Geisslerc9f78652020-09-18 14:11:35 -05007eSDK Introduction
8=================
9
10Welcome to the Yocto Project Application Development and the Extensible
William A. Kennington IIIac69b482021-06-02 12:28:27 -070011Software Development Kit (eSDK) manual. This manual
12explains how to use both the Yocto Project extensible and standard
Andrew Geisslerc9f78652020-09-18 14:11:35 -050013SDKs to develop applications and images.
14
15.. note::
16
17 Prior to the 2.0 Release of the Yocto Project, application
18 development was primarily accomplished through the use of the
19 Application Development Toolkit (ADT) and the availability of
20 stand-alone cross-development toolchains and other tools. With the
21 2.1 Release of the Yocto Project, application development has
22 transitioned to within a tool-rich extensible SDK and the more
23 traditional standard SDK.
24
25All SDKs consist of the following:
26
27- *Cross-Development Toolchain*: This toolchain contains a compiler,
William A. Kennington IIIac69b482021-06-02 12:28:27 -070028 debugger, and various associated tools.
Andrew Geisslerc9f78652020-09-18 14:11:35 -050029
30- *Libraries, Headers, and Symbols*: The libraries, headers, and
William A. Kennington IIIac69b482021-06-02 12:28:27 -070031 symbols are specific to the image (i.e. they match the image
32 against which the SDK was built).
Andrew Geisslerc9f78652020-09-18 14:11:35 -050033
William A. Kennington IIIac69b482021-06-02 12:28:27 -070034- *Environment Setup Script*: This ``*.sh`` file, once sourced, sets up the
Andrew Geisslerc9f78652020-09-18 14:11:35 -050035 cross-development environment by defining variables and preparing for
36 SDK use.
37
38Additionally, an extensible SDK has tools that allow you to easily add
39new applications and libraries to an image, modify the source of an
40existing component, test changes on the target hardware, and easily
41integrate an application into the :term:`OpenEmbedded Build System`.
42
43You can use an SDK to independently develop and test code that is
44destined to run on some target machine. SDKs are completely
45self-contained. The binaries are linked against their own copy of
46``libc``, which results in no dependencies on the target system. To
47achieve this, the pointer to the dynamic loader is configured at install
48time since that path cannot be dynamically altered. This is the reason
49for a wrapper around the ``populate_sdk`` and ``populate_sdk_ext``
50archives.
51
William A. Kennington IIIac69b482021-06-02 12:28:27 -070052Another feature of the SDKs is that only one set of cross-compiler
Andrew Geisslerc9f78652020-09-18 14:11:35 -050053toolchain binaries are produced for any given architecture. This feature
54takes advantage of the fact that the target hardware can be passed to
55``gcc`` as a set of compiler options. Those options are set up by the
56environment script and contained in variables such as
57:term:`CC` and
58:term:`LD`. This reduces the space needed
William A. Kennington IIIac69b482021-06-02 12:28:27 -070059for the tools. Understand, however, that every target still needs its own
Andrew Geisslerc9f78652020-09-18 14:11:35 -050060sysroot because those binaries are target-specific.
61
62The SDK development environment consists of the following:
63
64- The self-contained SDK, which is an architecture-specific
65 cross-toolchain and matching sysroots (target and native) all built
66 by the OpenEmbedded build system (e.g. the SDK). The toolchain and
67 sysroots are based on a :term:`Metadata`
68 configuration and extensions, which allows you to cross-develop on
69 the host machine for the target hardware. Additionally, the
70 extensible SDK contains the ``devtool`` functionality.
71
72- The Quick EMUlator (QEMU), which lets you simulate target hardware.
73 QEMU is not literally part of the SDK. You must build and include
74 this emulator separately. However, QEMU plays an important role in
75 the development process that revolves around use of the SDK.
76
77In summary, the extensible and standard SDK share many features.
78However, the extensible SDK has powerful development tools to help you
79more quickly develop applications. Following is a table that summarizes
80the primary differences between the standard and extensible SDK types
81when considering which to build:
82
83+-----------------------+-----------------------+-----------------------+
84| *Feature* | *Standard SDK* | *Extensible SDK* |
85+=======================+=======================+=======================+
Andrew Geissler4c19ea12020-10-27 13:52:24 -050086| Toolchain | Yes | Yes [1]_ |
Andrew Geisslerc9f78652020-09-18 14:11:35 -050087+-----------------------+-----------------------+-----------------------+
Andrew Geissler4c19ea12020-10-27 13:52:24 -050088| Debugger | Yes | Yes [1]_ |
Andrew Geisslerc9f78652020-09-18 14:11:35 -050089+-----------------------+-----------------------+-----------------------+
90| Size | 100+ MBytes | 1+ GBytes (or 300+ |
91| | | MBytes for minimal |
92| | | w/toolchain) |
93+-----------------------+-----------------------+-----------------------+
94| ``devtool`` | No | Yes |
95+-----------------------+-----------------------+-----------------------+
96| Build Images | No | Yes |
97+-----------------------+-----------------------+-----------------------+
98| Updateable | No | Yes |
99+-----------------------+-----------------------+-----------------------+
Andrew Geissler4c19ea12020-10-27 13:52:24 -0500100| Managed Sysroot [2]_ | No | Yes |
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500101+-----------------------+-----------------------+-----------------------+
Andrew Geissler4c19ea12020-10-27 13:52:24 -0500102| Installed Packages | No [3]_ | Yes [4]_ |
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500103+-----------------------+-----------------------+-----------------------+
104| Construction | Packages | Shared State |
105+-----------------------+-----------------------+-----------------------+
106
Andrew Geissler4c19ea12020-10-27 13:52:24 -0500107.. [1] Extensible SDK contains the toolchain and debugger if :term:`SDK_EXT_TYPE`
108 is "full" or :term:`SDK_INCLUDE_TOOLCHAIN` is "1", which is the default.
109.. [2] Sysroot is managed through the use of ``devtool``. Thus, it is less
110 likely that you will corrupt your SDK sysroot when you try to add
111 additional libraries.
112.. [3] You can add runtime package management to the standard SDK but it is not
113 supported by default.
114.. [4] You must build and make the shared state available to extensible SDK
115 users for "packages" you want to enable users to install.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500116
117The Cross-Development Toolchain
118-------------------------------
119
120The :term:`Cross-Development Toolchain` consists
121of a cross-compiler, cross-linker, and cross-debugger that are used to
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700122develop user-space applications for targeted hardware; in addition,
123the extensible SDK comes with built-in ``devtool``
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500124functionality. This toolchain is created by running a SDK installer
125script or through a :term:`Build Directory` that is based on
126your metadata configuration or extension for your targeted device. The
127cross-toolchain works with a matching target sysroot.
128
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500129Sysroots
130--------
131
132The native and target sysroots contain needed headers and libraries for
133generating binaries that run on the target architecture. The target
134sysroot is based on the target root filesystem image that is built by
135the OpenEmbedded build system and uses the same metadata configuration
136used to build the cross-toolchain.
137
138The QEMU Emulator
139-----------------
140
141The QEMU emulator allows you to simulate your hardware while running
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700142your application or image. QEMU is not part of the SDK but is
143automatically installed and available if you have done any one of
144the following:
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500145
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700146- cloned the ``poky`` Git repository to create a
147 :term:`Source Directory` and sourced the environment setup script.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500148
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700149- downloaded a Yocto Project release and unpacked it to
150 create a Source Directory and sourced the environment setup
151 script.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500152
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700153- installed the cross-toolchain tarball and
154 sourced the toolchain's setup environment script.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500155
156SDK Development Model
157=====================
158
159Fundamentally, the SDK fits into the development process as follows:
160
161.. image:: figures/sdk-environment.png
162 :align: center
163
164The SDK is installed on any machine and can be used to develop applications,
165images, and kernels. An SDK can even be used by a QA Engineer or Release
166Engineer. The fundamental concept is that the machine that has the SDK
167installed does not have to be associated with the machine that has the
168Yocto Project installed. A developer can independently compile and test
169an object on their machine and then, when the object is ready for
170integration into an image, they can simply make it available to the
171machine that has the Yocto Project. Once the object is available, the
172image can be rebuilt using the Yocto Project to produce the modified
173image.
174
175You just need to follow these general steps:
176
1771. *Install the SDK for your target hardware:* For information on how to
Andrew Geissler3b8a17c2021-04-15 15:55:55 -0500178 install the SDK, see the ":ref:`sdk-manual/using:installing the sdk`"
179 section.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500180
1812. *Download or Build the Target Image:* The Yocto Project supports
182 several target architectures and has many pre-built kernel images and
183 root filesystem images.
184
185 If you are going to develop your application on hardware, go to the
Andrew Geissler09209ee2020-12-13 08:44:15 -0600186 :yocto_dl:`machines </releases/yocto/yocto-&DISTRO;/machines/>` download area and choose a
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500187 target machine area from which to download the kernel image and root
188 filesystem. This download area could have several files in it that
189 support development using actual hardware. For example, the area
190 might contain ``.hddimg`` files that combine the kernel image with
191 the filesystem, boot loaders, and so forth. Be sure to get the files
192 you need for your particular development process.
193
194 If you are going to develop your application and then run and test it
195 using the QEMU emulator, go to the
Andrew Geissler09209ee2020-12-13 08:44:15 -0600196 :yocto_dl:`machines/qemu </releases/yocto/yocto-&DISTRO;/machines/qemu>` download area. From this
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500197 area, go down into the directory for your target architecture (e.g.
198 ``qemux86_64`` for an Intel-based 64-bit architecture). Download the
199 kernel, root filesystem, and any other files you need for your
200 process.
201
202 .. note::
203
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700204 To use the root filesystem in QEMU, you need to extract it. See the
205 ":ref:`sdk-manual/appendix-obtain:extracting the root filesystem`"
206 section for information on how to do this extraction.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500207
2083. *Develop and Test your Application:* At this point, you have the
209 tools to develop your application. If you need to separately install
210 and use the QEMU emulator, you can go to `QEMU Home
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600211 Page <https://wiki.qemu.org/Main_Page>`__ to download and learn about
Andrew Geissler09209ee2020-12-13 08:44:15 -0600212 the emulator. See the ":doc:`/dev-manual/qemu`" chapter in the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500213 Yocto Project Development Tasks Manual for information on using QEMU
214 within the Yocto Project.
215
216The remainder of this manual describes how to use the extensible and
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700217standard SDKs. There is also information in appendix form describing
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500218how you can build, install, and modify an SDK.