ar8161网卡 linux,解决AR8161网卡驱动的方法

linux内核普遍不支持AR8161系列网卡。很多系统装上之后,不能用以太网。有些网站说的也不是很对,我这里总结以下解决办法。

安装完成后没有eth0,也不能启动网卡

# ifconfig

lo Link encap:Local Loopback

inet addr:127.0.0.1 Mask:255.0.0.0

inet6 addr: ::1/128 Scope:Host

UP LOOPBACK RUNNING MTU:65536 Metric:1

RX packets:32 errors:0 dropped:0 overruns:0 frame:0

TX packets:32 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:1600 (1.5 Kb) TX bytes:1600 (1.5 Kb)

看一下自己的网卡型号

# lspci |grep net

02:00.0 Ethernet controller: Atheros Communications Inc. AR8161 Gigabit Ethernet (rev 08)

google,baidu到的就是需要安装compat-wireless兼容驱动。下载之~

点击打开链接 或点这里

下载候开始安装。

# tar xf compat-wireless-3.6.8-1.tar.bz2

# cd compat-wireless-3.6.8-1/

# ./scripts/driver-select alx

Processing new driver-select request...

Backing up makefile: Makefile.bk

Backup exists: Makefile.bk

Backing up makefile: drivers/net/ethernet/broadcom/Makefile.bk

Backing up makefile: drivers/net/ethernet/atheros/Makefile.bk

Backup exists: Makefile.bk

Backup exists: Makefile.bk

Backup exists: drivers/net/ethernet/broadcom/Makefile.bk

# make

make -C /lib/modules/3.7.10-1.24-desktop/build M=/HardDisk/tmp/compat-wireless-3.6.8-1 modules

make[1]: Entering directory `/usr/src/linux-3.7.10-1.24-obj/x86_64/desktop'

/usr/src/linux-3.7.10-1.24/scripts/Makefile.build:44: /HardDisk/tmp/compat-wireless-3.6.8-1/drivers/net/ethernet/atheros/alx/Makefile: No such file or directory

make[6]: *** No rule to make target `/HardDisk/tmp/compat-wireless-3.6.8-1/drivers/net/ethernet/atheros/alx/Makefile'.  Stop.

make[5]: *** [/HardDisk/tmp/compat-wireless-3.6.8-1/drivers/net/ethernet/atheros/alx] Error 2

make[4]: *** [/HardDisk/tmp/compat-wireless-3.6.8-1/drivers/net/ethernet/atheros] Error 2

make[3]: *** [_module_/HardDisk/tmp/compat-wireless-3.6.8-1] Error 2

make[2]: *** [sub-make] Error 2

make[1]: *** [all] Error 2

make[1]: Leaving directory `/usr/src/linux-3.7.10-1.24-obj/x86_64/desktop'

make: *** [modules] Error 2

在这里出现问题了,drivers/net/ethernet/atheros/alx/Makefile: No such file or directory.

说没有发现makefile.然后看到github上的这个 根据三楼说的,需要下载compat-drivers

看这里

安装compat-drivers

# tar xf compat-drivers-2013-03-04-u.tar.bz2#注意这里软件包的名字,不是compat-drivers-2013-02-03.tar.gz

# cd compat-drivers-2013-03-04-u/

ompat-drivers-2013-03-04-u # ./scripts/driver-select alx

Processing new driver-select request...

Backing up makefile: Makefile.bk

Backup exists: Makefile.bk

Backing up makefile: drivers/net/ethernet/broadcom/Makefile.bk

Backing up makefile: drivers/net/ethernet/atheros/Makefile.bk

Backup exists: Makefile.bk

Backup exists: Makefile.bk

Backup exists: drivers/net/ethernet/broadcom/Makefile.bk

compat-drivers-2013-03-04-u # make

./scripts/gen-compat-autoconf.sh /HardDisk/tmp/compat-drivers-2013-03-04-u/.config /HardDisk/tmp/compat-drivers-2013-03-04-u/config.mk > include/linux/compat_autoconf.h

make -C /lib/modules/3.7.10-1.24-desktop/build M=/HardDisk/tmp/compat-drivers-2013-03-04-u modules

make[1]: Entering directory `/usr/src/linux-3.7.10-1.24-obj/x86_64/desktop'

CC [M]  /HardDisk/tmp/compat-drivers-2013-03-04-u/compat/main.o

In file included from /HardDisk/tmp/compat-drivers-2013-03-04-u/include/linux/compat-2.6.h:72:0,

from :0:

/HardDisk/tmp/compat-drivers-2013-03-04-u/include/linux/compat-3.9.h:133:29: error: redefinition of ‘file_inode’

