Latest compat-drivers

Eugene Krasnikov k.eugene.e at gmail.com
Tue Apr 9 12:45:43 EDT 2013


Hi All,

First of all i would like to say sorry for all these dirty hacks:)
Please feel free to suggest improvements.

As soon as somebody is able to build and run wcn36xx with latest
compat-drivers I will push all changes to wcn36xx driver so it will
not be compatible with CM environment anymore. Meanwhile i'll work on
improving this guide(in total 11 action items).

This is brief instruction how to build wcn36xx with latest
compat-drivers(CM_ROOT- place where cyanogenmod is located, CD_ROOT-
where compat-drivers is located):

1) Download bleeding edge compat-drivers as described here
https://backports.wiki.kernel.org/index.php/Documentation/compat-drivers/hacking#Git_trees_you_will_need

2) Run scripts/admin-update.sh

If it failed with error “1 out of 1 hunk FAILED -- saving rejects to
file drivers/media/v4l2-core/Makefile.rej” just delete patch
“patches/collateral-evolutions/media/9999-Makefile-disable.patch”

3) Put latest wcn36xx to <CD_ROOT>/drivers/net/wireless/wcn36xx
Also apply 3 patches on top of current tree:
"Check if DEFINE_DYNAMIC_DEBUG_METADATA is defined"
"Use ieee80211_probereq_get from latest mac80211"
"Update tx ops to latest mac80211"

>From e645907bf949b8a3f3c42a7fbd39e997626e26f7 Mon Sep 17 00:00:00 2001
From: Eugene Krasnikov <k.eugene.e at gmail.com>
Date: Tue, 9 Apr 2013 18:02:32 +0200
Subject: [PATCH 1/3] Check if DEFINE_DYNAMIC_DEBUG_METADATA is defined

Signed-off-by: Eugene Krasnikov <k.eugene.e at gmail.com>
---
 wcn36xx.h |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/wcn36xx.h b/wcn36xx.h
