Gentoo Ndiswraapper

基本要求

  • 必需是最近的 kernel (至少是 2.6.6 或 2.4.26),並且有原始碼。
  • 確定在modules directory下有連到kernel source 的 link。 /lib/modules/VERSION/build 應該是連到 kernel source 的link,其中 VERSION 是你所執行的 kernel 的 version。假如沒有此 link,在安裝的步驟將會發生 error。要建立此 link,假設已有 kernel sources,使用下面的 command
ln -s /usr/src/linux-<kernel-version> /lib/modules/VERSION/build
  • 確定你有開始編譯過 kernel sources,那麼所需的 header files 已存在。
  • 有些 vendors 在他們的 distributions 中 ship ndiswrapper,你可以直接用,或是自行安裝ndiswrapper,但得確定先移除已有的。
  • 確定已安裝 Wireless Tools。

安裝

1. 安裝ndiswrapper

執行 emerge ndiswrapper 就可以裝好 ndiswrapper 啦!

提醒一下,若 kernel 有變動,可能要重新安裝一次。

2. 安裝 Windows 驅動程式

你需要下載你的卡所使用的 Windows XP 驅動程式。 在 ndiswrapper 的 wiki中可找到已知可正常運作的驅動程式的列表 List。要辨識你所需的驅動程式,首先以 "lspci" 來辨識你使用的網卡, 並且注意開頭的部分(像是 0000:00:0c.0),然後以"lspci -n" 找出對應於 "lspci" 輸出的開頭的部分的 PCI ID。PCIID在第三部分(或是有些distributions是在第四部分) ,其形式像這樣,"104c:8400"。 Now you need toget the Windows driver for this chipset. In the list of drivers, findout an entry for the same PCI ID and download the driver correspondingto it. Unpack the Windows driver with unzip/cabextract/unshield toolsand find out the INF file (i.e., file with .INF or .inf extension) andSYS file (i.e., file with .SYS or .sys extension). If there aremultiple INF/SYS files, you may look in the List if there are any hintsabout which of them should be used. 確定 INF 檔,SYS 檔以及任何 BIN 檔 (例如, TIdrivers 使用 BIN firmware 檔) 全部都在同一個目錄下。現在使用 "ndiswrapper" 工具來安裝,指令如下

ndiswrapper -i filename.inf

這會將所需的檔案複製到目錄 /etc/ndiswrapper,並且建立你的網卡所用的 config 檔。

留意一下目錄名稱有空白的目錄:(至少對於 ndiswrapper-0.11 是合用的)

 'ndiswrapper' choked on my CD with the INF sources because the directories had spaces in them.  You can tell if this is happening if you get this string in the output:
basename: too many arguments

注意: 你可能會看到開頭為"Warning: Cannot locate "的訊息。假如訊息中並未包含看起來像是檔案名稱的東東,那麼這 warning 是無傷的(我想是吧)。

安裝之後,可以執行

ndiswrapper -l

檢視所安裝的 drivers 的 status。假如你已經安裝正確的驅動程式,你應該得到類似這樣的訊息

Installed ndis drivers%%%
bcmwl5 hardware present

其中 "present" 表示可以用所安裝的驅動程式來驅動的網卡。在這個例子中,使用的是 broadcom 的驅動程式bcmwl5

3. 載入 module

執行下述指令來載入 module

modprobe ndiswrapper

假如沒有錯誤訊息,就表示驅動程式現在應該是已經載入了。你可以檢視 system log (由 <kbd>dmesg</kbd> 所產生的)來確定。假如成功地載入驅動程式,你應該在system log中看到如下的訊息

ndiswrapper version V loaded

確定此處的版本 V 與你下載及安裝的 ndiswrapper package 的版本一致。假如你得到的是不一樣的版本,那麼你的package是舊的版本,你應該將它移除,回頭從新安裝。

假如在 modprob'ing之後,系統被鎖住了 (如鍵盤沒有反應等等),即表示 kernel 已經 crash 了。 See[Distributions] and [FAQ] for hints on what may cause problems for yourdistribution/kernel.

假如你先前已經成功地安裝 windows 的驅動程式 (使用 <kbd>ndiswrapper -i INFfile</kbd>),那麼 ndiswrapper module 會將它們全部載入。然後你會在system log中看到下面的訊息,會出現對應每一個驅動程式的訊息

ndiswrapper: driver driver1 added

