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.
This commit is contained in:
Matthias Schiffer 2017-09-07 03:21:42 +02:00
parent 587c5016cb
commit 08cbbf9925
No known key found for this signature in database
GPG Key ID: 16EF3F64CB201D9C
9 changed files with 46 additions and 32 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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'

View File

@ -1,3 +1,2 @@
device linksys-wrt1200ac linksys-wrt1200ac
packages '-wpad-mini' # clashes with hostapd-mini
factory .img

View File

@ -1,5 +1,3 @@
packages '-wpad-mini' # clashes with hostapd-mini
# GL Innovations
device gl-mt300a gl-mt300a
factory

View File

@ -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