how-buildroot-works.txt 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // -*- mode:doc; -*-
  2. // vim: set syntax=asciidoc:
  3. == How Buildroot works
  4. As mentioned above, Buildroot is basically a set of Makefiles that
  5. download, configure, and compile software with the correct options. It
  6. also includes patches for various software packages - mainly the ones
  7. involved in the cross-compilation toolchain (+gcc+, +binutils+ and
  8. +uClibc+).
  9. There is basically one Makefile per software package, and they are
  10. named with the +.mk+ extension. Makefiles are split into many different
  11. parts.
  12. * The +toolchain/+ directory contains the Makefiles
  13. and associated files for all software related to the
  14. cross-compilation toolchain: +binutils+, +gcc+, +gdb+,
  15. +kernel-headers+ and +uClibc+.
  16. * The +arch/+ directory contains the definitions for all the processor
  17. architectures that are supported by Buildroot.
  18. * The +package/+ directory contains the Makefiles and
  19. associated files for all user-space tools and libraries that Buildroot
  20. can compile and add to the target root filesystem. There is one
  21. sub-directory per package.
  22. * The +linux/+ directory contains the Makefiles and associated files for
  23. the Linux kernel.
  24. * The +boot/+ directory contains the Makefiles and associated files for
  25. the bootloaders supported by Buildroot.
  26. * The +system/+ directory contains support for system integration, e.g.
  27. the target filesystem skeleton and the selection of an init system.
  28. * The +fs/+ directory contains the Makefiles and
  29. associated files for software related to the generation of the
  30. target root filesystem image.
  31. Each directory contains at least 2 files:
  32. * +something.mk+ is the Makefile that downloads, configures,
  33. compiles and installs the package +something+.
  34. * +Config.in+ is a part of the configuration tool
  35. description file. It describes the options related to the
  36. package.
  37. The main Makefile performs the following steps (once the
  38. configuration is done):
  39. * Create all the output directories: +staging+, +target+, +build+,
  40. etc. in the output directory (+output/+ by default,
  41. another value can be specified using +O=+)
  42. * Generate the toolchain target. When an internal toolchain is used, this
  43. means generating the cross-compilation toolchain. When an external
  44. toolchain is used, this means checking the features of the external
  45. toolchain and importing it into the Buildroot environment.
  46. * Generate all the targets listed in the +TARGETS+ variable. This
  47. variable is filled by all the individual components'
  48. Makefiles. Generating these targets will trigger the compilation of
  49. the userspace packages (libraries, programs), the kernel, the
  50. bootloader and the generation of the root filesystem images,
  51. depending on the configuration.