Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 2/2] package/pkg-kconfig.mk: new <pkg>-diff-config target
Date: Fri, 2 Aug 2019 17:25:54 +0200	[thread overview]
Message-ID: <20190802172554.426fc521@windsurf.home> (raw)
In-Reply-To: <20180921135521.32435-3-m.patzlaff@pilz.de>

Hello Marcel,

On Fri, 21 Sep 2018 15:55:21 +0200
Marcel Patzlaff <m.patzlaff@pilz.de> wrote:

> This patch introduces the new target to compare the current
> configuration with the one derived from the defconfig + fragments (if
> any). It helps identifying settings not yet inserted to the defconfig
> or any fragment.
> 
> Signed-off-by: Marcel Patzlaff <m.patzlaff@pilz.de>
> ---
>  package/pkg-kconfig.mk | 36 ++++++++++++++++++++++++++++++------
>  1 file changed, 30 insertions(+), 6 deletions(-)
> 
> diff --git a/package/pkg-kconfig.mk b/package/pkg-kconfig.mk
> index 5952be5482..b746dc588c 100644
> --- a/package/pkg-kconfig.mk
> +++ b/package/pkg-kconfig.mk
> @@ -49,6 +49,18 @@ define kconfig-package-regen-dot-config
>  			$(Q)(yes "" | $($(1)_KCONFIG_MAKE) oldconfig)))
>  endef
>  
> +# Macro to create a .config file where all given fragments are merged into.
> +# $(1): the name of the package in upper-case letters
> +# $(2): name of the .config file
> +# $(3): fragment files to merge
> +define kconfig-package-merge-config
> +	$(Q)$(if $($(1)_KCONFIG_DEFCONFIG),\
> +		$($(1)_KCONFIG_MAKE) $($(1)_KCONFIG_DEFCONFIG),\
> +		$(INSTALL) -m 0644 -D $($(1)_KCONFIG_FILE) $(2))
> +	$(Q)support/kconfig/merge_config.sh -m -O $(@D) $(2) $(3)

This $(@D) here cannot work. It works when this macro is called in the
context of the $$($(2)_DIR)/$$($(2)_KCONFIG_DOTCONFIG) rule, because
$(@D) makes sense. But when it's called inside the $(1)-diff-config
rule, $(@D) doesn't make sense, and evaluates to ".". Due to this,
when building in-tree, kconfig-package-merge-config overwrites the
Buildroot .config file!

I fixed this by using $(dir $(2)) instead of $(@D).

> +$(1)-diff-config: $(1)-check-configuration-done
> +	$$(Q)cp -a $$($(2)_DIR)/$$($(2)_KCONFIG_DOTCONFIG) $$($(2)_DIR)/.config.dc.bak
> +	$$(call kconfig-package-merge-config,$(2),$$($(2)_DIR)/$$($(2)_KCONFIG_DOTCONFIG),\
> +		$$($(2)_KCONFIG_FRAGMENT_FILES))
> +	@echo "### start of $$(@) output ###"
> +	@utils/diffconfig $$($(2)_DIR)/$$($(2)_KCONFIG_DOTCONFIG) \
> +		 $$($(2)_DIR)/.config.dc.bak

Changed @utils/diffconfig to $$(Q)utils/diffconfig

> +	@echo "### end of $$(@) output ###"

Both Yann and me found that the start/end messages were not really
needed. It would be nice if the output was less verbose, and really
only contained the output of utils/diffconfig, but we didn't find that
the start/end marker were making things any better.

I've applied with the above changes. Thanks a lot for this contribution!

Could you prepare an addition to the Buildroot manual to document this
new feature ?

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

      parent reply	other threads:[~2019-08-02 15:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-21 13:55 [Buildroot] [PATCH 0/2] package/pkg-kconfig.mk: Target to compare configurations Marcel Patzlaff
2018-09-21 13:55 ` [Buildroot] [PATCH 1/2] package/pkg-kconfig.mk: Reusability improvements Marcel Patzlaff
2019-03-17 16:40   ` Yann E. MORIN
2019-08-02 15:22   ` Thomas Petazzoni
2018-09-21 13:55 ` [Buildroot] [PATCH 2/2] package/pkg-kconfig.mk: new <pkg>-diff-config target Marcel Patzlaff
2019-03-17 16:41   ` Yann E. MORIN
2019-08-02 15:25   ` Thomas Petazzoni [this message]

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=20190802172554.426fc521@windsurf.home \
    --to=thomas.petazzoni@bootlin.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox