From c5b4450728a2a26af6f95772cf2bc5813236084d Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Fri, 13 Apr 2012 20:36:49 +0000 Subject: [PATCH] qla2x00t-howto clarifications Clarify the qla2x00t how-to where necessary: - Add instructions to unload the upstream qla2xxx kernel module before starting to build the SCST qla2xxx kernel modules. - Change the name qla2xxx into qla2xxx_scst in the step for loading kernel modules. - Replace the instructions for removing the distro-provided qla2xxx kernel module by instructions for blacklisting that module and rebuilding the initial RAM disk. - Prepend all commands that have to be executed by the user by a prompt. - Add instructions for RHEL / SUSE next to Debian. - Shortened Debian kernel development package list. Markup changes: - Use a CSS style attribute to specify the distance between steps instead of using


. - Add a missing tag. Signed-off-by: Bart Van Assche git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4209 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- qla2x00t/doc/qla2x00t-howto.html | 108 ++++++++++++++++++------------- 1 file changed, 62 insertions(+), 46 deletions(-) diff --git a/qla2x00t/doc/qla2x00t-howto.html b/qla2x00t/doc/qla2x00t-howto.html index 96bb05b70..5f4519378 100644 --- a/qla2x00t/doc/qla2x00t-howto.html +++ b/qla2x00t/doc/qla2x00t-howto.html @@ -8,6 +8,7 @@ How to configure QLogic target driver for 22xx/23xx/24xx/25xx adapters @@ -35,13 +36,17 @@ pre {color:brown;}
qla2xxx 0000:13:00.0: Firmware image unavailable.
 qla2xxx 0000:13:00.0: Failed to initialize adapter
- In this case I had to download ql2300_fw.bin.


