]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
add zfcp support for s390
authorHarald Hoyer <harald@redhat.com>
Thu, 8 Oct 2009 12:19:23 +0000 (14:19 +0200)
committerHarald Hoyer <harald@redhat.com>
Thu, 8 Oct 2009 12:21:32 +0000 (14:21 +0200)
dracut.8
modules.d/95zfcp/56-zfcp.rules [new file with mode: 0644]
modules.d/95zfcp/check [new file with mode: 0755]
modules.d/95zfcp/install [new file with mode: 0755]
modules.d/95zfcp/installkernel [new file with mode: 0755]
modules.d/95zfcp/parse-zfcp.sh [new file with mode: 0755]
modules.d/95zfcp/zfcpconf.sh [new file with mode: 0755]

index 89ca4076df138c9c70097042a4fbfa073f631a60..2e4a3459159c974e3bd1991bfd50eb943a9f0b5d 100644 (file)
--- a/dracut.8
+++ b/dracut.8
@@ -174,6 +174,15 @@ only activate the raid sets with the given UUID
 .B rd_DASD=....
 same syntax as the kernel module parameter (s390 only)
 
+.SH ZFCP
+.TP
+.B rd_ZFCP=<zfcp adaptor device bus ID>,<WWPN>,<FCPLUN>
+rd_zfcp can be specified multiple times on the kernel command line.
+example: rd_zfcp=0.0.4000,0x5005076300C213e9,0x5022000000000000 
+.TP
+.B rd_NO_ZFCPCONF
+ignore zfcp.conf included in the initramfs
+
 .SH DHCP
 .TP
 .B root=dhcp
diff --git a/modules.d/95zfcp/56-zfcp.rules b/modules.d/95zfcp/56-zfcp.rules
new file mode 100644 (file)
index 0000000..5e846a4
--- /dev/null
@@ -0,0 +1 @@
+KERNEL=="zfcp_cfdc", RUN+="/sbin/zfcpconf.sh"
diff --git a/modules.d/95zfcp/check b/modules.d/95zfcp/check
new file mode 100755 (executable)
index 0000000..a26196c
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/bash
+arch=$(uname -m)
+[ "$arch" = "s390" -o "$arch" = "s390x" ] || exit 1 
+
+exit 0
diff --git a/modules.d/95zfcp/install b/modules.d/95zfcp/install
new file mode 100755 (executable)
index 0000000..9d92634
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/bash
+inst_hook cmdline 30 "$moddir/parse-zfcp.sh"
+dracut_install tr
+inst "$moddir/zfcpconf.sh" /sbin/zfcpconf.sh
+inst_rules "$moddir/56-zfcp.rules"
+inst /etc/zfcp.conf
diff --git a/modules.d/95zfcp/installkernel b/modules.d/95zfcp/installkernel
new file mode 100755 (executable)
index 0000000..d8b197d
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+instmods zfcp
+       
+
diff --git a/modules.d/95zfcp/parse-zfcp.sh b/modules.d/95zfcp/parse-zfcp.sh
new file mode 100755 (executable)
index 0000000..4f502c2
--- /dev/null
@@ -0,0 +1,11 @@
+
+getarg rd_NO_ZFCPCONF && rm /etc/zfcp.conf
+
+for zfcp_arg in $(getargs 'rd_ZFCP='); do
+    ( 
+        IFS=","
+        set $zfcp_arg
+        echo "$@" >> /etc/zfcp.conf
+    )
+done
+
diff --git a/modules.d/95zfcp/zfcpconf.sh b/modules.d/95zfcp/zfcpconf.sh
new file mode 100755 (executable)
index 0000000..4eb1ab6
--- /dev/null
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+# config file syntax:
+# deviceno   WWPN   FCPLUN
+#
+# Example:
+# 0.0.4000 0x5005076300C213e9 0x5022000000000000 
+# 0.0.4001 0x5005076300c213e9 0x5023000000000000 
+#
+#
+# manual setup:
+# modprobe zfcp
+# echo 1    > /sys/bus/ccw/drivers/zfcp/0.0.4000/online
+# echo LUN  > /sys/bus/ccw/drivers/zfcp/0.0.4000/WWPN/unit_add
+# 
+# Example:
+# modprobe zfcp
+# echo 1                  > /sys/bus/ccw/drivers/zfcp/0.0.4000/online
+# echo 0x5022000000000000 > /sys/bus/ccw/drivers/zfcp/0.0.4000/0x5005076300c213e9/unit_add
+
+CONFIG=/etc/zfcp.conf
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+
+if [ -f "$CONFIG" ]; then
+   if [ ! -d /sys/bus/ccw/drivers/zfcp ]; then
+      modprobe zfcp
+   fi
+   if [ ! -d /sys/bus/ccw/drivers/zfcp ]; then
+      return
+   fi
+   tr "A-Z" "a-z" < $CONFIG| while read line; do
+       case $line in
+          \#*) ;;
+          *)
+              [ -z "$line" ] && continue
+              set $line
+              if [ $# -eq 5 ]; then
+                  DEVICE=$1
+                  SCSIID=$2
+                  WWPN=$3
+                  SCSILUN=$4
+                  FCPLUN=$5
+                  echo "Warning: Deprecated values in /etc/zfcp.conf, ignoring SCSI ID $SCSIID and SCSI LUN $SCSILUN"
+              elif [ $# -eq 3 ]; then
+                  DEVICE=${1##*0x}
+                  WWPN=$2
+                  FCPLUN=$3
+              fi
+              echo 1 > /sys/bus/ccw/drivers/zfcp/${DEVICE}/online
+              [ ! -d /sys/bus/ccw/drivers/zfcp/${DEVICE}/${WWPN}/${FCPLUN} ] \
+                  && echo $FCPLUN > /sys/bus/ccw/drivers/zfcp/${DEVICE}/${WWPN}/unit_add
+              ;;
+       esac
+   done
+fi