From 08cbbf992581f60ac264b63f81039309e7f4c482 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 7 Sep 2017 03:21:42 +0200 Subject: [PATCH] build: move all generic config generation to targets/generic As the default package list is now handled using the 'packages' directive, explicit wpad-mini removals in target definitions can be dropped. --- Makefile | 34 +++++++++++++++------------------- scripts/target_config.sh | 14 +++++++++++--- scripts/target_config_check.sh | 6 ++---- targets/brcm2708-bcm2708 | 1 - targets/brcm2708-bcm2710 | 1 - targets/generic | 18 ++++++++++++++++++ targets/mvebu | 1 - targets/ramips-mt7620 | 2 -- targets/sunxi | 1 - 9 files changed, 46 insertions(+), 32 deletions(-) diff --git a/Makefile b/Makefile index 463cf804..20998277 100644 --- a/Makefile +++ b/Makefile @@ -60,6 +60,15 @@ LEDEMAKE = $(MAKE) -C lede BOARD := $(GLUON_TARGET_$(GLUON_TARGET)_BOARD) SUBTARGET := $(GLUON_TARGET_$(GLUON_TARGET)_SUBTARGET) + +GLUON_CONFIG_VARS := \ + GLUON_SITEDIR='$(GLUON_SITEDIR)' \ + GLUON_RELEASE='$(GLUON_RELEASE)' \ + GLUON_BRANCH='$(GLUON_BRANCH)' \ + GLUON_LANGS='$(GLUON_LANGS)' \ + BOARD='$(BOARD)' \ + SUBTARGET='$(SUBTARGET)' + LEDE_TARGET := $(BOARD)$(if $(SUBTARGET),-$(SUBTARGET)) export LEDE_TARGET @@ -75,8 +84,6 @@ list-targets: FORCE @$(foreach target,$(GLUON_TARGETS),echo '$(target)';) -GLUON_DEFAULT_PACKAGES := -odhcpd -ppp -ppp-mod-pppoe -wpad-mini gluon-core ip6tables hostapd-mini - GLUON_FEATURE_PACKAGES := $(shell scripts/features.sh '$(GLUON_FEATURES)' || echo '__ERROR__') ifneq ($(filter __ERROR__,$(GLUON_FEATURE_PACKAGES)),) $(error Error while evaluating GLUON_FEATURES) @@ -89,30 +96,19 @@ define merge_packages GLUON_PACKAGES := $$(strip $$(filter-out -$$(patsubst -%,%,$(pkg)) $$(patsubst -%,%,$(pkg)),$$(GLUON_PACKAGES)) $(pkg)) ) endef -$(eval $(call merge_packages,$(GLUON_DEFAULT_PACKAGES) $(GLUON_FEATURE_PACKAGES) $(GLUON_SITE_PACKAGES))) - -GLUON_PACKAGES_YES := $(filter-out -%,$(GLUON_PACKAGES)) -GLUON_PACKAGES_NO := $(patsubst -%,%,$(filter -%,$(GLUON_PACKAGES))) - +$(eval $(call merge_packages,$(GLUON_FEATURE_PACKAGES) $(GLUON_SITE_PACKAGES))) config: FORCE @$(CheckExternal) @$(CheckTarget) - @( \ - echo 'CONFIG_TARGET_$(BOARD)=y' \ - $(if $(SUBTARGET),&& echo 'CONFIG_TARGET_$(BOARD)_$(SUBTARGET)=y') \ - $(foreach pkg,$(GLUON_PACKAGES_NO),&& echo '# CONFIG_PACKAGE_$(pkg) is not set') \ - && GLUON_SITEDIR='$(GLUON_SITEDIR)' scripts/target_config.sh '$(GLUON_TARGET)' \ - $(foreach pkg,$(GLUON_PACKAGES_YES),&& echo 'CONFIG_PACKAGE_$(pkg)=y') \ - $(foreach lang,$(GLUON_LANGS),&& echo 'CONFIG_GLUON_WEB_LANG_$(lang)=y') \ - && echo 'CONFIG_GLUON_RELEASE="$(GLUON_RELEASE)"' \ - && echo 'CONFIG_GLUON_SITEDIR="$(GLUON_SITEDIR)"' \ - && echo 'CONFIG_GLUON_BRANCH="$(GLUON_BRANCH)"' \ - ) > lede/.config + @$(GLUON_CONFIG_VARS) \ + scripts/target_config.sh '$(GLUON_TARGET)' '$(GLUON_PACKAGES)' \ + > lede/.config +@$(LEDEMAKE) defconfig - @GLUON_SITEDIR='$(GLUON_SITEDIR)' scripts/target_config_check.sh '$(GLUON_TARGET)' '$(GLUON_PACKAGES_YES)' + @$(GLUON_CONFIG_VARS) \ + scripts/target_config_check.sh '$(GLUON_TARGET)' '$(GLUON_PACKAGES)' LUA := lede/staging_dir/hostpkg/bin/lua diff --git a/scripts/target_config.sh b/scripts/target_config.sh index b50d1613..66db26e4 100755 --- a/scripts/target_config.sh +++ b/scripts/target_config.sh @@ -4,6 +4,9 @@ set -e [ "$LEDE_TARGET" ] || exit 1 +target="$1" +packages=$2 + output= profile= @@ -59,7 +62,7 @@ packages() { for package in "$@"; do if [ "${package:0:1}" = '-' ]; then - echo "CONFIG_PACKAGE_${package:1}=m" + echo "# CONFIG_PACKAGE_${package:1} is not set" else echo "CONFIG_PACKAGE_${package}=y" fi @@ -67,8 +70,13 @@ packages() { fi } -. targets/generic # The sort will not only remove duplicate entries, # but also magically make =y entries override =m ones -(. targets/"$1"; emit) | sort -u +( + . targets/generic + packages $packages + + . targets/"$target" + emit +) | sort -u diff --git a/scripts/target_config_check.sh b/scripts/target_config_check.sh index 5b30ef04..c9ae0528 100755 --- a/scripts/target_config_check.sh +++ b/scripts/target_config_check.sh @@ -93,12 +93,10 @@ packages() { . targets/generic +packages $packages + . targets/"$target" check_devices -for package in $packages; do - check_package "$package" 'y' -done - exit $ret diff --git a/targets/brcm2708-bcm2708 b/targets/brcm2708-bcm2708 index b9f59999..41d0ba2d 100644 --- a/targets/brcm2708-bcm2708 +++ b/targets/brcm2708-bcm2708 @@ -1,4 +1,3 @@ device raspberry-pi rpi factory -ext4-sdcard .img.gz sysupgrade -ext4-sdcard .img.gz -packages '-wpad-mini' # clashes with hostapd-mini diff --git a/targets/brcm2708-bcm2710 b/targets/brcm2708-bcm2710 index 4930366e..5c93449c 100644 --- a/targets/brcm2708-bcm2710 +++ b/targets/brcm2708-bcm2710 @@ -1,4 +1,3 @@ device raspberry-pi-3 rpi-3 factory -ext4-sdcard .img.gz sysupgrade -ext4-sdcard .img.gz -packages '-wpad-mini' # clashes with hostapd-mini diff --git a/targets/generic b/targets/generic index 2e062e16..cd133948 100644 --- a/targets/generic +++ b/targets/generic @@ -1,3 +1,17 @@ +[ "$GLUON_SITEDIR" -a "$GLUON_RELEASE" -a "$BOARD" ] || exit 1 + +config "CONFIG_GLUON_SITEDIR=\"$GLUON_SITEDIR\"" +config "CONFIG_GLUON_RELEASE=\"$GLUON_RELEASE\"" +try_config "CONFIG_GLUON_BRANCH=\"$GLUON_BRANCH\"" + +for lang in $GLUON_LANGS; do + try_config "CONFIG_GLUON_WEB_LANG_${lang}=y" +done + +[ "$BOARD" ] && config "CONFIG_TARGET_${BOARD}=y" +[ -z "$SUBTARGET" ] || config "CONFIG_TARGET_${BOARD}_${SUBTARGET}=y" + + config '# CONFIG_TARGET_ROOTFS_INITRAMFS is not set' config 'CONFIG_ALL_NONSHARED=y' @@ -17,3 +31,7 @@ then config '# CONFIG_USE_STRIP is not set' config '# CONFIG_USE_SSTRIP is not set' fi + + +packages '-odhcpd' '-ppp' '-ppp-mod-pppoe' '-wpad-mini' +packages 'gluon-core' 'ip6tables' 'hostapd-mini' diff --git a/targets/mvebu b/targets/mvebu index ba045e76..ee4bbbee 100644 --- a/targets/mvebu +++ b/targets/mvebu @@ -1,3 +1,2 @@ device linksys-wrt1200ac linksys-wrt1200ac -packages '-wpad-mini' # clashes with hostapd-mini factory .img diff --git a/targets/ramips-mt7620 b/targets/ramips-mt7620 index 600758a4..2f70cd65 100644 --- a/targets/ramips-mt7620 +++ b/targets/ramips-mt7620 @@ -1,5 +1,3 @@ -packages '-wpad-mini' # clashes with hostapd-mini - # GL Innovations device gl-mt300a gl-mt300a factory diff --git a/targets/sunxi b/targets/sunxi index 0152f0de..33f5bcd7 100644 --- a/targets/sunxi +++ b/targets/sunxi @@ -6,4 +6,3 @@ device lemaker-banana-pi sun7i-a20-bananapi device lemaker-banana-pro sun7i-a20-bananapro device lamobo-r1 sun7i-a20-lamobo-r1 -packages '-wpad-mini' # clashes with hostapd-mini