From 919dda90b30293a6c7c3da8369dcd81064d5282f Mon Sep 17 00:00:00 2001
From: Tata <tarek@ring0.de>
Date: Wed, 10 Jan 2018 15:49:33 +0100
Subject: [PATCH] build: introduce GLUON_WLAN_MESH build variable (#1298)

defaults to 11s, allowing to build devices without IBSS-support

obsoletes GLUON_ATH10K_MESH
---
 Makefile                      |  3 ++-
 docs/index.rst                |  2 +-
 docs/user/getting_started.rst | 15 ++++++++-------
 targets/ar71xx-generic        |  4 ++--
 targets/ipq806x               |  4 ++--
 targets/targets.mk            | 11 ++++++++---
 6 files changed, 23 insertions(+), 16 deletions(-)

diff --git a/Makefile b/Makefile
index c190dc59c..274f15818 100644
--- a/Makefile
+++ b/Makefile
@@ -35,11 +35,12 @@ $(GLUON_SITEDIR)/site.mk:
 
 include $(GLUON_SITEDIR)/site.mk
 
+GLUON_WLAN_MESH ?= 11s
 
 GLUON_RELEASE ?= $(error GLUON_RELEASE not set. GLUON_RELEASE can be set in site.mk or on the command line)
 
 
-export GLUON_RELEASE GLUON_ATH10K_MESH GLUON_REGION GLUON_DEBUG
+export GLUON_RELEASE GLUON_WLAN_MESH GLUON_REGION GLUON_DEBUG
 
 show-release:
 	@echo '$(GLUON_RELEASE)'
diff --git a/docs/index.rst b/docs/index.rst
index d9aea8891..be715325c 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -210,7 +210,7 @@ ar71xx-generic
   - My Net N750
 
 .. [#ath10k]
-  Device uses the ath10k WLAN driver; no image is built unless GLUON_ATH10K_MESH
+  Device uses the ath10k WLAN driver; images are built for 11s by default unless GLUON_WLAN_MESH
   is set as described in :ref:`getting-started-make-variables`
 
 ar71xx-nand
diff --git a/docs/user/getting_started.rst b/docs/user/getting_started.rst
index 7a97feab7..fa408f2de 100644
--- a/docs/user/getting_started.rst
+++ b/docs/user/getting_started.rst
@@ -155,13 +155,14 @@ usually be set on the command line or in ``site.mk``.
 Common variables
 ................
 
-GLUON_ATH10K_MESH
-  While Gluon does support some hardware with ath10k-based 5GHz WLAN, these WLAN adapters don't work
-  well for meshing at the moment, so building images for these models is disabled by default. In addition,
-  ath10k can't support IBSS and 11s meshing in the same image due to WLAN firmware restrictions.
-
-  Setting GLUON_ATH10K_MESH to ``11s`` or ``ibss`` will enable generation of images for ath10k devices
-  and install the firmware for the corresponding WLAN mode.
+GLUON_WLAN_MESH
+  While Gluon does support some hardware with ath10k-based 5GHz WLAN. ath10k can't support IBSS and 11s
+  meshing in the same image due to WLAN firmware restrictions.
+
+  Setting GLUON_MESH_MESH to ``11s`` or ``ibss`` will enable generation of images for ath10k devices
+  and install the firmware for the corresponding WLAN mode. Specifically setting to ``11s`` will also
+  enable the generation of images for targets that are able to run only AP+11s but not AP+IBSS, like
+  ralink or mediatek. Defaults to ``11s``.
 
 GLUON_BRANCH
   Sets the default branch of the autoupdater. If unset, the autoupdater is disabled
diff --git a/targets/ar71xx-generic b/targets/ar71xx-generic
index 95564ca41..e11e9f030 100644
--- a/targets/ar71xx-generic
+++ b/targets/ar71xx-generic
@@ -1,10 +1,10 @@
 ATH10K_PACKAGES=
 ATH10K_PACKAGES_QCA9887=
 
-if [ "$GLUON_ATH10K_MESH" = '11s' ]; then
+if [ "$GLUON_WLAN_MESH" = '11s' ]; then
 	ATH10K_PACKAGES='-kmod-ath10k kmod-ath10k-ct'
 fi
-if [ "$GLUON_ATH10K_MESH" = 'ibss' ]; then
+if [ "$GLUON_WLAN_MESH" = 'ibss' ]; then
 	ATH10K_PACKAGES='-kmod-ath10k kmod-ath10k-ct -ath10k-firmware-qca988x ath10k-firmware-qca988x-ct'
 	ATH10K_PACKAGES_QCA9887='-kmod-ath10k kmod-ath10k-ct -ath10k-firmware-qca9887 ath10k-firmware-qca9887-ct'
 fi
diff --git a/targets/ipq806x b/targets/ipq806x
index c9438302b..f4c0fc98c 100644
--- a/targets/ipq806x
+++ b/targets/ipq806x
@@ -1,9 +1,9 @@
 ATH10K_PACKAGES=
 
-if [ "$GLUON_ATH10K_MESH" = '11s' ]; then
+if [ "$GLUON_WLAN_MESH" = '11s' ]; then
 	ATH10K_PACKAGES='-kmod-ath10k kmod-ath10k-ct'
 fi
-if [ "$GLUON_ATH10K_MESH" = 'ibss' ]; then
+if [ "$GLUON_WLAN_MESH" = 'ibss' ]; then
 	ATH10K_PACKAGES='-kmod-ath10k kmod-ath10k-ct -ath10k-firmware-qca99x0 ath10k-firmware-qca99x0-ct'
 fi
 
diff --git a/targets/targets.mk b/targets/targets.mk
index 8ee42147b..cefd616a1 100644
--- a/targets/targets.mk
+++ b/targets/targets.mk
@@ -1,3 +1,5 @@
+GLUON_WLAN_MESH_11s := $(filter 11s,$(GLUON_WLAN_MESH))
+
 $(eval $(call GluonTarget,ar71xx,generic))
 $(eval $(call GluonTarget,ar71xx,tiny,generic))
 $(eval $(call GluonTarget,ar71xx,nand))
@@ -9,13 +11,16 @@ $(eval $(call GluonTarget,x86,generic))
 $(eval $(call GluonTarget,x86,geode))
 $(eval $(call GluonTarget,x86,64))
 
+ifneq ($(GLUON_WLAN_MESH_11s)$(BROKEN),)
+$(eval $(call GluonTarget,ramips,mt7620))
+$(eval $(call GluonTarget,ramips,mt7628))
+$(eval $(call GluonTarget,ramips,rt305x))
+endif
+
 ifneq ($(BROKEN),)
 $(eval $(call GluonTarget,ar71xx,mikrotik)) # BROKEN: no sysupgrade support
 $(eval $(call GluonTarget,brcm2708,bcm2710)) # BROKEN: Untested
 $(eval $(call GluonTarget,ipq806x)) # BROKEN: Untested
 $(eval $(call GluonTarget,mvebu)) # BROKEN: No AP+IBSS or 11s support
-$(eval $(call GluonTarget,ramips,mt7620)) # BROKEN: No AP+IBSS support
-$(eval $(call GluonTarget,ramips,mt7628)) # BROKEN: No AP+IBSS support
-$(eval $(call GluonTarget,ramips,rt305x)) # BROKEN: No AP+IBSS support
 $(eval $(call GluonTarget,sunxi)) # BROKEN: Untested
 endif
-- 
GitLab