package/pkg-utils: prevent KCONFIG_ENABLE_OPT from changing =m to =y
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>
(cherry picked from commit 66d2ff25ba
)
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
parent
69af5ab34f
commit
e1b34ca02a
@ -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])
|
||||
|
Loading…
Reference in New Issue
Block a user