how-buildroot-works.txt 2.4 KB

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