dracut/0050-Add-DASD-configuration-for-SuSE.patch
Harald Hoyer 4734ecf5fb dracut-034-62.git20131205
- fixed PATH shortener
- also install /etc/system-fips in the initramfs
- nbd, do not fail in hostonly mode
- add ohci-pci to the list of hardcoded modules
- lvm: do not run pvscan for lvmetad
- network fixes
- skip crypt swaps with password files
- fixed i18n
2013-12-05 17:38:32 +01:00

153 lines
4.4 KiB
Diff

From bfa1db78cdcf6aaea09da560b578426fe663a05e Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Fri, 29 Nov 2013 13:13:47 +0100
Subject: [PATCH] Add DASD configuration for SuSE
On SuSE the DASD configuration is kept in udev rules, one rule
file per device. So add a new module for copying and creating
these rules during boot.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
dracut-functions.sh | 28 +++++++++++++++++
modules.d/95dasd_rules/module-setup.sh | 27 ++++++++++++++++
modules.d/95dasd_rules/parse-dasd.sh | 56 ++++++++++++++++++++++++++++++++++
3 files changed, 111 insertions(+)
create mode 100755 modules.d/95dasd_rules/module-setup.sh
create mode 100755 modules.d/95dasd_rules/parse-dasd.sh
diff --git a/dracut-functions.sh b/dracut-functions.sh
index 04f4fea..7cfa097 100755
--- a/dracut-functions.sh
+++ b/dracut-functions.sh
@@ -899,6 +899,34 @@ inst_rules() {
done
}
+inst_rules_wildcard() {
+ local _target=/etc/udev/rules.d _rule _found
+
+ inst_dir "${udevdir}/rules.d"
+ inst_dir "$_target"
+ for _rule in ${udevdir}/rules.d/$1 ${dracutbasedir}/rules.d/$1 ; do
+ if [[ -e $_rule ]]; then
+ inst_rule_programs "$_rule"
+ inst_rule_group_owner "$_rule"
+ inst_rule_initqueue "$_rule"
+ inst_simple "$_rule"
+ _found=$_rule
+ fi
+ done
+ if [ -n ${hostonly} ] ; then
+ for _rule in ${_target}/$1 ; do
+ if [[ -f $_rule ]]; then
+ inst_rule_programs "$_rule"
+ inst_rule_group_owner "$_rule"
+ inst_rule_initqueue "$_rule"
+ inst_simple "$_rule"
+ _found=$_rule
+ fi
+ done
+ fi
+ [[ $_found ]] || dinfo "Skipping udev rule: $_rule"
+}
+
prepare_udev_rules() {
[ -z "$UDEVVERSION" ] && export UDEVVERSION=$(udevadm --version)
diff --git a/modules.d/95dasd_rules/module-setup.sh b/modules.d/95dasd_rules/module-setup.sh
new file mode 100755
index 0000000..d313171
--- /dev/null
+++ b/modules.d/95dasd_rules/module-setup.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+# called by dracut
+check() {
+ local _arch=$(uname -m)
+ [ -x /sbin/dasd_configure ] || return 1
+ [ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
+ return 0
+}
+
+# called by dracut
+depends() {
+ echo 'dasd_mod'
+ return 0
+}
+
+# called by dracut
+install() {
+ inst_multiple /usr/lib/udev/collect
+ inst_hook cmdline 30 "$moddir/parse-dasd.sh"
+ if [[ $hostonly ]] ; then
+ inst_rules_wildcard 51-dasd-*.rules
+ fi
+ inst_rules 59-dasd.rules
+}
diff --git a/modules.d/95dasd_rules/parse-dasd.sh b/modules.d/95dasd_rules/parse-dasd.sh
new file mode 100755
index 0000000..9389c44
--- /dev/null
+++ b/modules.d/95dasd_rules/parse-dasd.sh
@@ -0,0 +1,56 @@
+#!/bin/sh
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+create_udev_rule() {
+ local ccw=$1
+ local _drv _cu_type _dev_type
+ local _rule=/etc/udev/rules.d/51-dasd-${ccw}.rules
+
+ if [ -e /sys/bus/ccw/devices/${ccw} ] ; then
+ read _cu_type < /sys/bus/ccw/devices/${ccw}/cutype
+ read _dev_type < /sys/bus/ccw/devices/${ccw}/devtype
+ fi
+ case "$_cu_type" in
+ 3990/*|2105/*|2107/*|1750/*|9343/*)
+ _drv=dasd-eckd
+ ;;
+ 6310/*)
+ _drv=dasd-fba
+ ;;
+ 3880/*)
+ case "$_dev_type" in
+ 3380/*)
+ _drv=dasd_eckd
+ ;;
+ 3370/*)
+ _drv=dasd-fba
+ ;;
+ esac
+ ;;
+ esac
+ [ -z "${_drv}" ] && return 0
+
+ [ -e ${_rule} ] && return 0
+
+ cat > $_rule <<EOF
+ACTION=="add", SUBSYSTEM=="ccw", KERNEL=="$ccw", IMPORT{program}="collect $ccw %k ${ccw} $_drv"
+ACTION=="add", SUBSYSTEM=="drivers", KERNEL=="$_drv", IMPORT{program}="collect $ccw %k ${ccw} $_drv"
+ACTION=="add", ENV{COLLECT_$ccw}=="0", ATTR{[ccw/$ccw]online}="1"
+EOF
+}
+
+for dasd_arg in $(getargs root=) $(getargs resume=); do
+ (
+ case $dasd_arg in
+ /dev/disk/by-path/ccw-*)
+ ccw_arg=${dasd_arg##*/}
+ break;
+ esac
+ if [ -n "$ccw_arg" ] ; then
+ IFS="-"
+ set -- $ccw_arg
+ create_udev_rule $2
+ fi
+ )
+done