Skip to contentSkip to conversation

Let the distro control whether we include hostap or madwifi.

PATCH In review Chris Larson 2 participants 2 messages Jul 16, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Let the distro control whether we include hostap or madwifi.

- Add base_ifelse convenience function to base.bbclass.
- Replace all conditionals in the recipes relating to hostap and madwifi to
look for their name in COMBINED_FEATURES rather than looking for specific buses (pci, pcmcia).
- Change the default COMBINED_FEATURES to enable:
- madwifi, when:
- 'pci', 'wifi', and 'madwifi' are in distro features
- 'pci' is in machine features
- hostap, when:
- 'wifi' and 'hostap' are in distro features
- either 'pci' or 'pcmcia' are in both distro and machine features

---
 classes/base.bbclass                            |    6 ++++++
 conf/bitbake.conf                               |   19 +++++++++++++++++++
 recipes/hostap/hostap-daemon_0.5.10.bb          |   10 +++++-----
 recipes/tasks/task-base.bb                      |    7 +++----
 recipes/tasks/task-mokogateway.bb               |    4 ++--
 recipes/wpa-supplicant/wpa-supplicant-0.6.inc   |    8 ++++----
 recipes/wpa-supplicant/wpa-supplicant_0.5.10.bb |   10 +++++-----
 7 files changed, 44 insertions(+), 20 deletions(-)
classes/base.bbclass +6 -0
index bc50c67..3aa1146 100644
@@ -159,6 +159,12 @@ def base_read_file(filename):
 		return f.read().strip()
 	return None
 
+def base_ifelse(condition, iftrue = True, iffalse = False):
+    if condition:
+        return iftrue
+    else:
+        return iffalse
+
 def base_conditional(variable, checkvalue, truevalue, falsevalue, d):
 	import bb
 	if bb.data.getVar(variable,d,1) == checkvalue:
conf/bitbake.conf +19 -0
index 8b69564..a3c475f 100644
@@ -715,3 +715,22 @@ COMBINED_FEATURES = "\
     ${@base_both_contain("DISTRO_FEATURES", "MACHINE_FEATURES", "usbgadget", d)} \
     ${@base_both_contain("DISTRO_FEATURES", "MACHINE_FEATURES", "usbhost", d)} \
     ${@base_both_contain("DISTRO_FEATURES", "MACHINE_FEATURES", "wifi", d)}"
+
+# We want madwifi if all of the following are true:
+# - 'pci', 'wifi', and 'madwifi' are in distro features
+# - 'pci' is in machine features
+COMBINED_FEATURES += "${@base_ifelse( \
+    base_contains('DISTRO_FEATURES', ('pci', 'wifi', 'madwifi'), True, False, d) and \
+    base_contains('MACHINE_FEATURES', 'pci', True, False, d), \
+    'madwifi', '')}"
+
+# We want hostap if all of the following are true:
+# - 'wifi' and 'hostap' are in distro features
+# - either 'pci' or 'pcmcia' are in both distro and machine features
+COMBINED_FEATURES += "${@base_ifelse( \
+    base_contains('DISTRO_FEATURES', ('wifi', 'hostap'), True, False, d) and \
+    ((base_contains('MACHINE_FEATURES', 'pci', True, False, d) and \
+      base_contains('DISTRO_FEATURES', 'pci', True, False, d)) or \
+     (base_contains('MACHINE_FEATURES', 'pcmcia', True, False, d) and \
+      base_contains('DISTRO_FEATURES', 'pcmcia', True, False, d))), \
+    'hostap', '')}"
recipes/hostap/hostap-daemon_0.5.10.bb +5 -5
index ea49301..3706b08 100644
@@ -3,8 +3,8 @@ HOMEPAGE = "http://hostap.epitest.fi"
 SECTION = "kernel/userland"
 PRIORITY = "optional"
 LICENSE = "GPL"
-DEPENDS = "openssl ${@base_contains("COMBINED_FEATURES", "pci", "madwifi-ng", "",d)}"
-PR = "r1"
+DEPENDS = "openssl ${@base_contains("COMBINED_FEATURES", "madwifi", "madwifi-ng", "",d)}"
+PR = "r1.1"
 DEPENDS_append_mtx-1 = " madwifi-modules"
 DEPENDS_append_mtx-2 = " madwifi-modules"
 CPPFLAGS_append_mtx-1 = " -I${STAGING_INCDIR}/madwifi/"
@@ -12,7 +12,7 @@ CPPFLAGS_append_mtx-2 = " -I${STAGING_INCDIR}/madwifi/"
 
 #we introduce MY_ARCH to get 'armv5te' as arch instead of the misleading 'arm' on armv5te builds
 MY_ARCH := "${PACKAGE_ARCH}"
