2 // vim: set syntax=asciidoc:
4 [[customize-dir-structure]]
5 === Recommended directory structure
7 When customizing Buildroot for your project, you will be creating one or
8 more project-specific files that need to be stored somewhere. While most
9 of these files could be placed in _any_ location as their path is to be
10 specified in the Buildroot configuration, the Buildroot developers
11 recommend a specific directory structure which is described in this
14 Orthogonal to this directory structure, you can choose _where_ you place
15 this structure itself: either inside the Buildroot tree, or outside of
16 it using a br2-external tree. Both options are valid, the choice is up
25 | +-- <other configuration files>
35 | +-- <some other patches>
38 | +-- <boardname>_defconfig
42 | +-- Config.in (if not using a br2-external tree)
43 | +-- <company>.mk (if not using a br2-external tree)
51 +-- Config.in (if using a br2-external tree)
52 +-- external.mk (if using a br2-external tree)
55 Details on the files shown above are given further in this chapter.
57 Note: if you choose to place this structure outside of the Buildroot
58 tree but in a br2-external tree, the <company> and possibly <boardname>
59 components may be superfluous and can be left out.
61 ==== Implementing layered customizations
63 It is quite common for a user to have several related projects that partly
64 need the same customizations. Instead of duplicating these
65 customizations for each project, it is recommended to use a layered
66 customization approach, as explained in this section.
68 Almost all of the customization methods available in Buildroot, like
69 post-build scripts and root filesystem overlays, accept a
70 space-separated list of items. The specified items are always treated in
71 order, from left to right. By creating more than one such item, one for
72 the common customizations and another one for the really
73 project-specific customizations, you can avoid unnecessary duplication.
74 Each layer is typically embodied by a separate directory inside
75 +board/<company>/+. Depending on your projects, you could even introduce
78 An example directory structure for where a user has two customization
79 layers 'common' and 'fooboard' is:
94 +-- <other configuration files>
102 For example, if the user has the +BR2_GLOBAL_PATCH_DIR+ configuration
106 BR2_GLOBAL_PATCH_DIR="board/<company>/common/patches board/<company>/fooboard/patches"
109 then first the patches from the 'common' layer would be applied,
110 followed by the patches from the 'fooboard' layer.