index f806867..5af30d6 100644
--- a/wcn36xx.h
+++ b/wcn36xx.h
@@ -40,6 +40,8 @@
 #define wcn36xx_dbg(fmt, arg...) \
  pr_debug(DRIVER_PREFIX fmt "\n", ##arg)

+#ifdef DEFINE_DYNAMIC_DEBUG_METADATA
+#undef DEFINE_DYNAMIC_DEBUG_METADATA
 #define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt) \
  static struct _ddebug __used __aligned(8) \
  __attribute__((section("__verbose"))) name = { \
@@ -50,6 +52,7 @@
  .lineno = __LINE__, \
  .flags =  _DPRINTK_FLAGS_DEFAULT, \
  }
+#endif

 #define wcn36xx_dbg_dump(prefix_str, buf, len) \
 do { \
--
1.7.10

>From 561325d8848a67d3676e523af4f73904b03d5795 Mon Sep 17 00:00:00 2001
From: Eugene Krasnikov <k.eugene.e at gmail.com>
Date: Tue, 9 Apr 2013 18:09:30 +0200
Subject: [PATCH 2/3] Use ieee80211_probereq_get from latest mac80211

Latest mac80211 changed ieee80211_probereq_get function format

Signed-off-by: Eugene Krasnikov <k.eugene.e at gmail.com>
---
 main.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/main.c b/main.c
index 6cc7550..ff2d1d6 100644
--- a/main.c
+++ b/main.c
@@ -158,9 +158,9 @@ static int wcn36xx_hw_scan(struct ieee80211_hw *hw,
  wcn36xx_smd_update_scan_params(wcn);
  wcn36xx_smd_exit_imps(wcn);
  if (req->n_ssids > 0) {
- prb_req = ieee80211_probereq_get(hw, vif, req->ssids[0].ssid,
req->ssids[0].ssid_len, req->ie, req->ie_len);
+ prb_req = ieee80211_probereq_get(hw, vif, req->ssids[0].ssid,
req->ssids[0].ssid_len, req->ie_len);
  } else {
- prb_req = ieee80211_probereq_get(hw, vif, NULL, 0, req->ie, req->ie_len);
+ prb_req = ieee80211_probereq_get(hw, vif, NULL, 0, req->ie_len);
  }
  for(i = 0; i < req->n_channels; i++) {
  wcn36xx_smd_init_scan(wcn);
--
1.7.10

>From f349e2a4409868edec8cc656d8a7684224dc3794 Mon Sep 17 00:00:00 2001
From: Eugene Krasnikov <k.eugene.e at gmail.com>
Date: Tue, 9 Apr 2013 17:51:15 +0200
Subject: [PATCH] Suppress warning -Waddress in net/wireless/reg.c

Signed-off-by: Eugene Krasnikov <k.eugene.e at gmail.com>
---
 net/wireless/reg.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index e6df52d..1e7fb0e 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -208,7 +208,7 @@ static char user_alpha2[2];

 module_param(ieee80211_regdom, charp, 0444);
 MODULE_PARM_DESC(ieee80211_regdom, "IEEE 802.11 regulatory domain code");
-
+#pragma GCC diagnostic ignored "-Waddress"
 static void reset_regdomains(bool full_reset,
      const struct ieee80211_regdomain *new_regdom)
 {
--
1.7.10


4) Change compat-drivers to support wcn36xx “Add wcn36xx to compat-drivers”

>From 8c57cbdebf214cf4022958116b28ab830d13dbb7 Mon Sep 17 00:00:00 2001
From: Eugene Krasnikov <k.eugene.e at gmail.com>
Date: Tue, 9 Apr 2013 18:26:03 +0200
Subject: [PATCH] Add wcn36xx to compat-drivers

Signed-off-by: Eugene Krasnikov <k.eugene.e at gmail.com>
---
 config.mk             |    1 +
 scripts/driver-select |    7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/config.mk b/config.mk
index d002f87..6828f79 100644
--- a/config.mk
+++ b/config.mk
@@ -1,3 +1,4 @@
+export CONFIG_WCN36XX=m
 ifeq ($(wildcard $(KLIB_BUILD)/.config),)
 # These will be ignored by compat autoconf
  export CONFIG_PCI=y
diff --git a/scripts/driver-select b/scripts/driver-select
index 862f43b..73232b2 100755
--- a/scripts/driver-select
+++ b/scripts/driver-select
@@ -32,7 +32,7 @@ PURPLE="\033[35m"
 CYAN="\033[36m"
 UNDERLINE="\033[02m"

-SUPPORTED_80211_DRIVERS="ath5k ath9k ath9k_ap ath9k_htc carl9170
ath6kl ar5523 wil6210 b43 zd1211rw rt2x00 wl1251 wl12xx brcmsmac
brcmfmac mac80211_hwsim"
+SUPPORTED_80211_DRIVERS="ath5k ath9k ath9k_ap ath9k_htc carl9170
ath6kl ar5523 wil6210 b43 zd1211rw rt2x00 wl1251 wl12xx brcmsmac
brcmfmac wcn36xx mac80211_hwsim"

 # b43 needs some more work for driver-select, the SSB stuff, plus
 # what if you update b44 but not b43? It will bust.
@@ -508,6 +508,11 @@ case $1 in
  disable_staging
  disable_var_01
  ;;
+ wcn36xx)
+ select_drivers CONFIG_WCN36XX
+ disable_staging
+ disable_var_01
+ ;;
  mac80211_hwsim)
  select_drivers CONFIG_COMPAT_MAC80211_HWSIM
  disable_staging
--
1.7.10

5) From CD_ROOT run "./scripts/driver-select wcn36xx"

6) to the end of file <CD_ROOT>/drivers/net/wireless/Makefile.bk add
line "obj-$(CONFIG_WCN36XX) += wcn36xx/"

7) Build with the following command “make
KLIB=<CM_ROOT>/out/target/product/mint/obj/KERNEL_OBJ
KLIB_BUILD=<CM_ROOT>/out/target/product/mint/obj/KERNEL_OBJ  ARCH=arm
CROSS_COMPILE=<CM_ROOT>/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-”

8) In case of such an error:

<CM_ROOT>/kernel/sony/msm8x60/include/linux/device.h: In function
'root_device_register':
<CM_ROOT>/kernel/sony/msm8x60/include/linux/device.h:715:38: error:
'THIS_MODULE' undeclared (first use in this function)

Apply patch "Use export.h from CM location"

>From c059e8b803550c7b76cc102d6c1fb1d8a0fa6fa9 Mon Sep 17 00:00:00 2001
From: Eugene Krasnikov <k.eugene.e at gmail.com>
Date: Tue, 9 Apr 2013 18:28:38 +0200
Subject: [PATCH] Use export.h from CM location

Signed-off-by: Eugene Krasnikov <k.eugene.e at gmail.com>
---
 include/linux/compat-2.6.h |    1 +
 1 file changed, 1 insertion(+)

