using-buildroot-toolchain.txt 2.3 KB

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