diff --git a/chreipl-fcp-mpath/.gitignore b/chreipl-fcp-mpath/.gitignore index 0fd34f24..203a7f6d 100644 --- a/chreipl-fcp-mpath/.gitignore +++ b/chreipl-fcp-mpath/.gitignore @@ -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 diff --git a/chreipl-fcp-mpath/Makefile b/chreipl-fcp-mpath/Makefile index 0645d0d2..1bd40015 100644 --- a/chreipl-fcp-mpath/Makefile +++ b/chreipl-fcp-mpath/Makefile @@ -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 # diff --git a/chreipl-fcp-mpath/chreipl-fcp-mpath.mak b/chreipl-fcp-mpath/chreipl-fcp-mpath.mak index 08bd03a0..9d0c9d64 100644 --- a/chreipl-fcp-mpath/chreipl-fcp-mpath.mak +++ b/chreipl-fcp-mpath/chreipl-fcp-mpath.mak @@ -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; } \ diff --git a/chreipl-fcp-mpath/dracut/dracut.conf.d/70-chreipl-fcp-mpath.conf.in b/chreipl-fcp-mpath/dracut/dracut.conf.d/70-chreipl-fcp-mpath.conf.in new file mode 100644 index 00000000..3a2f8ae2 --- /dev/null +++ b/chreipl-fcp-mpath/dracut/dracut.conf.d/70-chreipl-fcp-mpath.conf.in @@ -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 "