In file included from /usr/src/linux-3.7.10-1.24/include/linux/compat.h:15:0,

from /usr/src/linux-3.7.10-1.24/include/linux/ethtool.h:15,

from /usr/src/linux-3.7.10-1.24/include/linux/netdevice.h:42,

from /HardDisk/tmp/compat-drivers-2013-03-04-u/include/linux/compat-2.6.29.h:5,

from /HardDisk/tmp/compat-drivers-2013-03-04-u/include/linux/compat-2.6.h:52,

from :0:

/usr/src/linux-3.7.10-1.24/include/linux/fs.h:2247:29: note: previous definition of ‘file_inode’ was here

make[5]: *** [/HardDisk/tmp/compat-drivers-2013-03-04-u/compat/main.o] Error 1

make[4]: *** [/HardDisk/tmp/compat-drivers-2013-03-04-u/compat] Error 2

make[3]: *** [_module_/HardDisk/tmp/compat-drivers-2013-03-04-u] Error 2

make[2]: *** [sub-make] Error 2

make[1]: *** [all] Error 2

make[1]: Leaving directory `/usr/src/linux-3.7.10-1.24-obj/x86_64/desktop'

make: *** [modules] Error 2我看compat-drivers和compat-wireless目录非常像,照着安装compat-wireless的安装,结果报一堆错误。

注意,重点到了

那就按照github上说的来吧。不过这里不是从compat-wireless拷贝文件到compat-drivers,而是反着过来的。估计github上的那位网友没有注意吧。。。

# cp -r compat-drivers-2013-03-04-u/drivers/net/ethernet/atheros/alx/* compat-wireless-3.6.8-1/drivers/net/ethernet/atheros/alx/

然后开始安装

# cd compat-wireless-3.6.8-1/

compat-wireless-3.6.8-1 # make

make -C /lib/modules/3.7.10-1.24-desktop/build M=/HardDisk/tmp/compat-wireless-3.6.8-1 modules

make[1]: Entering directory `/usr/src/linux-3.7.10-1.24-obj/x86_64/desktop'

CC [M]  /HardDisk/tmp/compat-wireless-3.6.8-1/drivers/net/ethernet/atheros/alx/alx_main.o

CC [M]  /HardDisk/tmp/compat-wireless-3.6.8-1/drivers/net/ethernet/atheros/alx/alx_ethtool.o

CC [M]  /HardDisk/tmp/compat-wireless-3.6.8-1/drivers/net/ethernet/atheros/alx/alx_hw.o

LD [M]  /HardDisk/tmp/compat-wireless-3.6.8-1/drivers/net/ethernet/atheros/alx/alx.o

Building modules, stage 2.

MODPOST 2 modules

CC      /HardDisk/tmp/compat-wireless-3.6.8-1/compat/compat.mod.o

LD [M]  /HardDisk/tmp/compat-wireless-3.6.8-1/compat/compat.ko

CC      /HardDisk/tmp/compat-wireless-3.6.8-1/drivers/net/ethernet/atheros/alx/alx.mod.o

LD [M]  /HardDisk/tmp/compat-wireless-3.6.8-1/drivers/net/ethernet/atheros/alx/alx.ko

make[1]: Leaving directory `/usr/src/linux-3.7.10-1.24-obj/x86_64/desktop'编译成功了。去看看生成的驱动

compat-wireless-3.6.8-1 # cd drivers/net/ethernet/atheros/alx/

compat-wireless-3.6.8-1/drivers/net/ethernet/atheros/alx # ls

.alx.ko.cmd     .alx_ethtool.o.cmd  Makefile  alx.mod.c  alx_ethtool.c  alx_hw.h    alx_main.o

.alx.mod.o.cmd  .alx_hw.o.cmd       alx.h     alx.mod.o  alx_ethtool.o  alx_hw.o    alx_reg.h

.alx.o.cmd      .alx_main.o.cmd     alx.ko    alx.o      alx_hw.c       alx_main.c  modules.order看到亲爱的

alx.ko 了,这就是网卡驱动了。有没有特别亲切啊~~~激动啊~~~

你可以把alx.ko复制到系统模块目录里

# cp alx.ko /lib/modules/3.7.10-1.1-default/updates/drivers/net/ethernet/atheros/alx/或者直接安装

compat-wireless-3.6.8-1 # make install

加载一下模块

#modprobe alx

# modprobe -l|grep alx.ko

updates/drivers/net/ethernet/atheros/alx/alx.ko

安装成功。

看看以太网可以用了吗,(*^__^*) 嘻嘻……

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值