From b925f7f5d97259dd81e9d562fd1c6433e4b04f30 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Mon, 15 Jan 2018 09:04:12 +0100 Subject: [PATCH] Merge pull request #347 from danimo/81cio_ignore 81cio_ignore: handle cio_ignore commandline --- dracut.cmdline.7.asc | 15 +++++++++++ modules.d/81cio_ignore/module-setup.sh | 40 ++++++++++++++++++++++++++++++ modules.d/81cio_ignore/parse-cio_accept.sh | 22 ++++++++++++++++ 3 files changed, 77 insertions(+) diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc index f95f4d63..8f83405e 100644 --- a/dracut.cmdline.7.asc +++ b/dracut.cmdline.7.asc @@ -1015,6 +1015,21 @@ ZIPL rd.zipl=UUID=0fb28157-99e3-4395-adef-da3f7d44835a -- +CIO_IGNORE +~~~~~~~~~~ +**rd.cio_accept=**____:: + Remove the devices listed in from the default + cio_ignore kernel command-line settings. + is a list of comma-separated CCW device ids. + The default for this value is taken from the + _/boot/zipl/active_devices.txt_ file. ++ +[listing] +.Example +-- +rd.cio_accept=0.0.0180,0.0.0800,0.0.0801,0.0.0802 +-- + Plymouth Boot Splash ~~~~~~~~~~~~~~~~~~~~ **plymouth.enable=0**:: diff --git a/modules.d/81cio_ignore/module-setup.sh b/modules.d/81cio_ignore/module-setup.sh new file mode 100755 index 00000000..37b414bf --- /dev/null +++ b/modules.d/81cio_ignore/module-setup.sh @@ -0,0 +1,40 @@ +#!/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 +} + +cmdline() { + local cio_accept + + if [ -e /boot/zipl/active_devices.txt ] ; then + while read dev etc ; do + [ "$dev" = "#" -o "$dev" = "" ] && continue; + if [ -z "$cio_accept" ] ; then + cio_accept="$dev" + else + cio_accept="${cio_accept},${dev}" + fi + done < /boot/zipl/active_devices.txt + fi + if [ -n "$cio_accept" ] ; then + echo "rd.cio_accept=${cio_accept}" + fi +} + +# called by dracut +install() { + if [[ $hostonly_cmdline == "yes" ]] ; then + local _cio_accept=$(cmdline) + [[ $_cio_accept ]] && printf "%s\n" "$_cio_accept" >> "${initdir}/etc/cmdline.d/01cio_accept.conf" + fi + + inst_hook cmdline 20 "$moddir/parse-cio_accept.sh" + inst_multiple cio_ignore +} diff --git a/modules.d/81cio_ignore/parse-cio_accept.sh b/modules.d/81cio_ignore/parse-cio_accept.sh new file mode 100755 index 00000000..4f899d25 --- /dev/null +++ b/modules.d/81cio_ignore/parse-cio_accept.sh @@ -0,0 +1,22 @@ +#!/bin/sh +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +# ex: ts=8 sw=4 sts=4 et filetype=sh + +CIO_IGNORE=$(getarg cio_ignore) +CIO_ACCEPT=$(getarg rd.cio_accept) + +if [ -z $CIO_IGNORE ] ; then + info "cio_ignored disabled on commandline" + return +fi +if [ -n "$CIO_ACCEPT" ] ; then + OLDIFS="$IFS" + IFS=, + set -- $CIO_ACCEPT + while (($# > 0)) ; do + info "Enabling device $1" + cio_ignore --remove $1 + shift + done + IFS="$OLDIFS" +fi