summaryrefslogtreecommitdiff
path: root/recipes/iscsi-target
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/iscsi-target')
-rw-r--r--recipes/iscsi-target/files/2.6.29.patch72
-rw-r--r--recipes/iscsi-target/files/ietd.conf17
-rw-r--r--recipes/iscsi-target/files/init36
-rw-r--r--recipes/iscsi-target/files/libs.patch11
-rw-r--r--recipes/iscsi-target/iscsi-target_0.4.17.bb45
-rw-r--r--recipes/iscsi-target/iscsi-target_svn.bb48
6 files changed, 229 insertions, 0 deletions
diff --git a/recipes/iscsi-target/files/2.6.29.patch b/recipes/iscsi-target/files/2.6.29.patch
new file mode 100644
index 0000000000..24c1afbdd1
--- /dev/null
+++ b/recipes/iscsi-target/files/2.6.29.patch
@@ -0,0 +1,72 @@
+Index: iscsitarget-0.4.17/kernel/block-io.c
+===================================================================
+--- iscsitarget-0.4.17/kernel/block-io.c (revision 198)
++++ iscsitarget-0.4.17/kernel/block-io.c (working copy)
+@@ -13,6 +13,7 @@
+ #include <linux/blkdev.h>
+ #include <linux/parser.h>
+ #include <linux/buffer_head.h>
++#include <linux/version.h>
+
+ #include "iscsi.h"
+ #include "iscsi_dbg.h"
+@@ -154,14 +155,22 @@
+ {
+ struct blockio_data *bio_data = volume->private;
+ struct block_device *bdev;
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
+ int flags = LUReadonly(volume) ? MS_RDONLY : 0;
++#else
++ fmode_t flags = LUReadonly(volume) ? FMODE_READ : (FMODE_READ | FMODE_WRITE);
++#endif
+ int err = 0;
+
+ bio_data->path = kstrdup(path, GFP_KERNEL);
+ if (!bio_data->path)
+ return -ENOMEM;
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
+ bdev = open_bdev_excl(path, flags, THIS_MODULE);
++#else
++ bdev = open_bdev_exclusive(path, flags, THIS_MODULE);
++#endif
+ if (IS_ERR(bdev)) {
+ err = PTR_ERR(bdev);
+ eprintk("Can't open device %s, error %d\n", path, err);
+@@ -324,8 +333,17 @@
+ {
+ struct blockio_data *bio_data = volume->private;
+
+- if (bio_data->bdev)
++ if (bio_data->bdev) {
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
+ close_bdev_excl(bio_data->bdev);
++#else
++ if (LUReadonly(volume)) {
++ close_bdev_exclusive(bio_data->bdev, FMODE_READ);
++ } else {
++ close_bdev_exclusive(bio_data->bdev, FMODE_READ|FMODE_WRITE);
++ }
++#endif
++ }
+ kfree(bio_data->path);
+
+ kfree(volume->private);
+Index: iscsitarget-0.4.17/kernel/conn.c
+===================================================================
+--- iscsitarget-0.4.17/kernel/conn.c (revision 198)
++++ iscsitarget-0.4.17/kernel/conn.c (working copy)
+@@ -46,9 +46,13 @@
+ "%u.%u.%u.%u", NIPQUAD(inet_sk(sk)->daddr));
+ break;
+ case AF_INET6:
++#ifdef NIP6
+ snprintf(buf, sizeof(buf),
+ "[%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x]",
+ NIP6(inet6_sk(sk)->daddr));
++#else
++ snprintf(buf, sizeof(buf), "[%p6]", &inet6_sk(sk)->daddr);
++#endif
+ break;
+ default:
+ break;
diff --git a/recipes/iscsi-target/files/ietd.conf b/recipes/iscsi-target/files/ietd.conf
new file mode 100644
index 0000000000..4ddfe9dc9e
--- /dev/null
+++ b/recipes/iscsi-target/files/ietd.conf
@@ -0,0 +1,17 @@
+#Target iqn.2007-01.org.foonas:iSCSI.sda.target1
+# Lun 0 Path=/dev/sdb1,Type=blockio
+# MaxConnections 1
+# HeaderDigest None
+# DataDigest None
+# InitialR2T Yes
+# ImmediateData No
+# MaxRecvDataSegmentLength 8192
+# MaxXmitDataSegmentLength 8192
+# MaxBurstLength 262144
+# FirstBurstLength 65536
+# DefaultTime2Wait 2
+# DefaultTime2Retain 20
+# MaxOutstandingR2T 8
+# DataPDUInOrder Yes
+# DataSequenceInOrder Yes
+# ErrorRecoveryLevel 0
diff --git a/recipes/iscsi-target/files/init b/recipes/iscsi-target/files/init
new file mode 100644
index 0000000000..d000adfe3c
--- /dev/null
+++ b/recipes/iscsi-target/files/init
@@ -0,0 +1,36 @@
+#!/bin/sh
+#
+# Start the iSCSI Enterprise Target.
+#
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+
+start_server()
+{
+ modprobe -q crc32c
+ modprobe iscsi_trgt
+ start-stop-daemon --start --quiet --pidfile /var/run/iscsi_trgt.pid --exec /sbin/ietd
+}
+
+stop_server()
+{
+ ietadm --op delete
+ start-stop-daemon --stop --quiet --pidfile /var/run/iscsi_trgt.pid --exec /sbin/ietd
+ sleep 1
+ modprobe -r iscsi_trgt
+}
+
+case "$1" in
+ start)
+ start_server
+ ;;
+ stop)
+ stop_server
+ ;;
+ *)
+ echo "Usage: {start|stop}" >&2
+ exit 1
+ ;;
+esac
+
+exit 0
diff --git a/recipes/iscsi-target/files/libs.patch b/recipes/iscsi-target/files/libs.patch
new file mode 100644
index 0000000000..5108027cc4
--- /dev/null
+++ b/recipes/iscsi-target/files/libs.patch
@@ -0,0 +1,11 @@
+diff -urN iscsitarget-0.4.15/usr/Makefile iscsitarget-0.4.15.new/usr/Makefile
+--- iscsitarget-0.4.15/usr/Makefile 2006-07-03 14:09:30.000000000 +0000
++++ iscsitarget-0.4.15.new/usr/Makefile 2007-07-29 23:16:45.000000000 +0000
+@@ -1,6 +1,6 @@
+ CFLAGS += -O2 -fno-inline -Wall -Wstrict-prototypes -g -I../include
+ PROGRAMS = ietd ietadm
+-LIBS = -lcrypto
++LIBS = -lcrypto $(LDFLAGS)
+
+ all: $(PROGRAMS)
+
diff --git a/recipes/iscsi-target/iscsi-target_0.4.17.bb b/recipes/iscsi-target/iscsi-target_0.4.17.bb
new file mode 100644
index 0000000000..07cbee90df
--- /dev/null
+++ b/recipes/iscsi-target/iscsi-target_0.4.17.bb
@@ -0,0 +1,45 @@
+DESCRIPTION = "iSCSI Enterprise Target is for building an iSCSI storage system on Linux"
+HOMEPAGE = "http://iscsitarget.sourceforge.net/"
+LICENSE = "GPL"
+PR = "r2"
+
+SRC_URI = "${SOURCEFORGE_MIRROR}/iscsitarget/iscsitarget-${PV}.tar.gz \
+ file://libs.patch;patch=1 \
+ file://2.6.29.patch;patch=1 \
+ file://ietd.conf \
+ file://init"
+S = "${WORKDIR}/iscsitarget-${PV}"
+
+DEPENDS = "openssl"
+RRECOMMENDS = "kernel-module-crc32c kernel-module-libcrc32c"
+
+inherit module
+
+do_configure() {
+}
+
+CFLAGS = "-isystem${STAGING_KERNEL_DIR}/include -I${STAGING_INCDIR} -L${STAGING_LIBDIR}"
+LDFLAGS = "-L${STAGING_LIBDIR}"
+FILES_${PN} += " ${base_sbindir}"
+
+do_compile() {
+ oe_runmake KSRC=${STAGING_KERNEL_DIR} CFLAGS='${CFLAGS}' LDFLAGS='${LDFLAGS}'
+}
+
+do_install() {
+ # Module
+ install -d ${D}${base_libdir}/modules/${KERNEL_VERSION}/kernel/iscsi
+ install -m 0644 kernel/iscsi_trgt.ko ${D}${base_libdir}/modules/${KERNEL_VERSION}/kernel/iscsi/iscsi_trgt.ko
+
+ # Userspace utilities
+ install -d ${D}${base_sbindir}
+ install -m 0755 usr/ietd ${D}${base_sbindir}/ietd
+ install -m 0755 usr/ietadm ${D}${base_sbindir}/ietadm
+
+ # Config files, init scripts
+ mkdir -p ${D}${sysconfdir}/init.d
+ install -m 0755 ../init ${D}${sysconfdir}/init.d/iscsi-target
+ install -m 0644 ${WORKDIR}/ietd.conf ${D}${sysconfdir}/
+ install -m 0644 etc/initiators.allow ${D}${sysconfdir}/
+ install -m 0644 etc/initiators.deny ${D}${sysconfdir}/
+}
diff --git a/recipes/iscsi-target/iscsi-target_svn.bb b/recipes/iscsi-target/iscsi-target_svn.bb
new file mode 100644
index 0000000000..774674002e
--- /dev/null
+++ b/recipes/iscsi-target/iscsi-target_svn.bb
@@ -0,0 +1,48 @@
+DESCRIPTION = "iSCSI Enterprise Target is for building an iSCSI storage system on Linux"
+HOMEPAGE = "http://iscsitarget.sourceforge.net/"
+LICENSE = "GPL"
+PR = "r13"
+
+DEFAULT_PREFERENCE = "-1"
+
+SRC_URI = "svn://svn.berlios.de/iscsitarget/;module=trunk;rev=HEAD \
+ file://libs.patch;patch=1 \
+ file://init \
+ file://ietd.conf \
+ "
+
+DEPENDS = " openssl"
+RRECOMMENDS = "kernel-module-crc32c kernel-module-libcrc32c"
+
+S = "${WORKDIR}/trunk"
+
+inherit module
+
+do_configure() {
+}
+
+CFLAGS = "-isystem${STAGING_KERNEL_DIR}/include -I${STAGING_INCDIR} -L${STAGING_LIBDIR}"
+LDFLAGS = "-L${STAGING_LIBDIR}"
+FILES_${PN} += " ${base_sbindir}"
+
+do_compile() {
+ oe_runmake KSRC=${STAGING_KERNEL_DIR} CFLAGS='${CFLAGS}' LDFLAGS='${LDFLAGS}'
+}
+
+do_install() {
+ # Module
+ install -d ${D}${base_libdir}/modules/${KERNEL_VERSION}/kernel/iscsi
+ install -m 0644 kernel/iscsi_trgt.ko ${D}${base_libdir}/modules/${KERNEL_VERSION}/kernel/iscsi/iscsi_trgt.ko
+
+ # Userspace utilities
+ install -d ${D}${base_sbindir}
+ install -m 0755 usr/ietd ${D}${base_sbindir}/ietd
+ install -m 0755 usr/ietadm ${D}${base_sbindir}/ietadm
+
+ # Config files, init scripts
+ mkdir -p ${D}${sysconfdir}/init.d
+ install -m 0755 ../init ${D}${sysconfdir}/init.d/iscsi-target
+ install -m 0644 ${WORKDIR}/ietd.conf ${D}${sysconfdir}/
+ install -m 0644 etc/initiators.allow ${D}${sysconfdir}/
+ install -m 0644 etc/initiators.deny ${D}${sysconfdir}/
+}