Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3022420
  • 博文数量: 877
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 6125
  • 用 户 组: 普通用户
  • 注册时间: 2016-11-11 09:12
个人简介

To be a better coder

文章分类

全部博文(877)

文章存档

2022年(1)

2021年(60)

2020年(175)

2019年(207)

2018年(210)

2017年(143)

2016年(81)

分类: LINUX

2019-04-22 09:07:39


[root@localhost kernels]# cp -rf /lib/modules/3.18.92/ ./
[root@localhost kernels]#
[root@localhost kernels]#
[root@localhost kernels]# ls
3.17.4-301.fc21.x86_64  3.18.92  4.1.6-100.fc21.x86_64
[root@localhost kernels]#
[root@localhost kernels]#
[root@localhost kernels]#
[root@localhost kernels]# rm -rf  /usr/src/linux
[root@localhost kernels]#
[root@localhost kernels]#
[root@localhost kernels]#
[root@localhost kernels]#
[root@localhost kernels]# ls
3.17.4-301.fc21.x86_64  3.18.92  4.1.6-100.fc21.x86_64
[root@localhost kernels]#
[root@localhost kernels]#
[root@localhost kernels]#
[root@localhost kernels]# ln -s /usr/src/kernels/3.18.92/ /usr/src/linux
[root@localhost kernels]#
[root@localhost kernels]# ls
3.17.4-301.fc21.x86_64  3.18.92  4.1.6-100.fc21.x86_64
[root@localhost kernels]#
[root@localhost kernels]#
[root@localhost kernels]#
[root@localhost kernels]#
[root@localhost kernels]# ls /lib/modules/3.18.
3.18.24/ 3.18.48/ 3.18.92/
[root@localhost kernels]# ls /lib/modules/3.18.48/
arch/                Documentation/       init/                lib/                 modules.alias.bin    modules.devname      Module.symvers       scripts/             System.map           vmlinux
block/               drivers/             ipc/                 MAINTAINERS          modules.builtin      modules.order        net/                 security/            tools/               vmlinux.o
COPYING              firmware/            Kbuild               Makefile             modules.builtin.bin  modules.softdep      README               signing_key.priv     usr/                 x509.genkey
CREDITS              fs/                  Kconfig              mm/                  modules.dep          modules.symbols      REPORTING-BUGS       signing_key.x509     venus.config         
crypto/              include/             kernel/              modules.alias        modules.dep.bin      modules.symbols.bin  samples/             sound/               virt/                
[root@localhost kernels]# ls /lib/modules/3.18.48/
arch/                Documentation/       init/                lib/                 modules.alias.bin    modules.devname      Module.symvers       scripts/             System.map           vmlinux
block/               drivers/             ipc/                 MAINTAINERS          modules.builtin      modules.order        net/                 security/            tools/               vmlinux.o
COPYING              firmware/            Kbuild               Makefile             modules.builtin.bin  modules.softdep      README               signing_key.priv     usr/                 x509.genkey
CREDITS              fs/                  Kconfig              mm/                  modules.dep          modules.symbols      REPORTING-BUGS       signing_key.x509     venus.config         
crypto/              include/             kernel/              modules.alias        modules.dep.bin      modules.symbols.bin  samples/             sound/               virt/                
[root@localhost kernels]#




CentOS 编译安装 ixgbe-5.3.7


1. 安装依赖

# yum install gcc kernel-header kernel-devel 

2. 解压源码并编译

# 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  make[1]: Entering directory `/usr/src/kernels/3.10.0-862.6.3.el7.x86_64'  CC [M] /root/ixgbe-5.3.7/src/ixgbe_main.o  CC [M] /root/ixgbe-5.3.7/src/ixgbe_api.o  CC [M] /root/ixgbe-5.3.7/src/ixgbe_common.o  CC [M] /root/ixgbe-5.3.7/src/ixgbe_dcb.o  CC [M] /root/ixgbe-5.3.7/src/ixgbe_dcb_82598.o  CC [M] /root/ixgbe-5.3.7/src/ixgbe_dcb_82599.o  CC [M] /root/ixgbe-5.3.7/src/ixgbe_ethtool.o  CC [M] /root/ixgbe-5.3.7/src/ixgbe_lib.o  CC [M] /root/ixgbe-5.3.7/src/ixgbe_mbx.o  CC [M] /root/ixgbe-5.3.7/src/ixgbe_sriov.o  CC [M] /root/ixgbe-5.3.7/src/ixgbe_param.o  CC [M] /root/ixgbe-5.3.7/src/ixgbe_phy.o  CC [M] /root/ixgbe-5.3.7/src/ixgbe_procfs.o  CC [M] /root/ixgbe-5.3.7/src/ixgbe_82598.o  CC [M] /root/ixgbe-5.3.7/src/ixgbe_82599.o  CC [M] /root/ixgbe-5.3.7/src/ixgbe_x540.o  CC [M] /root/ixgbe-5.3.7/src/ixgbe_x550.o  CC [M] /root/ixgbe-5.3.7/src/ixgbe_dcb_nl.o  CC [M] /root/ixgbe-5.3.7/src/ixgbe_debugfs.o  CC [M] /root/ixgbe-5.3.7/src/ixgbe_fcoe.o  CC [M] /root/ixgbe-5.3.7/src/ixgbe_ptp.o  CC [M] /root/ixgbe-5.3.7/src/ixgbe_sysfs.o  CC [M] /root/ixgbe-5.3.7/src/kcompat.o  LD [M] /root/ixgbe-5.3.7/src/ixgbe.o  Building modules, stage 2.  MODPOST 1 modules  CC /root/ixgbe-5.3.7/src/ixgbe.mod.o  LD [M] /root/ixgbe-5.3.7/src/ixgbe.ko make[1]: Leaving directory `/usr/src/kernels/3.10.0-862.6.3.el7.x86_64' 

查看编译后驱动信息

# modinfo ./ixgbe.ko filename: /root/ixgbe-5.3.7/src/./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 ………… 

3. 加载驱动

如果系统已经安装 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 

4. 安装 ixgbe 驱动

确认驱动加载成功后,继续安装驱动到系统

# 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/ 

编译好的驱动将在启动的时候自动加载,也可以用以下命令加载

# modprobe ixgbe  # modinfo ixgbe filename: /lib/modules/3.10.0-862.6.3.el7.x86_64/updates/drivers/net/ethernet/intel/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 ……
阅读(3552) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~