1// -*- mode:doc; -*- 2// vim: set syntax=asciidoc: 3 4==== Using the generated toolchain outside Buildroot 5 6You may want to compile, for your target, your own programs or other 7software that are not packaged in Buildroot. In order to do this you 8can use the toolchain that was generated by Buildroot. 9 10The toolchain generated by Buildroot is located by default in 11+output/host/+. The simplest way to use it is to add 12+output/host/bin/+ to your PATH environment variable and then to 13use +ARCH-linux-gcc+, +ARCH-linux-objdump+, +ARCH-linux-ld+, etc. 14 15Alternatively, Buildroot can also export the toolchain and the development 16files of all selected packages, as an SDK, by running the command 17+make sdk+. This generates a tarball of the content of the host directory 18+output/host/+, named +<TARGET-TUPLE>_sdk-buildroot.tar.gz+ (which can be 19overriden by setting the environment variable +BR2_SDK_PREFIX+) and 20located in the output directory +output/images/+. 21 22This tarball can then be distributed to application developers, when 23they want to develop their applications that are not (yet) packaged as 24a Buildroot package. 25 26Upon extracting the SDK tarball, the user must run the script 27+relocate-sdk.sh+ (located at the top directory of the SDK), to make 28sure all paths are updated with the new location. 29 30Alternatively, if you just want to prepare the SDK without generating 31the tarball (e.g. because you will just be moving the +host+ directory, 32or will be generating the tarball on your own), Buildroot also allows 33you to just prepare the SDK with +make prepare-sdk+ without actually 34generating a tarball. 35 36For your convenience, by selecting the option 37+BR2_PACKAGE_HOST_ENVIRONMENT_SETUP+, you can get a 38+environment-setup+ script installed in +output/host/+ and therefore 39in your SDK. This script can be sourced with 40+. your/sdk/path/environment-setup+ to export a number of environment 41variables that will help cross-compile your projects using the 42Buildroot SDK: the +PATH+ will contain the SDK binaries, standard 43_autotools_ variables will be defined with the appropriate values, and 44+CONFIGURE_FLAGS+ will contain basic +./configure+ options to 45cross-compile _autotools_ projects. It also provides some useful 46commands. Note however that once this script is sourced, the 47environment is setup only for cross-compilation, and no longer for 48native compilation. 49