• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

external/kernel-drivers


Commit MetaInfo

修订版4a2735361695fd3a52dbbb09ffdc583b465f27f9 (tree)
时间2018-12-06 16:00:09
作者Chih-Wei Huang <cwhuang@linu...>
CommiterChih-Wei Huang

Log Message

Add support for Broadcom wl sta driver

This will download Broadcom wl driver 6.30.223.271 and patch it
to build with the latest kernel.

Make sure you have a workable network on building.

更改概述

差异

--- /dev/null
+++ b/wl/Android.mk
@@ -0,0 +1,39 @@
1+#
2+# Copyright (C) 2018 The Android-x86 Open Source Project
3+#
4+# Licensed under the GNU General Public License Version 2 or later.
5+# You may not use this file except in compliance with the License.
6+# You may obtain a copy of the License at
7+#
8+# http://www.gnu.org/licenses/gpl.html
9+#
10+
11+LOCAL_PATH := $(my-dir)
12+LOCAL_MODULE := $(notdir $(LOCAL_PATH))
13+EXTRA_KERNEL_MODULE_PATH_$(LOCAL_MODULE) := $(LOCAL_PATH)
14+
15+# parts of build/tasks/kernel.mk
16+
17+TARGET_KERNEL_ARCH ?= $(TARGET_ARCH)
18+WL_PATH := $(TARGET_OUT_INTERMEDIATES)/kmodule/wl
19+WL_SRC := $(WL_PATH)/hybrid-v35$(if $(filter x86,$(TARGET_KERNEL_ARCH)),,_64)-nodebug-pcoem-6_30_223_271.tar.gz
20+WL_LIB := $(WL_PATH)/lib$(if $(filter x86,$(TARGET_KERNEL_ARCH)),32,64)
21+
22+WL_PATCHES := \
23+ wl.patch \
24+ linux-recent.patch \
25+ linux-48.patch \
26+ linux-411.patch \
27+ linux-412.patch \
28+ linux-415.patch \
29+
30+$(WL_SRC):
31+ @echo Downloading $(@F)...
32+ $(hide) mkdir -p $(@D) && curl -k https://docs.broadcom.com/docs-and-downloads/docs/linux_sta/$(@F) > $@
33+
34+$(WL_LIB): $(WL_SRC) $(addprefix $(LOCAL_PATH)/,$(WL_PATCHES))
35+ $(hide) tar zxf $< -C $(@D) --overwrite -m && \
36+ rm -rf $@ && mv $(@D)/lib $@ && touch $@ && \
37+ cat $(filter %.patch,$^) | patch -p1 -d $(@D)
38+
39+$(WL_PATH): $(WL_LIB)
--- /dev/null
+++ b/wl/linux-411.patch
@@ -0,0 +1,52 @@
1+diff --git a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c
2+index a9671e2..da36405 100644
3+--- a/src/wl/sys/wl_cfg80211_hybrid.c
4++++ b/src/wl/sys/wl_cfg80211_hybrid.c
5+@@ -30,6 +30,9 @@
6+ #include <linux/kthread.h>
7+ #include <linux/netdevice.h>
8+ #include <linux/ieee80211.h>
9++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
10++#include <linux/sched/signal.h>
11++#endif
12+ #include <net/cfg80211.h>
13+ #include <linux/nl80211.h>
14+ #include <net/rtnetlink.h>
15+diff --git a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
16+index 489c9f5..f8278ad 100644
17+--- a/src/wl/sys/wl_linux.c
18++++ b/src/wl/sys/wl_linux.c
19+@@ -117,6 +117,9 @@
20+
21+ typedef struct priv_link {
22+ wl_if_t *wlif;
23++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
24++ unsigned long last_rx;
25++#endif
26+ } priv_link_t;
27+
28+ #define WL_DEV_IF(dev) ((wl_if_t*)((priv_link_t*)DEV_PRIV(dev))->wlif)
29+@@ -2449,6 +2452,9 @@
30+ {
31+ struct sk_buff *oskb = (struct sk_buff *)p;
32+ struct sk_buff *skb;
33++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
34++ priv_link_t *priv_link;
35++#endif
36+ uchar *pdata;
37+ uint len;
38+
39+@@ -2915,7 +2921,13 @@
40+ if (skb == NULL) return;
41+
42+ skb->dev = wl->monitor_dev;
43++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
44++ priv_link = MALLOC(wl->osh, sizeof(priv_link_t));
45++ priv_link = netdev_priv(skb->dev);
46++ priv_link->last_rx = jiffies;
47++#else
48+ skb->dev->last_rx = jiffies;
49++#endif
50+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22)
51+ skb_reset_mac_header(skb);
52+ #else
--- /dev/null
+++ b/wl/linux-412.patch
@@ -0,0 +1,68 @@
1+diff --git a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c
2+index da36405..d3741eb 100644
3+--- a/src/wl/sys/wl_cfg80211_hybrid.c
4++++ b/src/wl/sys/wl_cfg80211_hybrid.c
5+@@ -53,7 +53,11 @@
6+ #endif
7+
8+ static s32 wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,
9++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
10++ enum nl80211_iftype type, struct vif_params *params);
11++#else
12+ enum nl80211_iftype type, u32 *flags, struct vif_params *params);
13++#endif
14+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)
15+ static s32
16+ wl_cfg80211_scan(struct wiphy *wiphy,
17+@@ -473,7 +477,11 @@
18+
19+ static s32
20+ wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,
21++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
22++ enum nl80211_iftype type,
23++#else
24+ enum nl80211_iftype type, u32 *flags,
25++#endif
26+ struct vif_params *params)
27+ {
28+ struct wl_cfg80211_priv *wl = wiphy_to_wl(wiphy);
29+@@ -2369,6 +2377,20 @@
30+ const wl_event_msg_t *e, void *data)
31+ {
32+ struct wl_cfg80211_connect_info *conn_info = wl_to_conn(wl);
33++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
34++ struct cfg80211_bss *bss;
35++ struct wlc_ssid *ssid;
36++ ssid = &wl->profile->ssid;
37++ bss = cfg80211_get_bss(wl_to_wiphy(wl), NULL, (s8 *)&wl->bssid,
38++ ssid->SSID, ssid->SSID_len, WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS);
39++ struct cfg80211_roam_info roam_info = {
40++ .bss = bss,
41++ .req_ie = conn_info->req_ie,
42++ .req_ie_len = conn_info->req_ie_len,
43++ .resp_ie = conn_info->resp_ie,
44++ .resp_ie_len = conn_info->resp_ie_len,
45++ };
46++#endif
47+ s32 err = 0;
48+
49+ wl_get_assoc_ies(wl);
50+@@ -2376,12 +2398,17 @@
51+ memcpy(&wl->bssid, &e->addr, ETHER_ADDR_LEN);
52+ wl_update_bss_info(wl);
53+ cfg80211_roamed(ndev,
54++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
55++ &roam_info,
56++#else
57+ #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)
58+ &wl->conf->channel,
59+ #endif
60+ (u8 *)&wl->bssid,
61+ conn_info->req_ie, conn_info->req_ie_len,
62+- conn_info->resp_ie, conn_info->resp_ie_len, GFP_KERNEL);
63++ conn_info->resp_ie, conn_info->resp_ie_len,
64++#endif
65++ GFP_KERNEL);
66+ WL_DBG(("Report roaming result\n"));
67+
68+ set_bit(WL_STATUS_CONNECTED, &wl->status);
--- /dev/null
+++ b/wl/linux-415.patch
@@ -0,0 +1,48 @@
1+diff --git a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
2+index 1270d6da22ba..ec120cf7d74c 100644
3+--- a/src/wl/sys/wl_linux.c
4++++ b/src/wl/sys/wl_linux.c
5+@@ -93,7 +93,11 @@
6+
7+ #include <wlc_wowl.h>
8+
9++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
10++static void wl_timer(struct timer_list *tl);
11++#else
12+ static void wl_timer(ulong data);
13++#endif
14+ static void _wl_timer(wl_timer_t *t);
15+ static struct net_device *wl_alloc_linux_if(wl_if_t *wlif);
16+
17+@@ -2300,10 +2304,17 @@
18+ atomic_dec(&t->wl->callbacks);
19+ }
20+
21++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
22++static void
23++wl_timer(struct timer_list *tl)
24++{
25++ wl_timer_t *t = (wl_timer_t *)tl;
26++#else
27+ static void
28+ wl_timer(ulong data)
29+ {
30+ wl_timer_t *t = (wl_timer_t *)data;
31++#endif
32+
33+ if (!WL_ALL_PASSIVE_ENAB(t->wl))
34+ _wl_timer(t);
35+@@ -2355,9 +2366,13 @@
36+
37+ bzero(t, sizeof(wl_timer_t));
38+
39++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
40++ timer_setup(&t->timer, wl_timer, 0);
41++#else
42+ init_timer(&t->timer);
43+ t->timer.data = (ulong) t;
44+ t->timer.function = wl_timer;
45++#endif
46+ t->wl = wl;
47+ t->fn = fn;
48+ t->arg = arg;
--- /dev/null
+++ b/wl/linux-48.patch
@@ -0,0 +1,52 @@
1+Reference: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=839629
2+
3+--- a/src/wl/sys/wl_cfg80211_hybrid.c 2016-10-03 10:53:55.588036464 +0200
4++++ b/src/wl/sys/wl_cfg80211_hybrid.c 2016-10-03 10:54:11.911695944 +0200
5+@@ -2394,8 +2394,15 @@
6+ s32 err = 0;
7+
8+ if (wl->scan_request) {
9++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
10++ struct cfg80211_scan_info info = {
11++ .aborted = true
12++ };
13+ WL_DBG(("%s: Aborting scan\n", __FUNCTION__));
14+- cfg80211_scan_done(wl->scan_request, true);
15++ cfg80211_scan_done(wl->scan_request, &info);
16++#else
17++ cfg80211_scan_done(wl->scan_request, true);
18++#endif
19+ wl->scan_request = NULL;
20+ }
21+
22+@@ -2496,7 +2503,14 @@
23+
24+ scan_done_out:
25+ if (wl->scan_request) {
26++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
27++ struct cfg80211_scan_info info = {
28++ .aborted = false
29++ };
30++ cfg80211_scan_done(wl->scan_request, &info);
31++#else
32+ cfg80211_scan_done(wl->scan_request, false);
33++#endif
34+ wl->scan_request = NULL;
35+ }
36+ rtnl_unlock();
37+@@ -2921,7 +2935,14 @@
38+ s32 err = 0;
39+
40+ if (wl->scan_request) {
41+- cfg80211_scan_done(wl->scan_request, true);
42++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
43++ struct cfg80211_scan_info info = {
44++ .aborted = true
45++ };
46++ cfg80211_scan_done(wl->scan_request, &info);
47++#else
48++ cfg80211_scan_done(wl->scan_request, true);
49++#endif
50+ wl->scan_request = NULL;
51+ }
52+
--- /dev/null
+++ b/wl/linux-recent.patch
@@ -0,0 +1,38 @@
1+--- a/src/shared/linux_osl.c
2++++ b/src/shared/linux_osl.c
3+@@ -932,7 +932,11 @@
4+ uint cycles;
5+
6+ #if defined(__i386__)
7++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0)
8++ cycles = (u32)rdtsc();
9++#else
10+ rdtscl(cycles);
11++#endif
12+ #else
13+ cycles = 0;
14+ #endif
15+--- a/src/wl/sys/wl_cfg80211_hybrid.c
16++++ b/src/wl/sys/wl_cfg80211_hybrid.c
17+@@ -235,6 +235,13 @@
18+ };
19+ #endif
20+
21++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0))
22++#define ieee80211_band nl80211_band
23++#define IEEE80211_BAND_2GHZ NL80211_BAND_2GHZ
24++#define IEEE80211_BAND_5GHZ NL80211_BAND_5GHZ
25++#define IEEE80211_NUM_BANDS NUM_NL80211_BANDS
26++#endif
27++
28+ #define CHAN2G(_channel, _freq, _flags) { \
29+ .band = IEEE80211_BAND_2GHZ, \
30+ .center_freq = (_freq), \
31+@@ -1872,6 +1879,7 @@
32+ }
33+ set_wiphy_dev(wdev->wiphy, dev);
34+ wdev->wiphy->max_scan_ssids = WL_NUM_SCAN_MAX;
35++ wdev->wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN;
36+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33)
37+ wdev->wiphy->max_num_pmkids = WL_NUM_PMKIDS_MAX;
38+ #endif
--- /dev/null
+++ b/wl/wl.patch
@@ -0,0 +1,43 @@
1+--- a/Makefile
2++++ b/Makefile
3+@@ -145,7 +145,7 @@
4+ EXTRA_CFLAGS += -Wno-date-time
5+ endif
6+
7+-EXTRA_LDFLAGS := $(src)/lib/wlc_hybrid.o_shipped
8++EXTRA_LDFLAGS := $(src)/lib$(if $(CONFIG_64BIT),64,32)/wlc_hybrid.o_shipped
9+
10+ KBASE ?= /lib/modules/`uname -r`
11+ KBUILD_DIR ?= $(KBASE)/build
12+--- a/src/wl/sys/wl_linux.c
13++++ b/src/wl/sys/wl_linux.c
14+@@ -217,7 +217,7 @@
15+ #define to_str(s) #s
16+ #define quote_str(s) to_str(s)
17+
18+-#define BRCM_WLAN_IFNAME eth%d
19++#define BRCM_WLAN_IFNAME wlan%d
20+
21+ static char intf_name[IFNAMSIZ] = quote_str(BRCM_WLAN_IFNAME);
22+
23+@@ -2053,8 +2053,8 @@ wl_osl_pcie_rc(struct wl_info *wl, uint op, int param)
24+ void
25+ wl_dump_ver(wl_info_t *wl, struct bcmstrbuf *b)
26+ {
27+- bcm_bprintf(b, "wl%d: %s %s version %s\n", wl->pub->unit,
28+- __DATE__, __TIME__, EPI_VERSION_STR);
29++ bcm_bprintf(b, "wl%d: version %s\n", wl->pub->unit,
30++ EPI_VERSION_STR);
31+ }
32+
33+ #if defined(BCMDBG)
34+@@ -2165,8 +2165,8 @@ wl_start(struct sk_buff *skb, struct net_device *dev)
35+ wlif = WL_DEV_IF(dev);
36+ wl = WL_INFO(dev);
37+
38++ skb->prev = NULL;
39+ if (WL_ALL_PASSIVE_ENAB(wl) || (WL_RTR() && WL_CONFIG_SMP())) {
40+- skb->prev = NULL;
41+
42+ TXQ_LOCK(wl);
43+