admin管理员组

文章数量:1532080

linux平台:中标麒麟桌面操作系统

GCC:gcc (GCC) 4.9.3 20150626 (NeoKylin 4.9.3-3)

买回来一款Intel的网卡,型号I210

如果想要安装这个网卡的驱动,需要去找此网卡的驱动源码。

当然,Intel已经帮我们把驱动源码写好了,我们要做的

只需要交叉编译这个驱动源码。

进入Intel驱动官网

https://downloadcenter.intel/zh-cn/download/13663

igb-5.3.5.36

英特尔®适用于 82575/6、82580、I350 和 I210/211 基于 Linux 的千兆位网络连接的网络适配器驱动程序

解压之后,查看README文件

Building and Installation
-------------------------
To build a binary RPM* package of this driver, run 'rpmbuild -tb
igb-<x.x.x>.tar.gz', where <x.x.x> is the version number for the driver tar
file.

Note: For the build to work properly, the currently running kernel MUST match
the version and configuration of the installed kernel sources. If you have just
recompiled the kernel reboot the system before building.

- To compile the driver on some kernel/arch combinations, a package with the
development version of libelf (e.g. libelf-dev, libelf-devel,
elfutilsl-libelf-devel) may need to be installed.

Note: RPM functionality has only been tested in Red Hat distributions.


1. Move the base driver tar file to the directory of your choice. For
   example, use '/home/username/igb' or '/usr/local/src/igb'.

2. Untar/unzip the archive, where <x.x.x> is the version number for the
   driver tar file:
   tar zxf igb-<x.x.x>.tar.gz

3. Change to the driver src directory, where <x.x.x> is the version number
   for the driver tar:
   cd igb-<x.x.x>/src/

4. Compile the driver module:
   # make install
   The binary will be installed as:
   /lib/modules/<KERNEL VERSION>/updates/drivers/net/ethernet/intel/igb/igb.ko

   The install location listed above is the default location. This may differ
   for various Linux distributions.

5. Load the module using the modprobe command:
   modprobe <igb> [parameter=port1_value,port2_value]

   Make sure that any older igb drivers are removed from the kernel before
   loading the new module:
   rmmod igb; modprobe igb

6. Assign an IP address to the interface by entering the following,
   where ethX is the interface name that was shown in dmesg after modprobe:
  
   ip address add <IP_address>/<netmask bits> dev ethX

7. Verify that the interface works. Enter the following, where IP_address
   is the IP address for another machine on the same subnet as the interface
   that is being tested:
   ping <IP_address>

To build igb driver with DCA
----------------------------
If your kernel supports DCA, the driver will build by default with DCA enabled.

Note: For certain distributions like (but not limited to) RedHat Enterprise
Linux 7 and Ubuntu, once the driver is installed the initrd/initramfs file may
need to be updated to prevent the OS loading old versions of the igb driver.
The dracut utility may be used on RedHat distributions:
	# dracut --force
   For Ubuntu:
	# update-initramfs -u

查看完building and Insallation之后

具体步骤

[root@localhost igb-5.3.5.36]# ls
COPYING  igb.7  igb.spec  pci.updates  README  scripts  src  SUMS
[root@localhost igb-5.3.5.36]# cd src
[root@localhost src]# ls
common.mk        e1000_manage.h  igb_ethtool.c  igb_ptp.o
e1000_82575.c    e1000_manage.o  igb_ethtool.o  igb_regtest.h
e1000_82575.h    e1000_mbx.c     igb.h          igb_vmdq.c
e1000_82575.o    e1000_mbx.h     igb_hwmon.c    igb_vmdq.h
e1000_api.c      e1000_mbx.o     igb_hwmon.o    igb_vmdq.o
e1000_api.h      e1000_nvm.c     igb.ko         kcompat.c
e1000_api.o      e1000_nvm.h     igb_main.c     kcompat_ethtool.c
e1000_defines.h  e1000_nvm.o     igb_main.o     kcompat.h
e1000_hw.h       e1000_osdep.h   igb.mod.c      kcompat.o
e1000_i210.c     e1000_phy.c     igb.mod.o      kcompat_overflow.h
e1000_i210.h     e1000_phy.h     igb.o          Makefile
e1000_i210.o     e1000_phy.o     igb_param.c    modules.order
e1000_mac.c      e1000_regs.h    igb_param.o    Module.supported
e1000_mac.h      igb.7.gz        igb_procfs.c   Module.symvers
e1000_mac.o      igb_debugfs.c   igb_procfs.o
e1000_manage.c   igb_debugfs.o   igb_ptp.c
[root@localhost src]# make clean
make[1]: Entering directory '/usr/src/kernels/3.10.0-2.nd7.33.mips64el'
  CLEAN   /home/100trust/igb-5.3.5.36/src/.tmp_versions
  CLEAN   /home/100trust/igb-5.3.5.36/src/Module.symvers