假如你沒有看到這些訊息,通常代表在 /etc/ndiswrapper 的目錄下並未安裝(可用的)驅動程式。檢查一下 /etc/ndiswrapper目錄下是否有對應每個驅動程式的子目錄,以及每個驅動程式的子目錄下是否有 inf, sys and conf 檔。否則,你可能要再做一次前面安裝驅動程式的步驟。

假如系統中有可以使所載入的驅動程式的其中之一來運作的話,你應該可以在 system log 中看到下述訊息

wlan0: ndiswrapper ethernet device xx:xx:xx:xx:xx:xx

4. 設定界面

要用 iwconfig 來設定無線網路界面。首先,看看這界面是否是可用的,使用下面的指令

iwconfig

你的系統中很可能沒有這工具 : 它是 package 'wireless-tools' 的一部分,你得自行安裝。

這樣會列出 wireless interface (例如, wlan0)。在下面範例中,將使用 wlan0;請以上述iwconfig 回報的 interface 來取代 wlan0。所使用的 wireless configuration 應該配合你所用的存取點(Access Point, AP)。首先,使用下列指令,看看是否可以找到你的存取點(AP)。

iwlist wlan0 scan

注意:你可能在scan之前,得先設定 network name 才能找到你的存取點(AP)。假如 scan 沒有找到你的 AP, 在使用 "iwlist wlan0 scan" 的指令之前,試著先下這個指令

iwconfig wlan0 essid ESSID

假如這樣有列出你的存取點(AP),你就可以繼續後面的步驟。否則,你可能碰到下面兩種問題的其中一個:你的存取點(AP) 未 broadcast SSID(Service Set IDentifier) 或者網卡的 radio 關掉了。

假如在上面的scan可以找到 存取點(AP),那麼可以依據你的設置,設定此 interface 的 operating mode。在大部分的情況下,都是 Managed

iwconfig wlan0 mode Managed

假如你有用 encryption (WEP)(Wired Equivalent Privacy), 則要設定 key:

iwconfig wlan0 key restricted XXXXXXXX

對於 40-bit encryption,可以使用 10 個 hex 數字,或是對於 128-bit encryption 可以使用 26 個hex 數字。視你的存取點(AP)的設定而定,你可能要使用open security mode,而非restricted。假如你要使用 ASCII 形式的 key,可以用 s: (例如,iwconfig wlan0 key restricted s:password).

設定 network name

iwconfig wlan0 essid ESSID

請以你的存取點(AP)使用的network name來取代 ESSID。

現在,設定interface wlan0 的 network parameters。這個會因你所用的 distribution而有所差異。要如何做,請參照你的 distribution 的文件。當完成這個後,你可以用 network tools來啟動網路;例如,

ifconfig wlan0 up

或是

dhclient wlan0

或者

dhcpcd wlan0

等等。

5. 自動化

要是一切都很順利的話,就可藉著執行下面的指令來得到正確無誤的 modprobe settings,在使用 wlan0 時,自動載入 ndiswrapper,

ndiswrapper -m

注意,這在boot time時不會自動載入 ndiswrapper module。假如你要在 boot time 時自動載入module,你得 configure 你的 module 設置(setup), 這視所用的 distrbution 而定。大部分的distributions 在 boot time 時會載入/etc/modules中所列的所有的 modules。Mandrake 10.x 是使用 /etc/modprobe.preload。對此,你可以在/etc/modules加一行,如下

ndiswrapper

6. WPA 支援

請參見 [WPA] Wiki on how to use WPA(Wi-fi Protected Access) with ndiswrapper.

转:http://wiki.gentoo.tw/index.php/NdisWrapper

用了一晚上时间装上了无线网卡的驱动,总结一下
开始的时候从http://ipw3945.sourceforge.net
下载ieee80211和ipw3945的驱动:
ieee80211-1.2.15
ipw3945-1.1.2
但是没有搞定(按照ipw3945包里的INSTALL文档)(有谁能搞定的补充一下)。后来看到用ndiswrapper搞定的。于是就安装了ndiswrapper,然后搞定:2cool
楼下有人说portage里有,emerge了一下果然有,但是我已经弄好了。。。就不再当小白了。。。谁用的这种方法补充一下吧。。

引用:
作者: superekcah
ipw3945和ieee80211Portage中有,以前可以正常使用,但使用新的2.6.19内核之后就连不上了,嗯,刚升级到1.1.2可以了


