From 1ccc0fad273c7ca9face5dc395ef3493a47aa39c Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Thu, 8 Oct 2009 14:19:23 +0200 Subject: [PATCH] add zfcp support for s390 --- dracut.8 | 9 ++++++ modules.d/95zfcp/56-zfcp.rules | 1 + modules.d/95zfcp/check | 5 ++++ modules.d/95zfcp/install | 6 ++++ modules.d/95zfcp/installkernel | 5 ++++ modules.d/95zfcp/parse-zfcp.sh | 11 +++++++ modules.d/95zfcp/zfcpconf.sh | 55 ++++++++++++++++++++++++++++++++++ 7 files changed, 92 insertions(+) create mode 100644 modules.d/95zfcp/56-zfcp.rules create mode 100755 modules.d/95zfcp/check create mode 100755 modules.d/95zfcp/install create mode 100755 modules.d/95zfcp/installkernel create mode 100755 modules.d/95zfcp/parse-zfcp.sh create mode 100755 modules.d/95zfcp/zfcpconf.sh diff --git a/dracut.8 b/dracut.8 index 89ca4076d..2e4a34591 100644 --- 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=,, +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 index 000000000..5e846a4c2 --- /dev/null +++ b/modules.d/95zfcp/56-zfcp.rules @@ -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 index 000000000..a26196cf3 --- /dev/null +++ b/modules.d/95zfcp/check @@ -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 index 000000000..9d926343b --- /dev/null +++ b/modules.d/95zfcp/install @@ -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 index 000000000..d8b197d93 --- /dev/null +++ b/modules.d/95zfcp/installkernel @@ -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 index 000000000..4f502c21e --- /dev/null +++ b/modules.d/95zfcp/parse-zfcp.sh @@ -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 index 000000000..4eb1ab61f --- /dev/null +++ b/modules.d/95zfcp/zfcpconf.sh @@ -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 -- 2.47.3