Files
s390-tools/zdev/initramfs/hooks/zdev
Peter Oberparleiter 156450f359 zdev: Implement support for early device configuration
Enable user to specify that a device should be configured early, that is
during the initial RAM-disk boot phase. This may be necessary, e.g. to
override auto-configuration for a device which is also applied during
that boot phase. It may also be used to manually specify devices that
are required to access the root file system, such as networking devices.

Users can mark devices as requiring early configuration by specifying
a value of 1 for the newly added internal attribute zdev:early:

 # chzdev dasd-eckd 0.0.1234 -p zdev:early=1

This can be changed back by removing the attribute setting, or by
setting the attribute value to 0:

 # chzdev dasd-eckd 0.0.1234 -p -r zdev:early

or

 # chzdev dasd-eckd 0.0.1234 -p zdev:early=0

Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-06-08 15:03:30 +02:00

57 lines
1.5 KiB
Bash

#!/bin/sh
#
# Copyright IBM Corp. 2016, 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.
#
# hooks/zdev
# This hook script adds files required to apply firmware-provided I/O
# configuration data during boot.
#
# Needs to run after udev or resulting udev rules could be overwritten
PREREQ="udev"
prereqs()
{
echo "$PREREQ"
}
case $1 in
prereqs)
prereqs
exit 0
;;
esac
. /usr/share/initramfs-tools/hook-functions
# Add modules for all device types supported by chzdev (required for
# auto-configuration)
zdev_modules="lcs qeth qeth_l2 qeth_l3 dasd_mod dasd_eckd_mod dasd_fba_mod dasd_diag_mod zfcp"
for x in $zdev_modules ; do
manual_add_modules ${x}
done
copy_exec /sbin/chzdev
copy_exec /sbin/lszdev
copy_exec /sbin/vmcp
_tempfile=$(mktemp --tmpdir initramfs-zdev.XXXXXX)
# Obtain early + root device configuration
chzdev --export "$_tempfile" --persistent --by-path / \
--by-attrib "zdev:early=1" --quiet --type 2>/dev/null
# Apply via --import to prevent other devices from being configured.
# Rename the resulting cio-ignore rule to ensure that it does not override
# the one copied by the initramfs udev hook to /lib/udev.
chzdev --import "$_tempfile" --persistent \
--base "/etc/udev/rules.d/41-cio-ignore.rules=$DESTDIR/etc/udev/rules.d/41-cio-ignore-root.rules" \
--base "/etc=$DESTDIR/etc" --yes --quiet --no-root-update --force \
>/dev/null
rm -f "$_tempfile"