[求助]Atheros AR8162网卡驱动问题

linux-ebjp:~ # lspci -vvv | grep Eth
03:00.0 Ethernet controller: Qualcomm Atheros AR8162 Fast Ethernet (rev 08)

看过了 [ 分享 ] 编译 Atheros 有线网卡

这个帖子。继续求助,我用的 openSUSE13.1.

2 楼的方法不怎么奏效。。。
然后编译,
编译报错:

kosmos@linux-ebjp:~/compat-drivers-2013-03-04-u> make >/dev/null
/home/kosmos/compat-drivers-2013-03-04-u/drivers/net/ethernet/atheros/alx/alx_main.c: In function ‘alx_dispatch_skb’:
/home/kosmos/compat-drivers-2013-03-04-u/drivers/net/ethernet/atheros/alx/alx_main.c:700:4: error: too few arguments to function ‘__vlan_hwaccel_put_tag’
    __vlan_hwaccel_put_tag(skb, ntohs(tag));
    ^
In file included from /home/kosmos/compat-drivers-2013-03-04-u/drivers/net/ethernet/atheros/alx/alx_main.c:22:0:
/usr/src/linux-3.11.6-4/include/linux/if_vlan.h:236:31: note: declared here
 static inline struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb,
                               ^
/home/kosmos/compat-drivers-2013-03-04-u/drivers/net/ethernet/atheros/alx/alx_main.c: In function ‘alx_set_vlan_mode’:
/home/kosmos/compat-drivers-2013-03-04-u/drivers/net/ethernet/atheros/alx/alx_main.c:1141:17: error: ‘NETIF_F_HW_VLAN_RX’ undeclared (first use in this function)
  if (features & NETIF_F_HW_VLAN_RX)
                 ^
/home/kosmos/compat-drivers-2013-03-04-u/drivers/net/ethernet/atheros/alx/alx_main.c:1141:17: note: each undeclared identifier is reported only once for each function it appears in
/home/kosmos/compat-drivers-2013-03-04-u/drivers/net/ethernet/atheros/alx/alx_main.c: In function ‘alx_fix_features’:
/home/kosmos/compat-drivers-2013-03-04-u/drivers/net/ethernet/atheros/alx/alx_main.c:1158:17: error: ‘NETIF_F_HW_VLAN_RX’ undeclared (first use in this function)
  if (features & NETIF_F_HW_VLAN_RX)
                 ^
/home/kosmos/compat-drivers-2013-03-04-u/drivers/net/ethernet/atheros/alx/alx_main.c:1159:15: error: ‘NETIF_F_HW_VLAN_TX’ undeclared (first use in this function)
   features |= NETIF_F_HW_VLAN_TX;
               ^
/home/kosmos/compat-drivers-2013-03-04-u/drivers/net/ethernet/atheros/alx/alx_main.c: In function ‘alx_set_features’:
/home/kosmos/compat-drivers-2013-03-04-u/drivers/net/ethernet/atheros/alx/alx_main.c:1176:18: error: ‘NETIF_F_HW_VLAN_RX’ undeclared (first use in this function)
  if (!(changed & NETIF_F_HW_VLAN_RX))
                  ^
/home/kosmos/compat-drivers-2013-03-04-u/drivers/net/ethernet/atheros/alx/alx_main.c: In function ‘alx_probe’:
/home/kosmos/compat-drivers-2013-03-04-u/drivers/net/ethernet/atheros/alx/alx_main.c:2637:10: error: ‘NETIF_F_HW_VLAN_RX’ undeclared (first use in this function)
          NETIF_F_HW_VLAN_RX |
          ^
/home/kosmos/compat-drivers-2013-03-04-u/drivers/net/ethernet/atheros/alx/alx_main.c:2640:43: error: ‘NETIF_F_HW_VLAN_TX’ undeclared (first use in this function)
  netdev->features = netdev->hw_features | NETIF_F_HW_VLAN_TX;
                                           ^
make[6]: *** [/home/kosmos/compat-drivers-2013-03-04-u/drivers/net/ethernet/atheros/alx/alx_main.o] 错误 1
make[5]: *** [/home/kosmos/compat-drivers-2013-03-04-u/drivers/net/ethernet/atheros/alx] 错误 2
make[4]: *** [/home/kosmos/compat-drivers-2013-03-04-u/drivers/net/ethernet/atheros] 错误 2
make[3]: *** [_module_/home/kosmos/compat-drivers-2013-03-04-u] 错误 2
make[2]: *** [sub-make] 错误 2
make[1]: *** [all] 错误 2
make: *** [modules] 错误 2

我之前用的 Mint,报同样的错,看到 openSUSE 有 rpm 包才来的,结果这个也不行。。。
不知道是什么这个错是什么原因?。。。

因为你的下载的版本和你已经装的内核版本的问题。

你要去 backports.wiki.kernel.org 下载最新版比如 backports-3.17-rc3-1

然后解压

tar -xf backports-3.17-rc3-1.tar.xz

编译

cd backports-3.17-rc3-1/drivers/net/ethernet/atheros/alx
make -C /lib/modules/`uname -r`/build M=`pwd` modules

得到的那个 alx.ko 就是你驱动的内核模块。

至于安装内核开发包,手动加载模块什么的去看之前的帖子。

另外 kernel:stable 源里的内核有提供 alx.ko。你也可以去升级内核。