1// -*- mode:doc; -*-
2// vim: set syntax=asciidoc:
3
4[[customize-packages]]
5=== Adding project-specific packages
6
7In general, any new package should be added directly in the +package+
8directory and submitted to the Buildroot upstream project. How to add
9packages to Buildroot in general is explained in full detail in
10xref:adding-packages[] and will not be repeated here. However, your
11project may need some proprietary packages that cannot be upstreamed.
12This section will explain how you can keep such project-specific
13packages in a project-specific directory.
14
15As shown in xref:customize-dir-structure[], the recommended location for
16project-specific packages is +package/<company>/+. If you are using the
17br2-external tree feature (see xref:outside-br-custom[]) the recommended
18location is to put them in a sub-directory named +package/+ in your
19br2-external tree.
20
21However, Buildroot will not be aware of the packages in this location,
22unless we perform some additional steps. As explained in
23xref:adding-packages[], a package in Buildroot basically consists of two
24files: a +.mk+ file (describing how to build the package) and a
25+Config.in+ file (describing the configuration options for this
26package).
27
28Buildroot will automatically include the +.mk+ files in first-level
29subdirectories of the +package+ directory (using the pattern
30+package/\*/*.mk+). If we want Buildroot to include +.mk+ files from
31deeper subdirectories (like +package/<company>/package1/+) then we
32simply have to add a +.mk+ file in a first-level subdirectory that
33includes these additional +.mk+ files. Therefore, create a file
34+package/<company>/<company>.mk+ with following contents (assuming you
35have only one extra directory level below +package/<company>/+):
36
37-----
38include $(sort $(wildcard package/<company>/*/*.mk))
39-----
40
41For the +Config.in+ files, create a file +package/<company>/Config.in+
42that includes the +Config.in+ files of all your packages. An exhaustive
43list has to be provided since wildcards are not supported in the source command of kconfig.
44For example:
45
46-----
47source "package/<company>/package1/Config.in"
48source "package/<company>/package2/Config.in"
49-----
50
51Include this new file +package/<company>/Config.in+ from
52+package/Config.in+, preferably in a company-specific menu to make
53merges with future Buildroot versions easier.
54
55If using a br2-external tree, refer to xref:outside-br-custom[] for how
56to fill in those files.
57