From 00bca6ce75e944d17b8f8b4fc7df41b3241bc250 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Thu, 15 May 2008 15:00:21 +0000 Subject: [PATCH] Patch from Bart Van Assche : By this time I have reworked the update of scripts/generate-kernel-patch'>scripts/generate-kernel-patch. These are the changes that were already present in version 1 of this patch and that have been kept in this patch: - The SCST code has been moved from drivers/scsi/scsi_tgt to drivers/scst. - Moved SCST header files from include/scsi_tgt to include/scst. - Added iscsi-scst in drivers/scst/iscsi-scst. For the time being the generate-kernel-patch does no longer try to add the qla2x00t driver in drivers/scst/qla2x00-target -- I have not yet been able to figure out how to get qla2x00t/qla2x00-target compiled without the initiator code. Just as in version 1 of this patch, the following files in the Subversion repository have been renamed to reflect the above changes: - Renamed scst/kernel/in-tree/Makefile.scsi.Linux-2.6.24.patch'>scst/kernel/in-tree/Makefile.scsi.Linux-2.6.24.patch to scst/kernel/in-tree/Makefile.drivers.Linux-2.6.24.patch'>scst/kernel/in-tree/Makefile.drivers.Linux-2.6.24.patch. - Renamed Kconfig'>scst/kernel/in-tree/Kconfig.scsi.Linux-2.6.24.patch to scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.24.patch'>scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.24.patch. - Renamed scst/kernel/in-tree/Makefile.scsi_tgt'>scst/kernel/in-tree/Makefile.scsi_tgt to scst/kernel/in-tree/Makefile.scst'>scst/kernel/in-tree/Makefile.scst. - Renamed scst/kernel/in-tree/Kconfig.scsi_tgt'>scst/kernel/in-tree/Kconfig.scsi_tgt to scst/kernel/in-tree/Kconfig.scst'>scst/kernel/in-tree/Kconfig.scst. Because of the above changes the include path specified in the following Makefiles had to be changed: - scst/kernel/in-tree/Makefile.dev_handlers'>scst/kernel/in-tree/Makefile.dev_handlers - srpt/src/Makefile.in_kernel'>srpt/src/Makefile.in_kernel Other changes: - I have added menu/endmenu entries in file scst/kernel/in-tree/Kconfig.scst such that the SCST entries become visible when running make xconfig or make menuconfig. - Elaborated the SCST help texts a little bit (in file scst/kernel/in-tree/Kconfig.scst). New in version 2 of this patch: - Moved remaining patches in the generate-kernel-patch script to separate files. - Added support for the 2.6.25 kernel. This patch has been tested as follows: mkdir -p tmp cd tmp rm -rf linux-2.6.25.3 /lib/modules/2.6.25.3-scst tar xjf ~vanasscb/software/downloads/linux-2.6.25.3.tar.bz2 cd linux-2.6.25.3 cp ../.config-2.6.25 . (cd ~vanasscb/software/scst && ~vanasscb/software/scst/scripts/generate-kernel-patch \ 2.6.25) | patch -p1 make oldconfig diff ../.config . make xconfig make menuconfig make -j5 bzImage modules make modules_install install cp -r /lib/firmware/$(uname -r) /lib/firmware/2.6.25.3-scst update-initramfs -k 2.6.25.3-scst -c reboot modprobe iscsi-scst modprobe ib_srpt lsmod | grep -E 'scst|ib_srpt' dmesg Signed-off-by: bart.vanassche@gmail.com git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@373 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- iscsi-scst/kernel/Kconfig | 5 + iscsi-scst/kernel/Makefile.in-kernel | 5 + scripts/generate-kernel-patch | 121 +++++++++++++----- .../Kconfig.drivers.Linux-2.6.24.patch | 21 +-- .../Kconfig.drivers.Linux-2.6.25.patch | 12 ++ scst/kernel/in-tree/Kconfig.scst | 16 ++- scst/kernel/in-tree/Makefile.dev_handlers | 2 +- .../Makefile.drivers.Linux-2.6.24.patch | 22 ++-- .../Makefile.drivers.Linux-2.6.25.patch | 11 ++ scst/kernel/in-tree/Makefile.scst | 2 +- .../src/Kconfig.infiniband.Linux-2.6.25.patch | 12 ++ srpt/src/Makefile.in_kernel | 2 +- .../Makefile.infiniband.Linux-2.6.25.patch | 9 ++ 13 files changed, 183 insertions(+), 57 deletions(-) create mode 100644 iscsi-scst/kernel/Kconfig create mode 100644 iscsi-scst/kernel/Makefile.in-kernel create mode 100644 scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.25.patch create mode 100644 scst/kernel/in-tree/Makefile.drivers.Linux-2.6.25.patch create mode 100644 srpt/src/Kconfig.infiniband.Linux-2.6.25.patch create mode 100644 srpt/src/Makefile.infiniband.Linux-2.6.25.patch diff --git a/iscsi-scst/kernel/Kconfig b/iscsi-scst/kernel/Kconfig new file mode 100644 index 000000000..c5b3e664c --- /dev/null +++ b/iscsi-scst/kernel/Kconfig @@ -0,0 +1,5 @@ +config SCST_ISCSI + tristate "SCST iSCSI Support" + depends on SCSI + ---help--- + iSCSI target support. The iSCSI protocol has been defined in RFC 3720. diff --git a/iscsi-scst/kernel/Makefile.in-kernel b/iscsi-scst/kernel/Makefile.in-kernel new file mode 100644 index 000000000..7c4358b95 --- /dev/null +++ b/iscsi-scst/kernel/Makefile.in-kernel @@ -0,0 +1,5 @@ +EXTRA_CFLAGS += -Iinclude/scst + +obj-m := iscsi-scst.o +iscsi-scst-objs := iscsi.o nthread.o config.o digest.o \ + conn.o session.o target.o event.o param.o diff --git a/scripts/generate-kernel-patch b/scripts/generate-kernel-patch index 8307b56da..5ecc1a048 100755 --- a/scripts/generate-kernel-patch +++ b/scripts/generate-kernel-patch @@ -28,31 +28,42 @@ # $2: path in kernel tree of file to be patched. function add_patch { if [ ! -e "$1" ]; then - echo "Error: could not find $1." + echo "Error: could not find $1." >&2 exit 1 fi sed -e "s:^--- [^ ]*:--- orig/$2:" -e "s:^+++ [^ ]*:+++ $2:" < "$1" } -# Generate a patch for a file to be added to the kernel source tree. +# Generate a patch for a file to be added to the kernel source tree, and strip +# trailing whitespace from C source files while converting the file to patch +# format. # $1: path of file to be added. # $2: path in kernel tree where file should be added. function add_file { local a b if [ ! -e "$1" ]; then - echo "Error: could not find $1." + echo "Error: could not find $1." >&2 exit 1 fi + # Skip any files generated by the kernel build process (*.mod.c). + if [ "${1%.mod.c}" != "$1" ]; then + return 0; + fi + cat <&2 done -# Kernel patches for other directories than drivers/scsi/scsi_tgt/. +# General kernel patches. for p in "${kpatch[@]}" do @@ -99,53 +111,102 @@ do echo '' done -add_patch "scst/kernel/in-tree/Kconfig.scsi.Linux-${kernel_version}.patch" \ - "linux-${kernel_version}/drivers/scsi/Kconfig" -add_patch "scst/kernel/in-tree/Makefile.scsi.Linux-${kernel_version}.patch" \ - "linux-${kernel_version}/drivers/scsi/Makefile" - - -# Directory include/scsi_tgt/ +# Directory include/scst/ for f in scst/include/*h do - add_file "${f}" "linux-${kernel_version}/include/scsi_tgt/${f#scst/include/}" + add_file "${f}" "linux-${kernel_version}/include/scst/${f#scst/include/}" done - -# Directory drivers/scsi/scsi_tgt/ - -add_file "scst/kernel/in-tree/Kconfig.scsi_tgt" \ - "drivers/scsi/scsi_tgt/Kconfig" -add_file "scst/kernel/in-tree/Makefile.scsi_tgt" \ - "drivers/scsi/scsi_tgt/Makefile" - - -for f in scst/src/*[ch] +for f in iscsi-scst/include/*h do - add_file ${f} linux-${kernel_version}/drivers/scsi/scsi_tgt/${f#scst/src/} +add_file "${f}" "linux-${kernel_version}/include/scst/${f#iscsi-scst/include/}" +done + + +# Directory drivers/ + +add_patch "scst/kernel/in-tree/Kconfig.drivers.Linux-${kernel_version}.patch" \ + "linux-${kernel_version}/drivers/Kconfig" + +add_patch "scst/kernel/in-tree/Makefile.drivers.Linux-${kernel_version}.patch"\ + "linux-${kernel_version}/drivers/Makefile" + + +# Directory drivers/scst/ + +add_file "scst/kernel/in-tree/Kconfig.scst" \ + "linux-${kernel_version}/drivers/scst/Kconfig" +add_file "scst/kernel/in-tree/Makefile.scst" \ + "linux-${kernel_version}/drivers/scst/Makefile" + + +for f in scst/src/*.[ch] +do + add_file ${f} linux-${kernel_version}/drivers/scst/${f#scst/src/} echo '' echo '' done -# Directory drivers/scsi/scsi_tgt/dev_handlers/ +# Directory drivers/scst/dev_handlers/ add_file "scst/kernel/in-tree/Makefile.dev_handlers" \ - "linux-${kernel_version}/drivers/scsi/scsi_tgt/dev_handlers/Makefile" + "linux-${kernel_version}/drivers/scst/dev_handlers/Makefile" for f in scst/src/dev_handlers/*.[ch] do - add_file ${f} linux-${kernel_version}/drivers/scsi/scsi_tgt/dev_handlers/${f#scst/src/dev_handlers/} + add_file ${f} linux-${kernel_version}/drivers/scst/dev_handlers/${f#scst/src/dev_handlers/} echo '' echo '' done +# Directory drivers/scst/iscsi-scst/ + +add_file "iscsi-scst/kernel/Makefile.in-kernel" \ + "linux-${kernel_version}/drivers/scst/iscsi-scst/Makefile" + +add_file "iscsi-scst/kernel/Kconfig" \ + "linux-${kernel_version}/drivers/scst/iscsi-scst/Kconfig" + +for f in iscsi-scst/kernel/*.[ch] +do + add_file "${f}" \ + "linux-${kernel_version}/drivers/scst/iscsi-scst/${f#iscsi-scst/kernel/}" + echo '' + echo '' +done + + +# Directory drivers/scst/qla2x00-target/ + +if false; then + +add_file "qla2x00t/qla2x00-target/Makefile.in-kernel" \ + "linux-${kernel_version}/drivers/scst/qla2x00-target/Makefile" + +add_file "qla2x00t/qla2x00-target/Kconfig" \ + "linux-${kernel_version}/drivers/scst/qla2x00-target/Kconfig" + +add_file "qla2x00t/qla2x_tgt_def.h" \ + "linux-${kernel_version}/drivers/scst/qla2x00-target/qla2x_tgt_def.h" + +for f in qla2x00t/qla2x00-target/*.[ch] +do + add_file "${f}" \ + "linux-${kernel_version}/drivers/scst/qla2x00-target/${f#qla2x00t/qla2x00-target/}" + echo '' + echo '' +done + +fi + + # Directory drivers/infiniband/ulp/srpt/ -add_patch "srpt/src/Kconfig.infiniband.Linux-${kernel_version}.patch" \ +add_patch "srpt/src/Kconfig.infiniband.Linux-${kernel_version}.patch" \ "linux-${kernel_version}/drivers/infiniband/Kconfig" add_patch "srpt/src/Makefile.infiniband.Linux-${kernel_version}.patch" \ @@ -155,7 +216,7 @@ add_file "srpt/src/Kconfig" "drivers/infiniband/ulp/srpt/Kconfig" add_file "srpt/src/Makefile.in_kernel" "drivers/infiniband/ulp/srpt/Makefile" -for f in srpt/src/*[ch] +for f in srpt/src/*.[ch] do add_file ${f} linux-${kernel_version}/drivers/infiniband/ulp/srpt/${f#srpt/src/} echo '' diff --git a/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.24.patch b/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.24.patch index 0a3fee391..01aeb90ab 100644 --- a/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.24.patch +++ b/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.24.patch @@ -1,11 +1,12 @@ ---- orig/linux-2.6.24/drivers/scsi/Kconfig 2008-01-24 23:58:37.000000000 +0100 -+++ linux-2.6.24/drivers/scsi/Kconfig 2008-05-09 13:25:39.000000000 +0200 -@@ -1351,6 +1351,8 @@ config SCSI_QLOGICPTI - source "drivers/scsi/qla2xxx/Kconfig" - source "drivers/scsi/qla4xxx/Kconfig" - -+source "drivers/scsi/scsi_tgt/Kconfig" +diff -uprN ../orig/linux-2.6.24/drivers/Kconfig linux-2.6.24/drivers/Kconfig +--- ../orig/linux-2.6.24/drivers/Kconfig 2008-01-24 23:58:37.000000000 +0100 ++++ linux-2.6.24/drivers/Kconfig 2008-05-13 13:05:55.000000000 +0200 +@@ -24,6 +24,8 @@ + + source "drivers/scsi/Kconfig" + ++source "drivers/scst/Kconfig" + - config SCSI_LPFC - tristate "Emulex LightPulse Fibre Channel Support" - depends on PCI && SCSI + source "drivers/ata/Kconfig" + + source "drivers/md/Kconfig" diff --git a/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.25.patch b/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.25.patch new file mode 100644 index 000000000..01aeb90ab --- /dev/null +++ b/scst/kernel/in-tree/Kconfig.drivers.Linux-2.6.25.patch @@ -0,0 +1,12 @@ +diff -uprN ../orig/linux-2.6.24/drivers/Kconfig linux-2.6.24/drivers/Kconfig +--- ../orig/linux-2.6.24/drivers/Kconfig 2008-01-24 23:58:37.000000000 +0100 ++++ linux-2.6.24/drivers/Kconfig 2008-05-13 13:05:55.000000000 +0200 +@@ -24,6 +24,8 @@ + + source "drivers/scsi/Kconfig" + ++source "drivers/scst/Kconfig" ++ + source "drivers/ata/Kconfig" + + source "drivers/md/Kconfig" diff --git a/scst/kernel/in-tree/Kconfig.scst b/scst/kernel/in-tree/Kconfig.scst index 659cb7b7f..7f3f6a0c6 100644 --- a/scst/kernel/in-tree/Kconfig.scst +++ b/scst/kernel/in-tree/Kconfig.scst @@ -1,3 +1,5 @@ +menu "SCSI target middle level support" + config SCSI_TARGET tristate "SCSI target middle level support" default SCSI @@ -70,17 +72,25 @@ config SCSI_TARGET_USER ---help--- SCSI TARGET handler for virtual user space device. +source "drivers/scst/iscsi-scst/Kconfig" + config SCSI_TARGET_EXTRACHECKS - bool "Extrachecks support" + bool "Extra consistency checks" ---help--- - SCSI TARGET extrachecks. + Enable additional consistency checks in the SCSI middle level target + code. This may be helpful for SCST developers. config SCSI_TARGET_TRACING bool "Tracing support" ---help--- - SCSI TARGET tracing. + Enable SCSI middle level tracing support. Tracing can be controlled + dynamically via /proc/scsi_tgt/trace_level. The traced information + is sent to the kernel log and may be very helpful when analyzing + the cause of a communication problem between initiator and target. config SCSI_TARGET_DEBUG bool "Debug support" ---help--- SCSI TARGET debugging. + +endmenu diff --git a/scst/kernel/in-tree/Makefile.dev_handlers b/scst/kernel/in-tree/Makefile.dev_handlers index cac49179b..3a21c786c 100644 --- a/scst/kernel/in-tree/Makefile.dev_handlers +++ b/scst/kernel/in-tree/Makefile.dev_handlers @@ -1,4 +1,4 @@ -EXTRA_CFLAGS += -Iinclude/scsi_tgt -Wextra -Wno-unused-parameter +EXTRA_CFLAGS += -Iinclude/scst -Wextra -Wno-unused-parameter obj-m := scst_cdrom.o scst_changer.o scst_disk.o scst_modisk.o scst_tape.o \ scst_vdisk.o scst_raid.o scst_processor.o scst_user.o diff --git a/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.24.patch b/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.24.patch index 6f39946d8..ab9cc765f 100644 --- a/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.24.patch +++ b/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.24.patch @@ -1,11 +1,11 @@ -diff -uprN orig/linux-2.6.24/drivers/scsi/Makefile linux-2.6.24/drivers/scsi/Makefile ---- orig/linux-2.6.24/drivers/scsi/Makefile 2008-01-24 23:58:37.000000000 +0100 -+++ linux-2.6.24/drivers/scsi/Makefile 2008-05-09 13:05:36.000000000 +0200 -@@ -88,6 +88,7 @@ obj-$(CONFIG_PCMCIA_QLOGIC) += qlogicfas - obj-$(CONFIG_SCSI_QLOGIC_1280) += qla1280.o - obj-$(CONFIG_SCSI_QLA_FC) += qla2xxx/ - obj-$(CONFIG_SCSI_QLA_ISCSI) += qla4xxx/ -+obj-$(CONFIG_SCSI_TARGET) += scsi_tgt/ - obj-$(CONFIG_SCSI_LPFC) += lpfc/ - obj-$(CONFIG_SCSI_PAS16) += pas16.o - obj-$(CONFIG_SCSI_SEAGATE) += seagate.o +diff -uprN ../orig/linux-2.6.24/drivers/Makefile linux-2.6.24/drivers/Makefile +--- ../orig/linux-2.6.24/drivers/Makefile 2008-01-24 23:58:37.000000000 +0100 ++++ linux-2.6.24/drivers/Makefile 2008-05-13 13:06:34.000000000 +0200 +@@ -35,6 +35,7 @@ + obj-y += macintosh/ + obj-$(CONFIG_IDE) += ide/ + obj-$(CONFIG_SCSI) += scsi/ ++obj-$(CONFIG_SCSI_TARGET) += scst/ + obj-$(CONFIG_ATA) += ata/ + obj-$(CONFIG_FUSION) += message/ + obj-$(CONFIG_FIREWIRE) += firewire/ diff --git a/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.25.patch b/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.25.patch new file mode 100644 index 000000000..a5f8d08c2 --- /dev/null +++ b/scst/kernel/in-tree/Makefile.drivers.Linux-2.6.25.patch @@ -0,0 +1,11 @@ +diff -uprN ../orig/linux-2.6.24/drivers/Makefile linux-2.6.24/drivers/Makefile +--- ../orig/linux-2.6.24/drivers/Makefile 2008-01-24 23:58:37.000000000 +0100 ++++ linux-2.6.24/drivers/Makefile 2008-05-13 13:06:34.000000000 +0200 +@@ -36,6 +36,7 @@ + obj-y += macintosh/ + obj-$(CONFIG_IDE) += ide/ + obj-$(CONFIG_SCSI) += scsi/ ++obj-$(CONFIG_SCSI_TARGET) += scst/ + obj-$(CONFIG_ATA) += ata/ + obj-$(CONFIG_FUSION) += message/ + obj-$(CONFIG_FIREWIRE) += firewire/ diff --git a/scst/kernel/in-tree/Makefile.scst b/scst/kernel/in-tree/Makefile.scst index 6ec64e291..5fcb58c60 100644 --- a/scst/kernel/in-tree/Makefile.scst +++ b/scst/kernel/in-tree/Makefile.scst @@ -1,4 +1,4 @@ -EXTRA_CFLAGS += -Iinclude/scsi_tgt -Wextra -Wno-unused-parameter +EXTRA_CFLAGS += -Iinclude/scst -Wextra -Wno-unused-parameter scst-y += scst_main.o scst-y += scst_targ.o diff --git a/srpt/src/Kconfig.infiniband.Linux-2.6.25.patch b/srpt/src/Kconfig.infiniband.Linux-2.6.25.patch new file mode 100644 index 000000000..ff3cd5e1f --- /dev/null +++ b/srpt/src/Kconfig.infiniband.Linux-2.6.25.patch @@ -0,0 +1,12 @@ +diff -uprN orig/linux-2.6.24/drivers/infiniband/Kconfig linux-2.6.24/drivers/infiniband/Kconfig +--- orig/linux-2.6.24/drivers/infiniband/Kconfig 2008-01-24 23:58:37.000000000 +0100 ++++ linux-2.6.24/drivers/infiniband/Kconfig 2008-05-09 13:55:27.000000000 +0200 +@@ -51,6 +51,8 @@ + + source "drivers/infiniband/ulp/srp/Kconfig" + ++source "drivers/infiniband/ulp/srpt/Kconfig" ++ + source "drivers/infiniband/ulp/iser/Kconfig" + + endif # INFINIBAND diff --git a/srpt/src/Makefile.in_kernel b/srpt/src/Makefile.in_kernel index 597f1c525..6b31a3723 100644 --- a/srpt/src/Makefile.in_kernel +++ b/srpt/src/Makefile.in_kernel @@ -1,4 +1,4 @@ EXTRA_CFLAGS += -Idrivers/infiniband/include -EXTRA_CFLAGS += -Iinclude/scsi_tgt +EXTRA_CFLAGS += -Iinclude/scst obj-$(CONFIG_INFINIBAND_SRPT) += ib_srpt.o diff --git a/srpt/src/Makefile.infiniband.Linux-2.6.25.patch b/srpt/src/Makefile.infiniband.Linux-2.6.25.patch new file mode 100644 index 000000000..71f7ccf77 --- /dev/null +++ b/srpt/src/Makefile.infiniband.Linux-2.6.25.patch @@ -0,0 +1,9 @@ +diff -uprN orig/linux-2.6.24/drivers/infiniband/Makefile linux-2.6.24/drivers/infiniband/Makefile +--- orig/linux-2.6.24/drivers/infiniband/Makefile 2008-01-24 23:58:37.000000000 +0100 ++++ linux-2.6.24/drivers/infiniband/Makefile 2008-05-09 13:57:00.000000000 +0200 +@@ -8,4 +8,5 @@ + obj-$(CONFIG_INFINIBAND_NES) += hw/nes/ + obj-$(CONFIG_INFINIBAND_IPOIB) += ulp/ipoib/ + obj-$(CONFIG_INFINIBAND_SRP) += ulp/srp/ ++obj-$(CONFIG_INFINIBAND_SRPT) += ulp/srpt/ + obj-$(CONFIG_INFINIBAND_ISER) += ulp/iser/