All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 0/2] package/pkg-kconfig.mk: Target to compare configurations
@ 2018-09-21 13:55 Marcel Patzlaff
  2018-09-21 13:55 ` [Buildroot] [PATCH 1/2] package/pkg-kconfig.mk: Reusability improvements Marcel Patzlaff
  2018-09-21 13:55 ` [Buildroot] [PATCH 2/2] package/pkg-kconfig.mk: new <pkg>-diff-config target Marcel Patzlaff
  0 siblings, 2 replies; 7+ messages in thread
From: Marcel Patzlaff @ 2018-09-21 13:55 UTC (permalink / raw)
  To: buildroot

"Inspired" by the discussion we had at [1], I propose this patch series
to support developers who fragment their configurations. They will be
able to compare the current configuration of any kconfig based package
with the one derived from the defconfig + fragments (if any). The
output of the new target would look like the following:

### start of linux-diff-config output ###
 CONFIG_CPU_IDLE_GOV_MENU y -> n
 CONFIG_MODULE_FORCE_UNLOAD n -> y
### end of linux-diff-config output ###


[1]: https://patchwork.ozlabs.org/patch/951068/


Marcel Patzlaff (2):
  package/pkg-kconfig.mk: Reusability improvements
  package/pkg-kconfig.mk: new <pkg>-diff-config target

 package/pkg-kconfig.mk | 77 +++++++++++++++++++++++++++++-------------
 1 file changed, 54 insertions(+), 23 deletions(-)

-- 
2.17.1

Gesch?ftsf?hrung: Susanne Kunschert, Thomas Pilz
Pilz GmbH & Co. KG, Sitz: Ostfildern, HRA 210 893, Amtsgericht Stuttgart
Kompl. Ges. Peter Pilz GmbH, Sitz: Ostfildern, HRB 210 612, Amtsgericht Stuttgart
Umsatzsteuer: ID-Nr. DE 145 355 773, WEEE-Reg.-Nr. DE 71636849
This email is intended solely for the use of the named address(es). Any unauthorised disclosure, copying or distribution of these confidential information contained therein, or the taking of any action based on it, is prohibited. The sender disclaims any liability for the integrity of this email. Legally binding declarations must be in written form.
Umweltschutz liegt uns am Herzen! - Bitte denken Sie an unsere Umwelt, bevor Sie diese E-Mail drucken.
We do care about the environment! - Please consider the environment before printing this e-mail.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 1/2] package/pkg-kconfig.mk: Reusability improvements
  2018-09-21 13:55 [Buildroot] [PATCH 0/2] package/pkg-kconfig.mk: Target to compare configurations Marcel Patzlaff
