From patchwork Fri Sep 21 13:55:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Patzlaff, Marcel" X-Patchwork-Id: 973223 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=pilz.de Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42Gw9M5FBhz9sBW for ; Fri, 21 Sep 2018 23:55:51 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id B1E3587B3A; Fri, 21 Sep 2018 13:55:47 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id cK0ORZ3HCXep; Fri, 21 Sep 2018 13:55:45 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 44AC087B42; Fri, 21 Sep 2018 13:55:45 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 1F45D1C1492 for ; Fri, 21 Sep 2018 13:55:41 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 1C5B38731A for ; Fri, 21 Sep 2018 13:55:41 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Ezh4uKugOH9U for ; Fri, 21 Sep 2018 13:55:40 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail1.pilz.de (mail1.pilz.de [212.211.209.113]) by whitealder.osuosl.org (Postfix) with ESMTPS id 007528865E for ; Fri, 21 Sep 2018 13:55:39 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.54,285,1534802400"; d="scan'208";a="2930762" Received: from unknown (HELO srv-desm01) ([172.20.2.85]) by mail1.pilz.de with ESMTP; 21 Sep 2018 15:55:35 +0200 Received: from srv-dema02.de.pilz.local ([172.16.206.6]) by srv-desm01 (IBM Domino Release 9.0.1FP8) with ESMTP id 2018092115553151-4870477 ; Fri, 21 Sep 2018 15:55:31 +0200 Received: from mpa-linux.de.pilz.local ([172.16.204.213]) by srv-dema02.de.pilz.local (IBM Domino Release 9.0.1FP8 HF475) with ESMTP id 2018092115553377-8899 ; Fri, 21 Sep 2018 15:55:33 +0200 From: Marcel Patzlaff To: buildroot@buildroot.org Date: Fri, 21 Sep 2018 15:55:20 +0200 Message-Id: <20180921135521.32435-2-m.patzlaff@pilz.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180921135521.32435-1-m.patzlaff@pilz.de> References: <20180921135521.32435-1-m.patzlaff@pilz.de> X-MIMETrack: Itemize by SMTP Server on DEMA02/SRV/Pilz(Release 9.0.1FP8 HF475|July 13, 2017) at 21.09.2018 15:55:33, Serialize by ntm_grab.EXE on DEMA02/SRV/Pilz(Release 9.0.1FP8 HF475|July 13, 2017) at 21.09.2018 15:55:34, Serialize complete at 21.09.2018 15:55:34, Serialize by Router on DEMA02/SRV/Pilz(Release 9.0.1FP8 HF475|July 13, 2017) at 21.09.2018 15:55:34, Itemize by SMTP Server on desm01/dmz(Release 9.0.1FP8|February 23, 2017) at 21.09.2018 15:55:31, Serialize by Router on desm01/dmz(Release 9.0.1FP8|February 23, 2017) at 21.09.2018 15:55:31, Serialize complete at 21.09.2018 15:55:31 X-TNEFEvaluated: 1 MIME-Version: 1.0 Subject: [Buildroot] [PATCH 1/2] package/pkg-kconfig.mk: Reusability improvements X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.24 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marcel Patzlaff Errors-To: buildroot-bounces@busybox.net Sender: "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 Reviewed-by: "Yann E. MORIN" Tested-by: "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 From patchwork Fri Sep 21 13:55:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Patzlaff, Marcel" X-Patchwork-Id: 973221 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=pilz.de Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42Gw9F4bLRz9sBW for ; Fri, 21 Sep 2018 23:55:44 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id A208E87B0C; Fri, 21 Sep 2018 13:55:42 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8NzKHqx92bBf; Fri, 21 Sep 2018 13:55:41 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 9DB8787A38; Fri, 21 Sep 2018 13:55:41 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 7B44A1C1492 for ; Fri, 21 Sep 2018 13:55:40 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 75B3788646 for ; Fri, 21 Sep 2018 13:55:40 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pgsSKQGjZ39l for ; Fri, 21 Sep 2018 13:55:39 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail1.pilz.de (mail1.pilz.de [212.211.209.113]) by whitealder.osuosl.org (Postfix) with ESMTPS id 1EC8E88650 for ; Fri, 21 Sep 2018 13:55:38 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.54,285,1534802400"; d="scan'208";a="2930760" Received: from unknown (HELO srv-desm01) ([172.20.2.85]) by mail1.pilz.de with ESMTP; 21 Sep 2018 15:55:34 +0200 Received: from srv-dema02.de.pilz.local ([172.16.206.6]) by srv-desm01 (IBM Domino Release 9.0.1FP8) with ESMTP id 2018092115553129-4870476 ; Fri, 21 Sep 2018 15:55:31 +0200 Received: from mpa-linux.de.pilz.local ([172.16.204.213]) by srv-dema02.de.pilz.local (IBM Domino Release 9.0.1FP8 HF475) with ESMTP id 2018092115553387-8900 ; Fri, 21 Sep 2018 15:55:33 +0200 From: Marcel Patzlaff To: buildroot@buildroot.org Date: Fri, 21 Sep 2018 15:55:21 +0200 Message-Id: <20180921135521.32435-3-m.patzlaff@pilz.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180921135521.32435-1-m.patzlaff@pilz.de> References: <20180921135521.32435-1-m.patzlaff@pilz.de> X-MIMETrack: Itemize by SMTP Server on DEMA02/SRV/Pilz(Release 9.0.1FP8 HF475|July 13, 2017) at 21.09.2018 15:55:33, Serialize by ntm_grab.EXE on DEMA02/SRV/Pilz(Release 9.0.1FP8 HF475|July 13, 2017) at 21.09.2018 15:55:34, Serialize complete at 21.09.2018 15:55:34, Serialize by Router on DEMA02/SRV/Pilz(Release 9.0.1FP8 HF475|July 13, 2017) at 21.09.2018 15:55:34, Itemize by SMTP Server on desm01/dmz(Release 9.0.1FP8|February 23, 2017) at 21.09.2018 15:55:31, Serialize by Router on desm01/dmz(Release 9.0.1FP8|February 23, 2017) at 21.09.2018 15:55:31, Serialize complete at 21.09.2018 15:55:31 X-TNEFEvaluated: 1 MIME-Version: 1.0 Subject: [Buildroot] [PATCH 2/2] package/pkg-kconfig.mk: new -diff-config target X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.24 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marcel Patzlaff Errors-To: buildroot-bounces@busybox.net Sender: "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 Reviewed-by: "Yann E. MORIN" Tested-by: "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_% \