dracut/0056-81cio_ignore-handle-cio_ignore-commandline.patch

79 lines
2.0 KiB
Diff
Raw Normal View History

Index: dracut-037/modules.d/81cio_ignore/module-setup.sh
===================================================================
--- /dev/null
+++ dracut-037/modules.d/81cio_ignore/module-setup.sh
@@ -0,0 +1,39 @@
+#!/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() {
+# do not add this module by default
+ local arch=$(uname -m)
+ [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
+ return 0
+}
+
+find_mount() {
+ local dev mnt etc wanted_dev
+ wanted_dev="$(readlink -e -q $1)"
+ while read dev mnt etc; do
+ [ "$mnt" = "$wanted_dev" ] && echo "$dev" && return 0
+ done < /proc/mounts
+ return 1
+}
+
+cmdline() {
+ local zipl_dasd
+ zipl_dasd=`find_mount /boot/zipl`
+ printf " rd.zipl_dasd=%s\n" "$zipl_dasd "
+}
+
+# called by dracut
+install() {
+ if [[ $hostonly_cmdline == "yes" ]];then
+ echo $(cmdline) >"${initdir}/etc/cmdline.d/01zipl_dasd.conf"
+ fi
+
+ inst_hook pre-mount 10 "$moddir/parse-zipl.sh"
+ inst_multiple cio_ignore mount umount mkdir
+}
+installkernel() {
+ instmods ext4
+}
Index: dracut-037/modules.d/81cio_ignore/parse-zipl.sh
===================================================================
--- /dev/null
+++ dracut-037/modules.d/81cio_ignore/parse-zipl.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+ZIPL_DEV="$(getarg rd.zipl_dasd)"
+ZIPL_DIR=/tmp/zipl
+CIO_REMOVE_LIST=$ZIPL_DIR/active_devices.txt
+
+if [ -n $ZIPL_DEV ];then
+ info "Waiting for zipl device $ZIPL_DEV"
+ wait_for_dev -n "$ZIPL_DEV"
+#
+# mount device and read devices
+#
+ [ -d $ZIPL_DIR ] || mkdir $ZIPL_DIR
+ mount -t ext2 -o ro $ZIPL_DEV $ZIPL_DIR
+ if [ -f $CIO_REMOVE_LIST ] ; then
+#
+# File exist
+#
+ while read dev etc; do
+ [ "$dev" = "#" -o "$dev" = "" ] && continue
+ cio_ignore --remove $dev
+ done < $CIO_REMOVE_LIST
+ fi
+ umount $ZIPL_DIR
+else
+ warn "No rd.zipl_dasd boot parameter found"
+fi