All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Stewart via buildroot <buildroot@buildroot.org>
To: buildroot@buildroot.org
Cc: Christian Stewart <christian@paral.in>,
	"Yann E . MORIN" <yann.morin.1998@free.fr>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: [Buildroot] [PATCH v1 1/1] package/pkg-utils: avoid overwriting =m with =y
Date: Tue, 17 May 2022 03:16:24 -0700	[thread overview]
Message-ID: <20220517101624.3242600-1-christian@paral.in> (raw)

The KCONFIG_ENABLE_OPT is intended to enable a required kernel configuration
option when a package requires it.

However, this will often override an existing enabled module with `=m` with `=y`
which overrides the module to be built-in instead of separate.

This is undesirable behavior; we often want these as `=m` and not `=y` to reduce
the size of the kernel image.

This patch changes KCONFIG_MUNGE_DOT_CONFIG to prevent changing `=m` to `=y`.

Signed-off-by: Christian Stewart <christian@paral.in>
---
 package/pkg-utils.mk | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/package/pkg-utils.mk b/package/pkg-utils.mk
index 7d1aea7710..96b15b3d46 100644
--- a/package/pkg-utils.mk
+++ b/package/pkg-utils.mk
@@ -21,8 +21,16 @@ KCONFIG_DOT_CONFIG = $(strip \
 )
 
 # KCONFIG_MUNGE_DOT_CONFIG (option, newline [, file])
+# If setting to =y and the option is already set to =m, ignore.
 define KCONFIG_MUNGE_DOT_CONFIG
-	$(SED) "/\\<$(strip $(1))\\>/d" $(call KCONFIG_DOT_CONFIG,$(3))
+	OPTION=$(firstword $(subst =, ,$(2))); \
+	VALUE=$(lastword $(subst =, ,$(2))); \
+	if [[ "$${VALUE}" == "y" ]]; then \
+		if grep -q "$${OPTION}=m" $(call KCONFIG_DOT_CONFIG,$(3)); then \
+			exit 0; \
+		fi; \
+  fi; \
+	$(SED) "/\\<$(strip $(1))\\>/d" $(call KCONFIG_DOT_CONFIG,$(3)); \
 	echo '$(strip $(2))' >> $(call KCONFIG_DOT_CONFIG,$(3))
 endef
 
-- 
2.35.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

                 reply	other threads:[~2022-05-17 10:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220517101624.3242600-1-christian@paral.in \
    --to=buildroot@buildroot.org \
    --cc=christian@paral.in \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=yann.morin.1998@free.fr \
    /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.