diff mbox

[12/13] docs/manual: document the usage of <pkg>_OVERRIDE_SRCDIR

Message ID 1393167879-16637-13-git-send-email-thomas.petazzoni@free-electrons.com
State Accepted
Headers show

Commit Message

Thomas Petazzoni Feb. 23, 2014, 3:04 p.m. UTC
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 docs/manual/advanced.txt                    |  2 +
 docs/manual/using-buildroot-development.txt | 84 +++++++++++++++++++++++++++++
 2 files changed, 86 insertions(+)
 create mode 100644 docs/manual/using-buildroot-development.txt

Comments

Yann E. MORIN Feb. 23, 2014, 4:29 p.m. UTC | #1
Thomas, All,

On 2014-02-23 16:04 +0100, Thomas Petazzoni spake thusly:
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> ---
>  docs/manual/advanced.txt                    |  2 +
>  docs/manual/using-buildroot-development.txt | 84 +++++++++++++++++++++++++++++
>  2 files changed, 86 insertions(+)
>  create mode 100644 docs/manual/using-buildroot-development.txt
> 
> diff --git a/docs/manual/advanced.txt b/docs/manual/advanced.txt
> index 764b71a..fb337f5 100644
> --- a/docs/manual/advanced.txt
> +++ b/docs/manual/advanced.txt
> @@ -11,3 +11,5 @@ include::ccache-support.txt[]
>  include::download-location.txt[]
>  
>  include::package-make-target.txt[]
> +
> +include::using-buildroot-development.txt[]
> diff --git a/docs/manual/using-buildroot-development.txt b/docs/manual/using-buildroot-development.txt
> new file mode 100644
> index 0000000..3267302
> --- /dev/null
> +++ b/docs/manual/using-buildroot-development.txt
> @@ -0,0 +1,84 @@
> +// -*- mode:doc; -*-
> +// vim: set syntax=asciidoc:
> +
> +Using Buildroot during development
> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> +
> +The normal operation of Buildroot is to download a tarball, extract
> +it, configure, compile and install the software component found inside
> +this tarball. The source code is extracted in
> ++output/build/<package>-<name>+, which is a temporary directory:

output/build/<package>-<version>

> +whenever +make clean+ is used, this directory is entirely removed, and
> +re-recreated at the next +make+ invocation. Even when a Git or
> +Subversion repository is used as the input for the package source
> +code, Buildroot creates a tarball out of it, and then behaves as it
> +does normally with tarballs.

normally does

> +This behavior is well-suited when Buildroot is used mainly as an
> +integration tool, to build and integrate all the components of an
> +embedded Linux system. However, if one uses Buildroot during the
> +development of certain components of the system, this behavior is not
> +very convenient: one would instead like to make a small change to the
> +source code of one package, and be able to quickly rebuild the system
> +with Buildroot.
> +
> +Making changes directly in +output/build/<package>-<name>+ is not

output/build/<package>-<version>

> +appropriate solution, because this directory is removed on +make
> +clean+.
> +
> +Therefore, Buildroot provides a specific mechanism for this use case:
> +the +<pkg>_OVERRIDE_SRCDIR+ mechanism. Buildroot reads an _override_
> +file, which allows the user to tell Buildroot the location of the
> +source for certain packages. By default this _override_ file is named
> ++local.mk+ and located in the top directory of the Buildroot source
> +tree,

Wrong, now it is locate in $(CONFIG_DIR), that is, the directory where
we have the .config file, since:
    b1e514d Config: default BR2_PACKAGE_OVERRIDE_FILE to $(CONFIG_DIR)/local.mk

This is Buildroot's top dir when building in-tree, and for out-of-tree
builds, it's in $(O).

[--SNIP--]

Otherwise, LGTM.

Regards,
Yann E. MORIN.
Peter Korsgaard Feb. 23, 2014, 9:29 p.m. UTC | #2
>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:

Hi,

 >> +appropriate solution, because this directory is removed on +make
 >> +clean+.
 >> +
 >> +Therefore, Buildroot provides a specific mechanism for this use case:
 >> +the +<pkg>_OVERRIDE_SRCDIR+ mechanism. Buildroot reads an _override_
 >> +file, which allows the user to tell Buildroot the location of the
 >> +source for certain packages. By default this _override_ file is named
 >> ++local.mk+ and located in the top directory of the Buildroot source
 >> +tree,

 > Wrong, now it is locate in $(CONFIG_DIR), that is, the directory where
 > we have the .config file, since:
 >     b1e514d Config: default BR2_PACKAGE_OVERRIDE_FILE to $(CONFIG_DIR)/local.mk

 > This is Buildroot's top dir when building in-tree, and for out-of-tree
 > builds, it's in $(O).

