All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [git commit] package/pkg-utils: prevent KCONFIG_ENABLE_OPT from changing =m to =y
@ 2022-07-25 14:26 Yann E. MORIN
  2022-08-17 12:47 ` Peter Korsgaard
  0 siblings, 1 reply; 2+ messages in thread
From: Yann E. MORIN @ 2022-07-25 14:26 UTC (permalink / raw)
  To: buildroot

commit: https://git.buildroot.net/buildroot/commit/?id=66d2ff25bad813659ed4541b3f4c6c2a09455bd7
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master

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>
Co-authored-by: TIAN Yuanhao <tianyuanhao3@163.com>
Cc: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
[yann.morin.1998@free.fr:
  - drop  || exit 1, it is superfluous
  - don't change the match in the SED (just append &&)
]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
---
 package/pkg-utils.mk | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/package/pkg-utils.mk b/package/pkg-utils.mk
index 7d1aea7710..e5dba2add0 100644
--- a/package/pkg-utils.mk
+++ b/package/pkg-utils.mk
@@ -22,12 +22,17 @@ KCONFIG_DOT_CONFIG = $(strip \
 
 # KCONFIG_MUNGE_DOT_CONFIG (option, newline [, file])
 define KCONFIG_MUNGE_DOT_CONFIG
-	$(SED) "/\\<$(strip $(1))\\>/d" $(call KCONFIG_DOT_CONFIG,$(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  = $(call KCONFIG_MUNGE_DOT_CONFIG, $(1), $(1)=y, $(2))
+# If the option is already set to =m or =y, ignore.
+define KCONFIG_ENABLE_OPT
+	$(Q)if ! grep -q '^$(strip $(1))=[my]' $(call KCONFIG_DOT_CONFIG,$(2)); then \
+		$(call KCONFIG_MUNGE_DOT_CONFIG, $(1), $(1)=y, $(2)); \
+	fi
+endef
 # KCONFIG_SET_OPT (option, value [, file])
 KCONFIG_SET_OPT     = $(call KCONFIG_MUNGE_DOT_CONFIG, $(1), $(1)=$(2), $(3))
 # KCONFIG_DISABLE_OPT  (option [, file])
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [git commit] package/pkg-utils: prevent KCONFIG_ENABLE_OPT from changing =m to =y
  2022-07-25 14:26 [Buildroot] [git commit] package/pkg-utils: prevent KCONFIG_ENABLE_OPT from changing =m to =y Yann E. MORIN
@ 2022-08-17 12:47 ` Peter Korsgaard
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Korsgaard @ 2022-08-17 12:47 UTC (permalink / raw)
  To: Yann E. MORIN; +Cc: buildroot

>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:

 > commit: https://git.buildroot.net/buildroot/commit/?id=66d2ff25bad813659ed4541b3f4c6c2a09455bd7
 > branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master

 > 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>
 > Co-authored-by: TIAN Yuanhao <tianyuanhao3@163.com>
 > Cc: Yann E. MORIN <yann.morin.1998@free.fr>
 > Cc: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
 > [yann.morin.1998@free.fr:
 >   - drop  || exit 1, it is superfluous
 >   - don't change the match in the SED (just append &&)
 > ]
 > Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>

Committed to 2022.05.x and 2022.02.x, thanks.

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2022-08-17 12:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-25 14:26 [Buildroot] [git commit] package/pkg-utils: prevent KCONFIG_ENABLE_OPT from changing =m to =y Yann E. MORIN
2022-08-17 12:47 ` Peter Korsgaard

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.