All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yann E. MORIN <yann.morin.1998@free.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v3 1/7] package/Makefile.in: expose CONFIG_DIR to post-build/post-image scripts
Date: Thu, 6 May 2021 23:03:13 +0200	[thread overview]
Message-ID: <20210506210313.GY2137340@scaer> (raw)
In-Reply-To: <20210504205139.1055360-2-thomas.petazzoni@bootlin.com>

Thomas, All,

On 2021-05-04 22:51 +0200, Thomas Petazzoni spake thusly:
> Sometimes, post-build or post-image scripts need to reinvoke
> Buildroot's make, for example to execute "make printvars".
> 
> However, so far none of the variables exposed to post-build/post-image
> scripts allowed to do that in a way that worked for both in-tree and
> out-of-tree builds. Indeed:

As we discussed on IRC, there is in fact one possibility to do that:

    make -C ${BR2_CONFIG%/*} printvars

Indeed, BR2_CONFIG points to the full path of the .config file, so by
removing the last path component of BR2_CONFIG, we end up with the
directory that is CONFIG_DIR.

However, it is not ver convenient to extract info from Br2_CONFIG, so
exposing CONFIG_DIR is a godd adition.

Applied to master, after referencing BR2_CONFIG, thanks.

Regards,
Yann E. MORIN.

>  * "make printvars" would work for in-tree builds, but not out of tree
>    builds
> 
>  * "make -C ${O} printvars" would work for out-of-tree builds, but not
>    in-tree builds
> 
> In order to solve this, this commit exposes $(CONFIG_DIR) to
> post-build/post-image scripts, through the EXTRA_ENV variable.
> 
> The documentation is updated accordingly.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> ---
>  docs/manual/customize-post-image.txt | 3 ++-
>  docs/manual/customize-rootfs.txt     | 3 +++
>  package/Makefile.in                  | 1 +
>  3 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/docs/manual/customize-post-image.txt b/docs/manual/customize-post-image.txt
> index 90ea2b9328..5308093d06 100644
> --- a/docs/manual/customize-post-image.txt
> +++ b/docs/manual/customize-post-image.txt
> @@ -28,7 +28,8 @@ different sets of arguments to each script.
>  
>  Again just like for the post-build scripts, the scripts have access to
>  the environment variables +BR2_CONFIG+, +HOST_DIR+, +STAGING_DIR+,
> -+TARGET_DIR+, +BUILD_DIR+, +BINARIES_DIR+ and +BASE_DIR+.
> ++TARGET_DIR+, +BUILD_DIR+, +BINARIES_DIR+, +CONFIG_DIR+ and
> ++BASE_DIR+.
>  
>  The post-image scripts will be executed as the user that executes
>  Buildroot, which should normally _not_ be the root user. Therefore, any
> diff --git a/docs/manual/customize-rootfs.txt b/docs/manual/customize-rootfs.txt
> index e1dbadda5b..8b361f8621 100644
> --- a/docs/manual/customize-rootfs.txt
> +++ b/docs/manual/customize-rootfs.txt
> @@ -65,6 +65,9 @@ In addition, you may also use these environment variables:
>    - +BUILD_DIR+: the directory where packages are extracted and built
>    - +BINARIES_DIR+: the place where all binary files (aka images) are
>      stored
> +  - +CONFIG_DIR+: the directory containing the .config file, and
> +    therefore the top-level Buildroot Makefile to use (which is
> +    correct for both in-tree and out-of-tree builds)
>    - +BASE_DIR+: the base output directory
>  
>  Below three more methods of customizing the target filesystem are
> diff --git a/package/Makefile.in b/package/Makefile.in
> index 51f5cbce4f..f4028bc67c 100644
> --- a/package/Makefile.in
> +++ b/package/Makefile.in
> @@ -318,6 +318,7 @@ EXTRA_ENV = \
>  	PATH=$(BR_PATH) \
>  	BR2_DL_DIR=$(BR2_DL_DIR) \
>  	BUILD_DIR=$(BUILD_DIR) \
> +	CONFIG_DIR=$(CONFIG_DIR) \
>  	O=$(CANONICAL_O)
>  
>  ################################################################################
> -- 
> 2.30.2
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

  reply	other threads:[~2021-05-06 21:03 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-04 20:51 [Buildroot] [PATCH v3 0/7] Support for the BeagleV platform Thomas Petazzoni
2021-05-04 20:51 ` [Buildroot] [PATCH v3 1/7] package/Makefile.in: expose CONFIG_DIR to post-build/post-image scripts Thomas Petazzoni
2021-05-06 21:03   ` Yann E. MORIN [this message]
2021-05-08 14:32   ` Peter Korsgaard
2021-05-04 20:51 ` [Buildroot] [PATCH v3 2/7] boot/opensbi: add options to enable/disable image installation Thomas Petazzoni
2021-05-05  1:03   ` Alistair Francis
2021-05-04 20:51 ` [Buildroot] [PATCH v3 3/7] configs/beaglev_defconfig: new defconfig Thomas Petazzoni
2021-05-05  1:05   ` Alistair Francis
2021-05-07 22:02   ` Yann E. MORIN
2021-05-08 18:23     ` Thomas Petazzoni
2021-05-04 20:51 ` [Buildroot] [PATCH v3 4/7] package/riscv64-elf-toolchain: new package Thomas Petazzoni
2021-05-04 20:51 ` [Buildroot] [PATCH v3 5/7] boot/beaglev-ddrinit: " Thomas Petazzoni
2021-05-07 22:04   ` Yann E. MORIN
2021-05-07 22:06     ` Yann E. MORIN
2021-05-07 23:30     ` Drew Fustini
2021-05-08  7:37       ` Yann E. MORIN
2021-05-08  7:48         ` Drew Fustini
2021-05-08 16:01           ` Khem Raj
2021-05-08 18:20             ` Yann E. MORIN
2021-05-08 19:54               ` Drew Fustini
2021-05-08 21:10             ` Drew Fustini
2021-05-08 22:09               ` Khem Raj
2021-05-09 20:23                 ` Drew Fustini
2021-05-09 20:26                   ` Khem Raj
2021-05-09 20:34                     ` Drew Fustini
2021-05-08 18:21     ` Thomas Petazzoni
2021-05-09 11:03     ` Arnout Vandecappelle
2021-05-09 11:04       ` Arnout Vandecappelle
2021-05-09 20:29         ` Drew Fustini
2021-05-09 20:31           ` Khem Raj
2021-05-10  7:02           ` Drew Fustini
2021-05-10  9:07             ` Peter Korsgaard
2021-05-04 20:51 ` [Buildroot] [PATCH v3 6/7] boot/beaglev-secondboot: " Thomas Petazzoni
2021-05-07 22:07   ` Yann E. MORIN
2021-05-04 20:51 ` [Buildroot] [PATCH v3 7/7] configs/beaglev: enable building of low-level firmware Thomas Petazzoni
2021-05-07 22:08   ` Yann E. MORIN
2021-05-07 22:00 ` [Buildroot] [PATCH v3 0/7] Support for the BeagleV platform Yann E. MORIN
2021-05-14 21:06 ` Drew Fustini

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=20210506210313.GY2137340@scaer \
    --to=yann.morin.1998@free.fr \
    --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.