zoukankan      html  css  js  c++  java
  • Ubuntu之:解决无线网卡驱动问题

    今天安装Ubuntu的时候,碰到一个问题,装好系统之后,无线网卡是能用的,但是升级完系统之后,或者使用了Ubuntu推荐的无线网卡驱动之后,就不能用了。在网上查阅了相关资料之后终于找到了解决之道,那就是自己编译无线网卡内核驱动!

    1. 首先,我们需要确定无线网卡的型号,这个可以通过 【lspci | grep 802】来获取。我本本的无线网卡是: “04:00.0 Network controller: Broadcom Corporation BCM43225 802.11b/g/n (rev 01)”。好,型号就在里面,Broadcom BCM43225。

    2. 确定了型号之后,就上这个网址去查看Ubuntu下面的驱动:http://linuxwireless.org/en/users/Drivers/b43。可以看到,b43、wl、brcm80211这3个驱动,都是支持我的无线网卡的。那么一开始系统装好,无线网卡是能用的,那么用的是哪个驱动呢?这个可以通过【lsmod】来查看,可以看到,系统用的是brcm80211这个驱动,但是这个驱动有2个问题,一个是,这个不是系统推荐的驱动,所以系统一升级,驱动就被替换掉了(且不能用!这个不知道为什么);第二个是,无线网卡的LED灯,不会自动亮起。

    3. 那么,我们就接着试试看,b43这个驱动能不能用,可以使用【modprobe -r brcmsmac; modprobe b43】来加载,同样,灯还是不会亮,那么只能使用最后那个咯,wl。wl其实是Booadcom公司释出的开源驱动,不能直接使用,只能自己编译。

    4. 那就自己编一个咯。首先,我们必须确保linux内核的头文件已经安装,这个可以通过检查 /lib/modules/$(uname -r)/build 目录是否存在,假如不存在,那么就需要安装。使用如下命令安装:【apt-get install linux-headers-$(uname -r)】。

    5. 准备完毕,开始下载源代码:http://www.broadcom.com/support/802.11/linux_sta.php。我的系统是64位的,所以下载64位的tar包,下载完解压。

    6. 因为该驱动代码比较旧,在最新的Ubuntu 12.10上是编译不过的,所以需要修改一些代码,参考http://forums.fedoraforum.org/archive/index.php/t-280821.html帖子:

    1) get the source files from broadcom -- http://www.broadcom.com/docs/linux_sta/hybrid-portsrc_x86_64-v5_100_82_112.tar.gz
    
    2) make a new directory and extract the source files
    # mkdir hybrid-wl
    # cd hydrid-wl
    # tar -xvzf ../hybrid-portsrc_x86_64-v5_100_82_112.tar.gz
    
    3) change to the problematic file directory
    # cd src/wl/sys
    
    4) fix the source file wl_linux.c (of course use your favourite editor):
    # vi wl_linux.c
    around line 43, remove the line
    #include <asm/system.h>
    
    search for the string
    .ndo_set_multicast_list
    and replace it with
    .ndo_set_rx_mode
    
    save the file, and try to compile

    7. 好,退回到源代码的根目录,就可以编译了,使用命令:【make】先测试下,假如没问题,那么就安装到内核里面去:【make install】

    8. 好,再使用命令【depmod】,更新下内核的依赖,以便我们就可以使用modprobe來加载它。

    9. 好,准备加载wl驱动,先禁用原有的驱动:【modprobe -r b43 brcmsmac bcma】,这个时候,无线网卡就不能工作了。那么就试试看wl吧:【modprobe wl】,正常的话,无线网卡马上就可以工作了,LED灯也亮了!哈哈!成功!

    10. 还没完,为了让系统记住,将来永远使用wl驱动,我们需要把b43, brcmsmac, bcma这3个默认的内核驱动加入黑名单:【sudo vi /etc/modprobe.d/blacklist.conf】,在末尾加入:

           blacklist b43
           blacklist ssb
           blacklist brcmsmac
         保存文件后,重启测试,幸运的话,无线网卡能够正常使用,而且灯也会亮起!你可以使用【lsmod | grep wl】来确认下,系统使用的确实是wl驱动。


    以下是研究过程中,参考过的网页,很不错:

     - 这篇帖子写的比较全,我基本上是照着这个帖子做的:http://blog.sina.com.cn/s/blog_73b6331101016haq.html

     - 这篇是我在上面提过的,老外的论坛帖子:http://forums.fedoraforum.org/archive/index.php/t-280821.html

     - 这个比较高级,留待将来参考:http://www.anywlan.com/forum.php?mod=viewthread&tid=91707





  • 相关阅读:
    luogu_P1850 换教室
    luogu_P3224 [HNOI2012]永无乡
    luogu_P1064 金明的预算方案
    luogu_P2014 选课
    luogu_P3372 【模板】线段树 1(动态开点)
    luogu_P2852 [USACO06DEC]牛奶模式Milk Patterns
    luogu_P1941 飞扬的小鸟
    luogu_P2678 跳石头
    luogu_P1638 逛画展
    【Tyvj2046】掷骰子
  • 原文地址:https://www.cnblogs.com/puncha/p/3876935.html
Copyright © 2011-2022 走看看