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 02/22] core/pkg-utils: kconfig mangling defaults to current package's .config
Date: Sat,  4 Apr 2020 14:10:14 +0200	[thread overview]
Message-ID: <14c3b30890f0dbccd6954e9e6c88de483b321b65.1586002215.git.yann.morin.1998@free.fr> (raw)
In-Reply-To: <cover.1586002215.git.yann.morin.1998@free.fr>

The kconfig mangling macros currently operate on the caller-supplied
.config file, on the assumption that the caller will always know what
file to mangle.

This was correct so far, as packages would indeed only mangle their own
.config files.

However, the linux kernel does its mangling based on whether some
packages are enabled or not. That list of conditional mangling is
getting bigger and bigger with each new package that needs such
mangling, culminating with the pending firewalld one [0]. Furthermore,
this mangling is not accessible to packages in br2-external trees. So
we'll want to have packages provide the mangling commands.

So we'll want the mangling to be done on the linux' .config file,,i.e.
and the expanding package context, not in the package calling the
macros.

But packages do not, and should not have knowledge about where the
.config file is, nor how it is named.

So we make the parameter to specify the .config file to mangle optional.
If it is set, this is what the macros will mangle; if it is not set, the
expanding packge's .config file will be used.

This has the added benefit that we do not have to repeat in the
exp[anding package context the knowledge of how the .config file is
named:

    FOO_KCONFIG_DOTCONFIG = .config
    define FOO_KCONFIG_FIXUPS_CMDS
        $(call KCONFIG_ENABLE_OPT,BLA,$(@D)/.config)
    endef

[0] http://lists.busybox.net/pipermail/buildroot/2020-March/278683.html

Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: Peter Korsgaard <peter@korsgaard.com>
---
 package/pkg-kconfig.mk |  2 ++
 package/pkg-utils.mk   | 19 +++++++++++++------
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/package/pkg-kconfig.mk b/package/pkg-kconfig.mk
index e2d52ee8ed..9d65b21ec5 100644
--- a/package/pkg-kconfig.mk
+++ b/package/pkg-kconfig.mk
@@ -166,6 +166,7 @@ define $(2)_FIXUP_DOT_CONFIG
 	$$(Q)touch $$($(2)_DIR)/.stamp_kconfig_fixup_done
 endef
 
+$$($(2)_DIR)/.stamp_kconfig_fixup_done: PKG=$(2)
 $$($(2)_DIR)/.stamp_kconfig_fixup_done: $$($(2)_DIR)/$$($(2)_KCONFIG_STAMP_DOTCONFIG)
 	$$($(2)_FIXUP_DOT_CONFIG)
 
@@ -223,6 +224,7 @@ $(2)_CONFIGURATOR_MAKE_ENV = \
 # end up having a valid @D.
 #
 $$(addprefix $(1)-,$$($(2)_KCONFIG_EDITORS)): $(1)-%: $$($(2)_DIR)/.kconfig_editor_%
+$$($(2)_DIR)/.kconfig_editor_%: PKG=$(2)
 $$($(2)_DIR)/.kconfig_editor_%: $$($(2)_DIR)/.stamp_kconfig_fixup_done
 	$$($(2)_CONFIGURATOR_MAKE_ENV) $$(MAKE) -C $$($(2)_DIR) \
 		$$(PKG_KCONFIG_COMMON_OPTS) $$($(2)_KCONFIG_OPTS) $$(*)
diff --git a/package/pkg-utils.mk b/package/pkg-utils.mk
index 91a492588e..6b254235ec 100644
--- a/package/pkg-utils.mk
+++ b/package/pkg-utils.mk
@@ -11,17 +11,24 @@
 # package, and more.
 #
 
-# KCONFIG_MUNGE_DOT_CONFIG (option, newline, file)
+# KCONFIG_DOT_CONFIG ([file])
+KCONFIG_DOT_CONFIG = $(strip \
+	$(if $(strip $(1)), $(1), \
+		$($(PKG)_BUILDDIR)/$($(PKG)_KCONFIG_DOTCONFIG) \
+	) \
+)
+
+# KCONFIG_MUNGE_DOT_CONFIG (option, newline [, file])
 define KCONFIG_MUNGE_DOT_CONFIG
-	$(SED) "/\\<$(strip $(1))\\>/d" $(strip $(3))
-	echo '$(strip $(2))' >> $(strip $(3))
+	$(SED) "/\\<$(strip $(1))\\>/d" $(call KCONFIG_DOT_CONFIG,$(3))
+	echo '$(strip $(2))' >> $(call KCONFIG_DOT_CONFIG,$(3))
 endef
 
-# KCONFIG_ENABLE_OPT (option, file)
+# KCONFIG_ENABLE_OPT (option [, file])
 KCONFIG_ENABLE_OPT  = $(call KCONFIG_MUNGE_DOT_CONFIG, $(1), $(1)=y, $(2))
-# KCONFIG_SET_OPT (option, value, file)
+# KCONFIG_SET_OPT (option, value [, file])
 KCONFIG_SET_OPT     = $(call KCONFIG_MUNGE_DOT_CONFIG, $(1), $(1)=$(2), $(3))
-# KCONFIG_DISABLE_OPT  (option, file)
+# KCONFIG_DISABLE_OPT  (option [, file])
 KCONFIG_DISABLE_OPT = $(call KCONFIG_MUNGE_DOT_CONFIG, $(1), $(SHARP_SIGN) $(1) is not set, $(2))
 
 # Helper functions to determine the name of a package and its
-- 
2.20.1

  parent reply	other threads:[~2020-04-04 12:10 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-04 12:10 [Buildroot] [PATCH 00/22] linux: allow packages to set kconfig options (branch yem/pkg-linux-opts) Yann E. MORIN
2020-04-04 12:10 ` [Buildroot] [PATCH 01/22] core/pkg-utils: rationalise kconfig option mangling Yann E. MORIN
2020-08-30  7:54   ` Peter Korsgaard
2020-04-04 12:10 ` Yann E. MORIN [this message]
2020-05-01 13:55   ` [Buildroot] [PATCH 02/22] core/pkg-utils: kconfig mangling defaults to current package's .config Thomas Petazzoni
2020-08-30  7:54   ` Peter Korsgaard
2020-04-04 12:10 ` [Buildroot] [PATCH 03/22] boot/barebox: don't specify .config to munge Yann E. MORIN
2020-04-04 12:10 ` [Buildroot] [PATCH 04/22] boot/uboot: " Yann E. MORIN
2020-04-04 12:10 ` [Buildroot] [PATCH 05/22] boot/busybox: " Yann E. MORIN
2020-04-04 12:10 ` [Buildroot] [PATCH 06/22] boot/swupdate: " Yann E. MORIN
2020-04-04 12:10 ` [Buildroot] [PATCH 07/22] boot/uclibc: " Yann E. MORIN
2020-04-04 12:10 ` [Buildroot] [PATCH 08/22] linux: " Yann E. MORIN
2020-04-04 12:10 ` [Buildroot] [PATCH 09/22] linux: allow packages to set options Yann E. MORIN
2020-05-01 13:56   ` Thomas Petazzoni
2020-04-04 12:10 ` [Buildroot] [PATCH 10/22] package/audit: bear the kernel options munging Yann E. MORIN
2020-04-06 12:10   ` Matthew Weber
2020-04-04 12:10 ` [Buildroot] [PATCH 11/22] package/intel-micro-code: " Yann E. MORIN
2020-04-04 12:10 ` [Buildroot] [PATCH 12/22] package/ktap: " Yann E. MORIN
2020-04-04 12:10 ` [Buildroot] [PATCH 13/22] package/pcm-tools: " Yann E. MORIN
2020-04-04 12:10 ` [Buildroot] [PATCH 14/22] package/linux-tools/perf: " Yann E. MORIN
2020-05-01 13:57   ` Thomas Petazzoni
2020-04-04 12:10 ` [Buildroot] [PATCH 15/22] package/systemd: " Yann E. MORIN
2020-04-04 12:10 ` [Buildroot] [PATCH 16/22] package/smack: " Yann E. MORIN
2020-04-04 12:10 ` [Buildroot] [PATCH 17/22] package/sunxi-mali-mainline-driver: " Yann E. MORIN
2020-04-04 12:10 ` [Buildroot] [PATCH 18/22] package/iptables: " Yann E. MORIN
2020-04-04 12:10 ` [Buildroot] [PATCH 19/22] package/xtables-addons: " Yann E. MORIN
2020-04-04 12:10 ` [Buildroot] [PATCH 20/22] package/wireguard-linux-compat: " Yann E. MORIN
2020-04-04 12:10 ` [Buildroot] [PATCH 21/22] package/libselinux: " Yann E. MORIN
2020-04-06 12:08   ` Matthew Weber
2020-04-19 18:14     ` Adam Duskett
2020-04-04 12:10 ` [Buildroot] [PATCH 22/22] package/kernel-module-imx-gpu-viv: " Yann E. MORIN
2020-05-01 13:54 ` [Buildroot] [PATCH 00/22] linux: allow packages to set kconfig options (branch yem/pkg-linux-opts) Thomas Petazzoni

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=14c3b30890f0dbccd6954e9e6c88de483b321b65.1586002215.git.yann.morin.1998@free.fr \
    --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.