xref: /OK3568_Linux_fs/buildroot/docs/manual/customize-outside-br.txt (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun// -*- mode:doc -*- ;
2*4882a593Smuzhiyun// vim: set syntax=asciidoc:
3*4882a593Smuzhiyun
4*4882a593Smuzhiyun[[outside-br-custom]]
5*4882a593Smuzhiyun=== Keeping customizations outside of Buildroot
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunAs already briefly mentioned in xref:customize-dir-structure[], you can
8*4882a593Smuzhiyunplace project-specific customizations in two locations:
9*4882a593Smuzhiyun
10*4882a593Smuzhiyun * directly within the Buildroot tree, typically maintaining them using
11*4882a593Smuzhiyun   branches in a version control system so that upgrading to a newer
12*4882a593Smuzhiyun   Buildroot release is easy.
13*4882a593Smuzhiyun
14*4882a593Smuzhiyun * outside of the Buildroot tree, using the _br2-external_ mechanism.
15*4882a593Smuzhiyun   This mechanism allows to keep package recipes, board support and
16*4882a593Smuzhiyun   configuration files outside of the Buildroot tree, while still
17*4882a593Smuzhiyun   having them nicely integrated in the build logic. We call this
18*4882a593Smuzhiyun   location a _br2-external tree_. This section explains how to use
19*4882a593Smuzhiyun   the br2-external mechanism and what to provide in a br2-external
20*4882a593Smuzhiyun   tree.
21*4882a593Smuzhiyun
22*4882a593SmuzhiyunOne can tell Buildroot to use one or more br2-external trees by setting
23*4882a593Smuzhiyunthe +BR2_EXTERNAL+ make variable set to the path(s) of the br2-external
24*4882a593Smuzhiyuntree(s) to use. It can be passed to any Buildroot +make+ invocation. It
25*4882a593Smuzhiyunis automatically saved in the hidden +.br2-external.mk+ file in the output
26*4882a593Smuzhiyundirectory. Thanks to this, there is no need to pass +BR2_EXTERNAL+ at
27*4882a593Smuzhiyunevery +make+ invocation. It can however be changed at any time by
28*4882a593Smuzhiyunpassing a new value, and can be removed by passing an empty value.
29*4882a593Smuzhiyun
30*4882a593Smuzhiyun.Note
31*4882a593SmuzhiyunThe path to a br2-external tree can be either absolute or relative.
32*4882a593SmuzhiyunIf it is passed as a relative path, it is important to note that it is
33*4882a593Smuzhiyuninterpreted relative to the main Buildroot source directory, *not* to
34*4882a593Smuzhiyunthe Buildroot output directory.
35*4882a593Smuzhiyun
36*4882a593Smuzhiyun.Note:
37*4882a593SmuzhiyunIf using an br2-external tree from before Buildroot 2016.11, you need to
38*4882a593Smuzhiyunconvert it before you can use it with Buildroot 2016.11 onward. See
39*4882a593Smuzhiyunxref:br2-external-converting[] for help on doing so.
40*4882a593Smuzhiyun
41*4882a593SmuzhiyunSome examples:
42*4882a593Smuzhiyun
43*4882a593Smuzhiyun-----
44*4882a593Smuzhiyunbuildroot/ $ make BR2_EXTERNAL=/path/to/foo menuconfig
45*4882a593Smuzhiyun-----
46*4882a593Smuzhiyun
47*4882a593SmuzhiyunFrom now on, definitions from the +/path/to/foo+ br2-external tree
48*4882a593Smuzhiyunwill be used:
49*4882a593Smuzhiyun
50*4882a593Smuzhiyun-----
51*4882a593Smuzhiyunbuildroot/ $ make
52*4882a593Smuzhiyunbuildroot/ $ make legal-info
53*4882a593Smuzhiyun-----
54*4882a593Smuzhiyun
55*4882a593SmuzhiyunWe can switch to another br2-external tree at any time:
56*4882a593Smuzhiyun
57*4882a593Smuzhiyun-----
58*4882a593Smuzhiyunbuildroot/ $ make BR2_EXTERNAL=/where/we/have/bar xconfig
59*4882a593Smuzhiyun-----
60*4882a593Smuzhiyun
61*4882a593SmuzhiyunWe can also use multiple br2-external trees:
62*4882a593Smuzhiyun
63*4882a593Smuzhiyun----
64*4882a593Smuzhiyunbuildroot/ $ make BR2_EXTERNAL=/path/to/foo:/where/we/have/bar menuconfig
65*4882a593Smuzhiyun----
66*4882a593Smuzhiyun
67*4882a593SmuzhiyunOr disable the usage of any br2-external tree:
68*4882a593Smuzhiyun
69*4882a593Smuzhiyun-----
70*4882a593Smuzhiyunbuildroot/ $ make BR2_EXTERNAL= xconfig
71*4882a593Smuzhiyun-----
72*4882a593Smuzhiyun
73*4882a593Smuzhiyun==== Layout of a br2-external tree
74*4882a593Smuzhiyun
75*4882a593SmuzhiyunA br2-external tree must contain at least those three files, described
76*4882a593Smuzhiyunin the following chapters:
77*4882a593Smuzhiyun
78*4882a593Smuzhiyun * +external.desc+
79*4882a593Smuzhiyun * +external.mk+
80*4882a593Smuzhiyun * +Config.in+
81*4882a593Smuzhiyun
82*4882a593SmuzhiyunApart from those mandatory files, there may be additional and optional
83*4882a593Smuzhiyuncontent that may be present in a br2-external tree, like the +configs/+
84*4882a593Smuzhiyunor +provides/+ directories. They are described in the following chapters
85*4882a593Smuzhiyunas well.
86*4882a593Smuzhiyun
87*4882a593SmuzhiyunA complete example br2-external tree layout is also described later.
88*4882a593Smuzhiyun
89*4882a593Smuzhiyun===== The +external.desc+ file
90*4882a593Smuzhiyun
91*4882a593SmuzhiyunThat file describes the br2-external tree: the _name_ and _description_
92*4882a593Smuzhiyunfor that br2-external tree.
93*4882a593Smuzhiyun
94*4882a593SmuzhiyunThe format for this file is line based, with each line starting by a
95*4882a593Smuzhiyunkeyword, followed by a colon and one or more spaces, followed by the
96*4882a593Smuzhiyunvalue assigned to that keyword. There are two keywords currently
97*4882a593Smuzhiyunrecognised:
98*4882a593Smuzhiyun
99*4882a593Smuzhiyun * +name+, mandatory, defines the name for that br2-external tree. That
100*4882a593Smuzhiyun   name must only use ASCII characters in the set +[A-Za-z0-9_]+; any
101*4882a593Smuzhiyun   other character is forbidden. Buildroot sets the variable
102*4882a593Smuzhiyun   +BR2_EXTERNAL_$(NAME)_PATH+ to the absolute path of the br2-external
103*4882a593Smuzhiyun   tree, so that you can use it to refer to your br2-external tree. This
104*4882a593Smuzhiyun   variable is available both in Kconfig, so you can use it to source your
105*4882a593Smuzhiyun   Kconfig files (see below) and in the Makefile, so that you can use it
106*4882a593Smuzhiyun   to include other Makefiles (see below) or refer to other files (like
107*4882a593Smuzhiyun   data files) from your br2-external tree.
108*4882a593Smuzhiyun+
109*4882a593Smuzhiyun.Note:
110*4882a593SmuzhiyunSince it is possible to use multiple br2-external trees at once, this
111*4882a593Smuzhiyun  name is used by Buildroot to generate variables for each of those trees.
112*4882a593Smuzhiyun  That name is used to identify your br2-external tree, so try to come up
113*4882a593Smuzhiyun  with a name that really describes your br2-external tree, in order for
114*4882a593Smuzhiyun  it to be relatively unique, so that it does not clash with another name
115*4882a593Smuzhiyun  from another br2-external tree, especially if you are planning on
116*4882a593Smuzhiyun  somehow sharing your br2-external tree with third parties or using
117*4882a593Smuzhiyun  br2-external trees from third parties.
118*4882a593Smuzhiyun
119*4882a593Smuzhiyun * +desc+, optional, provides a short description for that br2-external
120*4882a593Smuzhiyun   tree. It shall fit on a single line, is mostly free-form (see below),
121*4882a593Smuzhiyun   and is used when displaying information about a br2-external tree (e.g.
122*4882a593Smuzhiyun   above the list of defconfig files, or as the prompt in the menuconfig);
123*4882a593Smuzhiyun   as such, it should relatively brief (40 chars is probably a good upper
124*4882a593Smuzhiyun   limit). The description is available in the +BR2_EXTERNAL_$(NAME)_DESC+
125*4882a593Smuzhiyun   variable.
126*4882a593Smuzhiyun
127*4882a593SmuzhiyunExamples of names and the corresponding +BR2_EXTERNAL_$(NAME)_PATH+
128*4882a593Smuzhiyunvariables:
129*4882a593Smuzhiyun
130*4882a593Smuzhiyun  * +FOO+ -> +BR2_EXTERNAL_FOO_PATH+
131*4882a593Smuzhiyun  * +BAR_42+ -> +BR2_EXTERNAL_BAR_42_PATH+
132*4882a593Smuzhiyun
133*4882a593SmuzhiyunIn the following examples, it is assumed the name to be set to +BAR_42+.
134*4882a593Smuzhiyun
135*4882a593Smuzhiyun.Note:
136*4882a593SmuzhiyunBoth +BR2_EXTERNAL_$(NAME)_PATH+ and `BR2_EXTERNAL_$(NAME)_DESC` are
137*4882a593Smuzhiyun  available in the Kconfig files and the Makefiles. They are also
138*4882a593Smuzhiyun  exported in the environment so are available in post-build, post-image
139*4882a593Smuzhiyun  and in-fakeroot scripts.
140*4882a593Smuzhiyun
141*4882a593Smuzhiyun===== The +Config.in+ and +external.mk+ files
142*4882a593Smuzhiyun
143*4882a593SmuzhiyunThose files (which may each be empty) can be used to define package
144*4882a593Smuzhiyunrecipes (i.e. +foo/Config.in+ and +foo/foo.mk+ like for packages bundled
145*4882a593Smuzhiyunin Buildroot itself) or other custom configuration options or make logic.
146*4882a593Smuzhiyun
147*4882a593SmuzhiyunBuildroot automatically includes the +Config.in+ from each br2-external
148*4882a593Smuzhiyuntree to make it appear in the top-level configuration menu, and includes
149*4882a593Smuzhiyunthe +external.mk+ from each br2-external tree with the rest of the
150*4882a593Smuzhiyunmakefile logic.
151*4882a593Smuzhiyun
152*4882a593SmuzhiyunThe main usage of this is to store package recipes. The recommended way
153*4882a593Smuzhiyunto do this is to write a +Config.in+ file that looks like:
154*4882a593Smuzhiyun
155*4882a593Smuzhiyun------
156*4882a593Smuzhiyunsource "$BR2_EXTERNAL_BAR_42_PATH/package/package1/Config.in"
157*4882a593Smuzhiyunsource "$BR2_EXTERNAL_BAR_42_PATH/package/package2/Config.in"
158*4882a593Smuzhiyun------
159*4882a593Smuzhiyun
160*4882a593SmuzhiyunThen, have an +external.mk+ file that looks like:
161*4882a593Smuzhiyun
162*4882a593Smuzhiyun------
163*4882a593Smuzhiyuninclude $(sort $(wildcard $(BR2_EXTERNAL_BAR_42_PATH)/package/*/*.mk))
164*4882a593Smuzhiyun------
165*4882a593Smuzhiyun
166*4882a593SmuzhiyunAnd then in +$(BR2_EXTERNAL_BAR_42_PATH)/package/package1+ and
167*4882a593Smuzhiyun+$(BR2_EXTERNAL_BAR_42_PATH)/package/package2+ create normal
168*4882a593SmuzhiyunBuildroot package recipes, as explained in xref:adding-packages[].
169*4882a593SmuzhiyunIf you prefer, you can also group the packages in subdirectories
170*4882a593Smuzhiyuncalled <boardname> and adapt the above paths accordingly.
171*4882a593Smuzhiyun
172*4882a593SmuzhiyunYou can also define custom configuration options in +Config.in+ and
173*4882a593Smuzhiyuncustom make logic in +external.mk+.
174*4882a593Smuzhiyun
175*4882a593Smuzhiyun===== The +configs/+ directory
176*4882a593Smuzhiyun
177*4882a593SmuzhiyunOne can store Buildroot defconfigs in the +configs+ subdirectory of
178*4882a593Smuzhiyunthe br2-external tree. Buildroot will automatically show them in the
179*4882a593Smuzhiyunoutput of +make list-defconfigs+ and allow them to be loaded with the
180*4882a593Smuzhiyunnormal +make <name>_defconfig+ command. They will be visible in the
181*4882a593Smuzhiyun'make list-defconfigs' output, below an +External configs+ label that
182*4882a593Smuzhiyuncontains the name of the br2-external tree they are defined in.
183*4882a593Smuzhiyun
184*4882a593Smuzhiyun.Note:
185*4882a593SmuzhiyunIf a defconfig file is present in more than one br2-external tree, then
186*4882a593Smuzhiyunthe one from the last br2-external tree is used. It is thus possible
187*4882a593Smuzhiyunto override a defconfig bundled in Buildroot or another br2-external
188*4882a593Smuzhiyuntree.
189*4882a593Smuzhiyun
190*4882a593Smuzhiyun===== The +provides/+ directory
191*4882a593Smuzhiyun
192*4882a593SmuzhiyunFor some packages, Buildroot provides a choice between two (or more)
193*4882a593Smuzhiyunimplementations of API-compatible such packages. For example, there is
194*4882a593Smuzhiyuna choice to choose either libjpeg ot jpeg-turbo; there is one between
195*4882a593Smuzhiyunopenssl or libressl; there is one to select one of the known,
196*4882a593Smuzhiyunpre-configured toolchains...
197*4882a593Smuzhiyun
198*4882a593SmuzhiyunIt is possible for a br2-external to extend those choices, by providing
199*4882a593Smuzhiyuna set of files that define those alternatives:
200*4882a593Smuzhiyun
201*4882a593Smuzhiyun* +provides/toolchains.in+ defines the pre-configured toolchains, which
202*4882a593Smuzhiyun  will then be listed in the toolchain selection;
203*4882a593Smuzhiyun* +provides/jpeg.in+ defines the alternative libjpeg implementations;
204*4882a593Smuzhiyun* +provides/openssl.in+ defines the alternative openssl implementations;
205*4882a593Smuzhiyun* +provides/skeleton.in+ defines the alternative skeleton implementations;
206*4882a593Smuzhiyun* +provides/init.in+ defines the alternative init system implementations, this
207*4882a593Smuzhiyun  can be used to select a default skeleton for your init.
208*4882a593Smuzhiyun
209*4882a593Smuzhiyun===== Free-form content
210*4882a593Smuzhiyun
211*4882a593SmuzhiyunOne can store all the board-specific configuration files there, such
212*4882a593Smuzhiyunas the kernel configuration, the root filesystem overlay, or any other
213*4882a593Smuzhiyunconfiguration file for which Buildroot allows to set the location (by
214*4882a593Smuzhiyunusing the +BR2_EXTERNAL_$(NAME)_PATH+ variable). For example, you
215*4882a593Smuzhiyuncould set the paths to a global patch directory, to a rootfs overlay
216*4882a593Smuzhiyunand to the kernel configuration file as follows (e.g. by running
217*4882a593Smuzhiyun`make menuconfig` and filling in these options):
218*4882a593Smuzhiyun
219*4882a593Smuzhiyun----
220*4882a593SmuzhiyunBR2_GLOBAL_PATCH_DIR=$(BR2_EXTERNAL_BAR_42_PATH)/patches/
221*4882a593SmuzhiyunBR2_ROOTFS_OVERLAY=$(BR2_EXTERNAL_BAR_42_PATH)/board/<boardname>/overlay/
222*4882a593SmuzhiyunBR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE=$(BR2_EXTERNAL_BAR_42_PATH)/board/<boardname>/kernel.config
223*4882a593Smuzhiyun----
224*4882a593Smuzhiyun
225*4882a593Smuzhiyun===== Additional Linux kernel extensions
226*4882a593Smuzhiyun
227*4882a593SmuzhiyunAdditional Linux kernel extensions (see xref:linux-kernel-ext[]) can
228*4882a593Smuzhiyunbe added by storing them in the `linux/` directory at the root of a
229*4882a593Smuzhiyunbr2-external tree.
230*4882a593Smuzhiyun
231*4882a593Smuzhiyun===== Example layout
232*4882a593Smuzhiyun
233*4882a593SmuzhiyunHere is an example layout using all features of br2-external (the sample
234*4882a593Smuzhiyuncontent is shown for the file above it, when it is relevant to explain
235*4882a593Smuzhiyunthe br2-external tree; this is all entirely made up just for the sake of
236*4882a593Smuzhiyunillustration, of course):
237*4882a593Smuzhiyun
238*4882a593Smuzhiyun----
239*4882a593Smuzhiyun/path/to/br2-ext-tree/
240*4882a593Smuzhiyun  |- external.desc
241*4882a593Smuzhiyun  |     |name: BAR_42
242*4882a593Smuzhiyun  |     |desc: Example br2-external tree
243*4882a593Smuzhiyun  |     `----
244*4882a593Smuzhiyun  |
245*4882a593Smuzhiyun  |- Config.in
246*4882a593Smuzhiyun  |     |source "$BR2_EXTERNAL_BAR_42_PATH/toolchain/toolchain-external-mine/Config.in.options"
247*4882a593Smuzhiyun  |     |source "$BR2_EXTERNAL_BAR_42_PATH/package/pkg-1/Config.in"
248*4882a593Smuzhiyun  |     |source "$BR2_EXTERNAL_BAR_42_PATH/package/pkg-2/Config.in"
249*4882a593Smuzhiyun  |     |source "$BR2_EXTERNAL_BAR_42_PATH/package/my-jpeg/Config.in"
250*4882a593Smuzhiyun  |     |
251*4882a593Smuzhiyun  |     |config BAR_42_FLASH_ADDR
252*4882a593Smuzhiyun  |     |    hex "my-board flash address"
253*4882a593Smuzhiyun  |     |    default 0x10AD
254*4882a593Smuzhiyun  |     `----
255*4882a593Smuzhiyun  |
256*4882a593Smuzhiyun  |- external.mk
257*4882a593Smuzhiyun  |     |include $(sort $(wildcard $(BR2_EXTERNAL_BAR_42_PATH)/package/*/*.mk))
258*4882a593Smuzhiyun  |     |include $(sort $(wildcard $(BR2_EXTERNAL_BAR_42_PATH)/toolchain/*/*.mk))
259*4882a593Smuzhiyun  |     |
260*4882a593Smuzhiyun  |     |flash-my-board:
261*4882a593Smuzhiyun  |     |    $(BR2_EXTERNAL_BAR_42_PATH)/board/my-board/flash-image \
262*4882a593Smuzhiyun  |     |        --image $(BINARIES_DIR)/image.bin \
263*4882a593Smuzhiyun  |     |        --address $(BAR_42_FLASH_ADDR)
264*4882a593Smuzhiyun  |     `----
265*4882a593Smuzhiyun  |
266*4882a593Smuzhiyun  |- package/pkg-1/Config.in
267*4882a593Smuzhiyun  |     |config BR2_PACKAGE_PKG_1
268*4882a593Smuzhiyun  |     |    bool "pkg-1"
269*4882a593Smuzhiyun  |     |    help
270*4882a593Smuzhiyun  |     |      Some help about pkg-1
271*4882a593Smuzhiyun  |     `----
272*4882a593Smuzhiyun  |- package/pkg-1/pkg-1.hash
273*4882a593Smuzhiyun  |- package/pkg-1/pkg-1.mk
274*4882a593Smuzhiyun  |     |PKG_1_VERSION = 1.2.3
275*4882a593Smuzhiyun  |     |PKG_1_SITE = /some/where/to/get/pkg-1
276*4882a593Smuzhiyun  |     |PKG_1_LICENSE = blabla
277*4882a593Smuzhiyun  |     |
278*4882a593Smuzhiyun  |     |define PKG_1_INSTALL_INIT_SYSV
279*4882a593Smuzhiyun  |     |    $(INSTALL) -D -m 0755 $(PKG_1_PKGDIR)/S99my-daemon \
280*4882a593Smuzhiyun  |     |                          $(TARGET_DIR)/etc/init.d/S99my-daemon
281*4882a593Smuzhiyun  |     |endef
282*4882a593Smuzhiyun  |     |
283*4882a593Smuzhiyun  |     |$(eval $(autotools-package))
284*4882a593Smuzhiyun  |     `----
285*4882a593Smuzhiyun  |- package/pkg-1/S99my-daemon
286*4882a593Smuzhiyun  |
287*4882a593Smuzhiyun  |- package/pkg-2/Config.in
288*4882a593Smuzhiyun  |- package/pkg-2/pkg-2.hash
289*4882a593Smuzhiyun  |- package/pkg-2/pkg-2.mk
290*4882a593Smuzhiyun  |
291*4882a593Smuzhiyun  |- provides/jpeg.in
292*4882a593Smuzhiyun  |     |config BR2_PACKAGE_MY_JPEG
293*4882a593Smuzhiyun  |     |    bool "my-jpeg"
294*4882a593Smuzhiyun  |     `----
295*4882a593Smuzhiyun  |- package/my-jpeg/Config.in
296*4882a593Smuzhiyun  |     |config BR2_PACKAGE_PROVIDES_JPEG
297*4882a593Smuzhiyun  |     |    default "my-jpeg" if BR2_PACKAGE_MY_JPEG
298*4882a593Smuzhiyun  |     `----
299*4882a593Smuzhiyun  |- package/my-jpeg/my-jpeg.mk
300*4882a593Smuzhiyun  |     |# This is a normal package .mk file
301*4882a593Smuzhiyun  |     |MY_JPEG_VERSION = 1.2.3
302*4882a593Smuzhiyun  |     |MY_JPEG_SITE = https://example.net/some/place
303*4882a593Smuzhiyun  |     |MY_JPEG_PROVIDES = jpeg
304*4882a593Smuzhiyun  |     |$(eval $(autotools-package))
305*4882a593Smuzhiyun  |     `----
306*4882a593Smuzhiyun  |
307*4882a593Smuzhiyun  |- provides/init.in
308*4882a593Smuzhiyun  |     |config BR2_INIT_MINE
309*4882a593Smuzhiyun  |     |    bool "my custom init"
310*4882a593Smuzhiyun  |     |    select BR2_PACKAGE_MY_INIT
311*4882a593Smuzhiyun  |     |    select BR2_PACKAGE_SKELETON_INIT_MINE if BR2_ROOTFS_SKELETON_DEFAULT
312*4882a593Smuzhiyun  |     `----
313*4882a593Smuzhiyun  |
314*4882a593Smuzhiyun  |- provides/skeleton.in
315*4882a593Smuzhiyun  |     |config BR2_ROOTFS_SKELETON_MINE
316*4882a593Smuzhiyun  |     |    bool "my custom skeleton"
317*4882a593Smuzhiyun  |     |    select BR2_PACKAGE_SKELETON_MINE
318*4882a593Smuzhiyun  |     `----
319*4882a593Smuzhiyun  |- package/skeleton-mine/Config.in
320*4882a593Smuzhiyun  |     |config BR2_PACKAGE_SKELETON_MINE
321*4882a593Smuzhiyun  |     |    bool
322*4882a593Smuzhiyun  |     |    select BR2_PACKAGE_HAS_SKELETON
323*4882a593Smuzhiyun  |     |
324*4882a593Smuzhiyun  |     |config BR2_PACKAGE_PROVIDES_SKELETON
325*4882a593Smuzhiyun  |     |    default "skeleton-mine" if BR2_PACKAGE_SKELETON_MINE
326*4882a593Smuzhiyun  |     `----
327*4882a593Smuzhiyun  |- package/skeleton-mine/skeleton-mine.mk
328*4882a593Smuzhiyun  |     |SKELETON_MINE_ADD_TOOLCHAIN_DEPENDENCY = NO
329*4882a593Smuzhiyun  |     |SKELETON_MINE_ADD_SKELETON_DEPENDENCY = NO
330*4882a593Smuzhiyun  |     |SKELETON_MINE_PROVIDES = skeleton
331*4882a593Smuzhiyun  |     |SKELETON_MINE_INSTALL_STAGING = YES
332*4882a593Smuzhiyun  |     |$(eval $(generic-package))
333*4882a593Smuzhiyun  |     `----
334*4882a593Smuzhiyun  |
335*4882a593Smuzhiyun  |- provides/toolchains.in
336*4882a593Smuzhiyun  |     |config BR2_TOOLCHAIN_EXTERNAL_MINE
337*4882a593Smuzhiyun  |     |    bool "my custom toolchain"
338*4882a593Smuzhiyun  |     |    depends on BR2_some_arch
339*4882a593Smuzhiyun  |     |    select BR2_INSTALL_LIBSTDCPP
340*4882a593Smuzhiyun  |     `----
341*4882a593Smuzhiyun  |- toolchain/toolchain-external-mine/Config.in.options
342*4882a593Smuzhiyun  |     |if BR2_TOOLCHAIN_EXTERNAL_MINE
343*4882a593Smuzhiyun  |     |config BR2_TOOLCHAIN_EXTERNAL_PREFIX
344*4882a593Smuzhiyun  |     |    default "arch-mine-linux-gnu"
345*4882a593Smuzhiyun  |     |config BR2_PACKAGE_PROVIDES_TOOLCHAIN_EXTERNAL
346*4882a593Smuzhiyun  |     |    default "toolchain-external-mine"
347*4882a593Smuzhiyun  |     |endif
348*4882a593Smuzhiyun  |     `----
349*4882a593Smuzhiyun  |- toolchain/toolchain-external-mine/toolchain-external-mine.mk
350*4882a593Smuzhiyun  |     |TOOLCHAIN_EXTERNAL_MINE_SITE = https://example.net/some/place
351*4882a593Smuzhiyun  |     |TOOLCHAIN_EXTERNAL_MINE_SOURCE = my-toolchain.tar.gz
352*4882a593Smuzhiyun  |     |$(eval $(toolchain-external-package))
353*4882a593Smuzhiyun  |     `----
354*4882a593Smuzhiyun  |
355*4882a593Smuzhiyun  |- linux/Config.ext.in
356*4882a593Smuzhiyun  |     |config BR2_LINUX_KERNEL_EXT_EXAMPLE_DRIVER
357*4882a593Smuzhiyun  |     |    bool "example-external-driver"
358*4882a593Smuzhiyun  |     |    help
359*4882a593Smuzhiyun  |     |      Example external driver
360*4882a593Smuzhiyun  |     |---
361*4882a593Smuzhiyun  |- linux/linux-ext-example-driver.mk
362*4882a593Smuzhiyun  |
363*4882a593Smuzhiyun  |- configs/my-board_defconfig
364*4882a593Smuzhiyun  |     |BR2_GLOBAL_PATCH_DIR="$(BR2_EXTERNAL_BAR_42_PATH)/patches/"
365*4882a593Smuzhiyun  |     |BR2_ROOTFS_OVERLAY="$(BR2_EXTERNAL_BAR_42_PATH)/board/my-board/overlay/"
366*4882a593Smuzhiyun  |     |BR2_ROOTFS_POST_IMAGE_SCRIPT="$(BR2_EXTERNAL_BAR_42_PATH)/board/my-board/post-image.sh"
367*4882a593Smuzhiyun  |     |BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_BAR_42_PATH)/board/my-board/kernel.config"
368*4882a593Smuzhiyun  |     `----
369*4882a593Smuzhiyun  |
370*4882a593Smuzhiyun  |- patches/linux/0001-some-change.patch
371*4882a593Smuzhiyun  |- patches/linux/0002-some-other-change.patch
372*4882a593Smuzhiyun  |- patches/busybox/0001-fix-something.patch
373*4882a593Smuzhiyun  |
374*4882a593Smuzhiyun  |- board/my-board/kernel.config
375*4882a593Smuzhiyun  |- board/my-board/overlay/var/www/index.html
376*4882a593Smuzhiyun  |- board/my-board/overlay/var/www/my.css
377*4882a593Smuzhiyun  |- board/my-board/flash-image
378*4882a593Smuzhiyun  `- board/my-board/post-image.sh
379*4882a593Smuzhiyun        |#!/bin/sh
380*4882a593Smuzhiyun        |generate-my-binary-image \
381*4882a593Smuzhiyun        |    --root ${BINARIES_DIR}/rootfs.tar \
382*4882a593Smuzhiyun        |    --kernel ${BINARIES_DIR}/zImage \
383*4882a593Smuzhiyun        |    --dtb ${BINARIES_DIR}/my-board.dtb \
384*4882a593Smuzhiyun        |    --output ${BINARIES_DIR}/image.bin
385*4882a593Smuzhiyun        `----
386*4882a593Smuzhiyun----
387*4882a593Smuzhiyun
388*4882a593SmuzhiyunThe br2-external tree will then be visible in the menuconfig (with
389*4882a593Smuzhiyunthe layout expanded):
390*4882a593Smuzhiyun
391*4882a593Smuzhiyun----
392*4882a593SmuzhiyunExternal options  --->
393*4882a593Smuzhiyun    *** Example br2-external tree (in /path/to/br2-ext-tree/)
394*4882a593Smuzhiyun    [ ] pkg-1
395*4882a593Smuzhiyun    [ ] pkg-2
396*4882a593Smuzhiyun    (0x10AD) my-board flash address
397*4882a593Smuzhiyun----
398*4882a593Smuzhiyun
399*4882a593SmuzhiyunIf you are using more than one br2-external tree, it would look like
400*4882a593Smuzhiyun(with the layout expanded and the second one with name +FOO_27+ but no
401*4882a593Smuzhiyun+desc:+ field in +external.desc+):
402*4882a593Smuzhiyun
403*4882a593Smuzhiyun----
404*4882a593SmuzhiyunExternal options  --->
405*4882a593Smuzhiyun    Example br2-external tree  --->
406*4882a593Smuzhiyun        *** Example br2-external tree (in /path/to/br2-ext-tree)
407*4882a593Smuzhiyun        [ ] pkg-1
408*4882a593Smuzhiyun        [ ] pkg-2
409*4882a593Smuzhiyun        (0x10AD) my-board flash address
410*4882a593Smuzhiyun    FOO_27  --->
411*4882a593Smuzhiyun        *** FOO_27 (in /path/to/another-br2-ext)
412*4882a593Smuzhiyun        [ ] foo
413*4882a593Smuzhiyun        [ ] bar
414*4882a593Smuzhiyun----
415*4882a593Smuzhiyun
416*4882a593SmuzhiyunAdditionally, the jpeg provider will be visible in the jpeg choice:
417*4882a593Smuzhiyun
418*4882a593Smuzhiyun----
419*4882a593SmuzhiyunTarget packages  --->
420*4882a593Smuzhiyun    Libraries  --->
421*4882a593Smuzhiyun        Graphics  --->
422*4882a593Smuzhiyun            [*] jpeg support
423*4882a593Smuzhiyun                jpeg variant ()  --->
424*4882a593Smuzhiyun                    ( ) jpeg
425*4882a593Smuzhiyun                    ( ) jpeg-turbo
426*4882a593Smuzhiyun                        *** jpeg from: Example br2-external tree ***
427*4882a593Smuzhiyun                    (X) my-jpeg
428*4882a593Smuzhiyun                        *** jpeg from: FOO_27 ***
429*4882a593Smuzhiyun                    ( ) another-jpeg
430*4882a593Smuzhiyun----
431*4882a593Smuzhiyun
432*4882a593SmuzhiyunAnd similarly for the toolchains:
433*4882a593Smuzhiyun
434*4882a593Smuzhiyun----
435*4882a593SmuzhiyunToolchain  --->
436*4882a593Smuzhiyun    Toolchain ()  --->
437*4882a593Smuzhiyun        ( ) Custom toolchain
438*4882a593Smuzhiyun            *** Toolchains from: Example br2-external tree ***
439*4882a593Smuzhiyun        (X) my custom toolchain
440*4882a593Smuzhiyun----
441*4882a593Smuzhiyun
442*4882a593Smuzhiyun.Note
443*4882a593SmuzhiyunThe toolchain options in +toolchain/toolchain-external-mine/Config.in.options+
444*4882a593Smuzhiyunwill not appear in the `Toolchain` menu. They must be explicitly included
445*4882a593Smuzhiyunfrom within the br2-external's top-level +Config.in+ and will thus appear
446*4882a593Smuzhiyunin the `External options` menu.
447