xref: /OK3568_Linux_fs/yocto/poky/documentation/sdk-manual/using.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. SPDX-License-Identifier: CC-BY-SA-2.0-UK
2*4882a593Smuzhiyun
3*4882a593Smuzhiyun**********************
4*4882a593SmuzhiyunUsing the Standard SDK
5*4882a593Smuzhiyun**********************
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunThis chapter describes the standard SDK and how to install it.
8*4882a593SmuzhiyunInformation includes unique installation and setup aspects for the
9*4882a593Smuzhiyunstandard SDK.
10*4882a593Smuzhiyun
11*4882a593Smuzhiyun.. note::
12*4882a593Smuzhiyun
13*4882a593Smuzhiyun   For a side-by-side comparison of main features supported for a
14*4882a593Smuzhiyun   standard SDK as compared to an extensible SDK, see the
15*4882a593Smuzhiyun   ":ref:`sdk-manual/intro:introduction`" section.
16*4882a593Smuzhiyun
17*4882a593SmuzhiyunYou can use a standard SDK to work on Makefile and Autotools-based
18*4882a593Smuzhiyunprojects. See the
19*4882a593Smuzhiyun":ref:`sdk-manual/working-projects:using the sdk toolchain directly`" chapter
20*4882a593Smuzhiyunfor more information.
21*4882a593Smuzhiyun
22*4882a593SmuzhiyunWhy use the Standard SDK and What is in It?
23*4882a593Smuzhiyun===========================================
24*4882a593Smuzhiyun
25*4882a593SmuzhiyunThe Standard SDK provides a cross-development toolchain and libraries
26*4882a593Smuzhiyuntailored to the contents of a specific image. You would use the Standard
27*4882a593SmuzhiyunSDK if you want a more traditional toolchain experience as compared to
28*4882a593Smuzhiyunthe extensible SDK, which provides an internal build system and the
29*4882a593Smuzhiyun``devtool`` functionality.
30*4882a593Smuzhiyun
31*4882a593SmuzhiyunThe installed Standard SDK consists of several files and directories.
32*4882a593SmuzhiyunBasically, it contains an SDK environment setup script, some
33*4882a593Smuzhiyunconfiguration files, and host and target root filesystems to support
34*4882a593Smuzhiyunusage. You can see the directory structure in the
35*4882a593Smuzhiyun":ref:`sdk-manual/appendix-obtain:installed standard sdk directory structure`"
36*4882a593Smuzhiyunsection.
37*4882a593Smuzhiyun
38*4882a593SmuzhiyunInstalling the SDK
39*4882a593Smuzhiyun==================
40*4882a593Smuzhiyun
41*4882a593SmuzhiyunThe first thing you need to do is install the SDK on your :term:`Build
42*4882a593SmuzhiyunHost` by running the ``*.sh`` installation script.
43*4882a593Smuzhiyun
44*4882a593SmuzhiyunYou can download a tarball installer, which includes the pre-built
45*4882a593Smuzhiyuntoolchain, the ``runqemu`` script, and support files from the
46*4882a593Smuzhiyunappropriate :yocto_dl:`toolchain </releases/yocto/yocto-&DISTRO;/toolchain/>` directory within
47*4882a593Smuzhiyunthe Index of Releases. Toolchains are available for several 32-bit and
48*4882a593Smuzhiyun64-bit architectures with the ``x86_64`` directories, respectively. The
49*4882a593Smuzhiyuntoolchains the Yocto Project provides are based off the
50*4882a593Smuzhiyun``core-image-sato`` and ``core-image-minimal`` images and contain
51*4882a593Smuzhiyunlibraries appropriate for developing against the corresponding image.
52*4882a593Smuzhiyun
53*4882a593SmuzhiyunThe names of the tarball installer scripts are such that a string
54*4882a593Smuzhiyunrepresenting the host system appears first in the filename and then is
55*4882a593Smuzhiyunimmediately followed by a string representing the target architecture.
56*4882a593Smuzhiyun::
57*4882a593Smuzhiyun
58*4882a593Smuzhiyun   poky-glibc-host_system-image_type-arch-toolchain-release_version.sh
59*4882a593Smuzhiyun
60*4882a593Smuzhiyun   Where:
61*4882a593Smuzhiyun       host_system is a string representing your development system:
62*4882a593Smuzhiyun
63*4882a593Smuzhiyun                  i686 or x86_64.
64*4882a593Smuzhiyun
65*4882a593Smuzhiyun       image_type is the image for which the SDK was built:
66*4882a593Smuzhiyun
67*4882a593Smuzhiyun                  core-image-minimal or core-image-sato.
68*4882a593Smuzhiyun
69*4882a593Smuzhiyun       arch is a string representing the tuned target architecture:
70*4882a593Smuzhiyun
71*4882a593Smuzhiyun                  aarch64, armv5e, core2-64, i586, mips32r2, mips64, ppc7400, or cortexa8hf-neon.
72*4882a593Smuzhiyun
73*4882a593Smuzhiyun       release_version is a string representing the release number of the Yocto Project:
74*4882a593Smuzhiyun
75*4882a593Smuzhiyun                  &DISTRO;, &DISTRO;+snapshot
76*4882a593Smuzhiyun
77*4882a593SmuzhiyunFor example, the following SDK installer is for a 64-bit
78*4882a593Smuzhiyundevelopment host system and a i586-tuned target architecture based off
79*4882a593Smuzhiyunthe SDK for ``core-image-sato`` and using the current DISTRO snapshot::
80*4882a593Smuzhiyun
81*4882a593Smuzhiyun   poky-glibc-x86_64-core-image-sato-i586-toolchain-DISTRO.sh
82*4882a593Smuzhiyun
83*4882a593Smuzhiyun.. note::
84*4882a593Smuzhiyun
85*4882a593Smuzhiyun   As an alternative to downloading an SDK, you can build the SDK
86*4882a593Smuzhiyun   installer. For information on building the installer, see the
87*4882a593Smuzhiyun   ":ref:`sdk-manual/appendix-obtain:building an sdk installer`"
88*4882a593Smuzhiyun   section.
89*4882a593Smuzhiyun
90*4882a593SmuzhiyunThe SDK and toolchains are self-contained and by default are installed
91*4882a593Smuzhiyuninto the ``poky_sdk`` folder in your home directory. You can choose to
92*4882a593Smuzhiyuninstall the extensible SDK in any location when you run the installer.
93*4882a593SmuzhiyunHowever, because files need to be written under that directory during
94*4882a593Smuzhiyunthe normal course of operation, the location you choose for installation
95*4882a593Smuzhiyunmust be writable for whichever users need to use the SDK.
96*4882a593Smuzhiyun
97*4882a593SmuzhiyunThe following command shows how to run the installer given a toolchain
98*4882a593Smuzhiyuntarball for a 64-bit x86 development host system and a 64-bit x86 target
99*4882a593Smuzhiyunarchitecture. The example assumes the SDK installer is located in
100*4882a593Smuzhiyun``~/Downloads/`` and has execution rights.
101*4882a593Smuzhiyun
102*4882a593Smuzhiyun.. note::
103*4882a593Smuzhiyun
104*4882a593Smuzhiyun   If you do not have write permissions for the directory into which you
105*4882a593Smuzhiyun   are installing the SDK, the installer notifies you and exits. For
106*4882a593Smuzhiyun   that case, set up the proper permissions in the directory and run the
107*4882a593Smuzhiyun   installer again.
108*4882a593Smuzhiyun
109*4882a593Smuzhiyun::
110*4882a593Smuzhiyun
111*4882a593Smuzhiyun   $ ./Downloads/poky-glibc-x86_64-core-image-sato-i586-toolchain-&DISTRO;.sh
112*4882a593Smuzhiyun   Poky (Yocto Project Reference Distro) SDK installer version &DISTRO;
113*4882a593Smuzhiyun   ===============================================================
114*4882a593Smuzhiyun   Enter target directory for SDK (default: /opt/poky/&DISTRO;):
115*4882a593Smuzhiyun   You are about to install the SDK to "/opt/poky/&DISTRO;". Proceed [Y/n]? Y
116*4882a593Smuzhiyun   Extracting SDK........................................ ..............................done
117*4882a593Smuzhiyun   Setting it up...done
118*4882a593Smuzhiyun   SDK has been successfully set up and is ready to be used.
119*4882a593Smuzhiyun   Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g.
120*4882a593Smuzhiyun    $ . /opt/poky/&DISTRO;/environment-setup-i586-poky-linux
121*4882a593Smuzhiyun
122*4882a593SmuzhiyunAgain, reference the
123*4882a593Smuzhiyun":ref:`sdk-manual/appendix-obtain:installed standard sdk directory structure`"
124*4882a593Smuzhiyunsection for more details on the resulting directory structure of the installed
125*4882a593SmuzhiyunSDK.
126*4882a593Smuzhiyun
127*4882a593SmuzhiyunRunning the SDK Environment Setup Script
128*4882a593Smuzhiyun========================================
129*4882a593Smuzhiyun
130*4882a593SmuzhiyunOnce you have the SDK installed, you must run the SDK environment setup
131*4882a593Smuzhiyunscript before you can actually use the SDK. This setup script resides in
132*4882a593Smuzhiyunthe directory you chose when you installed the SDK, which is either the
133*4882a593Smuzhiyundefault ``/opt/poky/&DISTRO;`` directory or the directory you chose during
134*4882a593Smuzhiyuninstallation.
135*4882a593Smuzhiyun
136*4882a593SmuzhiyunBefore running the script, be sure it is the one that matches the
137*4882a593Smuzhiyunarchitecture for which you are developing. Environment setup scripts
138*4882a593Smuzhiyunbegin with the string "``environment-setup``" and include as part of
139*4882a593Smuzhiyuntheir name the tuned target architecture. As an example, the following
140*4882a593Smuzhiyuncommands set the working directory to where the SDK was installed and
141*4882a593Smuzhiyunthen source the environment setup script. In this example, the setup
142*4882a593Smuzhiyunscript is for an IA-based target machine using i586 tuning::
143*4882a593Smuzhiyun
144*4882a593Smuzhiyun   $ source /opt/poky/&DISTRO;/environment-setup-i586-poky-linux
145*4882a593Smuzhiyun
146*4882a593SmuzhiyunWhen you run the
147*4882a593Smuzhiyunsetup script, the same environment variables are defined as are when you
148*4882a593Smuzhiyunrun the setup script for an extensible SDK. See the
149*4882a593Smuzhiyun":ref:`sdk-manual/appendix-obtain:installed extensible sdk directory structure`"
150*4882a593Smuzhiyunsection for more information.
151