@ 2018-09-21 13:55 ` 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
  1 sibling, 2 replies; 7+ messages in thread
From: Marcel Patzlaff @ 2018-09-21 13:55 UTC (permalink / raw)
  To: buildroot

This patch refactors savedefconfig and the configuration re-generation
to separate macros so that the functionality can be re-used in further
rules.

Signed-off-by: Marcel Patzlaff <m.patzlaff@pilz.de>
---
 package/pkg-kconfig.mk | 43 ++++++++++++++++++++++++------------------
 1 file changed, 25 insertions(+), 18 deletions(-)

diff --git a/package/pkg-kconfig.mk b/package/pkg-kconfig.mk
index d6c95b897e..5952be5482 100644
--- a/package/pkg-kconfig.mk
+++ b/package/pkg-kconfig.mk
@@ -27,6 +27,28 @@ define kconfig-package-update-config
 	$(Q)touch --reference $($(PKG)_DIR)/$($(PKG)_KCONFIG_DOTCONFIG) $($(PKG)_KCONFIG_FILE)
 endef
 
+# Macro to save the defconfig file
+# $(1): the name of the package in upper-case letters
+define kconfig-package-savedefconfig
+	$($(1)_MAKE_ENV) $(MAKE) -C $($(1)_DIR) \
+		$($(1)_KCONFIG_OPTS) savedefconfig
+endef
+
+# The correct way to regenerate a .config file is to use 'make olddefconfig'.
+# For historical reasons, the target name is 'oldnoconfig' between Linux kernel
+# versions 2.6.36 and 3.6, and remains as an alias in later versions.
+# In older versions, and in some other projects that use kconfig, the target is
+# not supported at all, and we use 'yes "" | make oldconfig' as a fallback
+# only, as this can fail in complex cases.
+# $(1): the name of the package in upper-case letters
+define kconfig-package-regen-dot-config
+	$(if $(filter olddefconfig,$($(1)_KCONFIG_RULES)),
+		$(Q)$($(1)_KCONFIG_MAKE) olddefconfig,
+		$(if $(filter oldnoconfig,$($(1)_KCONFIG_RULES)),
+			$(Q)$($(1)_KCONFIG_MAKE) oldnoconfig,
+			$(Q)(yes "" | $($(1)_KCONFIG_MAKE) oldconfig)))
+endef
+
 ################################################################################
 # inner-kconfig-package -- generates the make targets needed to support a
 # kconfig package
@@ -94,20 +116,6 @@ $(2)_KCONFIG_RULES = \
 	$$(shell $$($(2)_KCONFIG_MAKE) -pn config 2>/dev/null | \
 		sed 's/^\([_0-9a-zA-Z]*config\):.*/\1/ p; d')
 
-# The correct way to regenerate a .config file is to use 'make olddefconfig'.
-# For historical reasons, the target name is 'oldnoconfig' between Linux kernel
-# versions 2.6.36 and 3.6, and remains as an alias in later versions.
-# In older versions, and in some other projects that use kconfig, the target is
-# not supported at all, and we use 'yes "" | make oldconfig' as a fallback
-# only, as this can fail in complex cases.
-define $(2)_REGEN_DOT_CONFIG
-	$$(if $$(filter olddefconfig,$$($(2)_KCONFIG_RULES)),
-		$$(Q)$$($(2)_KCONFIG_MAKE) olddefconfig,
-		$$(if $$(filter oldnoconfig,$$($(2)_KCONFIG_RULES)),
-			$$(Q)$$($(2)_KCONFIG_MAKE) oldnoconfig,
-			$$(Q)(yes "" | $$($(2)_KCONFIG_MAKE) oldconfig)))
-endef
-
 # The specified source configuration file and any additional configuration file
 # fragments are merged together to .config, after the package has been patched.
 # Since the file could be a defconfig file it needs to be expanded to a
@@ -118,7 +126,7 @@ $$($(2)_DIR)/$$($(2)_KCONFIG_DOTCONFIG): $$($(2)_KCONFIG_FILE) $$($(2)_KCONFIG_F
 		$$(INSTALL) -m 0644 -D $$($(2)_KCONFIG_FILE) $$(@))
 	$$(Q)support/kconfig/merge_config.sh -m -O $$(@D) \
 		$$(@) $$($(2)_KCONFIG_FRAGMENT_FILES)
-	$$($(2)_REGEN_DOT_CONFIG)
+	$$(call kconfig-package-regen-dot-config,$(2))
 
 # If _KCONFIG_FILE or _KCONFIG_FRAGMENT_FILES exists, this dependency is
 # already implied, but if we only have a _KCONFIG_DEFCONFIG we have to add
@@ -134,7 +142,7 @@ $$($(2)_DIR)/$$($(2)_KCONFIG_DOTCONFIG): | $$($(2)_KCONFIG_DEPENDENCIES)
 # The exact rules are specified by the package .mk file.
 define $(2)_FIXUP_DOT_CONFIG
 	$$($(2)_KCONFIG_FIXUP_CMDS)
-	$$($(2)_REGEN_DOT_CONFIG)
+	$$(call kconfig-package-regen-dot-config,$(2))
 	$$(Q)touch $$($(2)_DIR)/.stamp_kconfig_fixup_done
 endef
 
@@ -223,8 +231,7 @@ $(1)-check-configuration-done:
 	fi
 
 $(1)-savedefconfig: $(1)-check-configuration-done
-	$$($(2)_MAKE_ENV) $$(MAKE) -C $$($(2)_DIR) \
-		$$($(2)_KCONFIG_OPTS) savedefconfig
+	$$(call kconfig-package-savedefconfig,$(2))
 
 # Target to copy back the configuration to the source configuration file
 # Even though we could use 'cp --preserve-timestamps' here, the separate
-- 
2.17.1

Gesch?ftsf?hrung: Susanne Kunschert, Thomas Pilz
Pilz GmbH & Co. KG, Sitz: Ostfildern, HRA 210 893, Amtsgericht Stuttgart
Kompl. Ges. Peter Pilz GmbH, Sitz: Ostfildern, HRB 210 612, Amtsgericht Stuttgart
Umsatzsteuer: ID-Nr. DE 145 355 773, WEEE-Reg.-Nr. DE 71636849
This email is intended solely for the use of the named address(es). Any unauthorised disclosure, copying or distribution of these confidential information contained therein, or the taking of any action based on it, is prohibited. The sender disclaims any liability for the integrity of this email. Legally binding declarations must be in written form.
Umweltschutz liegt uns am Herzen! - Bitte denken Sie an unsere Umwelt, bevor Sie diese E-Mail drucken.
We do care about the environment! - Please consider the environment before printing this e-mail.

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 2/2] package/pkg-kconfig.mk: new <pkg>-diff-config target
  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
@ 2018-09-21 13:55 ` Marcel Patzlaff
  2019-03-17 16:41   ` Yann E. MORIN
  2019-08-02 15:25   ` Thomas Petazzoni
  1 sibling, 2 replies; 7+ messages in thread
