python-pathvalidate: bump version to 0.14.1
[buildroot-gz.git] / docs / manual / customize-directory-structure.txt
blobb177319f98284ccbdbdcda1d97342a9751a28cc3
1 // -*- mode:doc; -*-
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
12 section.
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
17 to you.
19 -----
20 +-- board/
21 |   +-- <company>/
22 |       +-- <boardname>/
23 |           +-- linux.config
24 |           +-- busybox.config
25 |           +-- <other configuration files>
26 |           +-- post_build.sh
27 |           +-- post_image.sh
28 |           +-- rootfs_overlay/
29 |           |   +-- etc/
30 |           |   +-- <some file>
31 |           +-- patches/
32 |               +-- foo/
33 |               |   +-- <some patch>
34 |               +-- libbar/
35 |                   +-- <some other patches>
37 +-- configs/
38 |   +-- <boardname>_defconfig
40 +-- package/
41 |   +-- <company>/
42 |       +-- Config.in (if not using a br2-external tree)
43 |       +-- <company>.mk (if not using a br2-external tree)
44 |       +-- package1/
45 |       |    +-- Config.in
46 |       |    +-- package1.mk
47 |       +-- package2/
48 |           +-- Config.in
49 |           +-- package2.mk
51 +-- Config.in (if using a br2-external tree)
52 +-- external.mk (if using a br2-external tree)
53 ------
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
76 more than two layers.
78 An example directory structure for where a user has two customization
79 layers 'common' and 'fooboard' is:
81 -----
82 +-- board/
83     +-- <company>/
84         +-- common/
85         |   +-- post_build.sh
86         |   +-- rootfs_overlay/
87         |   |   +-- ...
88         |   +-- patches/
89         |       +-- ...
90         |
91         +-- fooboard/
92             +-- linux.config
93             +-- busybox.config
94             +-- <other configuration files>
95             +-- post_build.sh
96             +-- rootfs_overlay/
97             |   +-- ...
98             +-- patches/
99                 +-- ...
100 -----
102 For example, if the user has the +BR2_GLOBAL_PATCH_DIR+ configuration
103 option set as:
105 -----
106 BR2_GLOBAL_PATCH_DIR="board/<company>/common/patches board/<company>/fooboard/patches"
107 -----
109 then first the patches from the 'common' layer would be applied,
110 followed by the patches from the 'fooboard' layer.