2013-12-05 20:11:13 +01:00
|
|
|
// -*- mode:doc -*- ;
|
2014-11-15 17:29:20 +01:00
|
|
|
// vim: set syntax=asciidoc:
|
2013-12-05 20:11:13 +01:00
|
|
|
|
|
|
|
[[outside-br-custom]]
|
2014-08-29 21:50:41 +02:00
|
|
|
=== Keeping customizations outside of Buildroot
|
2013-12-05 20:11:13 +01:00
|
|
|
|
2014-08-29 21:50:41 +02:00
|
|
|
As already briefly mentioned in xref:customize-dir-structure[], you can
|
|
|
|
place project-specific customizations in two locations:
|
2013-12-05 20:11:13 +01:00
|
|
|
|
2014-08-29 21:50:41 +02:00
|
|
|
* directly within the Buildroot tree, typically maintaining them using
|
|
|
|
branches in a version control system so that upgrading to a newer
|
|
|
|
Buildroot release is easy.
|
2013-12-05 20:11:13 +01:00
|
|
|
|
2014-08-29 21:50:41 +02:00
|
|
|
* outside of the Buildroot tree, using the +BR2_EXTERNAL+ mechanism.
|
|
|
|
This mechanism allows to keep package recipes, board support and
|
|
|
|
configuration files outside of the Buildroot tree, while still
|
|
|
|
having them nicely integrated in the build logic. This section
|
|
|
|
explains how to use +BR2_EXTERNAL+.
|
2013-12-05 20:11:13 +01:00
|
|
|
|
|
|
|
+BR2_EXTERNAL+ is an environment variable that can be used to point to
|
|
|
|
a directory that contains Buildroot customizations. It can be passed
|
|
|
|
to any Buildroot +make+ invocation. It is automatically saved in the
|
2014-08-29 21:50:41 +02:00
|
|
|
hidden +.br-external+ file in the output directory. Thanks to this,
|
2013-12-05 20:11:13 +01:00
|
|
|
there is no need to pass +BR2_EXTERNAL+ at every +make+ invocation. It
|
|
|
|
can however be changed at any time by passing a new value, and can be
|
|
|
|
removed by passing an empty value.
|
|
|
|
|
2015-05-24 23:49:56 +02:00
|
|
|
.Note
|
|
|
|
The +BR2_EXTERNAL+ path can be either an absolute or a relative path,
|
2013-12-05 20:11:13 +01:00
|
|
|
but if it's passed as a relative path, it is important to note that it
|
2014-02-21 23:17:53 +01:00
|
|
|
is interpreted relative to the main Buildroot source directory, *not*
|
2014-08-29 21:50:41 +02:00
|
|
|
to the Buildroot output directory.
|
2013-12-05 20:11:13 +01:00
|
|
|
|
|
|
|
Some examples:
|
|
|
|
|
|
|
|
-----
|
2015-05-24 23:49:55 +02:00
|
|
|
buildroot/ $ make BR2_EXTERNAL=/path/to/foobar menuconfig
|
2013-12-05 20:11:13 +01:00
|
|
|
-----
|
|
|
|
|
2014-08-29 21:50:41 +02:00
|
|
|
From now on, external definitions from the +/path/to/foobar+
|
2013-12-05 20:11:13 +01:00
|
|
|
directory will be used:
|
|
|
|
|
|
|
|
-----
|
2015-05-24 23:49:55 +02:00
|
|
|
buildroot/ $ make
|
|
|
|
buildroot/ $ make legal-info
|
2013-12-05 20:11:13 +01:00
|
|
|
-----
|
|
|
|
|
|
|
|
We can switch to another external definitions directory at any time:
|
|
|
|
|
|
|
|
-----
|
2015-05-24 23:49:55 +02:00
|
|
|
buildroot/ $ make BR2_EXTERNAL=/where/we/have/barfoo xconfig
|
2013-12-05 20:11:13 +01:00
|
|
|
-----
|
|
|
|
|
|
|
|
Or disable the usage of external definitions:
|
|
|
|
|
|
|
|
-----
|
2015-05-24 23:49:55 +02:00
|
|
|
buildroot/ $ make BR2_EXTERNAL= xconfig
|
2013-12-05 20:11:13 +01:00
|
|
|
-----
|
|
|
|
|
2014-08-29 21:50:41 +02:00
|
|
|
+BR2_EXTERNAL+ allows three different things:
|
2013-12-05 20:11:13 +01:00
|
|
|
|
|
|
|
* One can store all the board-specific configuration files there,
|
|
|
|
such as the kernel configuration, the root filesystem overlay, or
|
|
|
|
any other configuration file for which Buildroot allows to set its
|
|
|
|
location. The +BR2_EXTERNAL+ value is available within the
|
|
|
|
Buildroot configuration using +$(BR2_EXTERNAL)+. As an example, one
|
|
|
|
could set the +BR2_ROOTFS_OVERLAY+ Buildroot option to
|
|
|
|
+$(BR2_EXTERNAL)/board/<boardname>/overlay/+ (to specify a root
|
|
|
|
filesystem overlay), or the +BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE+
|
|
|
|
Buildroot option to
|
|
|
|
+$(BR2_EXTERNAL)/board/<boardname>/kernel.config+ (to specify the
|
2014-08-29 21:50:41 +02:00
|
|
|
location of the kernel configuration file).
|
2013-12-05 20:11:13 +01:00
|
|
|
|
2014-03-28 22:24:50 +01:00
|
|
|
* One can store package recipes (i.e. +Config.in+ and
|
2013-12-05 20:11:13 +01:00
|
|
|
+<packagename>.mk+), or even custom configuration options and make
|
2014-08-29 21:50:41 +02:00
|
|
|
logic. Buildroot automatically includes +$(BR2_EXTERNAL)/Config.in+ to
|
2013-12-05 20:11:13 +01:00
|
|
|
make it appear in the top-level configuration menu, and includes
|
2014-08-29 21:50:41 +02:00
|
|
|
+$(BR2_EXTERNAL)/external.mk+ with the rest of the makefile logic.
|
2015-05-24 23:49:56 +02:00
|
|
|
+
|
|
|
|
.Note
|
|
|
|
Providing +Config.in+ and +external.mk+ is mandatory, but they can be
|
|
|
|
empty.
|
2013-12-05 20:11:13 +01:00
|
|
|
+
|
|
|
|
The main usage of this is to store package recipes. The recommended
|
2014-08-29 21:50:41 +02:00
|
|
|
way to do this is to write a +$(BR2_EXTERNAL)/Config.in+ file that
|
|
|
|
looks like:
|
2013-12-05 20:11:13 +01:00
|
|
|
+
|
|
|
|
------
|
2014-09-18 21:39:32 +02:00
|
|
|
source "$BR2_EXTERNAL/package/package1/Config.in"
|
|
|
|
source "$BR2_EXTERNAL/package/package2/Config.in"
|
2013-12-05 20:11:13 +01:00
|
|
|
------
|
|
|
|
+
|
2014-08-29 21:50:41 +02:00
|
|
|
Then, have a +$(BR2_EXTERNAL)/external.mk+ file that looks like:
|
2013-12-05 20:11:13 +01:00
|
|
|
+
|
|
|
|
------
|
2014-09-18 21:39:32 +02:00
|
|
|
include $(sort $(wildcard $(BR2_EXTERNAL)/package/*/*.mk))
|
2013-12-05 20:11:13 +01:00
|
|
|
------
|
|
|
|
+
|
2014-09-18 21:39:32 +02:00
|
|
|
And then in +$(BR2_EXTERNAL)/package/package1+ and
|
|
|
|
+$(BR2_EXTERNAL)/package/package2+ create normal Buildroot
|
2014-08-29 21:50:41 +02:00
|
|
|
package recipes, as explained in xref:adding-packages[].
|
2014-09-18 21:39:32 +02:00
|
|
|
If you prefer, you can also group the packages in subdirectories
|
|
|
|
called <boardname> and adapt the above paths accordingly.
|
2013-12-05 20:11:13 +01:00
|
|
|
|
|
|
|
* One can store Buildroot defconfigs in the +configs+ subdirectory of
|
2014-08-29 21:50:41 +02:00
|
|
|
+$(BR2_EXTERNAL)+. Buildroot will automatically show them in the
|
2015-03-21 20:49:46 +01:00
|
|
|
output of +make list-defconfigs+ and allow them to be loaded with the
|
|
|
|
normal +make <name>_defconfig+ command. They will be visible under the
|
|
|
|
+User-provided configs+' label in the 'make list-defconfigs' output.
|