FC卡驱动源码编译基本流程
redhat6.x
4.2 Building the Driver for RHEL 6.x Linux
编译前先确认kernel-devel、gcc*是否安装好
-
In the directory that contains the source driver file,
qla2xxx-src-vx.xx.xx.xx.06.x-k.tar.gz, issue the following commands:tar -xzvf qla2xxx-src-vx.xx.xx.xx.06.x-k.tar.gz
cd qla2xxx-src-vx.xx.xx.xx.06.x-k
-
Build and install the driver modules from the source code by
executing the build.sh script as follows:./extras/build.sh install
The build.sh script does the following:
- Builds the driver .ko files.
- Copies the .ko files to the appropriate
/lib/modules/2.6…/extra/qlgc-qla2xxx directory. - Adds the appropriate directive in the modprobe.conf (if
applicable).
-
Manually load the driver for Linux Using insmod or modprobe.
-
To directly load the driver from the local build directory,
issue the following insmod commands in order:insmod /lib/modules/2.6…/kernel/drivers/scsi/scsi_tgt.ko
(if not already loaded)
insmod /lib/modules/2.6…/kernel/drivers/scsi/
scsi_transport_fc.ko
insmod qla2xxx.ko
-
To load the driver using modprobe, issue the following command:
-
modprobe -v qla2xxx
* To unload the driver using modprobe, issue the following
command:
# modprobe -r qla2xxx
-
Automatically load the driver by rebuilding the RAM disk to
include the driver as follows:a. Edit the /etc/modprobe.d/modprobe.conf file and add the following
entry. (Create a modprobe.conf file if it does not exist):alias scsi_hostadapterX qla2xxx
where, X is based on the order of the SCSI modules being
loaded.b. Create a backup copy of the RAMDISK image by issuing the
following commands:# cd /boot # cp initrd-[kernel version].img initrd-[kernel version].img.bak # mkinitrd -f initrd-[kernel version].img `uname -r`
NOTE: Depending on the server hardware, the RAMDISK file name
may be different.c. To load the driver, reboot the host.