Please note that User Registration has been temporarily disabled due to a recent increase in automated registrations. If anyone needs an account, please request one here: RequestAccount. Thanks for your patience!

Difference between revisions of "SDK/Toolchain/Application Developer Toolkit"

From Openembedded.org
Jump to: navigation, search
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
{{Outdated}}
 +
 
Along with recipes for building a compiler for internal its own use, OpenEmbedded has recipes to create a full cross-compiler environment for the host. First, you need to have a working OpenEmbedded environment (see [[Getting_started]]). Note that throughout this article we will use the example of working on the ARM architecture. While particular file names may differ in your case, the general process should be similar. To build the cross-compiler, build the <tt>meta-toolchain</tt> recipe,
 
Along with recipes for building a compiler for internal its own use, OpenEmbedded has recipes to create a full cross-compiler environment for the host. First, you need to have a working OpenEmbedded environment (see [[Getting_started]]). Note that throughout this article we will use the example of working on the ARM architecture. While particular file names may differ in your case, the general process should be similar. To build the cross-compiler, build the <tt>meta-toolchain</tt> recipe,
  
Line 8: Line 10:
  
 
<pre><nowiki>
 
<pre><nowiki>
$ tar -C / -pxvjf $SDK_ROOT/sdk-  
+
$ sudo tar -C / -pxvjf $SDK_ROOT/sdk-  
 
</nowiki></pre>
 
</nowiki></pre>
  
Line 17: Line 19:
 
</nowiki></pre>
 
</nowiki></pre>
 
Note that the meta-toolchain environment does not include any of the libraries included in your target image.
 
Note that the meta-toolchain environment does not include any of the libraries included in your target image.
 +
 +
= Installing libraries and headers =
 +
Along with a compiler, the meta-toolchain also comes with an installation of <tt>opkg</tt> with which one can install libraries into your cross-compilation environment. To install packages for use in cross-compiling use the <tt>opkg-target</tt> executable (not <tt>opkg</tt>; does anyone know what the latter is for?) There are a few  For instance, to install the development headers for the boost library (<tt>boost-dev</tt>),
 +
 +
<pre><nowiki>
 +
$ sudo -i
 +
# source /usr/local/angstrom/arm/environment-setup
 +
# opkg-target update
 +
# opkg-target install boost-dev
 +
</nowiki></pre>
 +
 +
This will fetch a package list from the Angstrom repository then fetch and install the boost package.
  
 
= Cross-compiling the kernel =
 
= Cross-compiling the kernel =
Because of the self-contained nature of the kernel, one must proceed slightly differently than with cross-compiling user-mode software. Namely, <b>one must not use the <tt>environment-setup</tt> script provided with <tt>meta-toolchain</tt>.</b>[http://thread.gmane.org/gmane.linux.kbuild.devel/5686/focus=39837][http://thread.gmane.org/gmane.linux.kernel/1015620/focus=5621] This script modifies environment required by the host compiler used to compile tools used during the build process, resulting in difficult to trace errors.
+
Because of the self-contained nature of the kernel, one must proceed slightly differently than with cross-compiling user-mode software. Namely, <b>one must not use the <tt>environment-setup</tt> script provided with <tt>meta-toolchain</tt>.</b> This script modifies environment required by the host compiler used to compile tools used during the build process, resulting in difficult to trace errors.[http://thread.gmane.org/gmane.linux.kbuild.devel/5686/focus=39837][http://thread.gmane.org/gmane.linux.kernel/1015620/focus=5621]
  
 
Instead, one simply must pass the target architecture and the cross-compiler executable name prefix to Kbuild,
 
Instead, one simply must pass the target architecture and the cross-compiler executable name prefix to Kbuild,
Line 36: Line 50:
 
$ make  
 
$ make  
 
</nowiki></pre>
 
</nowiki></pre>
 +
 +
= Other Resources =
 +
The OpenMoko wiki has a very useful page[http://wiki.openmoko.org/wiki/Toolchain] describing toolchain installation and usage.

Latest revision as of 15:01, 7 November 2012

NOTE: This page has been identified as having content that is significantly out-of-date, usually because it refers to OpenEmbedded-Classic - for new projects, you should use OpenEmbedded-Core.

See OpenEmbedded Wiki Update Project for more details.

Along with recipes for building a compiler for internal its own use, OpenEmbedded has recipes to create a full cross-compiler environment for the host. First, you need to have a working OpenEmbedded environment (see Getting_started). Note that throughout this article we will use the example of working on the ARM architecture. While particular file names may differ in your case, the general process should be similar. To build the cross-compiler, build the meta-toolchain recipe,

$ bitbake meta-toolchain

This will produce a tarball in a subdirectory of deploy/sdk. This tarball includes compiler executables, libraries, and core headers, as well as a small environment script, all under the prefix of usr/local/angstrom. To install this tarball, simply untar into /,

$ sudo tar -C / -pxvjf $SDK_ROOT/sdk- 

To cross-compile a package for your target platform, simply source the provided environment-setup script and compile as usual,

$ source /usr/local/angstrom/arm/environment-setup
$ make

Note that the meta-toolchain environment does not include any of the libraries included in your target image.

[edit] Installing libraries and headers

Along with a compiler, the meta-toolchain also comes with an installation of opkg with which one can install libraries into your cross-compilation environment. To install packages for use in cross-compiling use the opkg-target executable (not opkg; does anyone know what the latter is for?) There are a few For instance, to install the development headers for the boost library (boost-dev),

$ sudo -i
# source /usr/local/angstrom/arm/environment-setup
# opkg-target update
# opkg-target install boost-dev

This will fetch a package list from the Angstrom repository then fetch and install the boost package.

[edit] Cross-compiling the kernel

Because of the self-contained nature of the kernel, one must proceed slightly differently than with cross-compiling user-mode software. Namely, one must not use the environment-setup script provided with meta-toolchain. This script modifies environment required by the host compiler used to compile tools used during the build process, resulting in difficult to trace errors.[1][2]

Instead, one simply must pass the target architecture and the cross-compiler executable name prefix to Kbuild,

$ cd linux-2.6
$ export ARCH=arm
$ export CROSS_COMPILE=/usr/local/angstrom/arm/bin/
$ make menuconfig
$ make 

The kernel Makefile also contains useful rules for packing the kernel image and modules into a tarball, for easy installation on the target,

$ make 

[edit] Other Resources

The OpenMoko wiki has a very useful page[3] describing toolchain installation and usage.

Personal tools
Namespaces

Variants
Actions
Navigation
Categories
OE services
Toolbox