zdev/dracut: add rd.dasd cmdline option handling

Add parsing of dracut cmdline option "rd.dasd=..." at initrd runtime.
It delegates configuration to chzdev.

Implement `dracut --print-cmdline` and `dracut --hostonly-cmdline` for
initrd build time. Emit an rd.dasd option for each DASD disk in dracut's
device dependency graph (to mount the root-fs, or to access the kdump
target).

This allows a distribution independent device configuration.
Configuration is consistent by using chzdev as backend.
It also prevents duplicate activations of the same device.

Copy the udev rule for unique DASD device nodes under /dev/disk/
[59-dasd.rules] into initrd for the same functionality like 95dasd or
95dasd_rules.

Along with the existing functionality of zdev/dracut, it makes the
following dracut modules superfluous:
https://github.com/dracutdevs/dracut/tree/master/modules.d/95dasd
https://github.com/dracutdevs/dracut/tree/master/modules.d/95dasd_mod
https://github.com/dracutdevs/dracut/tree/master/modules.d/95dasd_rules

Github-ID: https://github.com/ibm-s390-linux/s390-tools/pull/158
Acked-by: Vineeth Vijayan <vneethv@linux.ibm.com>
Acked-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Steffen Maier
2023-03-23 17:48:56 +01:00
committed by Jan Höppner
parent 9b2fb1d4d2
commit 9927023680
5 changed files with 63 additions and 4 deletions
+10 -2
View File
@@ -37,15 +37,16 @@ zdev_zfcp_auto_lun_scan_active() {
return 1
}
# zdev_check_dev() can be extended for other device types such as DASD or PCIe
# zdev_check_dev() can be extended for other device types such as PCIe
zdev_check_dev() {
local _dev=$1
local _devsysfs _devtype _subsystem _driver
local _intlun _fcplun _scsitarget _wwpn _hbaid
local _busid _arg
_devsysfs=$(
cd -P /sys/dev/block/"$_dev" 2> /dev/null && echo "$PWD"
)
# This is roughly what systemd's udev-builtin-path_id does for zfcp:
# This is roughly what systemd's udev-builtin-path_id does:
while [[ -n "$_devsysfs" ]]; do
# ascend to parent: strip last path part
_devsysfs=${_devsysfs%/*}
@@ -97,6 +98,13 @@ zdev_check_dev() {
fi
break
fi
# check for DASD device bus-ID
if [[ "${_driver##*/}" == dasd-* ]]; then
_busid=${_devsysfs##*/}
_arg=$(/lib/s390-tools/zdev-to-dasd_mod.dasd "active" "$_busid")
printf " rd.dasd=%s\n" "$_arg"
break
fi
fi
done
}