SSブログ

Raspberry Pi (raspbian) + Planex GW-450D [Raspberry Pi]

 Raspberry Pi のNICだけが逝ってしまったのでその代替として11acの無線LAN子機「GW-450D」を導入した。ドライバ導入はメーカ(プラネックス)記事、
 ・「Raspberry Piで11ac無線LAN子機『GW-450D』を使うための設定方法」
を参考にしたが、当然、カーネルバージョンが上がっているので少し手順追加・変更が必要であった。
 まずインストール済みRaspbianのカーネルバージョンは、
$ uname -r
3.18.7+
だったが、この場合先人によればGCCのバージョンアップが必要とのことなので、その方の記事を参考にここではGCCバージョンアップのみを実施。
 ・GW-450DやWN-AC433UKをRaspberry Piで使う
 ちなみに手元の環境のGCCバージョンは
$ gcc -v
・・・・・・
gcc version 4.8.3 (Raspbian 4.8.3-13)
へ上がっていた。
 次にファームウェアを最新版へアップデート。これはGW-450Dドライバのビルド環境を作成する際に取得するカーネルソースバージョンも最新版となるので、これらを同一にするのが目的。
$ sudo apt-get update
$ sudo apt-get dist-upgrade
$ sudo apt-get install make bc ncurses-dev
$ sudo rpi-update
$ sudo reboot
ちなみに手元の環境で確認すると、
$ uname -r
3.18.8+
がこの時点の最新カーネルバージョンだった。
次にこれに対応した最新版カーネルソースを取得しGW-450Dドライバのビルド環境を作成。
$ sudo su
# cd /usr/src
# wget https://github.com/raspberrypi/linux/archive/rpi-3.18.y.tar.gz
# tar xvfz rpi-3.18.y.tar.gz
# head -5 linux-rpi-3.18.y/Makefile
VERSION = 3
PATCHLEVEL = 18
SUBLEVEL = 8
EXTRAVERSION =
NAME = Diseased Newt
# ln -s /usr/src/linux-rpi-3.18.y/ /lib/modules/`uname -r`/build
# cd /lib/modules/`uname -r`/build
# make mrproper
# zcat /proc/config.gz > .config
# make modules_prepare
# wget https://github.com/raspberrypi/firmware/raw/master/extra/Module.symvers
<3/9追記>
Raspberry Pi 2の場合は上記最終行が以下になる
# wget https://github.com/raspberrypi/firmware/raw/master/extra/Module7.symvers -O Module.symvers
 いよいよ「GW-450D」ドライバのコンパイルであるが、このままでは途中エラーが発生してコンパイルできなかった。いろいろとググってみて、
https://bitbucket.org/sanrath/mediatek_mt7610u_sta_driver_linux-64bit/commits/a989fcd6e073205690434e99ac1dc2b0f837350b
の修正をあてることで、何とかコンパイルすることができた。以下はこれにVendorID、ProductIDなどの変更を追加したパッチファイルになる。
$ cat mediatek_mt7610u_sta_driver_for_3.18.8.patch
diff -urN a/RT2870STA.dat b/RT2870STA.dat
--- a/RT2870STA.dat	2013-09-16 23:03:08.000000000 +0900
+++ b/RT2870STA.dat	2015-03-07 15:15:54.696136992 +0900
@@ -6,7 +6,7 @@
 ChannelGeography=1
 SSID=11n-AP
 NetworkType=Infra
-WirelessMode=5
+WirelessMode=8
 EfuseBufferMode=0
 Channel=0
 BeaconPeriod=100
@@ -17,7 +17,7 @@
 FragThreshold=2346
 TxBurst=1
 PktAggregate=0
-WmmCapable=1
+WmmCapable=0
 AckPolicy=0;0;0;0
 AuthMode=OPEN
 EncrypType=NONE
diff -urN a/chips/mt76x0.c b/chips/mt76x0.c
--- a/chips/mt76x0.c	2013-09-16 23:03:08.000000000 +0900
+++ b/chips/mt76x0.c	2015-03-07 15:15:54.706136902 +0900
@@ -1573,7 +1573,7 @@
 		E2: B0.R21<0>: xo_cxo<0>, B0.R22<7:0>: xo_cxo<8:1> 
 	*/
 	RFValue = (UCHAR)(pAd->RfFreqOffset & 0xFF);
