mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
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:
committed by
Jan Höppner
parent
9b2fb1d4d2
commit
9927023680
@@ -9,7 +9,7 @@
|
||||
# 95zdev-kdump/module_setup.sh
|
||||
# This module installs configuration files (udev rules and modprobe.conf
|
||||
# files) required to enable the kdump target on s390. In addition,
|
||||
# a hook is installed to parse rd.zfcp= kernel parameters.
|
||||
# hooks are installed to parse rd.zfcp= and rd.dasd= kernel parameters.
|
||||
#
|
||||
|
||||
# called by dracut
|
||||
@@ -71,6 +71,12 @@ install() {
|
||||
|
||||
# Hook to parse zfcp dracut cmdline parameter
|
||||
inst_hook cmdline 95 "$moddir/../95zdev/parse-zfcp.sh"
|
||||
# Hook to parse dasd dracut cmdline parameter
|
||||
# Must be the first one to use chzdev so dasd_mod is not yet loaded.
|
||||
inst_hook cmdline 94 "$moddir/../95zdev/parse-dasd.sh"
|
||||
inst_multiple /lib/s390-tools/zdev-from-dasd_mod.dasd
|
||||
|
||||
inst_rules "59-dasd.rules"
|
||||
|
||||
# Obtain kdump target device configuration
|
||||
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
# This module installs configuration files (udev rules and modprobe.conf
|
||||
# files) required to enable the root device on s390. It will only work when
|
||||
# the root device was configured using the chzdev tool. In addition,
|
||||
# hooks are installed to parse rd.zdev= and rd.zfcp= kernel parameters.
|
||||
# hooks are installed to parse rd.zdev= and rd.zfcp= and rd.dasd=
|
||||
# kernel parameters.
|
||||
#
|
||||
|
||||
# called by dracut
|
||||
@@ -76,10 +77,16 @@ install() {
|
||||
inst_hook cmdline 95 "$moddir/parse-zdev.sh"
|
||||
# Hook to parse zfcp dracut cmdline parameter
|
||||
inst_hook cmdline 95 "$moddir/parse-zfcp.sh"
|
||||
# Hook to parse dasd dracut cmdline parameter
|
||||
# Must be the first one to use chzdev so dasd_mod is not yet loaded.
|
||||
inst_hook cmdline 94 "$moddir/parse-dasd.sh"
|
||||
inst_multiple /lib/s390-tools/zdev-from-dasd_mod.dasd
|
||||
|
||||
# Rule to automatically enable devices when running in DPM
|
||||
inst_rules "81-dpm.rules"
|
||||
|
||||
inst_rules "59-dasd.rules"
|
||||
|
||||
# Obtain early + root device configuration
|
||||
|
||||
# shellcheck disable=SC2154
|
||||
|
||||
37
zdev/dracut/95zdev/parse-dasd.sh
Normal file
37
zdev/dracut/95zdev/parse-dasd.sh
Normal file
@@ -0,0 +1,37 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright IBM Corp. 2023
|
||||
#
|
||||
# s390-tools is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the MIT license. See LICENSE for details.
|
||||
#
|
||||
# 95zdev/parse-dasd.sh
|
||||
# Parse the command line for rd.dasd parameters. These
|
||||
# parameters are evaluated and used to configure dasd devices.
|
||||
#
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
type zdev_parse_dasd_list > /dev/null 2>&1 || . /lib/s390-tools/zdev-from-dasd_mod.dasd
|
||||
|
||||
# at this point in time dracut's vinfo() only logs to journal which is hard for
|
||||
# s390 users to find and access on a line mode console such as 3215 mode
|
||||
# so use a vinfo alternative that still prints to the console via kmsg
|
||||
zdev_vinfo() {
|
||||
local _zdev_vinfo_line
|
||||
while read -r _zdev_vinfo_line || [ -n "$_zdev_vinfo_line" ]; do
|
||||
# Prefix "<30>" represents facility LOG_DAEMON 3 and loglevel INFO 6:
|
||||
# (facility << 3) | level.
|
||||
echo "<30>dracut: $_zdev_vinfo_line" > /dev/kmsg
|
||||
done
|
||||
}
|
||||
|
||||
zdev_parse_rd_dasd() {
|
||||
local _zdev_dasd _zdev_dasd_list
|
||||
for _zdev_dasd in $(getargs rd.dasd -d 'rd_DASD='); do
|
||||
_zdev_dasd_list="${_zdev_dasd_list:+${_zdev_dasd_list},}$_zdev_dasd"
|
||||
done
|
||||
echo "$_zdev_dasd_list"
|
||||
}
|
||||
|
||||
zdev_parse_rd_dasd | zdev_parse_dasd_list globals 2>&1 | zdev_vinfo
|
||||
zdev_parse_rd_dasd | zdev_parse_dasd_list ranges 2>&1 | zdev_vinfo
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ install:
|
||||
$(ZDEVDIR)/parse-zdev.sh \
|
||||
$(ZDEVDIR)/zdev-lib.sh \
|
||||
$(ZDEVDIR)/parse-zfcp.sh \
|
||||
$(ZDEVDIR)/parse-dasd.sh \
|
||||
$(DESTDIR)$(DRACUTMODDIR)/$(ZDEVDIR)/
|
||||
$(INSTALL) -m 755 -d $(DESTDIR)$(DRACUTMODDIR)/$(ZDEVKDUMPDIR)
|
||||
$(INSTALL) -m 755 $(ZDEVKDUMPDIR)/module-setup.sh \
|
||||
|
||||
Reference in New Issue
Block a user