target.mk: improve handling of default enabled SECCOMP

Handling default packages selection is really problematic and error
prone. In all the changes, the SECCOMP config is enabled by default if
supported by the target.

This is problematic for the scenario of the first .config creation where
this option will be enabled by default but the package default are
already being parsed.

This cause the reparsing of the default package on the next command and
the "outdated config" error. To better handle this special case, add
additiona logic to match the dependency in the config and check if
CONFIG_SECCOMP should be enabled by default in the scenario where a
.config needs to be init and doesn't exist.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
This commit is contained in:
Christian Marangi 2024-06-19 16:19:10 +02:00
parent 3b83d393dd
commit 847fad476f
No known key found for this signature in database
GPG Key ID: AC001D09ADBFEAD7
1 changed files with 13 additions and 3 deletions

View File

@ -11,9 +11,19 @@ ifneq ($(DUMP),)
# default package configuration # default package configuration
# Keep DYNAMIC_DEF_PKG_CONF in sync with toplevel.mk to reflect the same configs # Keep DYNAMIC_DEF_PKG_CONF in sync with toplevel.mk to reflect the same configs
DYNAMIC_DEF_PKG_CONF := CONFIG_USE_APK CONFIG_SELINUX CONFIG_SMALL_FLASH CONFIG_SECCOMP DYNAMIC_DEF_PKG_CONF := CONFIG_USE_APK CONFIG_SELINUX CONFIG_SMALL_FLASH CONFIG_SECCOMP
ifneq ($(wildcard $(TOPDIR)/.config),)
$(foreach config, $(DYNAMIC_DEF_PKG_CONF), \ $(foreach config, $(DYNAMIC_DEF_PKG_CONF), \
$(eval $(config) := $(shell grep "$(config)=y" $(TOPDIR)/.config 2>/dev/null)) \ $(eval $(config) := $(shell grep "$(config)=y" $(TOPDIR)/.config 2>/dev/null)) \
) )
# Init config that are enabled by default. Dependency are checked matching the one in
# the config.
else
ifeq ($(filter $(BOARD), uml),)
ifneq ($(filter $(ARCH), aarch64 arm armeb mips mipsel mips64 mips64el i386 powerpc x86_64),)
CONFIG_SECCOMP := y
endif
endif
endif
endif endif
# default device type # default device type