diff --git a/include/linux/compat-2.6.h b/include/linux/compat-2.6.h
index 1e9effb..47f7434 100644
--- a/include/linux/compat-2.6.h
+++ b/include/linux/compat-2.6.h
@@ -43,6 +43,7 @@ void backport_dependency_symbol(void);
  * Each compat file represents compatibility code for new kernel
  * code introduced for *that* kernel revision.
  */
+#include <CM_ROOT/kernel/sony/msm8x60/include/linux/export.h>

 #include <linux/compat-2.6.22.h>
 #include <linux/compat-2.6.23.h>
--
1.7.10


9) In case of such an error:

/compat-drivers/net/mac80211/tx.c:2098:26: error: 'ETH_P_802_3_MIN'
undeclared (first use in this function)

Apply patch “Add ETH_P_802_3_MIN define”:

>From da3a47fdbbd0ffc511bcb38651ca9f7d87c05062 Mon Sep 17 00:00:00 2001
From: Eugene Krasnikov <k.eugene.e at gmail.com>
Date: Tue, 9 Apr 2013 18:17:26 +0200
Subject: [PATCH] Add ETH_P_802_3_MIN define

Signed-off-by: Eugene Krasnikov <k.eugene.e at gmail.com>
---
 include/net/cfg80211.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index bdba9b6..bef4141 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -60,7 +60,7 @@
  */

 struct wiphy;
-
+#define ETH_P_802_3_MIN 0x600
 /*
  * wireless hardware capability structures
  */
--
1.7.10

10) In case of such an error:

compat-drivers/net/mac80211/debugfs_key.c:37:0: warning: "KEY_FILE"
redefined [enabled by default]

Apply patch “Check if KEY_FILE is defined”:

>From 739ba3863b0aa520422ae63fd4c22057d9798b1b Mon Sep 17 00:00:00 2001
From: Eugene Krasnikov <k.eugene.e at gmail.com>
Date: Tue, 9 Apr 2013 17:44:55 +0200
Subject: [PATCH] Check if KEY_FILE is defined

Signed-off-by: Eugene Krasnikov <k.eugene.e at gmail.com>
---
 net/mac80211/debugfs_key.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/mac80211/debugfs_key.c b/net/mac80211/debugfs_key.c
index 1521cab..dd2517b 100644
--- a/net/mac80211/debugfs_key.c
+++ b/net/mac80211/debugfs_key.c
@@ -34,9 +34,12 @@ static const struct file_operations key_ ##name## _ops = { \
  .llseek = generic_file_llseek, \
 }

+#ifdef KEY_FILE
+#undef KEY_FILE
 #define KEY_FILE(name, format) \
  KEY_READ_##format(name) \
  KEY_OPS(name)
+#endif

 #define KEY_CONF_READ(name, format_string) \
  KEY_READ(conf_##name, conf.name, format_string)
--
1.7.10


11) In case of such an warning:

/compat-drivers/net/wireless/reg.c:244:2: warning: the comparison will
always evaluate as 'true' for the address of 'core_request_world' will
never be NULL [-Waddress]

Apply patch “Suppress warning -Waddress in net/wireless/reg.c”:

>From f349e2a4409868edec8cc656d8a7684224dc3794 Mon Sep 17 00:00:00 2001
From: Eugene Krasnikov <k.eugene.e at gmail.com>
Date: Tue, 9 Apr 2013 17:51:15 +0200
Subject: [PATCH] Suppress warning -Waddress in net/wireless/reg.c

Signed-off-by: Eugene Krasnikov <k.eugene.e at gmail.com>
---
 net/wireless/reg.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index e6df52d..1e7fb0e 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -208,7 +208,7 @@ static char user_alpha2[2];

 module_param(ieee80211_regdom, charp, 0444);
 MODULE_PARM_DESC(ieee80211_regdom, "IEEE 802.11 regulatory domain code");
-
+#pragma GCC diagnostic ignored "-Waddress"
 static void reset_regdomains(bool full_reset,
      const struct ieee80211_regdomain *new_regdom)
 {
--
1.7.10

2013/4/9 Kalle Valo <kvalo at qca.qualcomm.com>:
> Eugene Krasnikov <k.eugene.e at gmail.com> writes:
>
>> Finally I managed to build and run latest mac80211 with CM+wcn36xx.
>> I'll update readme tomorrow. Suggestion is that everybody will move to
>> latest mac80211 so wcn36xx is up to date with compat-drivers.
>
> Excellent. This will now solve the problem of products running different
> version of mac80211. Was it difficult to setup?
>
> Once you send the instructions I'll try compat-driver with mako.
>
> --
> Kalle Valo



-- 
Best regards,
Eugene



More information about the wcn36xx mailing list