summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Marangi2024-05-24 10:49:15 +0000
committerChristian Marangi2024-06-11 21:58:16 +0000
commit98703bf45833b915a0b835ae7ab7d419244a8840 (patch)
tree3506d165da53efcef4884cb8685d6922a613fb16
parent2c769cff234c514ce00f2dc760a67e909dc2bbb7 (diff)
downloadopenwrt-98703bf45833b915a0b835ae7ab7d419244a8840.tar.gz
target.mk: add support to early scan of default package configuration
There is currently a problem with how some option that modify default package configuration are parsed. When the DEFAULT_PACKAGES list is composed, DUMP is used. Using DUMP disable the loading of .config to remove and modification done by the user to prevent any kind of conflict or strange thing one creating all the info for each target. Because of this, .config is never parsed and any check to CONFIG doesn't work (for the first creation of .config). Later image build will check what is set in .config and the default package list won't be parsed anymore. This is problematic for some config that are OK to parse, for example SELINUX or USE_APK. To better handle them add some logic when DUMP is used to selectively parse these option if present in a to-be-init .config so that option are correctly parsed and DEFAULT_PACKAGES is correctly set. Link: https://github.com/openwrt/openwrt/pull/15543 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
-rw-r--r--include/target.mk11
1 files changed, 10 insertions, 1 deletions
diff --git a/include/target.mk b/include/target.mk
index e2274171a9..df34f937d3 100644
--- a/include/target.mk
+++ b/include/target.mk
@@ -6,6 +6,15 @@
ifneq ($(__target_inc),1)
__target_inc=1
+ifneq ($(DUMP),)
+ # Parse generic config that might be set before a .config is generated to modify the
+ # default package configuration
+ GENERIC_CONFIG := CONFIG_USE_APK CONFIG_SELINUX CONFIG_SMALL_FLASH CONFIG_SECCOMP
+ $(foreach config, $(GENERIC_CONFIG), \
+ $(eval $(config) := $(shell grep "$(config)=y" $(TOPDIR)/.config 2>/dev/null)) \
+ )
+endif
+
# default device type
DEVICE_TYPE?=router
@@ -26,7 +35,7 @@ DEFAULT_PACKAGES:=\
urandom-seed \
urngd
-ifdef CONFIG_USE_APK
+ifneq ($(CONFIG_USE_APK),)
DEFAULT_PACKAGES+=apk-mbedtls
else
DEFAULT_PACKAGES+=opkg