AR8171驱动编译及挂载

作品设计

作者:biner · 时间:2018-06-11 · 点击数:3198 · 评论:0

目前安装centos7.5,发现Atheros AR8171 网卡不支持wake on了,原来在2013-07-03的时候已经从内核移除 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/drivers/net/ethernet/atheros/alx?ofs=50
centos7.5的内核还很老

#uname -a
3.10.0-862.3.2.el7.x86_64

OK,我们重新编译


1.下载3.10.53的内核
#cd /home
#wget https://mirrors.edge.kernel.org/pub/linux/kernel/v3.x/linux-3.10.53.tar.xz
#tar xf linux-3.10.53.tar.xz
2.编译
#cd linux-3.10.53/drivers/net/ethernet/atheros/alx/
#make -C /lib/modules/`uname -r`/build M=`pwd` modules

如果报错,请打开main.c把747,1234前面加上//注释掉,重新执行,如果没有报错,可以执行下面的命令,建议不要远程执行,会断网无法连接

3.验证

enp2s0是我的网卡名称,这样输出的信息就会有Wake-on: pg了,完整的像下面这样:

#rmmod alx
#insmod alx.ko
#ethtool enp2s0

Settings for enp2s0:
    Supported ports: [ TP ]
    Supported link modes:   10baseT/Half 10baseT/Full 
                            100baseT/Half 100baseT/Full 
                            1000baseT/Full 
    Supported pause frame use: Symmetric
    Supports auto-negotiation: Yes
    Supported FEC modes: Not reported
    Advertised link modes:  10baseT/Half 10baseT/Full 
                            100baseT/Half 100baseT/Full 
                            1000baseT/Full 
    Advertised pause frame use: Symmetric
    Advertised auto-negotiation: Yes
    Advertised FEC modes: Not reported
    Speed: 1000Mb/s
    Duplex: Full
    Port: Twisted Pair
    PHYAD: 0
    Transceiver: internal
    Auto-negotiation: on
    MDI-X: Unknown
    Supports Wake-on: pg
    Wake-on: pg
    Current message level: 0x000060e4 (24804)
                   link ifup rx_err tx_err hw wol
    Link detected: yes
4.安装

写一个脚本,卸载内核驱动,使用编译的驱动;命名为alx.sh,权限为777

#!/bin/sh
cd /lib/modules/$(uname -r)/kernel/drivers/net/ethernet/atheros/alx/
rmmod alx
insmod alx.ko

写一个服务,自启动,权限为745,并拷贝到/usr/lib/systemd/system,命名为alx.service

[Unit]
Description=alx
After=network.target

[Service]
Type=forking
ExecStart=/lib/modules/3.10.0-862.3.2.el7.x86_64/kernel/drivers/net/ethernet/atheros/alx/alx.sh

[Install]
WantedBy=multi-user.target
#cp alx.service /usr/lib/systemd/system
#cp alx.ko /lib/modules/`uname -r`/kernel/drivers/net/ethernet/atheros/alx/alx.ko
#cp alx.sh /lib/modules/`uname -r`/kernel/drivers/net/ethernet/atheros/alx/alx.sh
#systemctl enable alx.service
#systemctl start alx.service
#reboot
参考:

https://www.linuxquestions.org/questions/linux-networking-3/qualcomm-atheros-ar8171-wake-on-lan-issues-4175491464/

https://mirrors.edge.kernel.org/pub/linux/kernel/v3.x/

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/drivers/net/ethernet/atheros/alx?ofs=50

标签:
评论列表