-	RFValue = min(RFValue, 0xBF); /* Max of 9-bit built-in crystal oscillator C1 code */
+	RFValue = min(RFValue, (UCHAR)0xBF); /* Max of 9-bit built-in crystal oscillator C1 code */
 	rlt_rf_write(pAd, RF_BANK0, RF_R22, RFValue);
 	
 	rlt_rf_read(pAd, RF_BANK0, RF_R22, &RFValue);
diff -urN a/common/cmm_info.c b/common/cmm_info.c
--- a/common/cmm_info.c	2013-09-16 23:03:08.000000000 +0900
+++ b/common/cmm_info.c	2015-03-07 15:15:54.716136813 +0900
@@ -44,7 +44,7 @@
 
 #ifdef CONFIG_STA_SUPPORT
 	IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
-		DBGPRINT(RT_DEBUG_TRACE, ("Driver version-%s %s %s\n", STA_DRIVER_VERSION, __DATE__, __TIME__));
+		DBGPRINT(RT_DEBUG_TRACE, ("Driver version-%s %s\n", STA_DRIVER_VERSION, STA_DRIVER_BUILD));
 #endif /* CONFIG_STA_SUPPORT */
 
     return TRUE;
diff -urN a/common/cmm_mac_usb.c b/common/cmm_mac_usb.c
--- a/common/cmm_mac_usb.c	2013-09-16 23:03:08.000000000 +0900
+++ b/common/cmm_mac_usb.c	2015-03-07 15:15:54.726136723 +0900
@@ -27,6 +27,8 @@
 
 #ifdef RTMP_MAC_USB
 
+#define usb_buffer_alloc(a, b, c, d) usb_alloc_coherent(a, b, c, d)
+#define usb_buffer_free(a, b, c, d) usb_free_coherent(a, b, c, d)
 
 #include	"rt_config.h"
 
diff -urN a/common/cmm_wpa.c b/common/cmm_wpa.c
--- a/common/cmm_wpa.c	2013-09-16 23:03:08.000000000 +0900
+++ b/common/cmm_wpa.c	2015-03-07 15:15:54.736136634 +0900
@@ -1802,17 +1802,17 @@
 	Return Value:
 
 	Note:
-		Output * KDF-Length (K, label, Context) where
+		Output \A1\F6 KDF-Length (K, label, Context) where
 		Input:    K, a 256-bit key derivation key
 				  label, a string identifying the purpose of the keys derived using this KDF
 				  Context, a bit string that provides context to identify the derived key
 				  Length, the length of the derived key in bits
 		Output: a Length-bit derived key
 
-		result * ""
-		iterations * (Length+255)/256 
+		result \A1\F6 ""
+		iterations \A1\F6 (Length+255)/256 
 		do i = 1 to iterations
-			result * result || HMAC-SHA256(K, i || label || Context || Length)
+			result \A1\F6 result || HMAC-SHA256(K, i || label || Context || Length)
 		od
 		return first Length bits of result, and securely delete all unused bits
 
@@ -2480,7 +2480,7 @@
 	UCHAR		PrimaryRsnie;			
 	BOOLEAN		bMixCipher = FALSE;	/* indicate the pairwise and group cipher are different*/
 	UCHAR		p_offset;		
-	WPA_MIX_PAIR_CIPHER		FlexibleCipher = MIX_CIPHER_NOTUSE;	/* it provide the more flexible cipher combination in WPA-WPA2 and TKIPAES mode*/
+	WPA_MIX_PAIR_CIPHER FlexibleCipher = WPA_TKIPAES_WPA2_TKIPAES;	/* it provide the more flexible cipher combination in WPA-WPA2 and TKIPAES mode*/
 		
 	rsnielen_cur_p = NULL;
 	rsnielen_ex_cur_p = NULL;
diff -urN a/common/mlme.c b/common/mlme.c
--- a/common/mlme.c	2013-09-16 23:03:08.000000000 +0900
+++ b/common/mlme.c	2015-03-07 15:15:54.746136544 +0900
@@ -535,8 +535,8 @@
 #endif /* RALINK_ATE */
 		/* for performace enchanement */
 		NdisZeroMemory(&pAd->RalinkCounters,
-						(UINT32)&pAd->RalinkCounters.OneSecEnd -
-						(UINT32)&pAd->RalinkCounters.OneSecStart);
+						(ULONG)&pAd->RalinkCounters.OneSecEnd -
+						(ULONG)&pAd->RalinkCounters.OneSecStart);
 
 	return;
 }
