From patchwork Mon Jul 30 15:51:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Patzlaff, Marcel" X-Patchwork-Id: 951067 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.138; helo=whitealder.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 whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41fPGB3ddWz9s1R for ; Tue, 31 Jul 2018 01:52:18 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 8472B88C0A; Mon, 30 Jul 2018 15:52:14 +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 gGwq8mjRA5sr; Mon, 30 Jul 2018 15:52:12 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 915D188BE3; Mon, 30 Jul 2018 15:52:12 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 9CD811C21CE for ; Mon, 30 Jul 2018 15:52:09 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 99E9D20783 for ; Mon, 30 Jul 2018 15:52:09 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id W3bf0PXw6QUx for ; Mon, 30 Jul 2018 15:52:08 +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 silver.osuosl.org (Postfix) with ESMTPS id E815D20782 for ; Mon, 30 Jul 2018 15:52:07 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.51,422,1526335200"; d="scan'208";a="1844225" Received: from unknown (HELO srv-desm01) ([172.20.2.85]) by mail1.pilz.de with ESMTP; 30 Jul 2018 17:52:03 +0200 Received: from srv-dema02.de.pilz.local ([172.16.206.6]) by srv-desm01 (IBM Domino Release 9.0.1FP8) with ESMTP id 2018073017515496-3962323 ; Mon, 30 Jul 2018 17:51:54 +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 2018073017520205-10211 ; Mon, 30 Jul 2018 17:52:02 +0200 From: Marcel Patzlaff To: buildroot@buildroot.org Date: Mon, 30 Jul 2018 17:51:51 +0200 Message-Id: <20180730155153.24091-2-m.patzlaff@pilz.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180730155153.24091-1-m.patzlaff@pilz.de> References: <20180730155153.24091-1-m.patzlaff@pilz.de> X-MIMETrack: Itemize by SMTP Server on DEMA02/SRV/Pilz(Release 9.0.1FP8 HF475|July 13, 2017) at 30.07.2018 17:52:02, Serialize by ntm_grab.EXE on DEMA02/SRV/Pilz(Release 9.0.1FP8 HF475|July 13, 2017) at 30.07.2018 17:52:02, Serialize complete at 30.07.2018 17:52:02, Serialize by Router on DEMA02/SRV/Pilz(Release 9.0.1FP8 HF475|July 13, 2017) at 30.07.2018 17:52:02, Itemize by SMTP Server on desm01/dmz(Release 9.0.1FP8|February 23, 2017) at 30.07.2018 17:51:54, Serialize by Router on desm01/dmz(Release 9.0.1FP8|February 23, 2017) at 30.07.2018 17:51:55, Serialize complete at 30.07.2018 17:51:55 X-TNEFEvaluated: 1 MIME-Version: 1.0 Subject: [Buildroot] [PATCH 1/3] Support script for defconfig comparison 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 adds a new support script that allows to compare two defconfigs and to output the differences in a form such that it can be used as configuration fragment. The comparison is done in two steps: 1) Apply a plain "diff" on the two files (A and B) and collect all item names where diff sees a difference. This results in a list of newline separated item names. 2) For each item name in the list, the complete line out of the .config file derived from B is taken and written to stdout. Signed-off-by: Marcel Patzlaff --- utils/diff_defconfig.sh | 95 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100755 utils/diff_defconfig.sh diff --git a/utils/diff_defconfig.sh b/utils/diff_defconfig.sh new file mode 100755 index 0000000000..385e741813 --- /dev/null +++ b/utils/diff_defconfig.sh @@ -0,0 +1,95 @@ +#!/bin/sh + +# diff_defconfig.sh - Takes two defconfig files A and B as well as the config +# file derived from B and outputs the differences that lead from A to B. +# The output can be used as configuration fragment. +# It is garanteed, that the output only contains configuration items that are +# present in either defconfig. So it's assumed, that all configuration items +# this script outputs are also user-settable. +# +# +# Copyright 2018 Pilz GmbH & Co. KG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the GNU General Public License for more details. + +set -e + +THIS_FILE=$(basename "${0}") + +USAGE="${THIS_FILE} [OPTIONS] " + +fail_msg() { + printf "%s\n" "${1}" 1>&2 + exit 1 +} + +help() { + cat <<-_EOF_ + Usage: + ${USAGE} + + ${THIS_FILE} takes two defconfig files A and B as well as the .config + file derived from B and outputs the differences that lead from A to B on + stdout. The output can be used as configuration fragment. + + Options: + -h display this help text + -p do not restrict config prefix to CONFIG_ + + Returns: + 0 If no error + !0 If any error + _EOF_ +} + + +ALLPREFIXES=false +# parse options +while true; do + case "${1}" in + "-h") + help + exit 0 + ;; + "-p") + ALLPREFIXES=true + shift + ;; + *) + break + ;; + esac +done + +# check if all files are given +[ "${#}" -eq "3" ] || fail_msg "Usage: ${USAGE}" + +# test if files exist +[ -f "${1}" ] || fail_msg "First defconfig file '${1}' does not exist!" +[ -f "${2}" ] || fail_msg "Second defconfig file '${2}' does not exist!" +[ -f "${3}" ] || fail_msg "Config file '${3}' does not exist!" + +ITEM_EXP="s/^[<>]\s\(# \)\{0,1\}\(CONFIG_[a-zA-Z0-9_]*\)[= ].*/\2/p" +if [ "${ALLPREFIXES}" = "true" ]; then + ITEM_EXP="s/^[<>]\s\(# \)\{0,1\}\([a-zA-Z][a-zA-Z0-9_]*\)[= ].*/\2/p" +fi + +# use normal diff and collect all differing item names +ITEMS=$(diff "${1}" "${2}" | sed -n "${ITEM_EXP}" | sort | uniq) + +# output their values +# Note: ITEMS does only contain newline separators and no other whitespaces. +# See regular expression above. +for item in ${ITEMS}; do + # some items disable/hide others so grep may fail here + grep -w "${item}" "${3}" || true +done + +exit 0 From patchwork Mon Jul 30 15:51:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Patzlaff, Marcel" X-Patchwork-Id: 951065 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 AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41fPGB1HvQz9ryt for ; Tue, 31 Jul 2018 01:52:17 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 2DBF587561; Mon, 30 Jul 2018 15:52:14 +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 rN9WWuu6gFFQ; Mon, 30 Jul 2018 15:52:13 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 388A1873EB; Mon, 30 Jul 2018 15:52:13 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 4A9BB1C21CE for ; Mon, 30 Jul 2018 15:52:11 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 46F882079E for ; Mon, 30 Jul 2018 15:52:11 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id M+6LUx7Fk5ZZ for ; Mon, 30 Jul 2018 15:52:09 +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 silver.osuosl.org (Postfix) with ESMTPS id 4441E2077B for ; Mon, 30 Jul 2018 15:52:09 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.51,422,1526335200"; d="scan'208";a="1844227" Received: from unknown (HELO srv-desm01) ([172.20.2.85]) by mail1.pilz.de with ESMTP; 30 Jul 2018 17:52:03 +0200 Received: from srv-dema02.de.pilz.local ([172.16.206.6]) by srv-desm01 (IBM Domino Release 9.0.1FP8) with ESMTP id 2018073017515529-3962325 ; Mon, 30 Jul 2018 17:51:55 +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 2018073017520218-10212 ; Mon, 30 Jul 2018 17:52:02 +0200 From: Marcel Patzlaff To: buildroot@buildroot.org Date: Mon, 30 Jul 2018 17:51:52 +0200 Message-Id: <20180730155153.24091-3-m.patzlaff@pilz.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180730155153.24091-1-m.patzlaff@pilz.de> References: <20180730155153.24091-1-m.patzlaff@pilz.de> X-MIMETrack: Itemize by SMTP Server on DEMA02/SRV/Pilz(Release 9.0.1FP8 HF475|July 13, 2017) at 30.07.2018 17:52:02, Serialize by ntm_grab.EXE on DEMA02/SRV/Pilz(Release 9.0.1FP8 HF475|July 13, 2017) at 30.07.2018 17:52:02, Serialize complete at 30.07.2018 17:52:02, Serialize by Router on DEMA02/SRV/Pilz(Release 9.0.1FP8 HF475|July 13, 2017) at 30.07.2018 17:52:02, Itemize by SMTP Server on desm01/dmz(Release 9.0.1FP8|February 23, 2017) at 30.07.2018 17:51:55, Serialize by Router on desm01/dmz(Release 9.0.1FP8|February 23, 2017) at 30.07.2018 17:51:55, Serialize complete at 30.07.2018 17:51:55 X-TNEFEvaluated: 1 MIME-Version: 1.0 Subject: [Buildroot] [PATCH 2/3] Refactoring of pkg-kconfig.mk to increase re-usability 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 targets. Signed-off-by: Marcel Patzlaff --- 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 81bba5220c..331ba16614 100644 --- a/package/pkg-kconfig.mk +++ b/package/pkg-kconfig.mk @@ -27,6 +27,27 @@ define kconfig-package-update-config $(Q)touch --reference $($(PKG)_DIR)/$($(PKG)_KCONFIG_DOTCONFIG) $($(PKG)_KCONFIG_FILE) endef +# Macro to save the defconfig file +define kconfig-package-savedefconfig + $($(PKG)_MAKE_ENV) $(MAKE) -C $($(PKG)_DIR) \ + $($(PKG)_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 @@ -90,20 +111,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 @@ -114,7 +121,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 @@ -125,7 +132,7 @@ $$($(2)_DIR)/$$($(2)_KCONFIG_DOTCONFIG): | $(1)-patch # 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 @@ -213,9 +220,9 @@ $(1)-check-configuration-done: exit 1; \ fi +$(1)-savedefconfig: PKG=$(2) $(1)-savedefconfig: $(1)-check-configuration-done - $$($(2)_MAKE_ENV) $$(MAKE) -C $$($(2)_DIR) \ - $$($(2)_KCONFIG_OPTS) savedefconfig + $$(call kconfig-package-savedefconfig) # Target to copy back the configuration to the source configuration file # Even though we could use 'cp --preserve-timestamps' here, the separate From patchwork Mon Jul 30 15:51:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Patzlaff, Marcel" X-Patchwork-Id: 951068 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 AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41fPGD2X2Vz9s2L for ; Tue, 31 Jul 2018 01:52:20 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id C4695873EB; Mon, 30 Jul 2018 15:52:18 +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 myx4qkhopWHG; Mon, 30 Jul 2018 15:52:18 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id E7D97874C7; Mon, 30 Jul 2018 15:52:17 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 529F51C21CE for ; Mon, 30 Jul 2018 15:52:12 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 4FF90873EB for ; Mon, 30 Jul 2018 15:52:12 +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 I0qjZiyLoUah for ; Mon, 30 Jul 2018 15:52:10 +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 fraxinus.osuosl.org (Postfix) with ESMTPS id 7444387398 for ; Mon, 30 Jul 2018 15:52:10 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.51,422,1526335200"; d="scan'208";a="1844229" Received: from unknown (HELO srv-desm01) ([172.20.2.85]) by mail1.pilz.de with ESMTP; 30 Jul 2018 17:52:03 +0200 Received: from srv-dema02.de.pilz.local ([172.16.206.6]) by srv-desm01 (IBM Domino Release 9.0.1FP8) with ESMTP id 2018073017515551-3962326 ; Mon, 30 Jul 2018 17:51:55 +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 2018073017520232-10213 ; Mon, 30 Jul 2018 17:52:02 +0200 From: Marcel Patzlaff To: buildroot@buildroot.org Date: Mon, 30 Jul 2018 17:51:53 +0200 Message-Id: <20180730155153.24091-4-m.patzlaff@pilz.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180730155153.24091-1-m.patzlaff@pilz.de> References: <20180730155153.24091-1-m.patzlaff@pilz.de> X-MIMETrack: Itemize by SMTP Server on DEMA02/SRV/Pilz(Release 9.0.1FP8 HF475|July 13, 2017) at 30.07.2018 17:52:02, Serialize by ntm_grab.EXE on DEMA02/SRV/Pilz(Release 9.0.1FP8 HF475|July 13, 2017) at 30.07.2018 17:52:02, Serialize complete at 30.07.2018 17:52:02, Serialize by Router on DEMA02/SRV/Pilz(Release 9.0.1FP8 HF475|July 13, 2017) at 30.07.2018 17:52:03, Serialize complete at 30.07.2018 17:52:03, Itemize by SMTP Server on desm01/dmz(Release 9.0.1FP8|February 23, 2017) at 30.07.2018 17:51:55, Serialize by Router on desm01/dmz(Release 9.0.1FP8|February 23, 2017) at 30.07.2018 17:51:55, Serialize complete at 30.07.2018 17:51:55 X-TNEFEvaluated: 1 MIME-Version: 1.0 Subject: [Buildroot] [PATCH 3/3] New -update-last-config-fragment target in pkg-kconfig.mk 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 adds the new target above which implements the update routine as detailled in the head of this patch series. Signed-off-by: Marcel Patzlaff --- package/pkg-kconfig.mk | 48 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 6 deletions(-) diff --git a/package/pkg-kconfig.mk b/package/pkg-kconfig.mk index 331ba16614..bc817c457f 100644 --- a/package/pkg-kconfig.mk +++ b/package/pkg-kconfig.mk @@ -48,6 +48,18 @@ define kconfig-package-regen-dot-config $(Q)(yes "" | $($(1)_KCONFIG_MAKE) oldconfig))) endef +# Macro to create a .config file where all 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 @@ -116,12 +128,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 @@ -239,11 +246,40 @@ $(1)-update-defconfig: PKG=$(2) $(1)-update-defconfig: $(1)-savedefconfig $$(call kconfig-package-update-config,defconfig) + +define $(2)_KCONFIG_LAST_FRAGMENT + $$(lastword $$($(2)_KCONFIG_FRAGMENT_FILES)) +endef + +define $(2)_KCONFIG_FIRST_FRAGMENTS + $$(filter-out $$($(2)_KCONFIG_LAST_FRAGMENT),\ + $$($(2)_KCONFIG_FRAGMENT_FILES)) +endef + +$(1)-update-last-config-fragment: PKG=$(2) +$(1)-update-last-config-fragment: $(1)-savedefconfig + @$$(if $$($(2)_KCONFIG_FRAGMENT_FILES), true, \ + echo "Unable to perform $(@) when no fragment files are set"; exit 1) + $$(Q)cp -a $$($(2)_DIR)/$$($(2)_KCONFIG_DOTCONFIG) $$($(2)_DIR)/.config.ulcf.all + $$(Q)cp -a $$($(2)_DIR)/defconfig $$($(2)_DIR)/defconfig.ulcf.all + $$(call kconfig-package-merge-config,$(2),$$($(2)_KCONFIG_DOTCONFIG),\ + $$($(2)_KCONFIG_FIRST_FRAGMENTS)) + $$(call kconfig-package-savedefconfig) + $$(Q)cp -a $$($(2)_DIR)/defconfig $$($(2)_DIR)/defconfig.ulcf.first + $$(Q)cp -a $$($(2)_DIR)/.config.ulcf.all $$($(2)_DIR)/$$($(2)_KCONFIG_DOTCONFIG) + $$(Q)cp -a $$($(2)_DIR)/defconfig.ulcf.all $$($(2)_DIR)/defconfig + $$(Q)utils/diff_defconfig.sh $$($(2)_DIR)/defconfig.ulcf.first \ + $$($(2)_DIR)/defconfig.ulcf.all $$($(2)_DIR)/.config.ulcf.all > \ + $$($(2)_KCONFIG_LAST_FRAGMENT) + $$(Q)rm -f $$($(2)_DIR)/defconfig.ulcf.* $$($(2)_DIR)/.config.ulcf.* + + endif # package enabled .PHONY: \ $(1)-update-config \ $(1)-update-defconfig \ + $(1)-update-last-config-fragment \ $(1)-savedefconfig \ $(1)-check-configuration-done \ $$($(2)_DIR)/.kconfig_editor_% \