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