1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-09 17:39:31 +00:00
Files
poky/documentation/getting-started/eclipse/html/getting-started/cross-development-toolchain-generation.html
T
Scott Rifenbark ae06e04cd2 documentation: Created new "Getting Started" manual.
Creation involved removing the overview-manual and replacing it
with the getting-started manual.  All links to the string
"&YOCTO_DOCS_OVERVIEW_URL" had to be replaced with
"&YOCTO_DOCS_GS_URL" across the entire YP manual set.  I renamed
files used to create the manual with prefixes suited for the
new manual name, which is "Getting Started With Yocto Project".

The style sheet for the new manual needed updating to display the
new .PNG image for the title page.  The mega-manual file had to
be updated to include the files.  The mega-manual.sed file had
to be updated to include the new manual and not use the overview
manual.

(From yocto-docs rev: 6c7abf9192390121000f577d6c98f259d290d15d)

Signed-off-by: Scott Rifenbark <srifenbark@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-02-14 15:25:29 +00:00

242 lines
12 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>3.2. Cross-Development Toolchain Generation</title>
<link rel="stylesheet" type="text/css" href="../book.css">
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="Getting Started With Yocto Project">
<link rel="up" href="overview-concepts.html" title="Chapter 3. Yocto Project Concepts">
<link rel="prev" href="usingpoky-components-configuration.html" title="3.1.5. Configuration">
<link rel="next" href="shared-state-cache.html" title="3.3. Shared State Cache">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="section" title="3.2. Cross-Development Toolchain Generation">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="cross-development-toolchain-generation"></a>3.2. Cross-Development Toolchain Generation</h2></div></div></div>
<p>
The Yocto Project does most of the work for you when it comes to
creating
<a class="link" href="../ref-manual/cross-development-toolchain.html" target="_self">cross-development toolchains</a>.
This section provides some technical background on how
cross-development toolchains are created and used.
For more information on toolchains, you can also see the
<a class="link" href="../sdk-manual/index.html" target="_self">Yocto Project Application Development and the Extensible Software Development Kit (eSDK)</a>
manual.
</p>
<p>
In the Yocto Project development environment, cross-development
toolchains are used to build the image and applications that run
on the target hardware.
With just a few commands, the OpenEmbedded build system creates
these necessary toolchains for you.
</p>
<p>
The following figure shows a high-level build environment regarding
toolchain construction and use.
</p>
<p>
</p>
<table border="0" summary="manufactured viewport for HTML img" cellspacing="0" cellpadding="0" width="720"><tr style="height: 540px"><td align="center"><img src="figures/cross-development-toolchains.png" align="middle" width="720"></td></tr></table>
<p>
</p>
<p>
Most of the work occurs on the Build Host.
This is the machine used to build images and generally work within the
the Yocto Project environment.
When you run BitBake to create an image, the OpenEmbedded build system
uses the host <code class="filename">gcc</code> compiler to bootstrap a
cross-compiler named <code class="filename">gcc-cross</code>.
The <code class="filename">gcc-cross</code> compiler is what BitBake uses to
compile source files when creating the target image.
You can think of <code class="filename">gcc-cross</code> simply as an
automatically generated cross-compiler that is used internally within
BitBake only.
</p>
<div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Note</h3>
The extensible SDK does not use
<code class="filename">gcc-cross-canadian</code> since this SDK
ships a copy of the OpenEmbedded build system and the sysroot
within it contains <code class="filename">gcc-cross</code>.
</div>
<p>
</p>
<p>
The chain of events that occurs when <code class="filename">gcc-cross</code> is
bootstrapped is as follows:
</p>
<pre class="literallayout">
gcc -&gt; binutils-cross -&gt; gcc-cross-initial -&gt; linux-libc-headers -&gt; glibc-initial -&gt; glibc -&gt; gcc-cross -&gt; gcc-runtime
</pre>
<p>
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
<code class="filename">gcc</code>:
The build host's GNU Compiler Collection (GCC).
</p></li>
<li class="listitem"><p>
<code class="filename">binutils-cross</code>:
The bare minimum binary utilities needed in order to run
the <code class="filename">gcc-cross-initial</code> phase of the
bootstrap operation.
</p></li>
<li class="listitem"><p>
<code class="filename">gcc-cross-initial</code>:
An early stage of the bootstrap process for creating
the cross-compiler.
This stage builds enough of the <code class="filename">gcc-cross</code>,
the C library, and other pieces needed to finish building the
final cross-compiler in later stages.
This tool is a "native" package (i.e. it is designed to run on
the build host).
</p></li>
<li class="listitem"><p>
<code class="filename">linux-libc-headers</code>:
Headers needed for the cross-compiler.
</p></li>
<li class="listitem"><p>
<code class="filename">glibc-initial</code>:
An initial version of the Embedded GLIBC needed to bootstrap
<code class="filename">glibc</code>.
</p></li>
<li class="listitem">
<p>
<code class="filename">gcc-cross</code>:
The final stage of the bootstrap process for the
cross-compiler.
This stage results in the actual cross-compiler that
BitBake uses when it builds an image for a targeted
device.
</p>
<div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Note</h3>
If you are replacing this cross compiler toolchain
with a custom version, you must replace
<code class="filename">gcc-cross</code>.
</div>
<p>
This tool is also a "native" package (i.e. it is
designed to run on the build host).
</p>
</li>
<li class="listitem"><p>
<code class="filename">gcc-runtime</code>:
Runtime libraries resulting from the toolchain bootstrapping
process.
This tool produces a binary that consists of the
runtime libraries need for the targeted device.
</p></li>
</ul></div>
<p>
</p>
<p>
You can use the OpenEmbedded build system to build an installer for
the relocatable SDK used to develop applications.
When you run the installer, it installs the toolchain, which contains
the development tools (e.g., the
<code class="filename">gcc-cross-canadian</code>),
<code class="filename">binutils-cross-canadian</code>, and other
<code class="filename">nativesdk-*</code> tools,
which are tools native to the SDK (i.e. native to
<a class="link" href="../ref-manual/var-SDK_ARCH.html" target="_self"><code class="filename">SDK_ARCH</code></a>),
you need to cross-compile and test your software.
The figure shows the commands you use to easily build out this
toolchain.
This cross-development toolchain is built to execute on the
<a class="link" href="../ref-manual/var-SDKMACHINE.html" target="_self"><code class="filename">SDKMACHINE</code></a>,
which might or might not be the same
machine as the Build Host.
</p>
<div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Note</h3>
If your target architecture is supported by the Yocto Project,
you can take advantage of pre-built images that ship with the
Yocto Project and already contain cross-development toolchain
installers.
</div>
<p>
</p>
<p>
Here is the bootstrap process for the relocatable toolchain:
</p>
<pre class="literallayout">
gcc -&gt; binutils-crosssdk -&gt; gcc-crosssdk-initial -&gt; linux-libc-headers -&gt;
glibc-initial -&gt; nativesdk-glibc -&gt; gcc-crosssdk -&gt; gcc-cross-canadian
</pre>
<p>
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
<code class="filename">gcc</code>:
The build host's GNU Compiler Collection (GCC).
</p></li>
<li class="listitem"><p>
<code class="filename">binutils-crosssdk</code>:
The bare minimum binary utilities needed in order to run
the <code class="filename">gcc-crosssdk-initial</code> phase of the
bootstrap operation.
</p></li>
<li class="listitem"><p>
<code class="filename">gcc-crosssdk-initial</code>:
An early stage of the bootstrap process for creating
the cross-compiler.
This stage builds enough of the
<code class="filename">gcc-crosssdk</code> and supporting pieces so that
the final stage of the bootstrap process can produce the
finished cross-compiler.
This tool is a "native" binary that runs on the build host.
</p></li>
<li class="listitem"><p>
<code class="filename">linux-libc-headers</code>:
Headers needed for the cross-compiler.
</p></li>
<li class="listitem"><p>
<code class="filename">glibc-initial</code>:
An initial version of the Embedded GLIBC needed to bootstrap
<code class="filename">nativesdk-glibc</code>.
</p></li>
<li class="listitem"><p>
<code class="filename">nativesdk-glibc</code>:
The Embedded GLIBC needed to bootstrap the
<code class="filename">gcc-crosssdk</code>.
</p></li>
<li class="listitem"><p>
<code class="filename">gcc-crosssdk</code>:
The final stage of the bootstrap process for the
relocatable cross-compiler.
The <code class="filename">gcc-crosssdk</code> is a transitory compiler
and never leaves the build host.
Its purpose is to help in the bootstrap process to create the
eventual relocatable <code class="filename">gcc-cross-canadian</code>
compiler, which is relocatable.
This tool is also a "native" package (i.e. it is
designed to run on the build host).
</p></li>
<li class="listitem"><p>
<code class="filename">gcc-cross-canadian</code>:
The final relocatable cross-compiler.
When run on the
<a class="link" href="../ref-manual/var-SDKMACHINE.html" target="_self"><code class="filename">SDKMACHINE</code></a>,
this tool
produces executable code that runs on the target device.
Only one cross-canadian compiler is produced per architecture
since they can be targeted at different processor optimizations
using configurations passed to the compiler through the
compile commands.
This circumvents the need for multiple compilers and thus
reduces the size of the toolchains.
</p></li>
</ul></div>
<p>
</p>
<div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Note</h3>
For information on advantages gained when building a
cross-development toolchain installer, see the
"<a class="link" href="../sdk-manual/sdk-building-an-sdk-installer.html" target="_self">Building an SDK Installer</a>"
section in the Yocto Project Application Development and the
Extensible Software Development Kit (eSDK) manual.
</div>
</div></body>
</html>