zdev: Integrate firmware auto-configuration with dracut

Add a dracut hook that applies firmware-provided I/O configuration data
as auto-configuration during boot. This way, all I/O devices configured
by DPM are automatically brought online without further user
interaction.

This mechanism is active by default. It can be deactivated by specifying
the following parameter on the kernel command line:

  rd.zdev=no-auto

Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Peter Oberparleiter
2017-09-01 11:05:56 +02:00
committed by Jan Höppner
parent fe68ec513d
commit 3fb356ebd2
3 changed files with 55 additions and 5 deletions

View File

@@ -9,7 +9,8 @@
# 95zdev/module_setup.sh
# 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.
# the root device was configured using the chzdev tool. In addition,
# a hook is installed to parse rd.zdev= kernel parameters.
#
check() {
@@ -29,15 +30,23 @@ depends() {
}
installkernel() {
local _modules=$(lszdev --by-path / --columns MODULES --no-headings 2>/dev/null)
[ -z "$_modules" ] && return 0
[ ! -z "$_modules" ] && instmods $_modules
# Add modules for all device types supported by chzdev (required for
# auto-configuration)
instmods lcs qeth qeth_l2 qeth_l3 dasd_mod dasd_eckd_mod dasd_fba_mod \
dasd_diag_mod zfcp
}
install() {
local _tempfile
# Ensure that required tools are available
inst_multiple chzdev lszdev vmcp
# Hook to parse zdev kernel parameter
inst_hook cmdline 95 "$moddir/parse-zdev.sh"
# Obtain root device configuration
# Exit early if root device type is unknown
if ! lszdev --by-path / >/dev/null 2>&1 ; then
return 0

View File

@@ -0,0 +1,38 @@
#!/bin/sh
#
# Copyright IBM Corp. 2017
#
# 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-zdev.sh
# Parse the kernel command line for rd.zdev kernel parameters. These
# parameters are evaluated and used to configure z Systems specific devices.
#
# Format:
# rd.zdev=no-auto
#
# where
#
# no-auto: Indicates that firmware-provided I/O configuration data
# should not be applied.
#
zdev_fw_file="/sys/firmware/sclp_sd/config/data"
zdev_base_args="--force --yes --no-root-update --no-settle --auto-conf --quiet"
if [ -e "$zdev_fw_file" ] ; then
zdev_auto=1
else
zdev_auto=0
fi
for zdev_arg in $(getargs rd.zdev); do
if [ "$zdev_arg" = "no-auto" ] ; then
zdev_auto=0
fi
done
if [ $zdev_auto -eq 1 ] ; then
chzdev --import "$zdev_fw_file" $zdev_base_args
fi

View File

@@ -11,11 +11,14 @@ ZDEVDIR := 95zdev
# performs the following functions when dracut is run:
#
# - copy the persistent root device configuration to the initial ram disk
# - install a boot-time hook to apply firmware-provided configuration data
# to the system
#
ifeq ($(HAVE_DRACUT),1)
install:
$(INSTALL) -m 755 -d $(DESTDIR)$(MODDIR)
$(INSTALL) -m 755 -d $(DESTDIR)$(MODDIR)/$(ZDEVDIR)
$(INSTALL) -m 755 $(ZDEVDIR)/module-setup.sh \
$(ZDEVDIR)/parse-zdev.sh \
$(DESTDIR)$(MODDIR)/$(ZDEVDIR)/
endif