All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnout Vandecappelle <arnout@mind.be>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCHv2 1/4] core: introduce the BR2_EXTERNAL variable
Date: Mon, 16 Sep 2013 23:30:49 +0200	[thread overview]
Message-ID: <52377889.3010402@mind.be> (raw)
In-Reply-To: <1379185433-8770-2-git-send-email-thomas.petazzoni@free-electrons.com>

On 14/09/13 21:03, Thomas Petazzoni wrote:
> This commit introduces the BR2_EXTERNAL environment variable, which
> will allow to keep Buildroot customization (board-specific
> configuration files or root filesystem overlays, package Config.in and
> makefiles, as well as defconfigs) outside of the Buildroot tree.
>
> This commit only introduces the variable itself, and ensures that it
> is available within Config.in options, so that string options used to
> specify paths to directories or files can use $BR2_EXTERNAL as a

  $(BR2_EXTERNAL). The $ is expanded by make. Same comment applies to 
other places in the commit message as well. You did put it correctly in 
the manual.

> reference. For example, one can use
> $BR2_EXTERNAL/board/<someboard>/kernel.config as the
> BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE value.
>
> Following patches extend the usage of BR2_EXTERNAL to other areas
> (packages and defconfigs).
>
> In details, this commit:
>
>   * Introduces the BR2_EXTERNAL Kconfig option. This option has no
>     prompt, and is therefore not visible to the user and also not
>     stored in the .config file. It is automatically set to the value of
>     the BR2_EXTERNAL environment variable. The only purpose of this
>     BR2_EXTERNAL Kconfig option is to allow $BR2_EXTERNAL to be
>     properly expanded when used inside Kconfig option values.
>
>   * Ensures that the path given in BR2_EXTERNAL is an absolute path, or
>     if not path is given, ensures that BR2_EXTERNAL points to a dummy
>     implementation in $(TOPDIR)/support/dummy-external/. This last part
>     is not directly useful in this commit, but is needed to properly
>     support Config.in options declared in BR2_EXTERNAL (next commit).

  It would make more sense to do it in that commit then, but that's just 
nitpicking.

>
>   * Passes the BR2_EXTERNAL into the *config environment, so that its
>     value is found when parsing/evaluating Config.in files and .config
>     values.

  That's pretty useless in this commit, since it anyway doesn't end up in 
.config and isn't used in Config.in.

>
>   * Encodes the BR2_EXTERNAL value into the Makefile wrapper (only if
>     BR2_EXTERNAL is specified by the user, not if the dummy internal
>     value is used).
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> ---
>   Config.in                  |  4 ++++
>   Makefile                   | 13 +++++++++++--
>   support/scripts/mkmakefile |  3 ++-
>   3 files changed, 17 insertions(+), 3 deletions(-)
>
> diff --git a/Config.in b/Config.in
> index 65c29b4..522eaf8 100644
> --- a/Config.in
> +++ b/Config.in
> @@ -14,6 +14,10 @@ config BR2_HOSTARCH
>   	string
>   	option env="HOSTARCH"
>
> +config BR2_EXTERNAL
> +	string
> +	option env="BR2_EXTERNAL"
> +

  If you agree to store the value in the .config file, it could look 
something like this.

-------

config BR2_EXTERNAL_FROM_ENV
         string
         option env="BR2_EXTERNAL"

# This condition forces the user to set BR2_EXTERNAL from the
# command line the first time.
if BR2_EXTERNAL_FROM_ENV != ""
config BR2_EXTERNAL
         string "External buildroot add-ons"
         default BR2_EXTERNAL_FROM_ENV
         help
           List of directories with buildroot add-ons. ...
endif

if BR2_EXTERNAL != BR2_EXTERNAL_FROM_ENV
comment "You need to re-run the config to see the new packages"
endif


-------

  It doesn't really work, though, because currently the .config is not 
read in when doing 'make menuconfig', so that BR2_EXTERNAL_FROM_ENV will 
always be "". But I'm sure we'll be able to find something that works 
with a little more effort.


