To be a better coder
分类: LINUX
2019-04-22 09:07:39
yum install gcc kernel-header kernel-devel
|
tar zxvf ixgbe-5.3.7.tar.gz cd ixgbe-5.3.7/src/ make |
此时还是有以下错误
# make common.mk:102: *** Kernel header files not in any of the expected locations. common.mk:103: *** Install the appropriate kernel development package, e.g. common.mk:104: *** kernel-devel, for building kernel modules and try again. Stop. |
打开 common.mk 发现编译时需要 /usr/src/linux 目录,但是系统并没有此目录,手动创建 /usr/src/kernels/3.10.0-862.6.3.el7.x86_64/ 到 /usr/src/linux 的链接即可
# ln -s /usr/src/kernels/3.10.0-862.6.3.el7.x86_64/ /usr/src/linux
|
重新编译
make[1]: Entering directory ` src3.10.0-862.6.3.el7.x86_64' CC [M] -5.3.7 ixgbe_main.o ixgbe CC [M] -5.3.7 ixgbe_api.o ixgbe CC [M] -5.3.7 ixgbe_common.o ixgbe CC [M] -5.3.7 ixgbe_dcb.o ixgbe CC [M] -5.3.7 ixgbe_dcb_82598.o ixgbe CC [M] -5.3.7 ixgbe_dcb_82599.o ixgbe CC [M] -5.3.7 ixgbe_ethtool.o ixgbe CC [M] -5.3.7 ixgbe_lib.o ixgbe CC [M] -5.3.7 ixgbe_mbx.o ixgbe CC [M] -5.3.7 ixgbe_sriov.o ixgbe CC [M] -5.3.7 ixgbe_param.o ixgbe CC [M] -5.3.7 ixgbe_phy.o ixgbe CC [M] -5.3.7 ixgbe_procfs.o ixgbe CC [M] -5.3.7 ixgbe_82598.o ixgbe CC [M] -5.3.7 ixgbe_82599.o ixgbe CC [M] -5.3.7 ixgbe_x540.o ixgbe CC [M] -5.3.7 ixgbe_x550.o ixgbe CC [M] -5.3.7 ixgbe_dcb_nl.o ixgbe CC [M] -5.3.7 ixgbe_debugfs.o ixgbe CC [M] -5.3.7 ixgbe_fcoe.o ixgbe CC [M] -5.3.7 ixgbe_ptp.o ixgbe CC [M] -5.3.7 ixgbe_sysfs.o ixgbe CC [M] -5.3.7 kcompat.o ixgbe LD [M] -5.3.7 ixgbe.o ixgbe Building modules, stage 2. MODPOST 1 modules CC -5.3.7 ixgbe.mod.o ixgbe LD [M] -5.3.7 ixgbe.ko ixgbemake[1]: Leaving directory ` src3.10.0-862.6.3.el7.x86_64' |
查看编译后驱动信息
filename: ixgbe-5.3.7 ./ixgbe.ko version: 5.3.7 license: GPL description: Intel(R) 10GbE PCI Express Linux Network Driver author: Intel Corporation, retpoline: Y rhelversion: 7.5 srcversion: 9E1B3824190E963083DADF5 ………… |
如果系统已经安装 ixgbe 驱动要先卸载
rmmod ixgbe.ko lsmod | grep ixgbe ixgbevf 62069 0 |
加载ixgbe驱动
# insmod ./ixgbe.ko # lsmod | grep ixgbe ixgbe 329961 0 ixgbevf 62069 0 dca 15130 2 ixgbe,ioatdma ptp 19231 2 tg3,ixgbe |
使用 dmesg 验证驱动是否加载成功
# dmesg [681507.970884] Intel(R) 10GbE PCI Express Linux Network Driver - version 5.3.7 [681507.970886] Copyright(c) 1999 - 2018 Intel Corporation. [681507.989690] ixgbe: 0000:05:00.0: ixgbe_check_options: FCoE Offload feature enabled [681508.138527] ixgbe 0000:05:00.0: irq 95 for MSI/MSI-X [681508.138537] ixgbe 0000:05:00.0: irq 96 for MSI/MSI-X [681508.138549] ixgbe 0000:05:00.0: irq 97 for MSI/MSI-X [681508.138557] ixgbe 0000:05:00.0: irq 98 for MSI/MSI-X [681508.138569] ixgbe 0000:05:00.0: irq 99 for MSI/MSI-X [681508.138577] ixgbe 0000:05:00.0: irq 100 for MSI/MSI-X [681508.138589] ixgbe 0000:05:00.0: irq 101 for MSI/MSI-X [681508.138597] ixgbe 0000:05:00.0: irq 102 for MSI/MSI-X [681508.138609] ixgbe 0000:05:00.0: irq 103 for MSI/MSI-X [681508.138616] ixgbe 0000:05:00.0: irq 104 for MSI/MSI-X [681508.138624] ixgbe 0000:05:00.0: irq 105 for MSI/MSI-X [681508.138632] ixgbe 0000:05:00.0: irq 106 for MSI/MSI-X [681508.138640] ixgbe 0000:05:00.0: irq 107 for MSI/MSI-X [681508.138648] ixgbe 0000:05:00.0: irq 108 for MSI/MSI-X [681508.138656] ixgbe 0000:05:00.0: irq 109 for MSI/MSI-X [681508.138664] ixgbe 0000:05:00.0: irq 110 for MSI/MSI-X [681508.138671] ixgbe 0000:05:00.0: irq 111 for MSI/MSI-X [681508.138679] ixgbe 0000:05:00.0: irq 112 for MSI/MSI-X [681508.138691] ixgbe 0000:05:00.0: irq 113 for MSI/MSI-X [681508.138698] ixgbe 0000:05:00.0: irq 114 for MSI/MSI-X [681508.138706] ixgbe 0000:05:00.0: irq 115 for MSI/MSI-X [681508.138714] ixgbe 0000:05:00.0: irq 116 for MSI/MSI-X [681508.138722] ixgbe 0000:05:00.0: irq 117 for MSI/MSI-X [681508.138730] ixgbe 0000:05:00.0: irq 118 for MSI/MSI-X [681508.138737] ixgbe 0000:05:00.0: irq 119 for MSI/MSI-X [681508.138751] ixgbe 0000:05:00.0: irq 120 for MSI/MSI-X [681508.138758] ixgbe 0000:05:00.0: irq 121 for MSI/MSI-X |
确认驱动加载成功后,继续安装驱动到系统
# make install make[1]: Entering directory `/usr/src/kernels/3.10.0-862.6.3.el7.x86_64' Building modules, stage 2. MODPOST 1 modules make[1]: Leaving directory `/usr/src/kernels/3.10.0-862.6.3.el7.x86_64' Copying manpages... Installing modules... make[1]: Entering directory `/usr/src/kernels/3.10.0-862.6.3.el7.x86_64' INSTALL /root/ixgbe-5.3.7/src/ixgbe.ko Can't read private key DEPMOD 3.10.0-862.6.3.el7.x86_64 make[1]: Leaving directory `/usr/src/kernels/3.10.0-862.6.3.el7.x86_64' Running depmod... |
ixgbe.ko 会被安装到以下目录
/lib/modules/KERNEL_VERSION/updates/drivers/net/ethernet/intel/ixgbe/
|
编译好的驱动将在启动的时候自动加载,也可以用以下命令加载
filename: modules/3.10.0-862.6.3.el7.x86_64 drivers ethernet ixgbe/ixgbe.ko version: 5.3.7 license: GPL description: Intel(R) 10GbE PCI Express Linux Network Driver author: Intel Corporation, retpoline: Y rhelversion: 7.5 srcversion: 9E1B3824190E963083DADF5 …… |