From: Marcel Patzlaff @ 2018-09-21 13:55 UTC (permalink / raw)
  To: buildroot

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)
+	$(call kconfig-package-regen-dot-config,$(1))
+endef
+
 ################################################################################
 # inner-kconfig-package -- generates the make targets needed to support a
 # kconfig package
@@ -121,12 +133,7 @@ $(2)_KCONFIG_RULES = \
 # Since the file could be a defconfig file it needs to be expanded to a
 # full .config first.
 $$($(2)_DIR)/$$($(2)_KCONFIG_DOTCONFIG): $$($(2)_KCONFIG_FILE) $$($(2)_KCONFIG_FRAGMENT_FILES)
-	$$(Q)$$(if $$($(2)_KCONFIG_DEFCONFIG), \
-		$$($(2)_KCONFIG_MAKE) $$($(2)_KCONFIG_DEFCONFIG), \
-		$$(INSTALL) -m 0644 -D $$($(2)_KCONFIG_FILE) $$(@))
-	$$(Q)support/kconfig/merge_config.sh -m -O $$(@D) \
-		$$(@) $$($(2)_KCONFIG_FRAGMENT_FILES)
-	$$(call kconfig-package-regen-dot-config,$(2))
+	$$(call kconfig-package-merge-config,$(2),$$(@),$$($(2)_KCONFIG_FRAGMENT_FILES))
 
 # If _KCONFIG_FILE or _KCONFIG_FRAGMENT_FILES exists, this dependency is
 # already implied, but if we only have a _KCONFIG_DEFCONFIG we have to add
@@ -248,11 +255,28 @@ $(1)-update-defconfig: PKG=$(2)
 $(1)-update-defconfig: $(1)-savedefconfig
 	$$(call kconfig-package-update-config,defconfig)
 
+# Target to output differences between the configuration obtained via the
+# defconfig + fragments (if any) and the current configuration.
+# Note: it preserves the timestamp of the current configuration when moving it
+# around.
+$(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
+	@echo "### end of $$(@) output ###"
+	$$(Q)cp -a $$($(2)_DIR)/.config.dc.bak $$($(2)_DIR)/$$($(2)_KCONFIG_DOTCONFIG)
+	$$(Q)rm -f $$($(2)_DIR)/.config.dc.bak
+
+
 endif # package enabled
 
 .PHONY: \
 	$(1)-update-config \
 	$(1)-update-defconfig \
+	$(1)-diff-config \
 	$(1)-savedefconfig \
 	$(1)-check-configuration-done \
 	$$($(2)_DIR)/.kconfig_editor_% \
-- 
2.17.1

Gesch?ftsf?hrung: Susanne Kunschert, Thomas Pilz
Pilz GmbH & Co. KG, Sitz: Ostfildern, HRA 210 893, Amtsgericht Stuttgart
Kompl. Ges. Peter Pilz GmbH, Sitz: Ostfildern, HRB 210 612, Amtsgericht Stuttgart
Umsatzsteuer: ID-Nr. DE 145 355 773, WEEE-Reg.-Nr. DE 71636849
This email is intended solely for the use of the named address(es). Any unauthorised disclosure, copying or distribution of these confidential information contained therein, or the taking of any action based on it, is prohibited. The sender disclaims any liability for the integrity of this email. Legally binding declarations must be in written form.
Umweltschutz liegt uns am Herzen! - Bitte denken Sie an unsere Umwelt, bevor Sie diese E-Mail drucken.
We do care about the environment! - Please consider the environment before printing this e-mail.

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 1/2] package/pkg-kconfig.mk: Reusability improvements
  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
  1 sibling, 0 replies; 7+ messages in thread
