From bc4f4551512c324915564e3898e9d7fd3401e6eb Mon Sep 17 00:00:00 2001 From: Steffen Maier Date: Fri, 5 May 2023 19:26:49 +0200 Subject: [PATCH] zdev/dracut: retain early persistent config over switch root MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Useful for debugging (what happened during early boot). Also useful for distro installers, which can import the early config into their own environment early after starting: chzdev --import /run/zdev.initrd.config --persistent --yes \ --no-root-update --force --verbose After that, distro installers can modify/add the device config based on interactive or unattended installation choices using chzdev --enable --active --persistent ... Finally, distro installers can likewise transfer the entire device config to the installed system mounted under $SYSROOT: chzdev --export /tmp/zdev.config --all --type --persistent --verbose Github-ID: https://github.com/ibm-s390-linux/s390-tools/pull/158 Acked-by: Vineeth Vijayan Acked-by: Peter Oberparleiter Signed-off-by: Steffen Maier Signed-off-by: Jan Höppner --- zdev/dracut/95zdev/module-setup.sh | 2 ++ zdev/dracut/95zdev/retain-zdev.sh | 26 ++++++++++++++++++++++++++ zdev/dracut/Makefile | 1 + 3 files changed, 29 insertions(+) create mode 100644 zdev/dracut/95zdev/retain-zdev.sh diff --git a/zdev/dracut/95zdev/module-setup.sh b/zdev/dracut/95zdev/module-setup.sh index 2bc9ce87..7dce1c15 100644 --- a/zdev/dracut/95zdev/module-setup.sh +++ b/zdev/dracut/95zdev/module-setup.sh @@ -82,6 +82,8 @@ install() { inst_hook cmdline 94 "$moddir/parse-dasd.sh" inst_multiple /lib/s390-tools/zdev-from-dasd_mod.dasd + inst_hook pre-pivot 95 "$moddir/retain-zdev.sh" + # Rule to automatically enable devices when running in DPM inst_rules "81-dpm.rules" diff --git a/zdev/dracut/95zdev/retain-zdev.sh b/zdev/dracut/95zdev/retain-zdev.sh new file mode 100644 index 00000000..8d13d00f --- /dev/null +++ b/zdev/dracut/95zdev/retain-zdev.sh @@ -0,0 +1,26 @@ +#!/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/retain-zdev.sh +# Copy zdev persistent config from initrd to root-fs. +# + +chzdev --export /run/zdev.initrd.config --all --type --persistent --quiet + +# Apart from debugging purposes, this is useful for distro installers, +# which can import the early config into their own environment early +# after starting: +# chzdev --import /run/zdev.initrd.config --persistent --yes --no-root-update --force --verbose +# +# After that, distro installers can modify/add the device config based +# on interactive or unattended installation choices using +# chzdev --enable --active --persistent ... +# +# Finally, distro installers can likewise transfer the entire device config +# to the installed system mounted under $SYSROOT: +# chzdev --export /tmp/zdev.config --all --type --persistent --verbose +# chzdev --import /tmp/zdev.config --persistent --yes --no-root-update --force --verbose --base "$SYSROOT" diff --git a/zdev/dracut/Makefile b/zdev/dracut/Makefile index e8410105..a3274a8a 100644 --- a/zdev/dracut/Makefile +++ b/zdev/dracut/Makefile @@ -23,6 +23,7 @@ install: $(ZDEVDIR)/zdev-lib.sh \ $(ZDEVDIR)/parse-zfcp.sh \ $(ZDEVDIR)/parse-dasd.sh \ + $(ZDEVDIR)/retain-zdev.sh \ $(DESTDIR)$(DRACUTMODDIR)/$(ZDEVDIR)/ $(INSTALL) -m 755 -d $(DESTDIR)$(DRACUTMODDIR)/$(ZDEVKDUMPDIR) $(INSTALL) -m 755 $(ZDEVKDUMPDIR)/module-setup.sh \