+ In this case I had to download ql2300_fw.bin. -
  • Install the necessary kernel development packages. On e.g. a Debian system +
  • Install the necessary kernel development packages. On a Debian system these packages can be installed as follows: -
    apt-get install gcc patch linux-headers libcunit1-ncurses libncurses5-dev cramfsprogs bootcd-mkinitramfs subversion lsscsi
    -

  • +
    [root@proj ]# apt-get install gcc libncurses5-dev linux-headers lsscsi patch subversion
    +On RHEL/CentOS/SL systems these packages can be installed as follows: +
    [root@proj ]# yum install gcc ncurses-devel kernel-devel lsscsi patch subversion
    +And on SUSE systems these packages can be installed by running the following command: +
    [root@proj ]# zypper install gcc ncurses-devel kernel-devel lsscsi patch subversion
    +
  • Download the SCST source code. That source code can be downloaded either @@ -55,68 +60,68 @@ these packages can be installed as follows: been extracted in a single directory. The structure of that directory will be identical to that of the SCST trunk. -
    [root@proj ] svn co https://scst.svn.sourceforge.net/svnroot/scst/trunk scst
    +
    [root@proj ]# svn co https://scst.svn.sourceforge.net/svnroot/scst/trunk scst
    After the above command finished a directory called 'scst' will have been created in the current directory, which is /root in this how-to. +
  • -


    +
  • +Unload the qla2xxx kernel module provided by your Linux distribution and blacklist it: +
    [root@proj ]# rmmod qla2xxx
    +[root@proj ]# echo blacklist qla2xxx >/etc/modprobe.d/blacklist-qla2xxx.conf
  • Find out whether you will need SCSI pass-through and/or the iSCSI zero-copy optimization. If not, skip the kernel download, patch, rebuild -and reboot steps and continue with the SCST build step -after having issued the command below: -
    export BUILD_2X_MODULE=y CONFIG_SCSI_QLA2XXX_TARGET=y
    - -


    +and reboot steps and continue with the SCST build step. +
  • Decide whether you want to start from a vanilla Linux kernel source tree or from the kernel source tree specific to your Linux distribution. Vanilla kernel sources can be downloaded from http://www.kernel.org/pub/linux/kernel/. Unzip the downloaded archive under /usr/src: -
    [root@proj src ] 
    -[root@proj src ] tar -xjf /usr/src/linux-2.6.26.tar.bz2
    +
    [root@proj src ]# tar -xjf /usr/src/linux-2.6.26.tar.bz2
    Instructions for obtaining a distribution-specific kernel source tree vary. An example for Debian: -
    [root@proj src ] apt-get install linux-source-2.6
    -[root@proj src ] tar xjf linux-source-2.6.32.tar.bz2
    +
    [root@proj src ]# apt-get install linux-source-2.6
    +[root@proj src ]# tar xjf linux-source-2.6.32.tar.bz2
  • Create the necessary symbolic links: -
    [root@proj src ] pwd
    +
    [root@proj src ]# pwd
     /usr/src
    -[root@proj src ] ln -s /usr/src/linux-2.6.26 linux
    -[root@proj src ] ln -s /usr/src/linux-2.6.26 kernel
    +[root@proj src ]# ln -s /usr/src/linux-2.6.26 linux +[root@proj src ]# ln -s /usr/src/linux-2.6.26 kernel
  • Patch the kernel that has just been downloaded: -
    [root@proj ] cd /usr/src/linux-2.6.26
    -[root@proj linux-2.6.26] patch -p1 < /root/scst/scst/kernel/scst_exec_req_fifo-2.6.26.patch
    +
    [root@proj ]# cd /usr/src/linux-2.6.26
    +[root@proj linux-2.6.26]# patch -p1 < /root/scst/scst/kernel/scst_exec_req_fifo-2.6.26.patch
  • Now build the kernel.

    Make sure you disable kernel hacking feature and HIGHMEM4G|HIGHMEM64G, i.e. -
    [root@proj ] grep -i highmem /usr/src/linux/.config
    +
    [root@proj ]# grep -i highmem /usr/src/linux/.config
     CONFIG_NOHIGHMEM=y
     # CONFIG_HIGHMEM4G is not set
     # CONFIG_HIGHMEM64G is not set
    If you have a system with more than 1GB of memory, consider to change CONFIG_VMSPLIT option to the corresponding value. -
    [root@proj linux ] pwd
    +
    [root@proj linux ]# pwd
     /usr/src/linux
    -[root@proj linux ] make menuconfig
    -[root@proj linux ] make bzImage
    -[root@proj linux ] make modules
    -[root@proj linux ] make modules_install
    -[root@proj linux ] make install
    +[root@proj linux ]# make menuconfig +[root@proj linux ]# make bzImage +[root@proj linux ]# make modules +[root@proj linux ]# make modules_install +[root@proj linux ]# make install
  • - Reboot the system and during boot select the freshly built kernel to boot from.


    + Reboot the system and during boot select the freshly built kernel to boot from.
  • @@ -158,25 +163,22 @@ CONFIG_NOHIGHMEM=y
    1. Build SCST. -
      [root@proj ] cd /root/scst/scst/src
      -[root@proj ] make all
      -[root@proj ] make install
      +
      [root@proj ]# cd /root/scst/scst/src
      +[root@proj ]# make all
      +[root@proj ]# make install
    2. Build the QLogic target driver as follows:
        -
      1. Remove the upstream qla2xxx initiator kernel module and any - previously installed SCST qla2xxx-related kernel modules: -
        rm -f /lib/modules/`uname -r`/{kernel/drivers/scsi/qla2xxx,extra}/qla2*
        -
      2. Change the working directory to the SCST source tree. -
        [root@proj trunk] pwd
        +	    
        [root@proj trunk]# pwd
         /root/scst
      3. Install the qla2xxx initiator kernel module from the SCST tree: -
        [root@proj trunk] BUILD_2X_MODULE=y CONFIG_SCSI_QLA_FC=y CONFIG_SCSI_QLA2XXX_TARGET=y make -s -C qla2x00t/qla2x00-target install
        +
        [root@proj trunk]# BUILD_2X_MODULE=y CONFIG_SCSI_QLA_FC=y CONFIG_SCSI_QLA2XXX_TARGET=y \
        +make -s -C qla2x00t/qla2x00-target install
      4. Verify that compilation and installation succeeded: -
        [root@proj trunk] ls -l /lib/modules/`uname -r`/extra/qla2*
        +	    
        [root@proj trunk]# ls -l /lib/modules/`uname -r`/extra/qla2*
         -rw-r--r--  1 root root  36756 Jun 20 18:46 qla2x00tgt.ko
         -rw-r--r--  1 root root 160192 Jun 20 18:46 qla2xxx_scst.ko   
         
        @@ -188,7 +190,7 @@ CONFIG_NOHIGHMEM=y
      5. Insert the kernel modules.
        The kernel modules have been installed in - '/lib/modules/`you_kernel_version`/extra'.
        In addition, scst.h, + '/lib/modules/`your_kernel_version`/extra'.
        In addition, scst.h, scst_debug.h as well as Module.symvers or Modules.symvers have been copied to '/usr/local/include/scst'.
        The first file contains all SCST's public interfaces used by target drivers. The other files allow target drivers to @@ -230,7 +232,7 @@ where: You can insert any of these kernel modules with the 'modprobe' program. As you can see, I've inserted all SCST kernel modules !!! -
        [root@proj ] for _mod in scst qla2xxx qla2x00tgt scst_vdisk scst_user scst_disk ...; do modprobe $_mod; done
        +
        [root@proj ]# for m in scst qla2xxx_scst qla2x00tgt scst_vdisk scst_user scst_disk ...; do modprobe $m; done
        This will result in the following dmesg output: @@ -241,17 +243,31 @@ scst: Virtual device handler vdisk for type 0 registered successfully scst: Virtual device handler "scst_user" registered successfully
      6. +
      7. +Back up and rebuild the initial RAM disk such that the qla2xxx kernel module in +that RAM disk will be replaced by qla2xxx_scst. How to do this depends on your +Linux distribution. For Debian systems, the initial RAM disk can be +rebuilt by running the following command: +
        [root@proj ]# update-initrd -c -k $(uname -r)
        +For Ubuntu systems: +
        [root@proj ]# update-initramfs -c -k $(uname -r)
        +For RHEL/CentOS/SL systems: +
        [root@proj ]# mkinitrd -f /boot/initramfs-$(uname -r).img $(uname -r)
        +And for SUSE systems: +
        [root@proj ]# mkinitrd
        +
      8. +
      9. Now let's create our virtual device: -
        [root@proj ] dd if=/dev/zero of=/mnt/disk1 bs=1024k count=512
        +
        [root@proj ]# dd if=/dev/zero of=/mnt/disk1 bs=1024k count=512
         512+0 records in
         512+0 records out
         
        -[root@proj ] ls -l /mnt/disk1
        +[root@proj ]# ls -l /mnt/disk1
         -rw-r--r--  1 root root 536870912 Jun 23 13:27 /mnt/disk1
         
        -[root@proj ] file /mnt/disk1
        +[root@proj ]# file /mnt/disk1
         /mnt/disk1: data
      10. @@ -315,7 +331,7 @@ The same can be done directly via the sysfs interface of SCST: device handler, corresponding device will be invisible for remote initiators, hence we have to add them manually. But as I've already loaded the device handler (scst_vdisk) on the target, I don't - have to perform any additional steps.

        + have to perform any additional steps.
      11. @@ -325,12 +341,12 @@ The same can be done directly via the sysfs interface of SCST: or by unloading and reloading the initiator kernel module. Automatic discovery isn't supported by all known initiators, so you need a way to make SCSI subsystem on the initiator to do the new devices discovery and hence be - able to see the new devices attached.

        + able to see the new devices attached. Alternatively, if your initiator already connected to the target and you simply added new devices to it, you can try to run a manual rescan as follows: -
        [root@initiator ] echo "- - -" >/sys/class/scsi_host/hostX/scan
        +
        [root@initiator ]# echo "- - -" >/sys/class/scsi_host/hostX/scan
        where X is the host number.