aboutsummaryrefslogtreecommitdiff
path: root/docs/manual/using-buildroot-toolchain.txt
blob: 110be5939fafbba7211c845a8098a80e837f1037 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// -*- mode:doc; -*-
// vim: set syntax=asciidoc:

==== Using the generated toolchain outside Buildroot

You may want to compile, for your target, your own programs or other
software that are not packaged in Buildroot. In order to do this you
can use the toolchain that was generated by Buildroot.

The toolchain generated by Buildroot is located by default in
+output/host/+. The simplest way to use it is to add
+output/host/bin/+ to your PATH environment variable and then to
use +ARCH-linux-gcc+, +ARCH-linux-objdump+, +ARCH-linux-ld+, etc.

Alternatively, Buildroot can also export the toolchain and the development
files of all selected packages, as an SDK, by running the command
+make sdk+. This generates a tarball of the content of the host directory
+output/host/+, named +<TARGET-TUPLE>_sdk-buildroot.tar.gz+ (which can be
overriden by setting the environment variable +BR2_SDK_PREFIX+) and
located in the output directory +output/images/+.

This tarball can then be distributed to application developers, when
they want to develop their applications that are not (yet) packaged as
a Buildroot package.

Upon extracting the SDK tarball, the user must run the script
+relocate-sdk.sh+ (located at the top directory of the SDK), to make
sure all paths are updated with the new location.

Alternatively, if you just want to prepare the SDK without generating
the tarball (e.g. because you will just be moving the +host+ directory,
or will be generating the tarball on your own), Buildroot also allows
you to just prepare the SDK with +make prepare-sdk+ without actually
generating a tarball.

For your convenience, by selecting the option
+BR2_PACKAGE_HOST_ENVIRONMENT_SETUP+, you can get a
+setup-environment+ script installed in +output/host/+ and therefore
in your SDK.  This script can be sourced with
+. your/sdk/path/environment-setup+ to export a number of environment
variables that will help cross-compile your projects using the
Buildroot SDK: the +PATH+ will contain the SDK binaries, standard
_autotools_ variables will be defined with the appropriate values, and
+CONFIGURE_FLAGS+ will contain basic +./configure+ options to
cross-compile _autotools_ projects. It also provides some useful
commands. Note however that once this script is sourced, the
environment is setup only for cross-compilation, and no longer for
native compilation.