chreipl-fcp-mpath: optional dracut config to bundle toolset into initrd

Add a dracut configuration file that might optionally be installed along
with the toolset (per default to: $(USRLIBDIR)/dracut/dracut.conf.d). It
causes the udev rules and helper scripts to be included into an initial
ramdisk, when (re-)built with dracut; along with any dependency.

This is only done when passing `HAVE_DRACUT` set to 1 during the
installation (default is 0), e.g.: make install HAVE_DRACUT=1.

Enabling the toolset during the initial ramdisk phase has the advantage
that paths can be audited earlier in the life cycle of this Linux
runtime, e.g. to record the WWID in the ID-file.

Reviewed-by: Steffen Maier <maier@linux.ibm.com>
Signed-off-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Benjamin Block
2021-09-17 13:50:22 +02:00
committed by Jan Höppner
parent 3591b94c42
commit e127b89624
4 changed files with 51 additions and 0 deletions

View File

@@ -5,3 +5,4 @@
/chreipl-fcp-mpath-is-reipl-zfcp
/chreipl-fcp-mpath-record-volume-identifier
/chreipl-fcp-mpath-try-change-ipl-path
/dracut/dracut.conf.d/70-chreipl-fcp-mpath.conf

View File

@@ -66,6 +66,17 @@ udev/rules.d/70-chreipl-fcp-mpath.rules: $(CHREIPL_FCP_MPATH_UDEV_HELPER)
chreipl-fcp-mpath: udev/rules.d/70-chreipl-fcp-mpath.rules
chreipl-fcp-mpath-clean: chreipl-fcp-mpath-udev-helper-clean
dracut/dracut.conf.d/70-chreipl-fcp-mpath.conf: $(MAKEFILE_LIST)
dracut/dracut.conf.d/70-chreipl-fcp-mpath.conf: % : %.in
$(call chreiplzfcpmp-sed-buildvar-replace,$(<),$(@))
.PHONY: chreipl-fcp-mpath-dracut-clean
chreipl-fcp-mpath-dracut-clean:
rm -f dracut/dracut.conf.d/70-chreipl-fcp-mpath.conf
chreipl-fcp-mpath: dracut/dracut.conf.d/70-chreipl-fcp-mpath.conf
chreipl-fcp-mpath-clean: chreipl-fcp-mpath-dracut-clean
#
## Install
#
@@ -113,6 +124,21 @@ chreipl-fcp-mpath-install-libfiles: $(CHREIPL_FCP_MPATH_COMMON)
chreipl-fcp-mpath-install: chreipl-fcp-mpath-install-libfiles
ifeq ($(HAVE_DRACUT),1)
# install dracut config files
INSTDIRS += $(DRACUTCONFDIR)
.PHONY: chreipl-fcp-mpath-install-dracut-config
chreipl-fcp-mpath-install-dracut-config: | $(DESTDIR)$(DRACUTCONFDIR)
chreipl-fcp-mpath-install-dracut-config: dracut/dracut.conf.d/70-chreipl-fcp-mpath.conf
$(INSTALL_DATA) -t $(DESTDIR)$(DRACUTCONFDIR) \
dracut/dracut.conf.d/70-chreipl-fcp-mpath.conf
chreipl-fcp-mpath-install: chreipl-fcp-mpath-install-dracut-config
endif
#
## Utility
#

View File

@@ -13,11 +13,17 @@
## Paths and Build Variables
#
# Install the configuration file for dracut, to automatically pull in the
# toolset into the initial ramdisk, when built with it.
HAVE_DRACUT = 0
# https://www.gnu.org/software/make/manual/make.html#Directory-Variables
CHREIPLZFCPMPDIR = $(USRLIBDIR)/chreipl-fcp-mpath
UDEVDIR = $(USRLIBDIR)/udev
UDEVRULESDIR = $(UDEVDIR)/rules.d
UDEVRUNDIR = /run/udev
DRACUTDIR = $(USRLIBDIR)/dracut
DRACUTCONFDIR = $(DRACUTDIR)/dracut.conf.d
DEBUGOUTDIR = $(UDEVRUNDIR)
INSTALL_EXEC = $(INSTALL) -g $(GROUP) -o $(OWNER) --preserve-timestamps
@@ -43,6 +49,8 @@ tmpout=$$(mktemp -p ./ .make.tmp.XXXXXXXXXXXXXXXX) && { \
-e 's|@chreiplzfcpmp-fwlock-file@|$(chreiplzfcpmp-fwlock-file)|g' \
-e 's|@chreiplzfcpmp-lib@|$(CHREIPLZFCPMPDIR)/chreipl-fcp-mpath-common.sh|g' \
-e 's|@debugoutdir@|$(DEBUGOUTDIR)|g' \
-e 's|@udevdir@|$(UDEVDIR)|g' \
-e 's|@udevrulesdir@|$(UDEVRULESDIR)|g' \
$(1) > $${tmpout} \
&& mv $${tmpout} $(2) \
|| { rm $${tmpout}; false; } \

View File

@@ -0,0 +1,16 @@
# SPDX-License-Identifier: MIT
#
# chreipl-fcp-mpath: use multipath information to change FCP IPL target
# (C) Copyright IBM Corp. 2021
add_dracutmodules+=" bash multipath udev-rules "
install_items+=" @udevrulesdir@/70-chreipl-fcp-mpath.rules "
install_items+=" @chreiplzfcpmp-lib@ "
install_items+=" @udevdir@/chreipl-fcp-mpath-is-ipl-tgt "
install_items+=" @udevdir@/chreipl-fcp-mpath-is-ipl-vol "
install_items+=" @udevdir@/chreipl-fcp-mpath-is-reipl-zfcp "
install_items+=" @udevdir@/chreipl-fcp-mpath-record-volume-identifier "
install_items+=" @udevdir@/chreipl-fcp-mpath-try-change-ipl-path "
install_items+=" flock hexdump logger mktemp readlink sync truncate "