加入收藏 | 设为首页 | 会员中心 | 我要投稿 应用网_丽江站长网 (http://www.0888zz.com/)- 科技、建站、数据工具、云上网络、机器学习!
当前位置: 首页 > 服务器 > 搭建环境 > Linux > 正文

linux 编译内核时网卡驱动丢失如何处理

发布时间:2022-06-11 16:36:37 所属栏目:Linux 来源:互联网
导读:Linux在编译内核期间遇到了网卡驱动丢失问题,看看下面我是如何把网卡找回的,有出现类似问题的朋友可以参考一下,我的系统 OS version:Centos 5.9 kernel:2.6.18-402 更新内核版本:2.6.20. 由于 yum 里面的内核头文件和卡发包并没有过多的源码 .c 文件,所以只
  Linux在编译内核期间遇到了网卡驱动丢失问题,看看下面我是如何把网卡找回的,有出现类似问题的朋友可以参考一下,我的系统 OS version:Centos 5.9 kernel:2.6.18-402 更新内核版本:2.6.20.
 
  由于 yum 里面的内核头文件和卡发包并没有过多的源码 .c 文件,所以只能从 www.kernel.org 下载相近的版本,有人肯定说了下你还不下个最新的内核版本,答:如内核版本跨度比较大,本人担心会出现各种问题,很多老的编译选项新版内核不支持.
 
  首先先下载 原系统的 开发包和头文件:
 
  shell $> yum install kernel-devel kernel-headers
  解压 2.6.20 内核压缩包,开始编译内核
  shell $> mv linux-2.6.20.tar.bz2 /usr/src/
  shell $> cd /usr/src/
  shell $> tar jxvf linux-2.6.20.tar.bz2
  shell $> cd linux-2.6.20
  # 修改源码 更改自己需要的,我修改了 tun 相关的 源码文件。
  shell $> make mrproper
   Feb 26 11:02:01 localhost kernel: intel_rng: don't want to disable this in firmware setup, and if
  Feb 26 11:02:01 localhost kernel: intel_rng: you are certain that your system has a functional
  Feb 26 11:02:01 localhost kernel: intel_rng: RNG, try using the 'no_fwh_detect' option.  
   
  # 看到了 pci_channel_offline
  # 下载对应网卡的驱动,编译安装看是否有错:
  shell $> wget http://www.broadcom.com/support/license.php?file=570x/linux-3.136h.zip
  shell $> reboot
  2.6.20 shell $> unzip linux-3.137h.zip
  2.6.20 shell $> tar zxvf tg3-3.136h.tar.gz
  2.6.20 shell $> cd tg3-3.136h
  2.6.20 shell $> make
  # 并没有报错,但是有警告:
   
    
  # 按照常规,警告我们是可以忽略的,那么我们更新这个驱动应该就没问题了,我跟你想的一样可是他还是有问题的
  2.6.20 shell $> make install
  2.6.20 shell $> rmmod tg3
  2.6.20 shell $> modprobe tg3
  # 还是报错了,看日志还是 Unknown symbol pci_channel_offline
  # 然后我就想 ,那我在老内核里编译看出错吗?结果在老内核里没有报错,我就在看老内核里 的 pci.h 文件,找到了 pci_channel_offline 方法:
   
  static inline int pci_channel_offline(struct pci_dev *pdev)
  {
          return (pdev->error_state != pci_channel_io_normal);
  }
   
  # 那么好,我把这段 复制到 2.6.20 内核里的 pci.h 里面
  2.6.20 shell $> vim /usr/src/linux-2.6.20/include/linux/pci.h
  # 加在 183行下面,在从新编译 网卡驱动
  2.6.20 shell $> make clean
  2.6.20 shell $> make
  # 这次 make 没错了
  2.6.20 shell $> make install
  2.6.20 shell $> rmmod tg3
  2.6.20 shell $> modprobe tg3
  # 重启网卡
  2.6.20 shell $> /etc/init.d/network restart
  //phpfensi.com
  # 至此解决!
  Linux 内核编译,解决网卡驱动缺少的问题.

(编辑:应用网_丽江站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读