      Build a Custom kernel with QLogic iSCSI Driver


1.0  Building a Custom Kernel to Load the Driver
-------------------------------------------------

Since it is not feasible to construct a single set of kernel build
instructions for every possible hardware or software configuration,
the following instructions are provided as an example of how to compile
the driver into the Linux kernel.  The user may be required to make
some adjustments in the procedure for their particular system hardware
or software configuration. The kernel source tree is referenced below
as /usr/src/linux.

This process is only supported on RedHat 8.0/9.0/Advanced Server 2.1/3.0
and SLES 8. The kernel source tree is referenced below as /usr/src/linux.
Under the RedHat distribution, the normal directory path is
/usr/src/linux-2.4.  For SuSE distributions, the kernel source is
usually located in /usr/src/linux.

1. Prepare the kernel source tree

   (For RedHat Distribution):

        a) Verify that both kernel-headers and kernel-source
                RPMS are already installed.

                # rpm -qa | grep kernel

           If the kernel-headers and kernel-source RPMs are
           not installed, install from the distribution's CD
           with the following commands:

                # rpm -i kernel-source*  (not required for Red Hat 9.0)
                # rpm -i kernel-headers*  (not required for Red Hat 9.0)

	b. Using the diskette you created in Section 4, copy the driver
	   source file - qla4xxxsrc-vx.yy.zz.tgz to the qla4xxx directory
	   and extract the files.  For example:

	       # mkdir /usr/src/linux/drivers/scsi/qla4xxx
	       # cd /usr/src/linux/drivers/scsi/qla4xxx
	       # mount /mnt/floppy
	       # cp /mnt/floppy/*.tgz . (the period at the end is required)
	       # tar -xvzf *.tgz
	       # rm -f Makefile
	       # cp -f Makefile.kernel Makefile

   (For SuSE Distribution):

	a. Install the kernel-source from the SuSE distribution CD-ROM
	   by typing:	

	       # yast  or
	       # yast2

	b. Create a soft link ( /usr/src/linux) to the kernel source
	   (/usr/src/<linux-version>) by typing:

	       # ln -sf /usr/src/<linux-version> /usr/src/linux

	c. To ensure kernel version synchronization between the driver and
	   running kernel, type the following:

	      	# cd /usr/src/linux
		# make mrproper (completely clean the kernel tree)
		# cp /boot/vmlinuz.config .config (copy the new config)
		# make oldconfig (update configuration using .config)
		# make dep (rebuild the dependencies)
		# make modules (build the modules)

	d. Using the diskette you created in Section 4, copy the source file
	   qla4xxxsrc-vx.yy.zz.tgz to the qla4xxx directory and extract the
	   files.  For example:

	       # mkdir /usr/src/linux/drivers/scsi/qla4xxx
	       # cd /usr/src/linux/drivers/scsi/qla4xxx
	       # mcopy a:*.tgz . (the period at the end is required)
	       # tar -xvzf *.tgz
	       # rm -f Makefile
	       # cp -f Makefile.kernel Makefile

2. Edit the Makefile under the kernel scsi directory

        # cd /usr/src/linux/drivers/scsi
        # vi Makefile

        a) Look for the following line:
	   (For RedHat AS 2.1/3.0)
                subdir-$(CONFIG_SCSI_AIC7XXX) += aic7xxx
	
	   (For RedHat 8.0/9.0/SLES 8)
                subdir-m   		+= aic7xxx

           And add the following line below it:

                subdir-$(CONFIG_SCSI_QLOGIC_QLA4XXX) += qla4xxx

        b) Locate the following line:
	   (For RedHat AS 2.1/3.0)
                obj-$(CONFIG_SCSI_QLOGIC_QLA2100) += qla2x00.o

	   (For RedHat 8.0/9.0/SLES 8)
                obj-$(CONFIG_SCSI_QLOGIC_QLA1280) += qla1280.o

           Add the following lines below it:

		ifeq ($(CONFIG_SCSI_QLOGIC_QLA4XXX),y)
                   obj-$(CONFIG_SCSI_QLOGIC_QLA4XXX_QLA4010) += qla4xxx/qla4010.o
		endif

        c) Append the following line(s) to the end of the Makefile:

                qla4xxx/qla4010.o:
                        cd qla4xxx; make qla4010.o

3. Edit the Config.in file under the kernel scsi directory

        # cd /usr/src/linux/drivers/scsi
        # vi Config.in

        Locate the following lines

	   	(For RedHat AS 2.1/3.0)
                dep_tristate 'Qlogic QLA 2100 FC SCSI support' CONFIG_SCSI_QLOGIC_QLA2100 $CONFIG_SCSI
                dep_tristate 'Qlogic QLA 2200 FC SCSI support' CONFIG_SCSI_QLOGIC_QLA2200 $CONFIG_SCSI

	   	(For RedHat 8.0/9.0/SuSE)
                dep_tristate 'Qlogic QLA 1280 SCSI support' CONFIG_SCSI_QLOGIC_QLA1280 $CONFIG_SCSI

        Add the following line(s) below it:

		source drivers/scsi/qla4xxx/Config.in

4. Configure the kernel to load the new QLogic driver.

        # cd /usr/src/linux
        # make menuconfig

	(Make sure built-in support is selected for the following options)

        - "SCSI Support"

        - "SCSI Disk Support"

        - "SCSI Generic Support"

        - "SCSI low-level drivers" <Enter>

        - "QLogic QLA 4XXX iSCSI support"
	
        - "QLogic QLA 4010 iSCSI support"

        - Select Exit to go back to the "SCSI Support" menu.

        - Select Exit to go back to the "Main Menu".

        - Select Exit to exit the Main Menu.

        The system prompts: "Do you wish to save your new kernel
        configuration?".  Select "Yes". The system saves a new config
        file called ".config" in the current directory.

5. Build kernel

       # make dep bzImage modules modules_install

6. Configure the boot loader to load the new kernel

        # cd /usr/src/linux/arch/i386/boot
        # cp bzImage /boot/newKernel

   For LILO:

        a) Add a section for newKernel in the /etc/lilo.conf file.
           An example is as follows:

           image=/boot/newKernel
                label=newKernel
                read-only
                root=/dev/sda

        b) To load newKernel by default, update the "default=" line
           at the top of the /etc/lilo.conf file as follows:

           default=newKernel

        c) Load the new boot configuration by typing the following:
	
	   # lilo
	
        d) Restart system.  The new kernel image containing the qla4010
	   driver(s) is now the default boot image.

   For GRUB:

	For RedHat Distribution:

        a) Add a section for newKernel in the /etc/grub.conf file.
           An example is as follows:

           title Red Hat Linux-newKernel (2.4.7-10)
                root (hd0,0)
                kernel /newKernel ro root=/dev/hda2

        b) Restart system.  The new kernel image containing the qla4010
	   driver(s) is now the default boot image.

	For SuSE Distribution:
        a) Add a section for newKernel in the /boot/grub/menu.lst file.
           An example is as follows:

           title Linux-newKernel (2.4.7-10)
                root (hd0,0)
                kernel /newKernel ro root=/dev/hda2

        b) Restart system.  The new kernel image containing the qla4010
	   driver(s) is now the default boot image.

