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