From: David Cantrell Date: Mon, 2 Nov 2009 19:59:58 +0000 (-1000) Subject: Support new rd_DASD parameter for s390 systems. X-Git-Tag: 003~74 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a790547896fd128d30892c5cb86bf4a4812445e7;p=thirdparty%2Fdracut.git Support new rd_DASD parameter for s390 systems. The new rd_DASD parameter allows dracut to handle multiple rd_DASD options. One parameter per DASD. The syntax is: rd_DASD=[,readonly=X][,erplog=X][,use_diag=X][,failfast=X] The device path is a CCW device path, such as 0.0.0200. The optional parameters are sysfs attributes for the DASD. The X value can be 0 or 1. Dracut will write out each of the rd_DASD settings to /etc/dasd.conf and on bootup, the dasdconf.sh script will parse this file and bring each DASD online with the specified attribute settings. --- diff --git a/modules.d/95dasd/check b/modules.d/95dasd/check index a26196cf3..72ad84668 100755 --- a/modules.d/95dasd/check +++ b/modules.d/95dasd/check @@ -1,5 +1,5 @@ #!/bin/bash arch=$(uname -m) -[ "$arch" = "s390" -o "$arch" = "s390x" ] || exit 1 +[ "$arch" = "s390" -o "$arch" = "s390x" ] || exit 1 exit 0 diff --git a/modules.d/95dasd/dasdconf.sh b/modules.d/95dasd/dasdconf.sh new file mode 100755 index 000000000..40a8ff9bc --- /dev/null +++ b/modules.d/95dasd/dasdconf.sh @@ -0,0 +1,54 @@ +#!/bin/sh + +# config file syntax: +# deviceno sysfs_opts... +# +# Examples: +# 0.0.0203 readonly=1 failfast=1 +# 0.0.0204 +# 0.0.0205 erplog=1 + +CONFIG=/etc/dasd.conf +PATH=/bin:/usr/bin:/sbin:/usr/sbin + +if [ -f "$CONFIG" ]; then + if [ ! -d /sys/bus/ccw/drivers/dasd-eckd ] && [ ! -d /sys/bus/ccw/drivers/dasd-fba ]; then + return + fi + tr "A-Z" "a-z" < $CONFIG | while read line; do + case $line in + \#*) ;; + *) + [ -z "$line" ] && continue + set $line + DEVICE=$1 + SYSFSPATH= + if [ -r "/sys/bus/ccw/drivers/dasd-eckd/$DEVICE" ]; then + SYSFSPATH="/sys/bus/ccw/drivers/dasd-eckd/$DEVICE" + elif [ -r "/sys/bus/ccw/drivers/dasd-fba/$DEVICE" ]; then + SYSFSPATH="/sys/bus/ccw/drivers/dasd-fba/$DEVICE" + else + continue + fi + echo 1 > $SYSFSPATH/online + shift + while [ ! -z "$1" ]; do + ( + attribute="$1" + IFS="=" + set $attribute + case "$1" in + readonly|use_diag|erplog|failfast) + if [ -r "$SYSFSPATH/$1" ]; then + echo $2 > $SYSFSPATH/$1 + fi + ;; + esac + ) + shift + done + echo + ;; + esac + done +fi diff --git a/modules.d/95dasd/install b/modules.d/95dasd/install index 8545a2534..d918dae6c 100755 --- a/modules.d/95dasd/install +++ b/modules.d/95dasd/install @@ -1,3 +1,5 @@ #!/bin/bash inst_hook cmdline 30 "$moddir/parse-dasd.sh" - +dracut_install tr +inst "$moddir/dasdconf.sh" /sbin/dasdconf.sh +inst /etc/dasd.conf diff --git a/modules.d/95dasd/installkernel b/modules.d/95dasd/installkernel index c83c1943c..1f8b37213 100755 --- a/modules.d/95dasd/installkernel +++ b/modules.d/95dasd/installkernel @@ -1,5 +1,4 @@ #!/bin/bash instmods dasd_mod dasd_eckd_mod dasd_fba_mod dasd_diag_mod - diff --git a/modules.d/95dasd/parse-dasd.sh b/modules.d/95dasd/parse-dasd.sh index 6caa64ff2..af58b3193 100755 --- a/modules.d/95dasd/parse-dasd.sh +++ b/modules.d/95dasd/parse-dasd.sh @@ -1,7 +1,7 @@ -[ -d /etc/modprobe.d ] || mkdir /etc/modprobe.d - -dasd_arg=$(getarg rd_DASD=) -if [ -n "$dasd_arg" ]; then - echo "options dasd_mod dasd=$dasd_arg" >> /etc/modprobe.d/dasd.conf -fi -unset dasd_arg +for dasd_arg in $(getargs 'rd_DASD='); do + ( + IFS="," + set $dasd_arg + echo "$@" >> /etc/dasd.conf + ) +done