>   # Hidden boolean selected by pre-built packages for x86, when they
>   # need to run on x86-64 machines (example: pre-built external
>   # toolchains, binary tools like SAM-BA, etc.).
> diff --git a/Makefile b/Makefile
> index 8610592..13ad342 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -51,6 +51,14 @@ CONFIG_CONFIG_IN=Config.in
>   CONFIG=support/kconfig
>   DATE:=$(shell date +%Y%m%d)
>
> +# Turn BR2_EXTERNAL into an absolute path
> +ifneq ($(BR2_EXTERNAL),)
> +override BR2_EXTERNAL := $(realpath $(BR2_EXTERNAL))
> +BR2_EXTERNAL_USED = y
> +else
> +BR2_EXTERNAL = $(TOPDIR)/support/dummy-external/
> +endif
> +
>   # Compute the full local version string so packages can use it as-is
>   # Need to export it, so it can be got from environment in children (eg. mconf)
>   export BR2_VERSION_FULL:=$(BR2_VERSION)$(shell $(TOPDIR)/support/scripts/setlocalversion)
> @@ -632,7 +640,8 @@ COMMON_CONFIG_ENV = \
>   	KCONFIG_AUTOCONFIG=$(BUILD_DIR)/buildroot-config/auto.conf \
>   	KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \
>   	KCONFIG_TRISTATE=$(BUILD_DIR)/buildroot-config/tristate.config \
> -	BUILDROOT_CONFIG=$(BUILDROOT_CONFIG)
> +	BUILDROOT_CONFIG=$(BUILDROOT_CONFIG) \
> +	BR2_EXTERNAL=$(BR2_EXTERNAL)
>
>   xconfig: $(BUILD_DIR)/buildroot-config/qconf outputmakefile
>   	@mkdir -p $(BUILD_DIR)/buildroot-config
> @@ -739,7 +748,7 @@ source-check:
>   # output directory.
>   outputmakefile:
>   ifeq ($(NEED_WRAPPER),y)
> -	$(Q)$(TOPDIR)/support/scripts/mkmakefile $(TOPDIR) $(O)
> +	$(Q)$(TOPDIR)/support/scripts/mkmakefile $(TOPDIR) $(O) $(if $(BR2_EXTERNAL_USED),$(BR2_EXTERNAL))
>   endif
>
>   # printvars prints all the variables currently defined in our Makefiles
> diff --git a/support/scripts/mkmakefile b/support/scripts/mkmakefile
> index cef2ec7..e7c1bd0 100755
> --- a/support/scripts/mkmakefile
> +++ b/support/scripts/mkmakefile
> @@ -6,7 +6,7 @@
>   # Usage
>   # $1 - Kernel src directory
>   # $2 - Output directory
> -
> +# $3 - BR2_EXTERNAL directory
>
>   test ! -r $2/Makefile -o -O $2/Makefile || exit 0
>   # Only overwrite automatically generated Makefiles
> @@ -27,6 +27,7 @@ makedir := \$(dir \$(call lastword,\$(MAKEFILE_LIST)))
>
>   MAKEARGS := -C $1
>   MAKEARGS += O=\$(if \$(patsubst /%,,\$(makedir)),\$(CURDIR)/)\$(patsubst %/,%,\$(makedir))
> +MAKEARGS += BR2_EXTERNAL=$3

  Obviously, this won't be needed anymore if the EXTERNAL is stored in 
the .config.


  Regards,
  Arnout

>
>   MAKEFLAGS += --no-print-directory
>
>


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

  parent reply	other threads:[~2013-09-16 21:30 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-14 19:03 [Buildroot] [PATCHv2 0/4] Add a BR2_EXTERNAL mechanism Thomas Petazzoni
2013-09-14 19:03 ` [Buildroot] [PATCHv2 1/4] core: introduce the BR2_EXTERNAL variable Thomas Petazzoni
2013-09-16 16:34   ` Ryan Barnett
2013-09-16 18:34     ` Thomas Petazzoni
2013-09-16 21:30   ` Arnout Vandecappelle [this message]
2013-09-17  4:26     ` Thomas Petazzoni
2013-09-17  6:10       ` Arnout Vandecappelle
2013-09-17 18:47         ` Thomas Petazzoni
2013-09-23 20:39   ` Ryan Barnett
2013-09-23 22:17     ` Samuel Martin
2013-09-23 22:30       ` Ryan Barnett
2013-09-23 22:41         ` [Buildroot] [PATCH] core: introduce the BR2_EXTERNAL variable (additional patch to fix manual build) Samuel Martin
2013-09-24  5:47         ` [Buildroot] [PATCHv2 1/4] core: introduce the BR2_EXTERNAL variable Thomas Petazzoni
2013-09-24  8:46           ` Samuel Martin
2013-09-14 19:03 ` [Buildroot] [PATCHv2 2/4] core: allow external Config.in/makefile code to be integrated Thomas Petazzoni
2013-09-16 21:39   ` Arnout Vandecappelle
2013-09-17  4:29     ` Thomas Petazzoni
2013-09-14 19:03 ` [Buildroot] [PATCHv2 3/4] core: allow external defconfigs to be used Thomas Petazzoni
2013-09-16 21:40   ` Arnout Vandecappelle
2013-09-14 19:03 ` [Buildroot] [PATCHv2 4/4] docs/manual: add explanations about BR2_EXTERNAL Thomas Petazzoni
2013-09-14 19:32   ` Simon Dawson
2013-09-14 19:39 ` [Buildroot] [PATCHv2 0/4] Add a BR2_EXTERNAL mechanism Simon Dawson
2013-09-14 19:55   ` Thomas Petazzoni
2013-09-14 20:04     ` Simon Dawson
2013-09-14 22:30 ` Yann E. MORIN
2013-09-15  5:17   ` Thomas Petazzoni
2013-09-16 20:38 ` Arnout Vandecappelle
2013-09-17  4:37   ` Thomas Petazzoni
2013-09-17  6:07     ` Arnout Vandecappelle
2013-09-17 14:56     ` rjbarnet at rockwellcollins.com
2013-10-01  0:06 ` Ryan Barnett
2013-11-24 20:20 ` Yann E. MORIN
2013-11-26 13:20   ` Thomas Petazzoni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52377889.3010402@mind.be \
    --to=arnout@mind.be \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.