customize-directory-structure.txt 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. // -*- mode:doc; -*-
  2. // vim: set syntax=asciidoc:
  3. [[customize-dir-structure]]
  4. === Recommended directory structure
  5. When customizing Buildroot for your project, you will be creating one or
  6. more project-specific files that need to be stored somewhere. While most
  7. of these files could be placed in _any_ location as their path is to be
  8. specified in the Buildroot configuration, the Buildroot developers
  9. recommend a specific directory structure which is described in this
  10. section.
  11. Orthogonal to this directory structure, you can choose _where_ you place
  12. this structure itself: either inside the Buildroot tree, or outside of
  13. it using +BR2_EXTERNAL+. Both options are valid, the choice is up to you.
  14. -----
  15. +-- board/
  16. | +-- <company>/
  17. | +-- <boardname>/
  18. | +-- linux.config
  19. | +-- busybox.config
  20. | +-- <other configuration files>
  21. | +-- post_build.sh
  22. | +-- post_image.sh
  23. | +-- rootfs_overlay/
  24. | | +-- etc/
  25. | | +-- <some file>
  26. | +-- patches/
  27. | +-- foo/
  28. | | +-- <some patch>
  29. | +-- libbar/
  30. | +-- <some other patches>
  31. |
  32. +-- configs/
  33. | +-- <boardname>_defconfig
  34. |
  35. +-- package/
  36. | +-- <company>/
  37. | +-- Config.in (if not using BR2_EXTERNAL)
  38. | +-- <company>.mk (if not using BR2_EXTERNAL)
  39. | +-- package1/
  40. | | +-- Config.in
  41. | | +-- package1.mk
  42. | +-- package2/
  43. | +-- Config.in
  44. | +-- package2.mk
  45. |
  46. +-- Config.in (if using BR2_EXTERNAL)
  47. +-- external.mk (if using BR2_EXTERNAL)
  48. ------
  49. Details on the files shown above are given further in this chapter.
  50. Note: if you choose to place this structure outside of the Buildroot
  51. tree using +BR2_EXTERNAL+, the <company> and possibly <boardname>
  52. components may be superfluous and can be left out.
  53. ==== Implementing layered customizations
  54. It is quite common for a user to have several related projects that partly
  55. need the same customizations. Instead of duplicating these
  56. customizations for each project, it is recommended to use a layered
  57. customization approach, as explained in this section.
  58. Almost all of the customization methods available in Buildroot, like
  59. post-build scripts and root filesystem overlays, accept a
  60. space-separated list of items. The specified items are always treated in
  61. order, from left to right. By creating more than one such item, one for
  62. the common customizations and another one for the really
  63. project-specific customizations, you can avoid unnecessary duplication.
  64. Each layer is typically embodied by a separate directory inside
  65. +board/<company>/+. Depending on your projects, you could even introduce
  66. more than two layers.
  67. An example directory structure for where a user has two customization
  68. layers 'common' and 'fooboard' is:
  69. -----
  70. +-- board/
  71. +-- <company>/
  72. +-- common/
  73. | +-- post_build.sh
  74. | +-- rootfs_overlay/
  75. | | +-- ...
  76. | +-- patches/
  77. | +-- ...
  78. |
  79. +-- fooboard/
  80. +-- linux.config
  81. +-- busybox.config
  82. +-- <other configuration files>
  83. +-- post_build.sh
  84. +-- rootfs_overlay/
  85. | +-- ...
  86. +-- patches/
  87. +-- ...
  88. -----
  89. For example, if the user has the +BR2_GLOBAL_PATCH_DIR+ configuration
  90. option set as:
  91. -----
  92. BR2_GLOBAL_PATCH_DIR="board/<company>/common/patches board/<company>/fooboard/patches"
  93. -----
  94. then first the patches from the 'common' layer would be applied,
  95. followed by the patches from the 'fooboard' layer.