开始正题:
首先,关于无线网卡的使用,在内核中不要选择和IEEE 802.11有关的选项,但是要选择Wireless Extensions
然后install ndiswrapper:

代码:
gentoo # emerge ndiswrapper

应该会同时安装wireless-tools,如果没有安装就手动安装一下。
然后下载一个ipw3945的windows驱动,从这里
http://www.intel.com/support/wireles.../cs-010623.htm
下载zip格式的驱动,解压缩后里面有一个inf文件NETw39x5.inf
执行命令

代码:
gentoo Drivers # ndiswrapper -i NETw39x5.inf

ndiswrapper -l to check
ndiswrapper -m to load into modprobe.d
其他参数参考帮助

代码:
gentoo Drivers # ndiswrapper -l
installed drivers:
netw39x5 driver installed, hardware (8086:4228) present

Let's list the available wireless networks around me:

代码:
gentoo Drivers # iwlist wlan0 scan

wlan0 Scan completed :
Cell 01 - Address: 00:0D:02:47:3E:77
ESSID:""
Protocol:IEEE 802.11g
Mode:Managed
Frequency:2.442 GHz (Channel 7)
Quality:90/100 Signal level:-38 dBm Noise level:-96 dBm
Encryption key:off
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
12 Mb/s; 24 Mb/s; 36 Mb/s
Extra:bcn_int=100
Extra:atim=0

这里ESSID为空是因为我没有广播ESSID,因为在小区怕别人盗用,加密又比较麻烦
然后把/etc/conf.d/wireless.example复制到/etc/conf.d/wireless并修改一下(如果你的无线广播ESSID并且没有加密那么也许不需要修改,也许)
我的配置如下

代码:
essid_wlan0="access"
channel_wlan0="7"
config_access=( "dhcp" )

此外还需要

代码:
gentoo Drivers # ln -sf /etc/init.d/net.lo /etc/init.d/net.wlan0

然后执行命令

代码:
gentoo Drivers # /etc/init.d/net.wlan0 start

就可以启动你的无线了
下面是几个有点帮助的命令
iwconfig iwevent iwlist

PS:本来无线已经搞定,但是昨天晚上update系统以后无线又起不来了:ask ,好像gentoo又更新了网络的脚本,给/etc/conf.d/wireless里加了下面一句无线又可以起来了

代码:
iwconfig_wlan0= essid access channel 7 ap auto

PS2:如果内核有选项和ndiswrapper冲突,那么编译内核的时候把和wireless相关的选项比如ieee80211还有ipw3945都选为模块M就可以解决了



参考iwconfig的参数

代码:
gentoo conf.d # iwconfig --help
Usage: iwconfig [interface]
interface essid {NNN|any|on|off}
interface mode {managed|ad-hoc|master|...}
interface freq N.NNN[k|M|G]
interface channel N
interface bit {N[k|M|G]|auto|fixed}
interface rate {N[k|M|G]|auto|fixed}
interface enc {NNNN-NNNN|off}
interface key {NNNN-NNNN|off}
interface power {period N|timeout N|saving N|off}
interface nick NNN
interface nwid {NN|on|off}
interface ap {N|off|auto}
interface txpower {NmW|NdBm|off|auto}
interface sens N
interface retry {limit N|lifetime N}
interface rts {N|auto|fixed|off}
interface frag {N|auto|fixed|off}
interface modulation {11g|11a|CCK|OFDMg|...}
interface commit
Check man pages for more details.

我的

代码:
gentoo Drivers #iwconfig wlan0
wlan0 IEEE 802.11g ESSID:"access"
Mode:Managed Frequency:2.442 GHz Access Point: 00:0D:02:47:3E:77
Bit Rate=54 Mb/s
Fragment thr:-95 B
Encryption key:off
Power Management:off
Link Quality:85/100 Signal level:-41 dBm Noise level:-96 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0

用了一段时间后发现ndiswrapper会导致linux系统死机
貌似很简单的解决了:
emerge -C ndiswrapper
然后
emerge ipw3945
中间提示内核编译的时候IEEE80211_CRYPT_TKIP和IEEE80211_CRYPT_CCMP没有选上
选上上面两个选项重新编译内核,然后emerge ipw3945
然后重启系统问题就解决了,配置方面也没做什么改动,现在还没出什么问题:rolleyes:

转:http://www.linuxsir.org/bbs/showthread.php?t=284204

原文地址:https://www.cnblogs.com/pchgo/p/1649922.html