make[1]: Leaving directory '/usr/src/kernels/3.10.0-2.nd7.33.mips64el'
[root@localhost src]# make install
make[1]: Entering directory '/usr/src/kernels/3.10.0-2.nd7.33.mips64el'
  CC [M]  /home/100trust/igb-5.3.5.36/src/igb_main.o
  CC [M]  /home/100trust/igb-5.3.5.36/src/e1000_api.o
  CC [M]  /home/100trust/igb-5.3.5.36/src/igb_ethtool.o
  CC [M]  /home/100trust/igb-5.3.5.36/src/igb_hwmon.o
  CC [M]  /home/100trust/igb-5.3.5.36/src/e1000_mbx.o
  CC [M]  /home/100trust/igb-5.3.5.36/src/e1000_mac.o
  CC [M]  /home/100trust/igb-5.3.5.36/src/e1000_manage.o
  CC [M]  /home/100trust/igb-5.3.5.36/src/e1000_nvm.o
  CC [M]  /home/100trust/igb-5.3.5.36/src/igb_param.o
  CC [M]  /home/100trust/igb-5.3.5.36/src/e1000_phy.o
  CC [M]  /home/100trust/igb-5.3.5.36/src/igb_procfs.o
  CC [M]  /home/100trust/igb-5.3.5.36/src/igb_vmdq.o
  CC [M]  /home/100trust/igb-5.3.5.36/src/e1000_82575.o
  CC [M]  /home/100trust/igb-5.3.5.36/src/e1000_i210.o
  CC [M]  /home/100trust/igb-5.3.5.36/src/igb_debugfs.o
  CC [M]  /home/100trust/igb-5.3.5.36/src/igb_ptp.o
  CC [M]  /home/100trust/igb-5.3.5.36/src/kcompat.o
  LD [M]  /home/100trust/igb-5.3.5.36/src/igb.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /home/100trust/igb-5.3.5.36/src/igb.mod.o
  LD [M]  /home/100trust/igb-5.3.5.36/src/igb.ko
make[1]: Leaving directory '/usr/src/kernels/3.10.0-2.nd7.33.mips64el'
Copying manpages...
Installing modules...
make[1]: Entering directory '/usr/src/kernels/3.10.0-2.nd7.33.mips64el'
  INSTALL /home/100trust/igb-5.3.5.36/src/igb.ko
  DEPMOD  3.10.0-2.nd7.33.mips64el
make[1]: Leaving directory '/usr/src/kernels/3.10.0-2.nd7.33.mips64el'
Running depmod...
[root@localhost src]# ls
common.mk        e1000_manage.h  igb_ethtool.c  igb_ptp.o
e1000_82575.c    e1000_manage.o  igb_ethtool.o  igb_regtest.h
e1000_82575.h    e1000_mbx.c     igb.h          igb_vmdq.c
e1000_82575.o    e1000_mbx.h     igb_hwmon.c    igb_vmdq.h
e1000_api.c      e1000_mbx.o     igb_hwmon.o    igb_vmdq.o
e1000_api.h      e1000_nvm.c     igb.ko         kcompat.c
e1000_api.o      e1000_nvm.h     igb_main.c     kcompat_ethtool.c
e1000_defines.h  e1000_nvm.o     igb_main.o     kcompat.h
e1000_hw.h       e1000_osdep.h   igb.mod.c      kcompat.o
e1000_i210.c     e1000_phy.c     igb.mod.o      kcompat_overflow.h
e1000_i210.h     e1000_phy.h     igb.o          Makefile
e1000_i210.o     e1000_phy.o     igb_param.c    modules.order
e1000_mac.c      e1000_regs.h    igb_param.o    Module.supported
e1000_mac.h      igb.7.gz        igb_procfs.c   Module.symvers
e1000_mac.o      igb_debugfs.c   igb_procfs.o
e1000_manage.c   igb_debugfs.o   igb_ptp.c
[root@localhost src]# modprobe igb
[root@localhost src]# dmesg | grep igb
[    3.414062] igb: Intel(R) Gigabit Ethernet Network Driver - version 5.4.0-k
[    3.414062] igb: Copyright (c) 2007-2014 Intel Corporation.
[root@localhost src]# lsmod
Module                  Size  Used by
nls_cp936             130566  0
vfat                   11334  0
fat                    61117  1 vfat
usb_storage            58814  0
fuse                   88700  3
snd_hda_codec_hdmi     42111  0
snd_hda_intel          24076  2
r8169                  80994  0
shpchp                 29282  0
ip_tables              18188  0
x_tables               28893  1 ip_tables
ipv6                  431873  50
autofs4                28486  2

 

本文标签: 源码网卡驱动Linuxintel