diff -urN a/common/rtusb_dev_id.c b/common/rtusb_dev_id.c
--- a/common/rtusb_dev_id.c	2013-09-16 23:03:08.000000000 +0900
+++ b/common/rtusb_dev_id.c	2015-03-07 15:15:54.746136544 +0900
@@ -36,8 +36,9 @@
 /* module table */
 USB_DEVICE_ID rtusb_dev_id[] = {
 #ifdef MT76x0
+	{USB_DEVICE(0x2019,0xAB31)}, /* GW-450D */
 	{USB_DEVICE(0x148F,0x7610)}, /* MT7610U */
-	{USB_DEVICE(0x0E8D,0x7610)}, /* MT7610U */
+	{USB_DEVICE(0x13B1,0x003E)}, /* MT7610U */
 	{USB_DEVICE_AND_INTERFACE_INFO(0x0E8D, 0x7630, 0xff, 0x2, 0xff)}, /* MT7630U */
 	{USB_DEVICE_AND_INTERFACE_INFO(0x0E8D, 0x7650, 0xff, 0x2, 0xff)}, /* MT7650U */
 #endif
diff -urN a/conf/RT2870STA.dat b/conf/RT2870STA.dat
--- a/conf/RT2870STA.dat	2013-09-16 23:03:08.000000000 +0900
+++ b/conf/RT2870STA.dat	2015-03-07 15:15:54.756136455 +0900
@@ -4,9 +4,9 @@
 CountryRegionABand=7
 CountryCode=
 ChannelGeography=1
-SSID=11n-AP
+SSID=
 NetworkType=Infra
-WirelessMode=5
+WirelessMode=8
 EfuseBufferMode=0
 Channel=0
 BeaconPeriod=100
@@ -17,10 +17,10 @@
 FragThreshold=2346
 TxBurst=1
 PktAggregate=0
-WmmCapable=1
+WmmCapable=0
 AckPolicy=0;0;0;0
-AuthMode=OPEN
-EncrypType=NONE
+AuthMode=WPA2PSK
+EncrypType=AES
 WPAPSK=
 DefaultKeyID=1
 Key1Type=0
diff -urN a/contributors.txt b/contributors.txt
--- a/contributors.txt	1970-01-01 09:00:00.000000000 +0900
+++ b/contributors.txt	2015-03-07 15:15:54.756136455 +0900
@@ -0,0 +1 @@
+Sanjit Rath
diff -urN a/include/mcu/mt7650_firmware.h b/include/mcu/mt7650_firmware.h
--- a/include/mcu/mt7650_firmware.h	2013-09-16 23:24:08.000000000 +0900
+++ b/include/mcu/mt7650_firmware.h	2015-03-07 15:25:46.590039797 +0900
@@ -1,28 +1,5 @@
-/*
- *************************************************************************
- * Ralink Tech Inc.
- * 5F., No.36, Taiyuan St., Jhubei City,
- * Hsinchu County 302,
- * Taiwan, R.O.C.
- *
- * (c) Copyright 2002-2010, Ralink Technology, Inc.
- *
- * This program is free software; you can redistribute it and/or modify  *
- * it under the terms of the GNU General Public License as published by  *
- * the Free Software Foundation; either version 2 of the License, or     *
- * (at your option) any later version.                                   *
- *                                                                       *
- * This program is distributed in the hope that it will be useful,       *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
- * GNU General Public License for more details.                          *
- *                                                                       *
- * You should have received a copy of the GNU General Public License     *
- * along with this program; if not, write to the                         *
- * Free Software Foundation, Inc.,                                       *
- * 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
- *                                                                       *
- *************************************************************************/
+/* AUTO GEN PLEASE DO NOT MODIFY IT */ 
+/* AUTO GEN PLEASE DO NOT MODIFY IT */ 
 
 
 UCHAR MT7650_FirmwareImage[] = {
diff -urN a/include/os/rt_linux.h b/include/os/rt_linux.h
--- a/include/os/rt_linux.h	2013-09-16 23:03:08.000000000 +0900
+++ b/include/os/rt_linux.h	2015-03-07 15:15:54.776136276 +0900
@@ -277,8 +277,8 @@
 
 typedef struct _OS_FS_INFO_
 {
-	int				fsuid;
-	int				fsgid;
+	kuid_t				fsuid;
+	kgid_t				fsgid;
 	mm_segment_t	fs;
 } OS_FS_INFO;
 
@@ -880,11 +880,20 @@
 #define SET_OS_PKT_LEN(_pkt, _len)	\
 		(RTPKT_TO_OSPKT(_pkt)->len) = (_len)
 		
+
+#ifdef NET_SKBUFF_DATA_USES_OFFSET
+#define GET_OS_PKT_DATATAIL(_pkt) \
+        (RTPKT_TO_OSPKT(_pkt)->head + (ULONG)RTPKT_TO_OSPKT(_pkt)->tail)
+#define SET_OS_PKT_DATATAIL(_pkt, _start, _len) \
+        ((RTPKT_TO_OSPKT(_pkt))->tail) = (ULONG)_start - (ULONG)(RTPKT_TO_OSPKT(_pkt)->head) + (_len)
+#else
 #define GET_OS_PKT_DATATAIL(_pkt) \
 		(RTPKT_TO_OSPKT(_pkt)->tail)
 #define SET_OS_PKT_DATATAIL(_pkt, _start, _len)	\
-		((RTPKT_TO_OSPKT(_pkt))->tail) = (PUCHAR)((_start) + (_len))
-		
+		((RTPKT_TO_OSPKT(_pkt))->tail) = (ULONG)((_start) + (_len))
+#endif 
+
+
 #define GET_OS_PKT_HEAD(_pkt) \
 		(RTPKT_TO_OSPKT(_pkt)->head)
 
diff -urN a/os/linux/config.mk b/os/linux/config.mk
--- a/os/linux/config.mk	2013-09-16 23:03:08.000000000 +0900
+++ b/os/linux/config.mk	2015-03-07 15:15:54.776136276 +0900
@@ -23,12 +23,12 @@
 
 # Support Wpa_Supplicant
 # i.e. wpa_supplicant -Dralink
-HAS_WPA_SUPPLICANT=n
+HAS_WPA_SUPPLICANT=y
 
 
 # Support Native WpaSupplicant for Network Maganger
 # i.e. wpa_supplicant -Dwext
-HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=n
+HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=y
 
 #Support Net interface block while Tx-Sw queue full
 HAS_BLOCK_NET_IF=n
@@ -207,12 +207,20 @@
 
 HAS_WIFI_P2P_CONCURRENT_FAST_SCAN=n
 
+STA_DRIVER_BUILD := 20141022-1327
+
 #################################################
 
 CC := $(CROSS_COMPILE)gcc
 LD := $(CROSS_COMPILE)ld
 
-WFLAGS := -g -DAGGREGATION_SUPPORT -DPIGGYBACK_SUPPORT -DWMM_SUPPORT  -DLINUX -Wall -Wstrict-prototypes -Wno-trigraphs
+ifndef $(WFLAGS)
+WFLAGS := -DSTA_DRIVER_BUILD="\"${STA_DRIVER_BUILD}\""
+else
+WFLAGS += -DSTA_DRIVER_BUILD="\"${STA_DRIVER_BUILD}\""
+endif
+
+WFLAGS += -g -DAGGREGATION_SUPPORT -DPIGGYBACK_SUPPORT -DWMM_SUPPORT  -DLINUX -Wall -Wstrict-prototypes -Wno-trigraphs
 WFLAGS += -DSYSTEM_LOG_SUPPORT -DRT28xx_MODE=$(RT28xx_MODE) -DCHIPSET=$(MODULE) -DRESOURCE_PRE_ALLOC -DENHANCED_STAT_DISPLAY
 #WFLAGS += -DFPGA_MODE
 WFLAGS += -I$(RT28xx_DIR)/include
@@ -660,7 +668,7 @@
 WFLAGS += -DCONFIG_CSO_SUPPORT -DCONFIG_TSO_SUPPORT
 endif
 
-CHIPSET_DAT = 2860
+CHIPSET_DAT = 2870
 endif
 
 ifneq ($(or $(findstring mt7662e,$(CHIPSET)),$(findstring mt7612e,$(CHIPSET))),)
diff -urN a/os/linux/rt_linux.c b/os/linux/rt_linux.c
--- a/os/linux/rt_linux.c	2013-09-16 23:03:08.000000000 +0900
+++ b/os/linux/rt_linux.c	2015-03-07 15:15:54.786136186 +0900
@@ -497,9 +497,9 @@
 		MEM_DBG_PKT_ALLOC_INC(skb);
 
 		skb_reserve(skb, 2);
-		NdisMoveMemory(skb->tail, pHeader802_3, HdrLen);
+		NdisMoveMemory(GET_OS_PKT_DATATAIL(skb), pHeader802_3, HdrLen);
 		skb_put(skb, HdrLen);
-		NdisMoveMemory(skb->tail, pData, DataSize);
+		NdisMoveMemory(GET_OS_PKT_DATATAIL(skb), pData, DataSize);
 		skb_put(skb, DataSize);
 		skb->dev = pNetDev;	/*get_netdev_from_bssid(pAd, FromWhichBSSID); */
 		pPacket = OSPKT_TO_RTPKT(skb);
@@ -650,7 +650,7 @@
 		pClonedPkt->dev = pRxPkt->dev;
 		pClonedPkt->data = pData;
 		pClonedPkt->len = DataSize;
-		pClonedPkt->tail = pClonedPkt->data + pClonedPkt->len;
+                SET_OS_PKT_DATATAIL(pClonedPkt, pClonedPkt->data, pClonedPkt->len);
 		ASSERT(DataSize < 1530);
 	}
 	return pClonedPkt;
@@ -695,7 +695,7 @@
 	pOSPkt->dev = pNetDev;
 	pOSPkt->data = pData;
 	pOSPkt->len = DataSize;
-	pOSPkt->tail = pOSPkt->data + pOSPkt->len;
+	SET_OS_PKT_DATATAIL(pOSPkt, pOSPkt->data, pOSPkt->len);
 
 	/* copy 802.3 header */
 
@@ -1105,9 +1105,10 @@
 		pOSFSInfo->fsuid = current->fsuid;
 		pOSFSInfo->fsgid = current->fsgid;
 		current->fsuid = current->fsgid = 0;
+
 #else
 		pOSFSInfo->fsuid = current_fsuid();
-		pOSFSInfo->fsgid = current_fsgid();
+		pOSFSInfo->fsgid = current_fsgid(); 
 #endif
 		pOSFSInfo->fs = get_fs();
 		set_fs(KERNEL_DS);
diff -urN a/os/linux/usb_main_dev.c b/os/linux/usb_main_dev.c
--- a/os/linux/usb_main_dev.c	2013-09-16 23:03:08.000000000 +0900
+++ b/os/linux/usb_main_dev.c	2015-03-07 15:15:54.786136186 +0900
@@ -39,7 +39,7 @@
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Paul Lin ");
 MODULE_DESCRIPTION("RT2870 Wireless Lan Linux Driver");
-
+MODULE_LICENSE("GPL");
 #ifdef CONFIG_STA_SUPPORT
 #ifdef MODULE_VERSION
 MODULE_VERSION(STA_DRIVER_VERSION);
diff -urN a/sta/sta_cfg.c b/sta/sta_cfg.c
--- a/sta/sta_cfg.c	2013-09-16 23:03:08.000000000 +0900
+++ b/sta/sta_cfg.c	2015-03-07 15:15:54.796136097 +0900
@@ -5398,7 +5398,7 @@
             wrq->u.data.length = strlen(extra) + 1; /* 1: size of '\0' */
             break;
         case SHOW_DRVIER_VERION:
-            snprintf(extra, size, "Driver version-%s, %s %s\n", STA_DRIVER_VERSION, __DATE__, __TIME__ );
+            snprintf(extra, size, "Driver version-%s, %s\n", STA_DRIVER_VERSION, STA_DRIVER_BUILD );
             wrq->u.data.length = strlen(extra) + 1; /* 1: size of '\0' */
             break;
 #ifdef DOT11_N_SUPPORT
あとはこのパッチを当てればコンパイル・インストールできる筈である。
$ tar xvjf mt7610u_wifi_sta_v3002_dpo_20130916.tar.bz2
$ cd mt7610u_wifi_sta_v3002_dpo_20130916/
$ patch -p1 < ../mediatek_mt7610u_sta_driver_for_3.18.8.patch
$ make
$ sudo make install
なお、文字コードの関係で一部リジェクトされ、手修正が必要になる場合がある。
 最後に冒頭のメーカ(プラネックス)記事を参考にネットワーク設定すれば良い。
nice!(0)  コメント(0) 

nice! 0

コメント 0

コメントを書く

お名前:
URL:
コメント:
画像認証:
下の画像に表示されている文字を入力してください。

※ブログオーナーが承認したコメントのみ表示されます。
Raspberry Pi 2 (rasp..|- ブログトップ

この広告は前回の更新から一定期間経過したブログに表示されています。更新すると自動で解除されます。