[Buildroot] [git commit branch/2022.02.x] package/pkg-utils: prevent KCONFIG_ENABLE_OPT from changing =m to =y
From: Peter Korsgaard <peter@korsgaard.com>
Date: 2022-08-18 06:22:21
Subsystem:
the rest · Maintainer:
Linus Torvalds
commit: https://git.buildroot.net/buildroot/commit/?id=e1b34ca02aa19a772b624292be8dd86cef54bbee branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/2022.02.x 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 <redacted> Co-authored-by: TIAN Yuanhao [off-list ref] Cc: Yann E. MORIN <redacted> Cc: Arnout Vandecappelle (Essensium/Mind) <redacted> [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 <redacted> (cherry picked from commit 66d2ff25bad813659ed4541b3f4c6c2a09455bd7) Signed-off-by: Peter Korsgaard <peter@korsgaard.com> --- 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