How To Compile SCSI Drivers
===========================
$Id: //depot/razor/linux/src/How_To_Compile_SCSI_Drivers.txt#1 $

Assumptions
-----------

Kernel tree root is at /usr/src/linux and the current
working directory is the kernel tree root, "cwd" or . for
short.

You should probably read the /usr/src/linux/README file.


The kernel has to be configured
-------------------------------

Make sure that your kernel is configured.  If you do not
have .config file in your kernel root, then your kernel is
not configured.  If you have that file but you're unsure if
your kernel is configured, then run "make oldconfig".

You need a configuration file in order to configure the
kernel.  You get one by manually configuring the kernel
("make menuconfig") or by copying a provided one from your
vendor/distributor or by getting the one currently used by
your running kenrel.

The latter two choices work as follows: copy the config file
of your desire from configs/ directory to . and rename it
".config".  Then run "make oldconfig".  Or you can copy
/proc/config.gz (if present, not all kernels support this)
to . and then unzip it using gunzip(1) and then rename it to
".config".  Then run "make oldconfig".

2.4.x
-----

Make the driver directory present in the kernel tree:

cd drivers/scsi/
mkdir adp94xx
lndir <driver source directory> adp94xx

Alternatively you can just copy the whole directory
("cp -a") into "drivers/scsi/", just as long as it is called
"adp94xx".  Or you can create a symlink to the actual
directory from drivers/scsi/ as long as the pointing symlink
is called "adp94xx".

Edit the "Makefile" to include the fact that we're building
that driver.  In the beginning after a bunch of lines
starting with "subdir-$(..." add this line:

subdir-$(CONFIG_SCSI_ADP94XX)   += adp94xx

Further down after the "ifeq" statement regarding
"aic7xxx/aic79xxx" add this statement:

ifeq ($(CONFIG_SCSI_ADP94XX),y)
  obj-$(CONFIG_SCSI_ADP94XX)    += adp94xx/adp94xx.o
endif

Edit the "Config.in" file to include this line:

source drivers/scsi/adp94xx/Config.in

after "source drivers/scsi/aic7xxx/Config.in" line.

Then,

cd ../../
make oldconfig

You will be asked only one question regarding the "new"
driver which has just been added, which whould be the
"adp94xx" driver.  Answer 'm' for module.  If you answer
'n', stop reading here.  If you answer 'y', the driver will
be built into the kernel.

Then you're ready to build it.

make SUBDIRS=drivers/scsi/adp94xx modules

The driver will be "drivers/scsi/adp94xx/adp94xx.o".

To insert it into the kernel, do, as root:

insmod drivers/scsi/adp94xx/adp94xx.o

You may want to give options.  See the readme.txt file in
this directory.


2.6.x
-----

cd <driver source directory>
mv Makefile Makefile.2_4
mv Makefile.2_6 Makefile
make -C /usr/src/linux M=`pwd`

The driver will be "adp94xx.ko".

To insert it into the kernel, do:

insmod adp94xx.ko

You may want to give options.  See the readme.txt file in
this directory.