From: Yann E. MORIN @ 2019-03-17 16:40 UTC (permalink / raw)
  To: buildroot

Marcel, All,

On 2018-09-21 15:55 +0200, Marcel Patzlaff spake thusly:
> This patch refactors savedefconfig and the configuration re-generation
> to separate macros so that the functionality can be re-used in further
> rules.
> 
> Signed-off-by: Marcel Patzlaff <m.patzlaff@pilz.de>

Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Regards,
Yann E. MORIN.

> ---
>  package/pkg-kconfig.mk | 43 ++++++++++++++++++++++++------------------
>  1 file changed, 25 insertions(+), 18 deletions(-)
> 
> diff --git a/package/pkg-kconfig.mk b/package/pkg-kconfig.mk
> index d6c95b897e..5952be5482 100644
> --- a/package/pkg-kconfig.mk
> +++ b/package/pkg-kconfig.mk
> @@ -27,6 +27,28 @@ define kconfig-package-update-config
>  	$(Q)touch --reference $($(PKG)_DIR)/$($(PKG)_KCONFIG_DOTCONFIG) $($(PKG)_KCONFIG_FILE)
>  endef
>  
> +# Macro to save the defconfig file
> +# $(1): the name of the package in upper-case letters
> +define kconfig-package-savedefconfig
> +	$($(1)_MAKE_ENV) $(MAKE) -C $($(1)_DIR) \
> +		$($(1)_KCONFIG_OPTS) savedefconfig
> +endef
> +
> +# The correct way to regenerate a .config file is to use 'make olddefconfig'.
> +# For historical reasons, the target name is 'oldnoconfig' between Linux kernel
> +# versions 2.6.36 and 3.6, and remains as an alias in later versions.
> +# In older versions, and in some other projects that use kconfig, the target is
> +# not supported at all, and we use 'yes "" | make oldconfig' as a fallback
> +# only, as this can fail in complex cases.
> +# $(1): the name of the package in upper-case letters
> +define kconfig-package-regen-dot-config
> +	$(if $(filter olddefconfig,$($(1)_KCONFIG_RULES)),
> +		$(Q)$($(1)_KCONFIG_MAKE) olddefconfig,
> +		$(if $(filter oldnoconfig,$($(1)_KCONFIG_RULES)),
> +			$(Q)$($(1)_KCONFIG_MAKE) oldnoconfig,
> +			$(Q)(yes "" | $($(1)_KCONFIG_MAKE) oldconfig)))
> +endef
> +
>  ################################################################################
>  # inner-kconfig-package -- generates the make targets needed to support a
>  # kconfig package
> @@ -94,20 +116,6 @@ $(2)_KCONFIG_RULES = \
>  	$$(shell $$($(2)_KCONFIG_MAKE) -pn config 2>/dev/null | \
>  		sed 's/^\([_0-9a-zA-Z]*config\):.*/\1/ p; d')
>  
> -# The correct way to regenerate a .config file is to use 'make olddefconfig'.
> -# For historical reasons, the target name is 'oldnoconfig' between Linux kernel
> -# versions 2.6.36 and 3.6, and remains as an alias in later versions.
> -# In older versions, and in some other projects that use kconfig, the target is
> -# not supported at all, and we use 'yes "" | make oldconfig' as a fallback
> -# only, as this can fail in complex cases.
> -define $(2)_REGEN_DOT_CONFIG
> -	$$(if $$(filter olddefconfig,$$($(2)_KCONFIG_RULES)),
> -		$$(Q)$$($(2)_KCONFIG_MAKE) olddefconfig,
> -		$$(if $$(filter oldnoconfig,$$($(2)_KCONFIG_RULES)),
> -			$$(Q)$$($(2)_KCONFIG_MAKE) oldnoconfig,
> -			$$(Q)(yes "" | $$($(2)_KCONFIG_MAKE) oldconfig)))
> -endef
> -
>  # The specified source configuration file and any additional configuration file
>  # fragments are merged together to .config, after the package has been patched.
>  # Since the file could be a defconfig file it needs to be expanded to a
> @@ -118,7 +126,7 @@ $$($(2)_DIR)/$$($(2)_KCONFIG_DOTCONFIG): $$($(2)_KCONFIG_FILE) $$($(2)_KCONFIG_F
>  		$$(INSTALL) -m 0644 -D $$($(2)_KCONFIG_FILE) $$(@))
>  	$$(Q)support/kconfig/merge_config.sh -m -O $$(@D) \
>  		$$(@) $$($(2)_KCONFIG_FRAGMENT_FILES)
> -	$$($(2)_REGEN_DOT_CONFIG)
> +	$$(call kconfig-package-regen-dot-config,$(2))
>  
>  # If _KCONFIG_FILE or _KCONFIG_FRAGMENT_FILES exists, this dependency is
>  # already implied, but if we only have a _KCONFIG_DEFCONFIG we have to add
> @@ -134,7 +142,7 @@ $$($(2)_DIR)/$$($(2)_KCONFIG_DOTCONFIG): | $$($(2)_KCONFIG_DEPENDENCIES)
>  # The exact rules are specified by the package .mk file.
>  define $(2)_FIXUP_DOT_CONFIG
>  	$$($(2)_KCONFIG_FIXUP_CMDS)
> -	$$($(2)_REGEN_DOT_CONFIG)
> +	$$(call kconfig-package-regen-dot-config,$(2))
>  	$$(Q)touch $$($(2)_DIR)/.stamp_kconfig_fixup_done
>  endef
>  
> @@ -223,8 +231,7 @@ $(1)-check-configuration-done:
>  	fi
>  
>  $(1)-savedefconfig: $(1)-check-configuration-done
> -	$$($(2)_MAKE_ENV) $$(MAKE) -C $$($(2)_DIR) \
> -		$$($(2)_KCONFIG_OPTS) savedefconfig
> +	$$(call kconfig-package-savedefconfig,$(2))
>  
>  # Target to copy back the configuration to the source configuration file
>  # Even though we could use 'cp --preserve-timestamps' here, the separate
> -- 
> 2.17.1
> 
> Gesch?ftsf?hrung: Susanne Kunschert, Thomas Pilz
> Pilz GmbH & Co. KG, Sitz: Ostfildern, HRA 210 893, Amtsgericht Stuttgart
> Kompl. Ges. Peter Pilz GmbH, Sitz: Ostfildern, HRB 210 612, Amtsgericht Stuttgart
> Umsatzsteuer: ID-Nr. DE 145 355 773, WEEE-Reg.-Nr. DE 71636849
> This email is intended solely for the use of the named address(es). Any unauthorised disclosure, copying or distribution of these confidential information contained therein, or the taking of any action based on it, is prohibited. The sender disclaims any liability for the integrity of this email. Legally binding declarations must be in written form.
> Umweltschutz liegt uns am Herzen! - Bitte denken Sie an unsere Umwelt, bevor Sie diese E-Mail drucken.
> We do care about the environment! - Please consider the environment before printing this e-mail.
> _______________________________________________
> 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.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 2/2] package/pkg-kconfig.mk: new <pkg>-diff-config target
  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
  1 sibling, 0 replies; 7+ messages in thread
