Hi,
attaches is a patch for minimal iniramfs support, please apply. It adds
an extra open-iscsi-initramfs package. The hooks there try to add the
basics stuff for booting via iscsi. The question now is how do we want
to pass the arguments to iscsistart. I'd go for a
/etc/iscsi/iscsistart.initramfs that gets also copied onto the initrd
and parsed by the local-top/iscsi script. I only wonder how we can
ensure, that the network is up? Depending on kernel level
autoconfiguration via dhcp or bootp would probably be easiest for now.
Cheers,
 -- Guido
commit 9f34f6af9d67c2521a6de4a0f9e054a1cacdb68a
Author: Guido Guenther <[EMAIL PROTECTED]>
Date:   Sun Aug 12 01:53:07 2007 +0200

    add basic initramfs support

diff --git a/debian/changelog b/debian/changelog
index c240726..96cd5ba 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+open-iscsi (2.0.865-1~irf0) unstable; urgency=low
+
+  * add initramfs package
+  * use quilt for patches
+  * no need to link iscsistart statically
+
+ -- Guido Guenther <[EMAIL PROTECTED]>  Sun, 12 Aug 2007 00:47:07 +0200
+
 open-iscsi (2.0.865-1) unstable; urgency=low
 
   * New upstream release
diff --git a/debian/control b/debian/control
index 731e823..294170d 100644
--- a/debian/control
+++ b/debian/control
@@ -2,7 +2,7 @@ Source: open-iscsi
 Section: net
 Priority: optional
 Maintainer: Philipp Hug <[EMAIL PROTECTED]>
-Build-Depends: debhelper (>= 4.0.0), bzip2
+Build-Depends: debhelper (>= 4.0.0), bzip2, quilt (>= 0.40)
 Standards-Version: 3.7.2.1
 
 Package: open-iscsi
@@ -14,6 +14,17 @@ Description: High performance, transport independent iSCSI implementation
  .
   Homepage: http://www.open-iscsi.org/
 
+Package: open-iscsi-initramfs
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: boot from iscsi target support
+ iSCSI is a network protocol standard that allows the use of the SCSI protocol
+ over TCP/IP networks.  This implementation follows RFC3720.
+ .
+  Homepage: http://www.open-iscsi.org/
+ .
+ This package contains the necessary scripts to support the rootfs on iSCSI.
+
 #Package: linux-iscsi-modules-source
 #Architecture: all
 #Depends: ${shlibs:Depends}, ${misc:Depends}, module-assistant, debhelper (>= 4.0.0), bzip2
diff --git a/debian/initramfs/hooks b/debian/initramfs/hooks
new file mode 100644
index 0000000..2ed7536
--- /dev/null
+++ b/debian/initramfs/hooks
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+PREREQS=""
+
+prereqs() { echo "$PREREQS"; }
+
+case $1 in
+prereqs)
+	prereqs
+	exit 0
+	;;
+esac
+
+if [ ! -x /sbin/iscsistart ]; then
+	exit 0
+fi
+
+. /usr/share/initramfs-tools/hook-functions
+
+copy_exec /sbin/iscsistart	/sbin
+
+for x in iscsi_tcp libiscsi scsi_transport_iscsi; do
+	manual_add_modules ${x}
+done
+
diff --git a/debian/initramfs/local-top b/debian/initramfs/local-top
new file mode 100644
index 0000000..9066696
--- /dev/null
+++ b/debian/initramfs/local-top
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+VERBOSITY=0
+
+PREREQ=""
+
+prereqs() { echo "$PREREQ"; }
+
+case $1 in
+prereqs)
+	prereqs
+	exit 0
+	;;
+esac
+
+
+if [ ! -e /sbin/iscsistart ]; then
+	exit 0
+fi
+
+modprobe -q iscsi_tcp
+
+exit 0
+
diff --git a/debian/open-iscsi-initramfs.install b/debian/open-iscsi-initramfs.install
new file mode 100644
index 0000000..e783265
--- /dev/null
+++ b/debian/open-iscsi-initramfs.install
@@ -0,0 +1 @@
+/usr/iscsistart /sbin/
diff --git a/debian/patches/nostatic.diff b/debian/patches/nostatic.diff
new file mode 100644
index 0000000..ca2b3cb
--- /dev/null
+++ b/debian/patches/nostatic.diff
@@ -0,0 +1,13 @@
+diff --git a/usr/Makefile b/usr/Makefile
+index db33ed1..fe34df2 100644
+--- a/usr/Makefile
++++ b/usr/Makefile
+@@ -50,7 +50,7 @@ iscsiadm: $(COMMON_SRCS) strings.o discovery.o iscsiadm.o
+ 
+ iscsistart: $(IPC_OBJ) $(ISCSI_LIB_SRCS) $(INITIATOR_SRCS) iscsistart.o \
+ 		statics.o
+-	$(CC) $(CFLAGS) -static $^ -o $@
++	$(CC) $(CFLAGS) $^ -o $@
+ 
+ clean:
+ 	rm -f *.o $(PROGRAMS)
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..5bbd9fe
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+nostatic.diff
diff --git a/debian/rules b/debian/rules
index 391e717..b3efe53 100755
--- a/debian/rules
+++ b/debian/rules
@@ -16,7 +16,9 @@
 # This has to be exported to make some magic below work.
 export DH_OPTIONS
 
+include /usr/share/quilt/quilt.make
 
+INITRAMFS=$(CURDIR)/debian/open-iscsi-initramfs/usr/share/initramfs-tools/
 
 CFLAGS = -Wall -g
 export OPTFLAGS =-DDISCOVERY_FILE=\"/var/lib/open-iscsi/discovery\" -DNODE_FILE=\"/var/lib/open-iscsi/node\"
@@ -28,7 +30,7 @@ else
 endif
 
 configure: configure-stamp
-configure-stamp:
+configure-stamp: patch
 	dh_testdir
 	# Add here commands to configure the package.
 
@@ -39,7 +41,7 @@ configure-stamp:
 build: build-arch
 
 build-arch: build-arch-stamp
-build-arch-stamp: configure-stamp 
+build-arch-stamp: configure-stamp
 
 	# Add here commands to compile the arch part of the package.
 	$(MAKE) -C usr
@@ -54,7 +56,7 @@ build-indep-stamp: configure-stamp
 	#$(MAKE) doc
 	touch build-indep-stamp
 
-clean:
+clean: unpatch
 	dh_testdir
 	dh_testroot
 	rm -f build-arch-stamp build-indep-stamp configure-stamp
@@ -113,6 +115,11 @@ install-arch:
 	install -m 644 etc/iscsid.conf $(CURDIR)/debian/open-iscsi/etc/iscsi
 	install -m 644 debian/initiatorname.iscsi $(CURDIR)/debian/open-iscsi/etc/iscsi/initiatorname.iscsi
 
+	# initramfs stuff:
+	install -D -m 755 debian/initramfs/hooks $(INITRAMFS)/hooks/iscsi
+	install -D -m 755 debian/initramfs/local-top \
+		$(INITRAMFS)/scripts/local-top/iscsi
+
 	dh_install -s
 
 # Must not depend on anything. This is to be called by

Reply via email to