True, but that commit is only in next, and I imho think this series
belongs on master, so I'll leave it for now.
Yann E. MORIN Feb. 23, 2014, 9:33 p.m. UTC | #3
On 2014-02-23 22:29 +0100, Peter Korsgaard spake thusly:
> >>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:
> 
> Hi,
> 
>  >> +appropriate solution, because this directory is removed on +make
>  >> +clean+.
>  >> +
>  >> +Therefore, Buildroot provides a specific mechanism for this use case:
>  >> +the +<pkg>_OVERRIDE_SRCDIR+ mechanism. Buildroot reads an _override_
>  >> +file, which allows the user to tell Buildroot the location of the
>  >> +source for certain packages. By default this _override_ file is named
>  >> ++local.mk+ and located in the top directory of the Buildroot source
>  >> +tree,
> 
>  > Wrong, now it is locate in $(CONFIG_DIR), that is, the directory where
>  > we have the .config file, since:
>  >     b1e514d Config: default BR2_PACKAGE_OVERRIDE_FILE to $(CONFIG_DIR)/local.mk
> 
>  > This is Buildroot's top dir when building in-tree, and for out-of-tree
>  > builds, it's in $(O).
> 
> True, but that commit is only in next, and I imho think this series
> belongs on master, so I'll leave it for now.

Right! In fact, I was looking at my tree, which has it. It's eda3d0e on
-next.

And I agree, this series belongs to master. We'll just have to remember
it at merge time.

Sorry for the disruption.

Regards,
Yann E. MORIN.
diff mbox

Patch

diff --git a/docs/manual/advanced.txt b/docs/manual/advanced.txt
index 764b71a..fb337f5 100644
--- a/docs/manual/advanced.txt
+++ b/docs/manual/advanced.txt
@@ -11,3 +11,5 @@  include::ccache-support.txt[]
 include::download-location.txt[]
 
 include::package-make-target.txt[]
+
+include::using-buildroot-development.txt[]
diff --git a/docs/manual/using-buildroot-development.txt b/docs/manual/using-buildroot-development.txt
new file mode 100644
index 0000000..3267302
--- /dev/null
+++ b/docs/manual/using-buildroot-development.txt
@@ -0,0 +1,84 @@ 
+// -*- mode:doc; -*-
+// vim: set syntax=asciidoc:
+
+Using Buildroot during development
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The normal operation of Buildroot is to download a tarball, extract
+it, configure, compile and install the software component found inside
+this tarball. The source code is extracted in
++output/build/<package>-<name>+, which is a temporary directory:
+whenever +make clean+ is used, this directory is entirely removed, and
+re-recreated at the next +make+ invocation. Even when a Git or
+Subversion repository is used as the input for the package source
+code, Buildroot creates a tarball out of it, and then behaves as it
+does normally with tarballs.
+
+This behavior is well-suited when Buildroot is used mainly as an
+integration tool, to build and integrate all the components of an
+embedded Linux system. However, if one uses Buildroot during the
+development of certain components of the system, this behavior is not
+very convenient: one would instead like to make a small change to the
+source code of one package, and be able to quickly rebuild the system
+with Buildroot.
+
+Making changes directly in +output/build/<package>-<name>+ is not
+appropriate solution, because this directory is removed on +make
+clean+.
+
+Therefore, Buildroot provides a specific mechanism for this use case:
+the +<pkg>_OVERRIDE_SRCDIR+ mechanism. Buildroot reads an _override_
+file, which allows the user to tell Buildroot the location of the
+source for certain packages. By default this _override_ file is named
++local.mk+ and located in the top directory of the Buildroot source
+tree, but a different location can be specified through the
++BR2_PACKAGE_OVERRIDE_FILE+ configuration option.
+
+In this _override_ file, Buildroot expects to find lines of the form:
+
+------------------
+<pkg1>_OVERRIDE_SRCDIR = /path/to/pkg1/sources
+<pkg2>_OVERRIDE_SRCDIR = /path/to/pkg2/sources
+------------------
+
+For example:
+
+------------------
+LINUX_OVERRIDE_SRCDIR = /home/bob/linux/
+BUSYBOX_OVERRIDE_SRCDIR = /home/bob/busybox/
+------------------
+
+When Buildroot finds that for a given package, an
++<pkg>_OVERRIDE_SRCDIR+ has been defined, it will no longer attempt to
+download, extract and patch the package. Instead, it will directly use
+the source code available in in the specified directory and +make
+clean+ will not touch this directory. This allows to point Buildroot
+to your own directories, that can be managed by Git, Subversion, or
+any other version control system. To achieve this, Buildroot will use
+_rsync_ to copy the source code of the component from the specified
++<pkg>_OVERRIDE_SRCDIR+ to +output/build/<package>-custom/+.
+
+This mechanism is best used in conjuction with the +make
+<pkg>-rebuild+ and +make <pkg>-reconfigure+ targets. A +make
+<pkg>-rebuild all+ sequence will _rsync_ the source code from
++<pkg>_OVERRIDE_SRCDIR+ to +output/build/<package>-custom+ (thanks to
+_rsync_, only the modified files are copied), and restart the build
+process of just this package.
+
+In the example of the +linux+ package above, the developer can then
+make a source code change in +/home/bob/linux+ and then run:
+
+-----------------------
+make linux-rebuild all
+-----------------------
+
+and in a matter of seconds gets the updated Linux kernel image in
++output/images+. Similarly, a change can be made to the Busybox source
+code in +/home/bob/busybox+, and after:
+
+-----------------------
+make busybox-rebuild all
+-----------------------
+
+the root filesystem image in +output/images+ contains the updated
+Busybox.