From: Yann E. MORIN @ 2019-03-17 16:41 UTC (permalink / raw)
  To: buildroot

Marcel, All,

On 2018-09-21 15:55 +0200, Marcel Patzlaff spake thusly:
> 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>

Thanks for this new iteration! :-)

Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Regards,
Yann E. MORIN.

> ---
>  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)
> +	$(call kconfig-package-regen-dot-config,$(1))
> +endef
> +
>  ################################################################################
>  # inner-kconfig-package -- generates the make targets needed to support a
>  # kconfig package
> @@ -121,12 +133,7 @@ $(2)_KCONFIG_RULES = \
>  # Since the file could be a defconfig file it needs to be expanded to a
>  # full .config first.
>  $$($(2)_DIR)/$$($(2)_KCONFIG_DOTCONFIG): $$($(2)_KCONFIG_FILE) $$($(2)_KCONFIG_FRAGMENT_FILES)
> -	$$(Q)$$(if $$($(2)_KCONFIG_DEFCONFIG), \
> -		$$($(2)_KCONFIG_MAKE) $$($(2)_KCONFIG_DEFCONFIG), \
> -		$$(INSTALL) -m 0644 -D $$($(2)_KCONFIG_FILE) $$(@))
> -	$$(Q)support/kconfig/merge_config.sh -m -O $$(@D) \
> -		$$(@) $$($(2)_KCONFIG_FRAGMENT_FILES)
> -	$$(call kconfig-package-regen-dot-config,$(2))
> +	$$(call kconfig-package-merge-config,$(2),$$(@),$$($(2)_KCONFIG_FRAGMENT_FILES))
>  
>  # If _KCONFIG_FILE or _KCONFIG_FRAGMENT_FILES exists, this dependency is
>  # already implied, but if we only have a _KCONFIG_DEFCONFIG we have to add
> @@ -248,11 +255,28 @@ $(1)-update-defconfig: PKG=$(2)
>  $(1)-update-defconfig: $(1)-savedefconfig
>  	$$(call kconfig-package-update-config,defconfig)
>  
> +# Target to output differences between the configuration obtained via the
> +# defconfig + fragments (if any) and the current configuration.
> +# Note: it preserves the timestamp of the current configuration when moving it
> +# around.
> +$(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
> +	@echo "### end of $$(@) output ###"
> +	$$(Q)cp -a $$($(2)_DIR)/.config.dc.bak $$($(2)_DIR)/$$($(2)_KCONFIG_DOTCONFIG)
> +	$$(Q)rm -f $$($(2)_DIR)/.config.dc.bak
> +
> +
>  endif # package enabled
>  
>  .PHONY: \
>  	$(1)-update-config \
>  	$(1)-update-defconfig \
> +	$(1)-diff-config \
>  	$(1)-savedefconfig \
>  	$(1)-check-configuration-done \
>  	$$($(2)_DIR)/.kconfig_editor_% \
> -- 
> 2.17.1
> 
> Gesch?ftsf?hrung: Susanne Kunschert, Thomas Pilz
> Pilz GmbH & Co. KG, Sitz: Ostfildern, HRA 210 893, Amtsgericht Stuttgart
> Kompl. Ges. Peter Pilz GmbH, Sitz: Ostfildern, HRB 210 612, Amtsgericht Stuttgart
> Umsatzsteuer: ID-Nr. DE 145 355 773, WEEE-Reg.-Nr. DE 71636849
> This email is intended solely for the use of the named address(es). Any unauthorised disclosure, copying or distribution of these confidential information contained therein, or the taking of any action based on it, is prohibited. The sender disclaims any liability for the integrity of this email. Legally binding declarations must be in written form.
> Umweltschutz liegt uns am Herzen! - Bitte denken Sie an unsere Umwelt, bevor Sie diese E-Mail drucken.
> We do care about the environment! - Please consider the environment before printing this e-mail.
> _______________________________________________
> 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.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 1/2] package/pkg-kconfig.mk: Reusability improvements
  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
  1 sibling, 0 replies; 7+ messages in thread
From: Thomas Petazzoni @ 2019-08-02 15:22 UTC (permalink / raw)
  To: buildroot

Hello,

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

> This patch refactors savedefconfig and the configuration re-generation
> to separate macros so that the functionality can be re-used in further
> rules.
> 
> Signed-off-by: Marcel Patzlaff <m.patzlaff@pilz.de>
> ---
>  package/pkg-kconfig.mk | 43 ++++++++++++++++++++++++------------------
>  1 file changed, 25 insertions(+), 18 deletions(-)

I've applied to master, which required fixing a few conflicts due to
other changes that occurred in the mean time. Sorry for the time it
took :-/

Best regards,

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 2/2] package/pkg-kconfig.mk: new <pkg>-diff-config target
  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
  1 sibling, 0 replies; 7+ messages in thread
From: Thomas Petazzoni @ 2019-08-02 15:25 UTC (permalink / raw)
  To: buildroot

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-08-02 15:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 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.