-PACKAGE_ARCH = "${@base_contains('COMBINED_FEATURES', 'pci', '${MACHINE_ARCH}', '${MY_ARCH}', d)}"
+PACKAGE_ARCH = "${@base_contains('COMBINED_FEATURES', 'madwifi', '${MACHINE_ARCH}', '${MY_ARCH}', d)}"
 
 SRC_URI = "http://hostap.epitest.fi/releases/hostapd-${PV}.tar.gz \
 	file://makefile-cross.diff;patch=1 \
@@ -21,14 +21,14 @@ SRC_URI = "http://hostap.epitest.fi/releases/hostapd-${PV}.tar.gz \
 
 S = "${WORKDIR}/hostapd-${PV}"
 
-export HAS_PCI = "${@base_contains('COMBINED_FEATURES', 'pci', 1, 0,d)}"
+export HAS_MADWIFI = "${@base_contains('COMBINED_FEATURES', 'madwifi', 1, 0,d)}"
 
 inherit update-rc.d
 INITSCRIPT_NAME=hostapd
 
 do_configure() {
 	install -m 0644 ${WORKDIR}/defconfig ${S}/.config
-	if [ "x$HAS_PCI" = "x1" ] ; then
+	if [ "x$HAS_MADWIFI" = "x1" ] ; then
 		echo "CONFIG_DRIVER_MADWIFI=y" >> .config
 		echo "CFLAGS += -I${STAGING_INCDIR}/madwifi-ng" >> .config
 	fi
recipes/tasks/task-base.bb +3 -4
index 66c26af..7316d8f 100644
@@ -340,13 +340,12 @@ RRECOMMENDS_task-base-ipsec = "\
 #
 RDEPENDS_task-base-wifi = "\
     wireless-tools \
-    ${@base_contains('COMBINED_FEATURES', 'pcmcia', 'hostap-utils', '',d)} \
-    ${@base_contains('COMBINED_FEATURES', 'pci', 'hostap-utils', '',d)} \
-    ${@base_contains('COMBINED_FEATURES', 'pci', 'madwifi-ng-tools', '',d)} \
+    ${@base_contains('COMBINED_FEATURES', 'hostap', 'hostap-utils', '',d)} \
+    ${@base_contains('COMBINED_FEATURES', 'madwifi', 'madwifi-ng-tools', '',d)} \
     wpa-supplicant"
 
 RRECOMMENDS_task-base-wifi = "\
-    ${@base_contains('COMBINED_FEATURES', 'pci', 'madwifi-ng-modules', '',d)} \
+    ${@base_contains('COMBINED_FEATURES', 'madwifi', 'madwifi-ng-modules', '',d)} \
     ${@base_contains('COMBINED_FEATURES', 'usbhost', 'kernel-module-zd1211rw', '',d)} \
     kernel-module-ieee80211-crypt \
     kernel-module-ieee80211-crypt-ccmp \
recipes/tasks/task-mokogateway.bb +2 -2
index b0214dc..a1e0bc2 100644
@@ -55,8 +55,8 @@ DESCRIPTION_task-mokogateway-wifi = "MokoGateway: WiFi"
 RDEPENDS_task-mokogateway-wifi = "\
 	bridge-utils \
 	wireless-tools \
-	${@base_contains("COMBINED_FEATURES", "pci", "madwifi-ng-modules", "",d)} \
-	${@base_contains("COMBINED_FEATURES", "pci", "madwifi-ng-tools", "",d)} \
+	${@base_contains("COMBINED_FEATURES", "madwifi", "madwifi-ng-modules", "",d)} \
+	${@base_contains("COMBINED_FEATURES", "madwifi", "madwifi-ng-tools", "",d)} \
 	wpa-supplicant \
 "
 RRECOMMENDS_task-mokogateway-wifi = "\
recipes/wpa-supplicant/wpa-supplicant-0.6.inc +4 -4
index aee9ced..a31207f 100644
@@ -2,11 +2,11 @@ DESCRIPTION = "A Client for Wi-Fi Protected Access (WPA)."
 SECTION = "network"
 LICENSE = "GPL"
 HOMEPAGE = "http://hostap.epitest.fi/wpa_supplicant/"
-DEPENDS = "dbus gnutls ${@base_contains("COMBINED_FEATURES", "pci", "madwifi-ng", "",d)}"
+DEPENDS = "dbug gnutls ${@base_contains("COMBINED_FEATURES", "madwifi", "madwifi-ng", "",d)}"
 
 #we introduce MY_ARCH to get 'armv5te' as arch instead of the misleading 'arm' on armv5te builds
 MY_ARCH := "${PACKAGE_ARCH}"
-PACKAGE_ARCH = "${@base_contains('COMBINED_FEATURES', 'pci', '${MACHINE_ARCH}', '${MY_ARCH}', d)}"
+PACKAGE_ARCH = "${@base_contains('COMBINED_FEATURES', 'madwifi', '${MACHINE_ARCH}', '${MY_ARCH}', d)}"
 
 DEFAULT_PREFERENCE = "-2"
 
@@ -26,12 +26,12 @@ RREPLACES = "wpa-supplicant-cli"
 
 RRECOMMENDS_${PN} = "wpa-supplicant-passphrase"
 
-export HAS_PCI = "${@base_contains('COMBINED_FEATURES', 'pci', 1, 0,d)}"
+export HAS_MADWIFI = "${@base_contains('COMBINED_FEATURES', 'madwifi', 1, 0,d)}"
 
 do_configure () {
         install -m 0755 ${WORKDIR}/defconfig-0.6.0-gnutls  .config
 
-        if [ "x$HAS_PCI" == "x1" ] ; then
+        if [ "x$HAS_MADWIFI" == "x1" ] ; then
                 echo "CONFIG_DRIVER_MADWIFI=y" >> .config
                 echo "CFLAGS += -I${STAGING_INCDIR}/madwifi-ng" >> .config
         fi
recipes/wpa-supplicant/wpa-supplicant_0.5.10.bb +5 -5
index 14186db..6ba2e99 100644
@@ -2,13 +2,13 @@ DESCRIPTION = "A Client for Wi-Fi Protected Access (WPA)."
 SECTION = "network"
 LICENSE = "GPL"
 HOMEPAGE = "http://hostap.epitest.fi/wpa_supplicant/"
-DEPENDS = "gnutls ${@base_contains("COMBINED_FEATURES", "pci", "madwifi-ng", "",d)}"
+DEPENDS = "gnutls ${@base_contains("COMBINED_FEATURES", "madwifi", "madwifi-ng", "",d)}"
 
-PR = "r1"
+PR = "r1.1"
 
 #we introduce MY_ARCH to get 'armv5te' as arch instead of the misleading 'arm' on armv5te builds
 MY_ARCH := "${PACKAGE_ARCH}"
-PACKAGE_ARCH = "${@base_contains('COMBINED_FEATURES', 'pci', '${MACHINE_ARCH}', '${MY_ARCH}', d)}"
+PACKAGE_ARCH = "${@base_contains('COMBINED_FEATURES', 'madwifi', '${MACHINE_ARCH}', '${MY_ARCH}', d)}"
 
 SRC_URI = "http://hostap.epitest.fi/releases/wpa_supplicant-${PV}.tar.gz \
 	file://defconfig-gnutls \
@@ -24,12 +24,12 @@ RREPLACES = "wpa-supplicant-cli"
 
 RRECOMMENDS_${PN} = "wpa-supplicant-passphrase"
 
-export HAS_PCI = "${@base_contains('COMBINED_FEATURES', 'pci', 1, 0,d)}"
+export HAS_MADWIFI = "${@base_contains('COMBINED_FEATURES', 'madwifi', 1, 0,d)}"
 
 do_configure () {
         install -m 0755 ${WORKDIR}/defconfig-gnutls  .config
 
-        if [ "x$HAS_PCI" == "x1" ] ; then
+        if [ "x$HAS_MADWIFI" == "x1" ] ; then
                 echo "CONFIG_DRIVER_MADWIFI=y" >> .config
                 echo "CFLAGS += -I${STAGING_INCDIR}/madwifi-ng" >> .config
         fi
Signature · 1 line
1.6.0
#1 lore raw
Quoted 11 lines · Chris Larson

- Add base_ifelse convenience function to base.bbclass.
- Replace all conditionals in the recipes relating to hostap and madwifi to
 look for their name in COMBINED_FEATURES rather than looking for specific buses (pci, pcmcia).
- Change the default COMBINED_FEATURES to enable:
 - madwifi, when:
   - 'pci', 'wifi', and 'madwifi' are in distro features
   - 'pci' is in machine features
 - hostap, when:
   - 'wifi' and 'hostap' are in distro features
   - either 'pci' or 'pcmcia' are in both distro and machine features

Quoted 1 line

Erm, ignore the PR changes, I'll kill those. This is one of the changes I've made at MontaVista.

Signature · 7 lines
Chris Larson
clarson at kergoth dot com
clarson at mvista dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Software Engineer
MontaVista Software, Inc.