diff --git a/0022-feat-hwdb-add-hwdb-module-to-install-hwdb.bin-on-dem.patch b/0001-feat-hwdb-add-hwdb-module-to-install-hwdb.bin-on-dem.patch similarity index 91% rename from 0022-feat-hwdb-add-hwdb-module-to-install-hwdb.bin-on-dem.patch rename to 0001-feat-hwdb-add-hwdb-module-to-install-hwdb.bin-on-dem.patch index 1971943..f2b57ec 100644 --- a/0022-feat-hwdb-add-hwdb-module-to-install-hwdb.bin-on-dem.patch +++ b/0001-feat-hwdb-add-hwdb-module-to-install-hwdb.bin-on-dem.patch @@ -1,7 +1,7 @@ -From 0b65ac224d831cc96da940cce510523c7276a5ec Mon Sep 17 00:00:00 2001 +From 3bcb0a9f06bac7fa62dc7241860deb8b671f17cd Mon Sep 17 00:00:00 2001 From: Pavel Valena Date: Tue, 25 Apr 2023 14:56:59 +0200 -Subject: [PATCH 22/23] feat(hwdb): add hwdb module to install hwdb.bin on +Subject: [PATCH 01/24] feat(hwdb): add hwdb module to install hwdb.bin on demand Module to install hwdb.bin. Further extensions might make only selected diff --git a/0023-fix-rngd-install-system-service-file.patch b/0002-fix-rngd-install-system-service-file.patch similarity index 93% rename from 0023-fix-rngd-install-system-service-file.patch rename to 0002-fix-rngd-install-system-service-file.patch index affedec..bdd3d3b 100644 --- a/0023-fix-rngd-install-system-service-file.patch +++ b/0002-fix-rngd-install-system-service-file.patch @@ -1,7 +1,7 @@ -From 9df3cb58a19f38157a615c311356cfd6ae55d2d7 Mon Sep 17 00:00:00 2001 +From d14d724620fe4810930d1c2f07d10fa6b8bc9557 Mon Sep 17 00:00:00 2001 From: Pavel Valena Date: Sun, 23 Jul 2023 19:44:17 +0200 -Subject: [PATCH 23/23] fix(rngd): install system service file +Subject: [PATCH 02/24] fix(rngd): install system service file as there's no reason to keep a copy; there shouldn't be any modifications. diff --git a/0003-refactor-cms-use-zdev-to-simplify-handling-CMSDASD-..patch b/0003-refactor-cms-use-zdev-to-simplify-handling-CMSDASD-..patch deleted file mode 100644 index f71e2b0..0000000 --- a/0003-refactor-cms-use-zdev-to-simplify-handling-CMSDASD-..patch +++ /dev/null @@ -1,198 +0,0 @@ -From 38412977daad049b12273966300d07211674834e Mon Sep 17 00:00:00 2001 -From: Steffen Maier -Date: Wed, 24 May 2023 19:02:09 +0200 -Subject: [PATCH 03/23] refactor(cms): use zdev to simplify handling - CMSDASD=... boot option - -This is just internal to initrd, so we can already migrate the code to -consolidated dasd device configuration with zdev -https://github.com/ibm-s390-linux/s390-tools/tree/master/zdev/. -The code change is transparent to users after dracut switch root. - -Signed-off-by: Steffen Maier ---- - modules.d/80cms/cmssetup.sh | 108 ++++++-------------------------- - modules.d/80cms/module-setup.sh | 3 +- - 2 files changed, 21 insertions(+), 90 deletions(-) - -diff --git a/modules.d/80cms/cmssetup.sh b/modules.d/80cms/cmssetup.sh -index 68e45632..23e81ca9 100755 ---- a/modules.d/80cms/cmssetup.sh -+++ b/modules.d/80cms/cmssetup.sh -@@ -2,34 +2,16 @@ - - type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh - --function sysecho() { -- file="$1" -- shift -- local i=1 -- while [ $i -le 10 ]; do -- if [ ! -f "$file" ]; then -- sleep 1 -- i=$((i + 1)) -- else -- break -- fi -- done -- local status -- read -r status < "$file" -- if [[ $status != "$*" ]]; then -- [ -f "$file" ] && echo "$*" > "$file" -- fi --} -- - function dasd_settle() { -- local dasd_status=/sys/bus/ccw/devices/$1/status -+ local dasd_status -+ dasd_status=$(lszdev dasd "$1" --columns ATTRPATH:status --no-headings --active) - if [ ! -f "$dasd_status" ]; then - return 1 - fi - local i=1 - while [ $i -le 60 ]; do - local status -- read -r status < "$dasd_status" -+ status=$(lszdev dasd "$1" --columns ATTR:status --no-headings --active) - case $status in - online | unformatted) - return 0 -@@ -43,77 +25,23 @@ function dasd_settle() { - return 1 - } - --function dasd_settle_all() { -- for dasdccw in $(while read -r line || [ -n "$line" ]; do echo "${line%%(*}"; done < /proc/dasd/devices); do -- if ! dasd_settle "$dasdccw"; then -- echo $"Could not access DASD $dasdccw in time" -- return 1 -- fi -- done -- return 0 --} -- --# prints a canonocalized device bus ID for a given devno of any format --function canonicalize_devno() { -- case ${#1} in -- 3) echo "0.0.0${1}" ;; -- 4) echo "0.0.${1}" ;; -- *) echo "${1}" ;; -- esac -- return 0 --} -- - # read file from CMS and write it to /tmp - function readcmsfile() { # $1=dasdport $2=filename - local dev -- local numcpus - local devname - local ret=0 - if [ $# -ne 2 ]; then return; fi -- # precondition: udevd created dasda block device node -- if ! dasd_cio_free -d "$1"; then -- echo $"DASD $1 could not be cleared from device blacklist" -- return 1 -- fi -- -- modprobe dasd_mod dasd="$CMSDASD" -- modprobe dasd_eckd_mod -- udevadm settle -- -- # precondition: dasd_eckd_mod driver incl. dependencies loaded, -- # dasd_mod must be loaded without setting any DASD online -- dev=$(canonicalize_devno "$1") -- numcpus=$( -- while read -r line || [ -n "$line" ]; do -- if strstr "$line" "# processors"; then -- echo "${line##*:}" -- break -- fi -- done < /proc/cpuinfo -- ) -+ # precondition: udevd created block device node - -- if [ "${numcpus}" -eq 1 ]; then -- echo 1 > /sys/bus/ccw/devices/"$dev"/online -- else -- if ! sysecho /sys/bus/ccw/devices/"$dev"/online 1; then -- echo $"DASD $dev could not be set online" -- return 1 -- fi -- udevadm settle -- if ! dasd_settle "$dev"; then -- echo $"Could not access DASD $dev in time" -- return 1 -- fi -+ dev="$1" -+ chzdev --enable --active --yes --quiet --no-root-update --force dasd "$dev" || return 1 -+ if ! dasd_settle "$dev"; then -+ echo $"Could not access DASD $dev in time" -+ return 1 - fi - -- udevadm settle -- -- devname=$( -- cd /sys/bus/ccw/devices/"$dev"/block || exit -- set -- * -- [ -b /dev/"$1" ] && echo "$1" -- ) -- devname=${devname:-dasda} -+ devname=$(lszdev dasd "$dev" --columns NAMES --no-headings --active) -+ [[ -n $devname ]] || return 1 - - [[ -d /mnt ]] || mkdir -p /mnt - if cmsfs-fuse --to=UTF-8 -a /dev/"$devname" /mnt; then -@@ -125,20 +53,22 @@ function readcmsfile() { # $1=dasdport $2=filename - ret=1 - fi - -- if ! sysecho /sys/bus/ccw/devices/"$dev"/online 0; then -- echo $"DASD $dev could not be set offline again" -- #return 1 -- fi -- udevadm settle -+ chzdev --disable --active --yes --quiet --no-root-update --force dasd "$dev" - - # unbind all dasds to unload the dasd modules for a clean start - ( - cd /sys/bus/ccw/drivers/dasd-eckd || exit -- for i in *.*; do echo "$i" > unbind; done -+ for i in *.*; do echo "$i" > unbind 2> /dev/null; done -+ ) -+ ( -+ cd /sys/bus/ccw/drivers/dasd-fba || exit -+ for i in *.*; do echo "$i" > unbind 2> /dev/null; done - ) - udevadm settle - modprobe -r dasd_eckd_mod - udevadm settle -+ modprobe -r dasd_fba_mod -+ udevadm settle - modprobe -r dasd_diag_mod - udevadm settle - modprobe -r dasd_mod -diff --git a/modules.d/80cms/module-setup.sh b/modules.d/80cms/module-setup.sh -index 2b280e0f..4872734b 100755 ---- a/modules.d/80cms/module-setup.sh -+++ b/modules.d/80cms/module-setup.sh -@@ -4,6 +4,7 @@ - check() { - arch=${DRACUT_ARCH:-$(uname -m)} - [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1 -+ require_binaries chzdev lszdev || return 1 - return 255 - } - -@@ -28,7 +29,7 @@ install() { - # shellcheck disable=SC2046 - inst_multiple /etc/cmsfs-fuse/filetypes.conf /etc/udev/rules.d/99-fuse.rules /etc/fuse.conf \ - cmsfs-fuse fusermount bash insmod rmmod cat normalize_dasd_arg sed \ -- $(rpm -ql s390utils-base) awk getopt -+ $(rpm -ql s390utils-base) awk getopt chzdev lszdev - - inst_libdir_file "gconv/*" - #inst /usr/lib/locale/locale-archive --- -2.42.0 - diff --git a/0003-revert-fix-install.d-correctly-install-pre-genned-im.patch b/0003-revert-fix-install.d-correctly-install-pre-genned-im.patch new file mode 100644 index 0000000..e1a62aa --- /dev/null +++ b/0003-revert-fix-install.d-correctly-install-pre-genned-im.patch @@ -0,0 +1,238 @@ +From 6fa596ca039300e5f4bb3cca14768976efe95eac Mon Sep 17 00:00:00 2001 +From: Pavel Valena +Date: Wed, 12 Jun 2024 06:30:42 +0200 +Subject: [PATCH 03/24] revert: "fix(install.d): correctly install pre-genned + image and die if no args" + +revert: "fix(install.d): simplify and use what kernel-install gives us" + +This reverts commits: + d40155385d060f8d8608fa8a4931e2e42ddc3a8f + 8388ad149c698c951089606352fdb0cdcaaf40c9 + +https://github.com/dracut-ng/dracut-ng/issues/334 + +This is temporary, until the `20-grub.install` will be able to handle initrd +from kernel staging area. +--- + install.d/50-dracut.install | 152 ++++++++++++++++++----------- + install.d/51-dracut-rescue.install | 22 +---- + 2 files changed, 97 insertions(+), 77 deletions(-) + +diff --git a/install.d/50-dracut.install b/install.d/50-dracut.install +index 14f87721..441414ac 100755 +--- a/install.d/50-dracut.install ++++ b/install.d/50-dracut.install +@@ -1,13 +1,13 @@ + #!/bin/bash + +-COMMAND="${1:?}" +-KERNEL_VERSION="${2:?}" +-#shellcheck disable=SC2034 ++COMMAND="$1" ++KERNEL_VERSION="$2" + BOOT_DIR_ABS="$3" + KERNEL_IMAGE="$4" + +-# If the initrd was provided on the kernel command line, we shouldn't generate our own. +-if [[ "$COMMAND" != "add" || "$#" -gt 4 ]]; then ++# If KERNEL_INSTALL_MACHINE_ID is defined but empty, BOOT_DIR_ABS is a fake directory. ++# So, let's skip to create initrd. ++if ! [[ ${KERNEL_INSTALL_MACHINE_ID-x} ]]; then + exit 0 + fi + +@@ -16,64 +16,102 @@ if [[ "$KERNEL_INSTALL_IMAGE_TYPE" = "uki" ]]; then + exit 0 + fi + +-if [[ "${KERNEL_INSTALL_INITRD_GENERATOR:-dracut}" = "dracut" ]]; then +- # We are the initrd generator +- IMAGE="initrd" +- UEFI_OPTS="--no-uefi" ++# Mismatching the install layout and the --uefi/--no-uefi opts just creates a mess. ++if [[ $KERNEL_INSTALL_LAYOUT == "uki" && -n $KERNEL_INSTALL_STAGING_AREA ]]; then ++ BOOT_DIR_ABS="$KERNEL_INSTALL_STAGING_AREA" ++ if [[ -z $KERNEL_INSTALL_UKI_GENERATOR || $KERNEL_INSTALL_UKI_GENERATOR == "dracut" ]]; then ++ # No uki generator preference set or we have been chosen ++ IMAGE="uki.efi" ++ UEFI_OPTS="--uefi" ++ elif [[ -z $KERNEL_INSTALL_INITRD_GENERATOR || $KERNEL_INSTALL_INITRD_GENERATOR == "dracut" ]]; then ++ # We aren't the uki generator, but we have been requested to make the initrd ++ IMAGE="initrd" ++ UEFI_OPTS="--no-uefi" ++ else ++ exit 0 ++ fi ++elif [[ $KERNEL_INSTALL_LAYOUT == "bls" && -n $KERNEL_INSTALL_STAGING_AREA ]]; then ++ BOOT_DIR_ABS="$KERNEL_INSTALL_STAGING_AREA" ++ if [[ -z $KERNEL_INSTALL_INITRD_GENERATOR || $KERNEL_INSTALL_INITRD_GENERATOR == "dracut" ]]; then ++ IMAGE="initrd" ++ UEFI_OPTS="--no-uefi" ++ else ++ exit 0 ++ fi + else +- exit 0 ++ # No layout information, use users --uefi/--no-uefi preference ++ UEFI_OPTS="" ++ if [[ -d $BOOT_DIR_ABS ]]; then ++ IMAGE="initrd" ++ else ++ BOOT_DIR_ABS="/boot" ++ IMAGE="initramfs-${KERNEL_VERSION}.img" ++ fi + fi + +-if [[ "$KERNEL_INSTALL_UKI_GENERATOR" = "dracut" ]]; then +- # We are chosen to generate the UKI as well as initrd +- IMAGE="uki.efi" +- UEFI_OPTS="--uefi" +-fi ++ret=0 + +-if [[ -f ${KERNEL_IMAGE%/*}/$IMAGE ]]; then +- # we found an initrd or uki.efi at the same place as the kernel +- # use this and don't generate a new one +- [[ $KERNEL_INSTALL_VERBOSE == 1 ]] && echo \ +- "There is an $IMAGE image at the same place as the kernel, skipping generating a new one" +- cp --reflink=auto "${KERNEL_IMAGE%/*}/$IMAGE" "$KERNEL_INSTALL_STAGING_AREA/$IMAGE" \ +- && chown root:root "$KERNEL_INSTALL_STAGING_AREA/$IMAGE" \ +- && chmod 0600 "$KERNEL_INSTALL_STAGING_AREA/$IMAGE" \ +- && exit 0 +-fi ++case "$COMMAND" in ++ add) ++ if [[ $IMAGE == "uki.efi" ]]; then ++ IMAGE_PREGENERATED=${KERNEL_IMAGE%/*}/uki.efi ++ else ++ IMAGE_PREGENERATED=${KERNEL_IMAGE%/*}/initrd ++ fi ++ if [[ -f ${IMAGE_PREGENERATED} ]]; then ++ # we found an initrd or uki.efi at the same place as the kernel ++ # use this and don't generate a new one ++ [[ $KERNEL_INSTALL_VERBOSE == 1 ]] && echo \ ++ "There is an ${IMAGE} image at the same place as the kernel, skipping generating a new one" ++ cp --reflink=auto "$IMAGE_PREGENERATED" "$BOOT_DIR_ABS/$IMAGE" \ ++ && chown root:root "$BOOT_DIR_ABS/$IMAGE" \ ++ && chmod 0600 "$BOOT_DIR_ABS/$IMAGE" \ ++ && exit 0 ++ fi + +-if [ -n "$KERNEL_INSTALL_CONF_ROOT" ]; then +- if [ -f "$KERNEL_INSTALL_CONF_ROOT/cmdline" ]; then +- read -r -d '' -a BOOT_OPTIONS < "$KERNEL_INSTALL_CONF_ROOT/cmdline" +- fi +-elif [[ -f /etc/kernel/cmdline ]]; then +- read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline +-elif [[ -f /usr/lib/kernel/cmdline ]]; then +- read -r -d '' -a BOOT_OPTIONS < /usr/lib/kernel/cmdline +-else +- declare -a BOOT_OPTIONS ++ if [ -n "$KERNEL_INSTALL_CONF_ROOT" ]; then ++ if [ -f "$KERNEL_INSTALL_CONF_ROOT/cmdline" ]; then ++ read -r -d '' -a BOOT_OPTIONS < "$KERNEL_INSTALL_CONF_ROOT/cmdline" ++ fi ++ elif [[ -f /etc/kernel/cmdline ]]; then ++ read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline ++ elif [[ -f /usr/lib/kernel/cmdline ]]; then ++ read -r -d '' -a BOOT_OPTIONS < /usr/lib/kernel/cmdline ++ else ++ declare -a BOOT_OPTIONS + +- read -r -d '' -a line < /proc/cmdline +- for i in "${line[@]}"; do +- [[ ${i#initrd=*} != "$i" ]] && continue +- BOOT_OPTIONS+=("$i") +- done +-fi ++ read -r -d '' -a line < /proc/cmdline ++ for i in "${line[@]}"; do ++ [[ ${i#initrd=*} != "$i" ]] && continue ++ BOOT_OPTIONS+=("$i") ++ done ++ fi + +-unset noimageifnotneeded ++ unset noimageifnotneeded + +-for ((i = 0; i < "${#BOOT_OPTIONS[@]}"; i++)); do +- # shellcheck disable=SC1001 +- if [[ ${BOOT_OPTIONS[$i]} == root\=PARTUUID\=* ]]; then +- noimageifnotneeded="yes" +- break +- fi +-done ++ for ((i = 0; i < "${#BOOT_OPTIONS[@]}"; i++)); do ++ # shellcheck disable=SC1001 ++ if [[ ${BOOT_OPTIONS[$i]} == root\=PARTUUID\=* ]]; then ++ noimageifnotneeded="yes" ++ break ++ fi ++ done ++ ++ # shellcheck disable=SC2046 ++ dracut -f \ ++ ${noimageifnotneeded:+--noimageifnotneeded} \ ++ $([[ $KERNEL_INSTALL_VERBOSE == 1 ]] && echo --verbose) \ ++ $([[ -n $KERNEL_IMAGE ]] && echo --kernel-image "$KERNEL_IMAGE") \ ++ "$UEFI_OPTS" \ ++ --kver "$KERNEL_VERSION" \ ++ "$BOOT_DIR_ABS/$IMAGE" ++ ret=$? ++ ;; ++ ++ remove) ++ rm -f -- "$BOOT_DIR_ABS/$IMAGE" ++ ret=$? ++ ;; ++esac + +-# shellcheck disable=SC2046 +-dracut -f \ +- ${noimageifnotneeded:+--noimageifnotneeded} \ +- $([[ $KERNEL_INSTALL_VERBOSE == 1 ]] && echo --verbose) \ +- $([[ -n $KERNEL_IMAGE ]] && echo --kernel-image "$KERNEL_IMAGE") \ +- "$UEFI_OPTS" \ +- --kver "$KERNEL_VERSION" \ +- "$KERNEL_INSTALL_STAGING_AREA/$IMAGE" || exit 1 ++exit $ret +diff --git a/install.d/51-dracut-rescue.install b/install.d/51-dracut-rescue.install +index 25f75557..aa0ccdc5 100755 +--- a/install.d/51-dracut-rescue.install ++++ b/install.d/51-dracut-rescue.install +@@ -2,29 +2,11 @@ + + export LANG=C + +-COMMAND="${1:?}" +-KERNEL_VERSION="${2:?}" ++COMMAND="$1" ++KERNEL_VERSION="$2" + BOOT_DIR_ABS="${3%/*}/0-rescue" + KERNEL_IMAGE="$4" + +-# If the initrd was provided on the kernel command line, we shouldn't generate our own. +-if [[ "$COMMAND" = "add" && "$#" -gt 4 ]]; then +- exit 0 +-fi +- +-# Do not attempt to create initramfs if the supplied image is already a UKI +-if [[ "$KERNEL_INSTALL_IMAGE_TYPE" = "uki" ]]; then +- exit 0 +-fi +- +-if [[ "$KERNEL_INSTALL_UKI_GENERATOR" = "dracut" ]]; then +- # Rescue images currently not compatible with UKIs +- exit 0 +-elif [[ "${KERNEL_INSTALL_INITRD_GENERATOR:-dracut}" != "dracut" ]]; then +- # We are not the initrd generator +- exit 0 +-fi +- + dropindirs_sort() { + suffix=$1 + shift +-- +2.42.0 + diff --git a/0001-feat-kernel-install-do-nothing-when-KERNEL_INSTALL_I.patch b/0004-feat-kernel-install-do-nothing-when-KERNEL_INSTALL_I.patch similarity index 96% rename from 0001-feat-kernel-install-do-nothing-when-KERNEL_INSTALL_I.patch rename to 0004-feat-kernel-install-do-nothing-when-KERNEL_INSTALL_I.patch index de38727..7f68517 100644 --- a/0001-feat-kernel-install-do-nothing-when-KERNEL_INSTALL_I.patch +++ b/0004-feat-kernel-install-do-nothing-when-KERNEL_INSTALL_I.patch @@ -1,7 +1,7 @@ -From f86d5ff72868e9df7d255e3c5e938a9e339f09fa Mon Sep 17 00:00:00 2001 +From c6d18c3c71597e78572378fc4dde391f1845b8bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 18 Jan 2022 18:08:42 +0100 -Subject: [PATCH 01/10] feat(kernel-install): do nothing when +Subject: [PATCH 04/24] feat(kernel-install): do nothing when $KERNEL_INSTALL_INITRD_GENERATOR says so dracut may be installed without being actually used. This is very common in diff --git a/0004-refactor-cms-use-consolidated-zfcp-config-with-zdev-.patch b/0004-refactor-cms-use-consolidated-zfcp-config-with-zdev-.patch deleted file mode 100644 index 0a35c9b..0000000 --- a/0004-refactor-cms-use-consolidated-zfcp-config-with-zdev-.patch +++ /dev/null @@ -1,77 +0,0 @@ -From 3a9b9a5cf507a868f8b3ec33cf686b3a552286c2 Mon Sep 17 00:00:00 2001 -From: Steffen Maier -Date: Sat, 28 Jan 2023 01:58:29 +0100 -Subject: [PATCH 04/23] refactor(cms): use consolidated zfcp config with zdev - from s390-tools - -This is just internal to initrd, so we can already migrate the code to -consolidated zfcp device configuration with zdev -https://github.com/ibm-s390-linux/s390-tools/tree/master/zdev/. -The code change is transparent to users after dracut switch root. - -The generated persistent config of chzdev are pure udev rules so it has no -dependency on other dracut modules such as zdev, or zfcp. - -Signed-off-by: Steffen Maier ---- - modules.d/80cms/cmssetup.sh | 21 ++++++++++++++++----- - modules.d/80cms/module-setup.sh | 2 +- - 2 files changed, 17 insertions(+), 6 deletions(-) - -diff --git a/modules.d/80cms/cmssetup.sh b/modules.d/80cms/cmssetup.sh -index 23e81ca9..da42ec0f 100755 ---- a/modules.d/80cms/cmssetup.sh -+++ b/modules.d/80cms/cmssetup.sh -@@ -117,7 +117,6 @@ processcmsfile() { - dasd_cio_free - fi - -- unset _do_zfcp - for i in ${!FCP_*}; do - echo "${!i}" | while read -r port rest || [ -n "$port" ]; do - case $port in -@@ -130,12 +129,24 @@ processcmsfile() { - port="0.0.$port" - ;; - esac -- echo "$port" "$rest" >> /etc/zfcp.conf -+ # shellcheck disable=SC2086 -+ set -- $rest -+ SAVED_IFS="$IFS" -+ IFS=":" -+ # Intentionally do not dynamically activate now, but only generate udev -+ # rules, which activate the device later during udev coldplug. -+ if [[ -z $rest ]]; then -+ chzdev --enable --persistent \ -+ --no-settle --yes --quiet --no-root-update --force \ -+ zfcp-host "$port" 2>&1 | vinfo -+ else -+ chzdev --enable --persistent \ -+ --no-settle --yes --quiet --no-root-update --force \ -+ zfcp-lun "$port:$*" 2>&1 | vinfo -+ fi -+ IFS="$SAVED_IFS" - done -- _do_zfcp=1 - done -- [[ $_do_zfcp ]] && zfcp_cio_free -- unset _do_zfcp - } - - [[ $CMSDASD ]] || CMSDASD=$(getarg "CMSDASD=") -diff --git a/modules.d/80cms/module-setup.sh b/modules.d/80cms/module-setup.sh -index 4872734b..0dd86b80 100755 ---- a/modules.d/80cms/module-setup.sh -+++ b/modules.d/80cms/module-setup.sh -@@ -12,7 +12,7 @@ check() { - depends() { - arch=${DRACUT_ARCH:-$(uname -m)} - [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1 -- echo znet zfcp dasd dasd_mod bash -+ echo znet dasd dasd_mod bash - return 0 - } - --- -2.42.0 - diff --git a/0002-fix-kernel-install-do-not-generate-an-initrd-when-on.patch b/0005-fix-kernel-install-do-not-generate-an-initrd-when-on.patch similarity index 90% rename from 0002-fix-kernel-install-do-not-generate-an-initrd-when-on.patch rename to 0005-fix-kernel-install-do-not-generate-an-initrd-when-on.patch index 858ec33..37f69b2 100644 --- a/0002-fix-kernel-install-do-not-generate-an-initrd-when-on.patch +++ b/0005-fix-kernel-install-do-not-generate-an-initrd-when-on.patch @@ -1,7 +1,7 @@ -From 9f979fc9486af3c7c924d3f9f837f06616c61829 Mon Sep 17 00:00:00 2001 +From 1bd81956dc050db071c5885cfbcde393370468ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 18 Jan 2022 18:58:58 +0100 -Subject: [PATCH 02/23] fix(kernel-install): do not generate an initrd when one +Subject: [PATCH 05/24] fix(kernel-install): do not generate an initrd when one was specified According to the synopsis, kernel-install can be called with an diff --git a/0005-refactor-cms-use-consolidated-dasd-config-with-zdev-.patch b/0005-refactor-cms-use-consolidated-dasd-config-with-zdev-.patch deleted file mode 100644 index 01f78c9..0000000 --- a/0005-refactor-cms-use-consolidated-dasd-config-with-zdev-.patch +++ /dev/null @@ -1,81 +0,0 @@ -From 74edb9758da26ef063e4686a595f1d34f07f86f7 Mon Sep 17 00:00:00 2001 -From: Steffen Maier -Date: Wed, 24 May 2023 19:04:48 +0200 -Subject: [PATCH 05/23] refactor(cms): use consolidated dasd config with zdev - from s390-tools - -Depends on https://github.com/ibm-s390-linux/s390-tools commit -9b2fb1d4d2e2 ("zdev: add helper to convert from dasd_mod.dasd to zdev -config"). - -This is just internal to initrd, so it's possible to migrate the code to -consolidated dasd device configuration with zdev -https://github.com/ibm-s390-linux/s390-tools/tree/master/zdev/. -The code change is transparent to users after dracut switch root. - -The generated persistent config of chzdev are pure udev rules so it has no -dependency on other dracut modules such as zdev, dasd, or dasd_mod. -Instead now install the corresponding kernel device drivers here directly. - -Signed-off-by: Steffen Maier ---- - modules.d/80cms/cmssetup.sh | 6 +++--- - modules.d/80cms/module-setup.sh | 6 +++--- - 2 files changed, 6 insertions(+), 6 deletions(-) - -diff --git a/modules.d/80cms/cmssetup.sh b/modules.d/80cms/cmssetup.sh -index da42ec0f..01cfd303 100755 ---- a/modules.d/80cms/cmssetup.sh -+++ b/modules.d/80cms/cmssetup.sh -@@ -1,6 +1,7 @@ - #!/bin/bash - - type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh -+type zdev_parse_dasd_list > /dev/null 2>&1 || . /lib/s390-tools/zdev-from-dasd_mod.dasd - - function dasd_settle() { - local dasd_status -@@ -112,9 +113,8 @@ processcmsfile() { - fi - - if [[ $DASD ]] && [[ $DASD != "none" ]]; then -- echo "$DASD" | normalize_dasd_arg > /etc/dasd.conf -- echo "options dasd_mod dasd=$DASD" > /etc/modprobe.d/dasd_mod.conf -- dasd_cio_free -+ echo "$DASD" | zdev_parse_dasd_list globals 2>&1 | vinfo -+ echo "$DASD" | zdev_parse_dasd_list ranges 2>&1 | vinfo - fi - - for i in ${!FCP_*}; do -diff --git a/modules.d/80cms/module-setup.sh b/modules.d/80cms/module-setup.sh -index 0dd86b80..05b049da 100755 ---- a/modules.d/80cms/module-setup.sh -+++ b/modules.d/80cms/module-setup.sh -@@ -12,13 +12,13 @@ check() { - depends() { - arch=${DRACUT_ARCH:-$(uname -m)} - [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1 -- echo znet dasd dasd_mod bash -+ echo znet bash - return 0 - } - - # called by dracut - installkernel() { -- instmods zfcp -+ instmods zfcp dasd_mod dasd_eckd_mod dasd_fba_mod dasd_diag_mod - } - - # called by dracut -@@ -28,7 +28,7 @@ install() { - inst_script "$moddir/cmsifup.sh" /sbin/cmsifup - # shellcheck disable=SC2046 - inst_multiple /etc/cmsfs-fuse/filetypes.conf /etc/udev/rules.d/99-fuse.rules /etc/fuse.conf \ -- cmsfs-fuse fusermount bash insmod rmmod cat normalize_dasd_arg sed \ -+ cmsfs-fuse fusermount bash insmod rmmod cat /lib/s390-tools/zdev-from-dasd_mod.dasd sed \ - $(rpm -ql s390utils-base) awk getopt chzdev lszdev - - inst_libdir_file "gconv/*" --- -2.42.0 - diff --git a/0006-fix-crypt-decryption-when-rd.luks.name-is-set.patch b/0006-fix-crypt-decryption-when-rd.luks.name-is-set.patch new file mode 100644 index 0000000..e84385c --- /dev/null +++ b/0006-fix-crypt-decryption-when-rd.luks.name-is-set.patch @@ -0,0 +1,25 @@ +From 6cb58e86ae65cf9922023b12e889446323a89080 Mon Sep 17 00:00:00 2001 +From: Laszlo Gombos +Date: Sat, 15 Jun 2024 15:21:44 -0400 +Subject: [PATCH 06/24] fix(crypt): decryption when rd.luks.name is set + +--- + modules.d/90crypt/parse-crypt.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/modules.d/90crypt/parse-crypt.sh b/modules.d/90crypt/parse-crypt.sh +index 39fc6d21..9567a4a9 100755 +--- a/modules.d/90crypt/parse-crypt.sh ++++ b/modules.d/90crypt/parse-crypt.sh +@@ -174,7 +174,7 @@ else + } >> "$hookdir/emergency/90-crypt.sh" + fi + done +- elif getargbool 1 rd.auto; then ++ elif getargbool 1 rd.auto && [ -z "$(getargs rd.luks.name)" ]; then + if [ -z "$DRACUT_SYSTEMD" ]; then + { + printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="%s ' "$(command -v initqueue)" +-- +2.42.0 + diff --git a/0006-refactor-cms-use-consolidated-network-config-with-zd.patch b/0006-refactor-cms-use-consolidated-network-config-with-zd.patch deleted file mode 100644 index 74f3d4c..0000000 --- a/0006-refactor-cms-use-consolidated-network-config-with-zd.patch +++ /dev/null @@ -1,109 +0,0 @@ -From cc14fe218861f2855ca88ad03220ecb78d4aa31a Mon Sep 17 00:00:00 2001 -From: Steffen Maier -Date: Wed, 26 Jul 2023 13:50:03 +0200 -Subject: [PATCH 06/23] refactor(cms): use consolidated network config with - zdev from s390-tools - -This is just internal to initrd, so we can already migrate the code to -consolidated network device configuration with zdev -https://github.com/ibm-s390-linux/s390-tools/tree/master/zdev/. -The code change is transparent to users after dracut switch root. - -The generated persistent config of chzdev are pure udev rules so it has no -dependency on the zdev dracut module. - -Keep the dependency on dracut module znet to at least pull in the required -kernel device drivers. - -Since consolidated s390 network device configuration with zdev is used, -it takes care of all s390-specific settings. -None of the s390-specific ifcfg variables should be used anymore. -NETTYPE, OPTIONS, PORTNAME, and CTCPROT can be removed entirely. -SUBCHANNELS is kept because there are some dependency chains -(probably around the key identifiying an interface which is not HWADDR): - -modules.d/35network-legacy/module-setup.sh -parses (sources) each of /etc/sysconfig/network-scripts/ifcfg-* -and if that contains SUBCHANNELS, create a symlink from the ifcfg file to -/etc/sysconfig/network-scripts/ccw-${SUBCHANNELS}.conf - -modules.d/35network-legacy/ifup.sh installed as /sbin/ifup -checks during team setup if a slave interface is an s390 channel-attached -network interface and then parses (sources) -/etc/sysconfig/network-scripts/ccw-${SUBCHANNELS}.conf -from above, if that file exists - -Signed-off-by: Steffen Maier ---- - modules.d/80cms/cms-write-ifcfg.sh | 13 ------------- - modules.d/80cms/cmssetup.sh | 21 +++++++++++++-------- - 2 files changed, 13 insertions(+), 21 deletions(-) - -diff --git a/modules.d/80cms/cms-write-ifcfg.sh b/modules.d/80cms/cms-write-ifcfg.sh -index ecfd53ef..91263092 100755 ---- a/modules.d/80cms/cms-write-ifcfg.sh -+++ b/modules.d/80cms/cms-write-ifcfg.sh -@@ -81,21 +81,8 @@ EOF - fi - # colons in SEARCHDNS already replaced with spaces above for /etc/resolv.conf - [[ $SEARCHDNS ]] && echo "DOMAIN=\"$SEARCHDNS\"" >> "$IFCFGFILE" -- [[ $NETTYPE ]] && echo "NETTYPE=$NETTYPE" >> "$IFCFGFILE" - [[ $PEERID ]] && echo "PEERID=$PEERID" >> "$IFCFGFILE" -- [[ $PORTNAME ]] && echo "PORTNAME=$PORTNAME" >> "$IFCFGFILE" -- [[ $CTCPROT ]] && echo "CTCPROT=$CTCPROT" >> "$IFCFGFILE" - [[ $MACADDR ]] && echo "MACADDR=$MACADDR" >> "$IFCFGFILE" -- optstr="" -- for option in LAYER2 PORTNO; do -- [ -z "${!option}" ] && continue -- [ -n "$optstr" ] && optstr=${optstr}" " -- optstr=${optstr}$(echo ${option} | sed 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/')"="${!option} -- done -- # write single quotes since network.py removes double quotes but we need quotes -- echo "OPTIONS='$optstr'" >> "$IFCFGFILE" -- unset option -- unset optstr - unset DNS1 - unset DNS2 - echo "files /etc/sysconfig/network-scripts" >> /run/initramfs/rwtab -diff --git a/modules.d/80cms/cmssetup.sh b/modules.d/80cms/cmssetup.sh -index 01cfd303..5e5b9267 100755 ---- a/modules.d/80cms/cmssetup.sh -+++ b/modules.d/80cms/cmssetup.sh -@@ -82,13 +82,19 @@ processcmsfile() { - SUBCHANNELS="$(echo "$SUBCHANNELS" | sed 'y/ABCDEF/abcdef/')" - - if [[ $NETTYPE ]]; then -- ( -- echo -n "$NETTYPE","$SUBCHANNELS" -- [[ $PORTNAME ]] && echo -n ",portname=$PORTNAME" -- [[ $LAYER2 ]] && echo -n ",layer2=$LAYER2" -- [[ $NETTYPE == "ctc" ]] && [[ $CTCPROT ]] && echo -n ",protocol=$CTCPROT" -- echo -- ) >> /etc/ccw.conf -+ _cms_attrs="" -+ if [[ $PORTNAME ]]; then -+ if [[ $NETTYPE == lcs ]]; then -+ _cms_attrs="$_cms_attrs portno=$PORTNAME" -+ else -+ _cms_attrs="$_cms_attrs portname=$PORTNAME" -+ fi -+ fi -+ [[ $LAYER2 ]] && _cms_attrs="$_cms_attrs layer2=$LAYER2" -+ [[ $CTCPROT ]] && _cms_attrs="$_cms_attrs protocol=$CTCPROT" -+ # shellcheck disable=SC2086 -+ chzdev --enable --persistent --yes --no-root-update --force \ -+ "$NETTYPE" "$SUBCHANNELS" $_cms_attrs 2>&1 | vinfo - - OLDIFS=$IFS - IFS=, -@@ -109,7 +115,6 @@ processcmsfile() { - [[ -f /etc/udev/rules.d/90-net.rules ]] \ - || printf 'SUBSYSTEM=="net", ACTION=="online", RUN+="/sbin/initqueue --onetime --env netif=$name source_hook initqueue/online"\n' >> /etc/udev/rules.d/99-cms.rules - udevadm control --reload -- znet_cio_free - fi - - if [[ $DASD ]] && [[ $DASD != "none" ]]; then --- -2.42.0 - diff --git a/0007-fix-incorrectly-applied-patch-in-commit-c6d18c3c7159.patch b/0007-fix-incorrectly-applied-patch-in-commit-c6d18c3c7159.patch new file mode 100644 index 0000000..3b642c7 --- /dev/null +++ b/0007-fix-incorrectly-applied-patch-in-commit-c6d18c3c7159.patch @@ -0,0 +1,75 @@ +From 30e7870504d09183bb9d99ed04f148c7dfb0c645 Mon Sep 17 00:00:00 2001 +From: Pavel Valena +Date: Thu, 11 Jul 2024 07:33:05 +0200 +Subject: [PATCH 07/24] fix: incorrectly applied patch in commit + c6d18c3c71597e78572378fc4dde391f1845b8 + +named: "feat(kernel-install): do nothing when $KERNEL_INSTALL_INITRD_GENERATOR says so" + +Resolves: rhbz#2276271 +--- + install.d/50-dracut.install | 30 ++++++++++++++++++++++++++++-- + install.d/51-dracut-rescue.install | 6 +++--- + 2 files changed, 31 insertions(+), 5 deletions(-) + +diff --git a/install.d/50-dracut.install b/install.d/50-dracut.install +index 3907e303..076b4f5e 100755 +--- a/install.d/50-dracut.install ++++ b/install.d/50-dracut.install +@@ -18,8 +18,34 @@ if [ "${KERNEL_INSTALL_INITRD_GENERATOR:-dracut}" != "dracut" ]; then + exit 0 + fi + +-if [[ -d "$BOOT_DIR_ABS" ]]; then +- INITRD="initrd" ++# Do not attempt to create initramfs if the supplied image is already a UKI ++if [[ "$KERNEL_INSTALL_IMAGE_TYPE" = "uki" ]]; then ++ exit 0 ++fi ++ ++# Mismatching the install layout and the --uefi/--no-uefi opts just creates a mess. ++if [[ $KERNEL_INSTALL_LAYOUT == "uki" && -n $KERNEL_INSTALL_STAGING_AREA ]]; then ++ BOOT_DIR_ABS="$KERNEL_INSTALL_STAGING_AREA" ++ if [[ -z $KERNEL_INSTALL_UKI_GENERATOR || $KERNEL_INSTALL_UKI_GENERATOR == "dracut" ]]; then ++ # No uki generator preference set or we have been chosen ++ IMAGE="uki.efi" ++ UEFI_OPTS="--uefi" ++ elif [[ -z $KERNEL_INSTALL_INITRD_GENERATOR || $KERNEL_INSTALL_INITRD_GENERATOR == "dracut" ]]; then ++ # We aren't the uki generator, but we have been requested to make the initrd ++ IMAGE="initrd" ++ UEFI_OPTS="--no-uefi" ++ else ++ exit 0 ++ fi ++elif [[ $KERNEL_INSTALL_LAYOUT == "bls" && -n $KERNEL_INSTALL_STAGING_AREA ]]; then ++ BOOT_DIR_ABS="$KERNEL_INSTALL_STAGING_AREA" ++ if [[ -z $KERNEL_INSTALL_INITRD_GENERATOR || $KERNEL_INSTALL_INITRD_GENERATOR == "dracut" ]]; then ++ IMAGE="initrd" ++ UEFI_OPTS="--no-uefi" ++ else ++ exit 0 ++ fi ++ + else + # No layout information, use users --uefi/--no-uefi preference + UEFI_OPTS="" +diff --git a/install.d/51-dracut-rescue.install b/install.d/51-dracut-rescue.install +index be4172b5..5310229e 100755 +--- a/install.d/51-dracut-rescue.install ++++ b/install.d/51-dracut-rescue.install +@@ -13,9 +13,9 @@ if [ "${KERNEL_INSTALL_INITRD_GENERATOR:-dracut}" != "dracut" ]; then + exit 0 + fi + +-dropindirs_sort() +-{ +- suffix=$1; shift ++dropindirs_sort() { ++ suffix=$1 ++ shift + args=("$@") + files=$( + while (($# > 0)); do +-- +2.42.0 + diff --git a/0007-refactor-cms-remove-now-unnecessary-inclusion-of-ful.patch b/0007-refactor-cms-remove-now-unnecessary-inclusion-of-ful.patch deleted file mode 100644 index ff067a0..0000000 --- a/0007-refactor-cms-remove-now-unnecessary-inclusion-of-ful.patch +++ /dev/null @@ -1,27 +0,0 @@ -From a2c1fc530d8bcbdeaf1806f4a22019052715fc98 Mon Sep 17 00:00:00 2001 -From: Steffen Maier -Date: Thu, 8 Feb 2024 18:38:48 +0100 -Subject: [PATCH 07/23] refactor(cms): remove now unnecessary inclusion of full - s390utils-base - -Signed-off-by: Steffen Maier ---- - modules.d/80cms/module-setup.sh | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/modules.d/80cms/module-setup.sh b/modules.d/80cms/module-setup.sh -index 05b049da..5b33cd18 100755 ---- a/modules.d/80cms/module-setup.sh -+++ b/modules.d/80cms/module-setup.sh -@@ -29,7 +29,7 @@ install() { - # shellcheck disable=SC2046 - inst_multiple /etc/cmsfs-fuse/filetypes.conf /etc/udev/rules.d/99-fuse.rules /etc/fuse.conf \ - cmsfs-fuse fusermount bash insmod rmmod cat /lib/s390-tools/zdev-from-dasd_mod.dasd sed \ -- $(rpm -ql s390utils-base) awk getopt chzdev lszdev -+ awk getopt chzdev lszdev - - inst_libdir_file "gconv/*" - #inst /usr/lib/locale/locale-archive --- -2.42.0 - diff --git a/0008-feat-zfcp_rules-remove-zfcp-handling-consolidated-in.patch b/0008-feat-zfcp_rules-remove-zfcp-handling-consolidated-in.patch deleted file mode 100644 index b831225..0000000 --- a/0008-feat-zfcp_rules-remove-zfcp-handling-consolidated-in.patch +++ /dev/null @@ -1,222 +0,0 @@ -From 71876ea8c73090741bdf26abb89c28fb260ed575 Mon Sep 17 00:00:00 2001 -From: Steffen Maier -Date: Fri, 20 Jan 2023 18:22:19 +0100 -Subject: [PATCH 08/23] feat(zfcp_rules): remove zfcp handling consolidated in - s390-tools - -These are handled by s390-tools zdev dracut module 95zdev as of -https://github.com/ibm-s390-linux/s390-tools/commit/06a30ae529a5d6ad2369ed81da056bf3a6147bb6 -("zdev/dracut: add rd.zfcp cmdline option handling"). - -Even though this removes one implementation of parsing rd.zfcp in dracut, -above s390-tools change introduces another implementation of parsing the -exact same rd.zfcp syntax. Therefore, it would be good to keep the -documentation in man/dracut.cmdline.7 of dracut as one central place -describing all s390 device types that dracut handles. - -This also fixes problems such as RHBZ 1552619/1745470. It was due to a -duplicate configuration because the SUSE-specific module 95zfcp_rules does -not have any distro-specific dependency and thus also ran in Red Hat -distros. - -That also caused a kind of competition with 95zfcp regarding the same hook -registration: - inst_hook cmdline 30 "$moddir/parse-zfcp.sh" -"luckily" 95zfcp wins since it runs lexicographically first -and the first one registering the hook via inst_simple wins. - -Because commit c8aa1d949aec ("95zfcp_rules: simplified rd.zfcp commandline -for NPIV") extended the emitted rd.zfcp syntax for hostonly-cmdline in -95zfcp_rules, kdump initrds built with hostonly-cmdline parsed such rd.zfcp -with 95zfcp, which did not understand the extended syntax yet and aborted -early boot with a syntax error. - -It also seems that parse-zfcp.sh on its own is without effect because -create_udev_rule() [similar to what zfcp_disk_configure had generated] does -not handle the pre-requisite of setting an FCP device (vHBA) online first. -So the rport match does not trigger unless something else happens to set an -FCP device online [such as rules generated by zfcp_host_configure]. Related -to commit d40c49a8dfe2 ("fix(zfcp_rules): remove collect based udev rule -creators"). - -module-setup.sh having copied all udev rules from the root-fs into the -initrd conflicted with s390-tools dracut module zdev-kdump, which -intentionally only activates the dependencies of the kdump target. - -Signed-off-by: Steffen Maier ---- - modules.d/95zfcp_rules/module-setup.sh | 80 -------------------------- - modules.d/95zfcp_rules/parse-zfcp.sh | 74 ------------------------ - 2 files changed, 154 deletions(-) - delete mode 100755 modules.d/95zfcp_rules/module-setup.sh - delete mode 100755 modules.d/95zfcp_rules/parse-zfcp.sh - -diff --git a/modules.d/95zfcp_rules/module-setup.sh b/modules.d/95zfcp_rules/module-setup.sh -deleted file mode 100755 -index dfa79514..00000000 ---- a/modules.d/95zfcp_rules/module-setup.sh -+++ /dev/null -@@ -1,80 +0,0 @@ --#!/bin/bash -- --# called by dracut --cmdline() { -- is_zfcp() { -- local _dev=$1 -- local _devpath -- _devpath=$( -- cd -P /sys/dev/block/"$_dev" || exit -- echo "$PWD" -- ) -- local _sdev _scsiid _hostno _lun _wwpn _ccw _port_type -- local _allow_lun_scan _is_npiv -- -- read -r _allow_lun_scan < /sys/module/zfcp/parameters/allow_lun_scan -- [ "${_devpath#*/sd}" == "$_devpath" ] && return 1 -- _sdev="${_devpath%%/block/*}" -- [ -e "${_sdev}"/fcp_lun ] || return 1 -- _scsiid="${_sdev##*/}" -- _hostno="${_scsiid%%:*}" -- [ -d /sys/class/fc_host/host"${_hostno}" ] || return 1 -- read -r _port_type < /sys/class/fc_host/host"${_hostno}"/port_type -- case "$_port_type" in -- NPIV*) -- _is_npiv=1 -- ;; -- esac -- read -r _ccw < "${_sdev}"/hba_id -- if [ "$_is_npiv" ] && [ "$_allow_lun_scan" = "Y" ]; then -- echo "rd.zfcp=${_ccw}" -- else -- read -r _lun < "${_sdev}"/fcp_lun -- read -r _wwpn < "${_sdev}"/wwpn -- echo "rd.zfcp=${_ccw},${_wwpn},${_lun}" -- fi -- return 0 -- } -- [[ $hostonly ]] || [[ $mount_needs ]] && { -- for_each_host_dev_and_slaves_all is_zfcp -- } | sort | uniq --} -- --# called by dracut --check() { -- local _arch=${DRACUT_ARCH:-$(uname -m)} -- local _ccw -- [ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1 -- -- [[ $hostonly ]] || [[ $mount_needs ]] && { -- found=0 -- for _ccw in /sys/bus/ccw/devices/*/host*; do -- [ -d "$_ccw" ] || continue -- found=$((found + 1)) -- done -- [ $found -eq 0 ] && return 255 -- } -- return 0 --} -- --# called by dracut --depends() { -- echo bash -- return 0 --} -- --# called by dracut --install() { -- inst_hook cmdline 30 "$moddir/parse-zfcp.sh" -- if [[ $hostonly_cmdline == "yes" ]]; then -- local _zfcp -- -- for _zfcp in $(cmdline); do -- printf "%s\n" "$_zfcp" >> "${initdir}/etc/cmdline.d/94zfcp.conf" -- done -- fi -- if [[ $hostonly ]]; then -- inst_rules_wildcard "51-zfcp-*.rules" -- inst_rules_wildcard "41-zfcp-*.rules" -- fi --} -diff --git a/modules.d/95zfcp_rules/parse-zfcp.sh b/modules.d/95zfcp_rules/parse-zfcp.sh -deleted file mode 100755 -index a474b81b..00000000 ---- a/modules.d/95zfcp_rules/parse-zfcp.sh -+++ /dev/null -@@ -1,74 +0,0 @@ --#!/bin/bash -- --create_udev_rule() { -- local ccw=$1 -- local wwpn=$2 -- local lun=$3 -- local _rule=/etc/udev/rules.d/51-zfcp-${ccw}.rules -- local _cu_type _dev_type -- -- if [ -x /sbin/cio_ignore ] && cio_ignore -i "$ccw" > /dev/null; then -- cio_ignore -r "$ccw" -- fi -- -- if [ -e /sys/bus/ccw/devices/"${ccw}" ]; then -- read -r _cu_type < /sys/bus/ccw/devices/"${ccw}"/cutype -- read -r _dev_type < /sys/bus/ccw/devices/"${ccw}"/devtype -- fi -- if [ "$_cu_type" != "1731/03" ]; then -- return 0 -- fi -- if [ "$_dev_type" != "1732/03" ] && [ "$_dev_type" != "1732/04" ]; then -- return 0 -- fi -- -- [ -z "$wwpn" ] || [ -z "$lun" ] && return -- m=$(sed -n "/.*${wwpn}.*${lun}.*/p" "$_rule") -- if [ -z "$m" ]; then -- cat >> "$_rule" << EOF --ACTION=="add", KERNEL=="rport-*", ATTR{port_name}=="$wwpn", SUBSYSTEMS=="ccw", KERNELS=="$ccw", ATTR{[ccw/$ccw]$wwpn/unit_add}="$lun" --EOF -- fi --} -- --if [[ -f /sys/firmware/ipl/ipl_type ]] \ -- && [[ $(< /sys/firmware/ipl/ipl_type) == "fcp" ]]; then -- ( -- read -r _wwpn < /sys/firmware/ipl/wwpn -- read -r _lun < /sys/firmware/ipl/lun -- read -r _ccw < /sys/firmware/ipl/device -- -- create_udev_rule "$_ccw" "$_wwpn" "$_lun" -- ) --fi -- --for zfcp_arg in $(getargs rd.zfcp); do -- ( -- OLDIFS="$IFS" -- IFS="," -- # shellcheck disable=SC2086 -- set $zfcp_arg -- IFS="$OLDIFS" -- create_udev_rule "$1" "$2" "$3" -- ) --done -- --for zfcp_arg in $(getargs root=) $(getargs resume=); do -- ( -- case $zfcp_arg in -- /dev/disk/by-path/ccw-*) -- ccw_arg=${zfcp_arg##*/} -- ;; -- esac -- if [ -n "$ccw_arg" ]; then -- OLDIFS="$IFS" -- IFS="-" -- # shellcheck disable=SC2086 -- set -- $ccw_arg -- IFS="$OLDIFS" -- _wwpn=${4%:*} -- _lun=${4#*:} -- create_udev_rule "$2" "$wwpn" "$lun" -- fi -- ) --done --- -2.42.0 - diff --git a/0008-revert-fix-crypt-unlock-encrypted-devices-by-default.patch b/0008-revert-fix-crypt-unlock-encrypted-devices-by-default.patch new file mode 100644 index 0000000..99282e8 --- /dev/null +++ b/0008-revert-fix-crypt-unlock-encrypted-devices-by-default.patch @@ -0,0 +1,29 @@ +From 93937d805f8166d9f708f9163fc93839fc1437d3 Mon Sep 17 00:00:00 2001 +From: Pavel Valena +Date: Thu, 11 Jul 2024 16:24:14 +0200 +Subject: [PATCH 08/24] revert: "fix(crypt): unlock encrypted devices by + default during boot" + +This reverts commit 2339acfaeee60d6bb26a1103db2e53bc8f9cb2d1. + +Resolves: rhbz#2295215 +--- + modules.d/90crypt/parse-crypt.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/modules.d/90crypt/parse-crypt.sh b/modules.d/90crypt/parse-crypt.sh +index 9567a4a9..e46e347a 100755 +--- a/modules.d/90crypt/parse-crypt.sh ++++ b/modules.d/90crypt/parse-crypt.sh +@@ -174,7 +174,7 @@ else + } >> "$hookdir/emergency/90-crypt.sh" + fi + done +- elif getargbool 1 rd.auto && [ -z "$(getargs rd.luks.name)" ]; then ++ elif getargbool 0 rd.auto; then + if [ -z "$DRACUT_SYSTEMD" ]; then + { + printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="%s ' "$(command -v initqueue)" +-- +2.42.0 + diff --git a/0009-feat-zfcp-minimize-zfcp-handling-consolidated-in-s39.patch b/0009-feat-zfcp-minimize-zfcp-handling-consolidated-in-s39.patch deleted file mode 100644 index 7f494b2..0000000 --- a/0009-feat-zfcp-minimize-zfcp-handling-consolidated-in-s39.patch +++ /dev/null @@ -1,104 +0,0 @@ -From 8d6098969aa9dc34edfd1bc96e6aa0384ae2fb99 Mon Sep 17 00:00:00 2001 -From: Steffen Maier -Date: Tue, 31 Jan 2023 09:14:40 +0100 -Subject: [PATCH 09/23] feat(zfcp): minimize zfcp handling consolidated in - s390-tools - -Parsing of rd.zfcp is handled by s390-tools zdev dracut module 95zdev as of -https://github.com/ibm-s390-linux/s390-tools/commit/06a30ae529a5d6ad2369ed81da056bf3a6147bb6 -("zdev/dracut: add rd.zfcp cmdline option handling"). - -Even though this removes the last implementation of parsing rd.zfcp in -dracut, above s390-tools change introduces another implementation of -parsing the exact same rd.zfcp syntax. Therefore, it would be good to keep -the documentation in man/dracut.cmdline.7 of dracut as one central place -describing all s390 device types that dracut handles. - -For the time being, keep copying /etc/zfcp.conf. -Retain the call of zfcp_cio_free so /etc/zfcp.conf gets processed even -with the typical cio_ignore kernel boot parameter ignoring most devices. -Also keep handling rd.zfcp.conf=0 so users can, at boot time, ignore -/etc/zfcp.conf already copied into initrd. - -Preparation for consolidating persistent configuration with zdev. - -Signed-off-by: Steffen Maier ---- - man/dracut.cmdline.7.asc | 12 +++++++++++- - modules.d/95zfcp/module-setup.sh | 4 ++-- - modules.d/95zfcp/parse-zfcp.sh | 11 ----------- - 3 files changed, 13 insertions(+), 14 deletions(-) - -diff --git a/man/dracut.cmdline.7.asc b/man/dracut.cmdline.7.asc -index 858991fa..01bdf10f 100644 ---- a/man/dracut.cmdline.7.asc -+++ b/man/dracut.cmdline.7.asc -@@ -980,12 +980,22 @@ ZFCP - **rd.zfcp=**____,____,____:: - rd.zfcp can be specified multiple times on the kernel command - line. -++ -+NOTE: -+ This parameter is no longer handled by dracut itself but with the exact -+ same syntax by -+ https://github.com/ibm-s390-linux/s390-tools/tree/master/zdev/dracut/95zdev. - - **rd.zfcp=**____:: - If NPIV is enabled and the 'allow_lun_scan' parameter to the zfcp -- module is set to 'Y' then the zfcp adaptor will be initiating a -+ module is set to 'Y' then the zfcp driver will be initiating a - scan internally and the and parameters can be omitted. - + -+NOTE: -+ This parameter is no longer handled by dracut itself but with the exact -+ same syntax by -+ https://github.com/ibm-s390-linux/s390-tools/tree/master/zdev/dracut/95zdev. -++ - [listing] - .Example - -- -diff --git a/modules.d/95zfcp/module-setup.sh b/modules.d/95zfcp/module-setup.sh -index e1f3aa35..b547f9bc 100755 ---- a/modules.d/95zfcp/module-setup.sh -+++ b/modules.d/95zfcp/module-setup.sh -@@ -5,7 +5,7 @@ check() { - arch=${DRACUT_ARCH:-$(uname -m)} - [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1 - -- require_binaries zfcp_cio_free grep sed seq || return 1 -+ require_binaries zfcp_cio_free sed || return 1 - - return 0 - } -@@ -23,7 +23,7 @@ installkernel() { - # called by dracut - install() { - inst_hook cmdline 30 "$moddir/parse-zfcp.sh" -- inst_multiple zfcp_cio_free grep sed seq -+ inst_multiple zfcp_cio_free sed - - inst_script /sbin/zfcpconf.sh - inst_rules 56-zfcp.rules -diff --git a/modules.d/95zfcp/parse-zfcp.sh b/modules.d/95zfcp/parse-zfcp.sh -index 495aa67f..41216dd9 100755 ---- a/modules.d/95zfcp/parse-zfcp.sh -+++ b/modules.d/95zfcp/parse-zfcp.sh -@@ -2,15 +2,4 @@ - - getargbool 1 rd.zfcp.conf -d -n rd_NO_ZFCPCONF || rm /etc/zfcp.conf - --for zfcp_arg in $(getargs rd.zfcp -d 'rd_ZFCP='); do -- echo "$zfcp_arg" | grep '^0\.[0-9a-fA-F]\.[0-9a-fA-F]\{4\}\(,0x[0-9a-fA-F]\{16\},0x[0-9a-fA-F]\{16\}\)\?$' > /dev/null -- test $? -ne 0 && die "For argument 'rd.zfcp=$zfcp_arg'\nSorry, invalid format." -- ( -- IFS="," -- # shellcheck disable=SC2086 -- set $zfcp_arg -- echo "$@" >> /etc/zfcp.conf -- ) --done -- - zfcp_cio_free --- -2.42.0 - diff --git a/0009-fix-90kernel-modules-install-blk-modules-using-symbo.patch b/0009-fix-90kernel-modules-install-blk-modules-using-symbo.patch new file mode 100644 index 0000000..87df5db --- /dev/null +++ b/0009-fix-90kernel-modules-install-blk-modules-using-symbo.patch @@ -0,0 +1,33 @@ +From e02ef9afa1ede698623f25d5694949e9b4fedb4e Mon Sep 17 00:00:00 2001 +From: Pavel Valena +Date: Tue, 6 Dec 2022 21:46:01 +0100 +Subject: [PATCH 09/24] fix(90kernel-modules): install blk modules using symbol + blk_alloc_disk + +Corresponding kernel symbol blk_cleanup_disk is no longer used in the nvdimm +driver and calls are made directly instead. + +blk_alloc_disk is used: +https://elixir.bootlin.com/linux/v6.1-rc8/source/drivers/nvdimm/pmem.c#L522 + +Resolves: RHEL-32237 +--- + modules.d/90kernel-modules/module-setup.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/modules.d/90kernel-modules/module-setup.sh b/modules.d/90kernel-modules/module-setup.sh +index ec60f393..89f33231 100755 +--- a/modules.d/90kernel-modules/module-setup.sh ++++ b/modules.d/90kernel-modules/module-setup.sh +@@ -2,7 +2,7 @@ + + # called by dracut + installkernel() { +- local _blockfuncs='ahci_platform_get_resources|ata_scsi_ioctl|scsi_add_host|blk_cleanup_queue|register_mtd_blktrans|scsi_esp_register|register_virtio_device|usb_stor_disconnect|mmc_add_host|sdhci_add_host|scsi_add_host_with_dma|blk_mq_alloc_disk|blk_mq_alloc_request|blk_mq_destroy_queue|blk_cleanup_disk' ++ local _blockfuncs='ahci_platform_get_resources|ata_scsi_ioctl|scsi_add_host|blk_cleanup_queue|register_mtd_blktrans|scsi_esp_register|register_virtio_device|usb_stor_disconnect|mmc_add_host|sdhci_add_host|scsi_add_host_with_dma|blk_alloc_disk|blk_mq_alloc_disk|blk_mq_alloc_request|blk_mq_destroy_queue|blk_cleanup_disk' + local -A _hostonly_drvs + + record_block_dev_drv() { +-- +2.42.0 + diff --git a/0010-feat-dasd_rules-remove-dasd-handling-consolidated-in.patch b/0010-feat-dasd_rules-remove-dasd-handling-consolidated-in.patch deleted file mode 100644 index 2887176..0000000 --- a/0010-feat-dasd_rules-remove-dasd-handling-consolidated-in.patch +++ /dev/null @@ -1,151 +0,0 @@ -From 7294e45b5204e47bb8ee2108e2c38c5843e64fac Mon Sep 17 00:00:00 2001 -From: Steffen Maier -Date: Thu, 23 Mar 2023 18:06:23 +0100 -Subject: [PATCH 10/23] feat(dasd_rules): remove dasd handling consolidated in - s390-tools - -These are handled by s390-tools zdev dracut module 95zdev as of -https://github.com/ibm-s390-linux/s390-tools/commit/99270236805972544932feab9692ee7122a343b8 -("zdev/dracut: add rd.dasd cmdline option handling"). - -Even though this removes one implementation of parsing rd.dasd in dracut, -above s390-tools change introduces another implementation of parsing the -exact same rd.dasd syntax. Therefore, it would be good to keep the -documentation in man/dracut.cmdline.7 of dracut as one central place -describing all s390 device types that dracut handles. - -module-setup.sh having copied all udev rules from the root-fs into the -initrd conflicted with s390-tools dracut module zdev-kdump, which -intentionally only activates the dependencies of the kdump target. - -Signed-off-by: Steffen Maier ---- - modules.d/95dasd_rules/module-setup.sh | 65 -------------------------- - modules.d/95dasd_rules/parse-dasd.sh | 43 ----------------- - 2 files changed, 108 deletions(-) - delete mode 100755 modules.d/95dasd_rules/module-setup.sh - delete mode 100755 modules.d/95dasd_rules/parse-dasd.sh - -diff --git a/modules.d/95dasd_rules/module-setup.sh b/modules.d/95dasd_rules/module-setup.sh -deleted file mode 100755 -index 06c57a48..00000000 ---- a/modules.d/95dasd_rules/module-setup.sh -+++ /dev/null -@@ -1,65 +0,0 @@ --#!/bin/bash -- --# called by dracut --cmdline() { -- is_dasd() { -- local _dev=$1 -- local _devpath -- _devpath=$( -- cd -P /sys/dev/block/"$_dev" || exit -- echo "$PWD" -- ) -- -- [ "${_devpath#*/dasd}" == "$_devpath" ] && return 1 -- _ccw="${_devpath%%/block/*}" -- echo "rd.dasd=${_ccw##*/}" -- return 0 -- } -- [[ $hostonly ]] || [[ $mount_needs ]] && { -- for_each_host_dev_and_slaves_all is_dasd || return 255 -- } | sort | uniq --} -- --# called by dracut --check() { -- local _arch=${DRACUT_ARCH:-$(uname -m)} -- local found=0 -- local bdev -- [ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1 -- -- [[ $hostonly ]] || [[ $mount_needs ]] && { -- for bdev in /sys/block/*; do -- case "${bdev##*/}" in -- dasd*) -- found=$((found + 1)) -- break -- ;; -- esac -- done -- [ $found -eq 0 ] && return 255 -- } -- return 0 --} -- --# called by dracut --depends() { -- echo 'dasd_mod' bash -- return 0 --} -- --# called by dracut --install() { -- inst_hook cmdline 30 "$moddir/parse-dasd.sh" -- if [[ $hostonly_cmdline == "yes" ]]; then -- local _dasd -- _dasd=$(cmdline) -- [[ $_dasd ]] && printf "%s\n" "$_dasd" >> "${initdir}/etc/cmdline.d/95dasd.conf" -- fi -- if [[ $hostonly ]]; then -- inst_rules_wildcard "51-dasd-*.rules" -- inst_rules_wildcard "41-dasd-*.rules" -- mark_hostonly /etc/udev/rules.d/51-dasd-*.rules -- mark_hostonly /etc/udev/rules.d/41-dasd-*.rules -- fi -- inst_rules 59-dasd.rules --} -diff --git a/modules.d/95dasd_rules/parse-dasd.sh b/modules.d/95dasd_rules/parse-dasd.sh -deleted file mode 100755 -index 4454aec3..00000000 ---- a/modules.d/95dasd_rules/parse-dasd.sh -+++ /dev/null -@@ -1,43 +0,0 @@ --#!/bin/bash -- --allow_device() { -- local ccw=$1 -- -- if [ -x /sbin/cio_ignore ] && cio_ignore -i "$ccw" > /dev/null; then -- cio_ignore -r "$ccw" -- fi --} -- --if [[ -f /sys/firmware/ipl/ipl_type ]] && [[ $(< /sys/firmware/ipl/ipl_type) == "ccw" ]]; then -- allow_device "$(< /sys/firmware/ipl/device)" --fi -- --for dasd_arg in $(getargs root=) $(getargs resume=); do -- [[ $dasd_arg =~ /dev/disk/by-path/ccw-* ]] || continue -- -- ccw_dev="${dasd_arg##*/ccw-}" -- allow_device "${ccw_dev%%-*}" --done -- --for dasd_arg in $(getargs rd.dasd=); do -- IFS=',' read -r -a devs <<< "$dasd_arg" -- declare -p devs -- for dev in "${devs[@]}"; do -- case "$dev" in -- autodetect | probeonly) ;; -- -- *-*) -- IFS="-" read -r start end _ <<< "${dev%(ro)}" -- prefix=${start%.*} -- start=${start##*.} -- for rdev in $(seq $((16#$start)) $((16#$end))); do -- allow_device "$(printf "%s.%04x" "$prefix" "$rdev")" -- done -- ;; -- *) -- IFS="." read -r sid ssid chan _ <<< "${dev%(ro)}" -- allow_device "$(printf "%01x.%01x.%04x" $((16#$sid)) $((16#$ssid)) $((16#$chan)))" -- ;; -- esac -- done --done --- -2.42.0 - diff --git a/0010-test-do-not-force-include-dash-let-sh-module-make-a-.patch b/0010-test-do-not-force-include-dash-let-sh-module-make-a-.patch new file mode 100644 index 0000000..d9dd8cc --- /dev/null +++ b/0010-test-do-not-force-include-dash-let-sh-module-make-a-.patch @@ -0,0 +1,30 @@ +From aded658821983ba7d92def26793813c1b3a83475 Mon Sep 17 00:00:00 2001 +From: Laszlo Gombos +Date: Sat, 20 Jul 2024 18:49:38 -0400 +Subject: [PATCH 10/24] test: do not force include dash, let sh module make a + selection + +This is important for alpine, so that it does not install both +dash and busybox dracut modules that are potentially conflicting. + +(cherry picked from commit 6e3c2bf9d01ad0f93176ee121bb70404f24de4e7) +--- + modules.d/80test-makeroot/module-setup.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/modules.d/80test-makeroot/module-setup.sh b/modules.d/80test-makeroot/module-setup.sh +index f311e4a0..fc105d7e 100755 +--- a/modules.d/80test-makeroot/module-setup.sh ++++ b/modules.d/80test-makeroot/module-setup.sh +@@ -6,7 +6,7 @@ check() { + } + + depends() { +- echo "dash rootfs-block kernel-modules qemu" ++ echo "rootfs-block kernel-modules qemu" + } + + installkernel() { +-- +2.42.0 + diff --git a/0011-feat-dasd_mod-minimize-dasd-handling-consolidated-in.patch b/0011-feat-dasd_mod-minimize-dasd-handling-consolidated-in.patch deleted file mode 100644 index 6114794..0000000 --- a/0011-feat-dasd_mod-minimize-dasd-handling-consolidated-in.patch +++ /dev/null @@ -1,73 +0,0 @@ -From a82045ef34bc8c913502eba37b6b9c60709d6997 Mon Sep 17 00:00:00 2001 -From: Steffen Maier -Date: Thu, 23 Mar 2023 18:22:56 +0100 -Subject: [PATCH 11/23] feat(dasd_mod): minimize dasd handling consolidated in - s390-tools - -Parsing of rd.dasd is handled by s390-tools zdev dracut module 95zdev as of -https://github.com/ibm-s390-linux/s390-tools/commit/99270236805972544932feab9692ee7122a343b8 -("zdev/dracut: add rd.dasd cmdline option handling"). - -Even though this removes one implementation of parsing rd.dasd in dracut, -above s390-tools change introduces another implementation of parsing the -exact same rd.dasd syntax. Therefore, it would be good to keep the -documentation in man/dracut.cmdline.7 of dracut as one central place -describing all s390 device types that dracut handles. - -95dasd/modules-setup.sh copies /etc/dasd.conf from root-fs into initrd. -Retain the call of dasd_cio_free here so /etc/dasd.conf gets processed even -with the typical cio_ignore kernel boot parameter ignoring most devices. - -Preparation for consolidating persistent configuration with zdev. - -Signed-off-by: Steffen Maier ---- - modules.d/95dasd_mod/module-setup.sh | 2 -- - modules.d/95dasd_mod/parse-dasd-mod.sh | 14 -------------- - 2 files changed, 16 deletions(-) - -diff --git a/modules.d/95dasd_mod/module-setup.sh b/modules.d/95dasd_mod/module-setup.sh -index c59dd3ac..155eaacc 100755 ---- a/modules.d/95dasd_mod/module-setup.sh -+++ b/modules.d/95dasd_mod/module-setup.sh -@@ -4,7 +4,6 @@ - check() { - local _arch=${DRACUT_ARCH:-$(uname -m)} - [ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1 -- require_binaries grep sed seq - - return 0 - } -@@ -22,6 +21,5 @@ installkernel() { - # called by dracut - install() { - inst_hook cmdline 31 "$moddir/parse-dasd-mod.sh" -- inst_multiple grep sed seq - inst_multiple -o dasd_cio_free - } -diff --git a/modules.d/95dasd_mod/parse-dasd-mod.sh b/modules.d/95dasd_mod/parse-dasd-mod.sh -index 2b86d454..b635ecf9 100755 ---- a/modules.d/95dasd_mod/parse-dasd-mod.sh -+++ b/modules.d/95dasd_mod/parse-dasd-mod.sh -@@ -1,18 +1,4 @@ - #!/bin/sh --mod_args="" -- --for dasd_arg in $(getargs rd.dasd= -d rd_DASD= DASD=); do -- mod_args="$mod_args,$dasd_arg" --done -- --mod_args="${mod_args#*,}" -- --if [ -x /sbin/dasd_cio_free -a -n "$mod_args" ]; then -- [ -d /etc/modprobe.d ] || mkdir -m 0755 -p /etc/modprobe.d -- echo "options dasd_mod dasd=$mod_args" >> /etc/modprobe.d/dasd_mod.conf --fi -- --unset dasd_arg - if [ -x /sbin/dasd_cio_free ]; then - dasd_cio_free - fi --- -2.42.0 - diff --git a/0011-fix-dracut-functions-allow-for-in-get_maj_min-file-p.patch b/0011-fix-dracut-functions-allow-for-in-get_maj_min-file-p.patch new file mode 100644 index 0000000..16cc6c8 --- /dev/null +++ b/0011-fix-dracut-functions-allow-for-in-get_maj_min-file-p.patch @@ -0,0 +1,31 @@ +From a891ae527aaf3c015d3b4b0290655b89fdf8f03d Mon Sep 17 00:00:00 2001 +From: Pavel Valena +Date: Thu, 8 Aug 2024 01:30:50 +0200 +Subject: [PATCH 11/24] fix(dracut-functions): allow for \ in get_maj_min file + path + +as the path might be f.e. /dev/disk/by-partlabel/EFI\x20System\x20Partition + +which would produce Warning 'grep: warning: stray \ before x' in get_maj_min + +Resolves: RHEL-47145 +--- + dracut-functions.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/dracut-functions.sh b/dracut-functions.sh +index f9e5d3bc..c8cb2e15 100755 +--- a/dracut-functions.sh ++++ b/dracut-functions.sh +@@ -243,7 +243,7 @@ get_maj_min() { + local _out + + if [[ $get_maj_min_cache_file ]]; then +- _out="$(grep -m1 -oE "^$1 \S+$" "$get_maj_min_cache_file" | awk '{print $NF}')" ++ _out="$(grep -m1 -oE "^${1//\\/\\\\} \S+$" "$get_maj_min_cache_file" | awk '{print $NF}')" + fi + + if ! [[ "$_out" ]]; then +-- +2.42.0 + diff --git a/0012-feat-dasd-minimize-dasd-handling-consolidated-in-s39.patch b/0012-feat-dasd-minimize-dasd-handling-consolidated-in-s39.patch deleted file mode 100644 index 7ab681f..0000000 --- a/0012-feat-dasd-minimize-dasd-handling-consolidated-in-s39.patch +++ /dev/null @@ -1,100 +0,0 @@ -From 1ff6be8aef787513b8143df444a1dd2d696b0944 Mon Sep 17 00:00:00 2001 -From: Steffen Maier -Date: Thu, 23 Mar 2023 19:33:52 +0100 -Subject: [PATCH 12/23] feat(dasd): minimize dasd handling consolidated in - s390-tools - -Parsing of rd.dasd is handled by s390-tools zdev dracut module 95zdev as of -https://github.com/ibm-s390-linux/s390-tools/commit/99270236805972544932feab9692ee7122a343b8 -("zdev/dracut: add rd.dasd cmdline option handling"). - -Even though this removes the last implementation of parsing rd.dasd in -dracut, above s390-tools change introduces another implementation of -parsing the exact same rd.dasd syntax. Therefore, it would be good to keep -the documentation in man/dracut.cmdline.7 of dracut as one central place -describing all s390 device types that dracut handles. - -For the time being, keep copying /etc/dasd.conf. -The corresponding call to dasd_cio_free is in 95dasd_mod/parse-dasd-mod.sh -and indirectly triggers processing of /etc/dasd.conf even with the typical -cio_ignore kernel boot parameter ignoring most devices. - -Preparation for consolidating persistent configuration with zdev. - -Signed-off-by: Steffen Maier ---- - man/dracut.cmdline.7.asc | 11 ++++++++++- - modules.d/95dasd/module-setup.sh | 6 ++---- - modules.d/95dasd/parse-dasd.sh | 11 ----------- - 3 files changed, 12 insertions(+), 16 deletions(-) - delete mode 100755 modules.d/95dasd/parse-dasd.sh - -diff --git a/man/dracut.cmdline.7.asc b/man/dracut.cmdline.7.asc -index 01bdf10f..c31dbfc6 100644 ---- a/man/dracut.cmdline.7.asc -+++ b/man/dracut.cmdline.7.asc -@@ -973,7 +973,16 @@ root=virtiofs:host rw - DASD - ~~~~ - **rd.dasd=**....:: -- same syntax as the kernel module parameter (s390 only) -+ same syntax as the kernel module parameter (s390 only). -+ For more details on the syntax see the IBM book -+ "Linux on IBM Z and IBM LinuxONE - Device Drivers, Features, and Commands" -+ https://www.ibm.com/docs/en/linux-on-systems?topic=overview-device-drivers-features-commands. -+ This parameter can be specified multiple times. -++ -+NOTE: -+ This parameter is no longer handled by dracut itself but with the exact -+ same syntax by -+ https://github.com/ibm-s390-linux/s390-tools/tree/master/zdev/dracut/95zdev. - - ZFCP - ~~~~ -diff --git a/modules.d/95dasd/module-setup.sh b/modules.d/95dasd/module-setup.sh -index 180da140..825f95d8 100755 ---- a/modules.d/95dasd/module-setup.sh -+++ b/modules.d/95dasd/module-setup.sh -@@ -4,20 +4,18 @@ - check() { - local _arch=${DRACUT_ARCH:-$(uname -m)} - [ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1 -- require_binaries normalize_dasd_arg || return 1 -+ require_binaries dasdconf.sh || return 1 - return 0 - } - - # called by dracut - depends() { -- echo "dasd_mod" - return 0 - } - - # called by dracut - install() { -- inst_hook cmdline 30 "$moddir/parse-dasd.sh" -- inst_multiple dasdinfo dasdconf.sh normalize_dasd_arg -+ inst_multiple dasdconf.sh - conf=/etc/dasd.conf - if [[ $hostonly && -f $conf ]]; then - inst -H $conf -diff --git a/modules.d/95dasd/parse-dasd.sh b/modules.d/95dasd/parse-dasd.sh -deleted file mode 100755 -index cda3970c..00000000 ---- a/modules.d/95dasd/parse-dasd.sh -+++ /dev/null -@@ -1,11 +0,0 @@ --#!/bin/sh --for dasd_arg in $(getargs rd.dasd= -d rd_DASD= DASD=); do -- ( -- local OLDIFS="$IFS" -- IFS="," -- # shellcheck disable=SC2086 -- set -- $dasd_arg -- IFS="$OLDIFS" -- echo "$@" | normalize_dasd_arg >> /etc/dasd.conf -- ) --done --- -2.42.0 - diff --git a/0012-fix-dracut-functions.sh-only-return-block-devices-fr.patch b/0012-fix-dracut-functions.sh-only-return-block-devices-fr.patch new file mode 100644 index 0000000..f72e622 --- /dev/null +++ b/0012-fix-dracut-functions.sh-only-return-block-devices-fr.patch @@ -0,0 +1,42 @@ +From 821ffb39cd0c3003b2711d30302b713ab9b5da9b Mon Sep 17 00:00:00 2001 +From: Fabian Vogt +Date: Mon, 5 Aug 2024 11:28:32 +0200 +Subject: [PATCH 12/24] fix(dracut-functions.sh): only return block devices + from get_persistent_dev + +With udev 256, there are now directories such as +/dev/disk/by-path/pci-0000:02:00.0-nvme-1-part/ which match here. + +In case a nonexisting file/device was passed to get_persistent_dev, it +returned the first directory it looked at because both have maj:min 0:0. +This accidental conversion from garbage to a sensible looking path leads +to weird behaviour later. + +Instead of filtering out directories explicitly switch the check to only +return block devices, which also takes care of the character special +/dev/mapper/control. + +(cherry picked from commit 55d2fb5b459f356fdbde60ddefb97be942a0c141) + +Resolves: RHEL-49744 +--- + dracut-functions.sh | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/dracut-functions.sh b/dracut-functions.sh +index c8cb2e15..43d905e3 100755 +--- a/dracut-functions.sh ++++ b/dracut-functions.sh +@@ -294,8 +294,7 @@ get_persistent_dev() { + /dev/disk/by-partlabel/* \ + /dev/disk/by-id/* \ + /dev/disk/by-path/*; do +- [[ -e $i ]] || continue +- [[ $i == /dev/mapper/control ]] && continue ++ [[ -b $i ]] || continue + [[ $i == /dev/mapper/mpath* ]] && continue + _tmp=$(get_maj_min "$i") + if [ "$_tmp" = "$_dev" ]; then +-- +2.42.0 + diff --git a/0013-feat-systemd-include-systemd-config-files-from-usr-l.patch b/0013-feat-systemd-include-systemd-config-files-from-usr-l.patch new file mode 100644 index 0000000..bc98fa7 --- /dev/null +++ b/0013-feat-systemd-include-systemd-config-files-from-usr-l.patch @@ -0,0 +1,112 @@ +From 3e4a22f2b72d0723fd43ca917b8aa9003c6c7f8f Mon Sep 17 00:00:00 2001 +From: Pavel Valena +Date: Wed, 12 Jun 2024 06:06:32 +0200 +Subject: [PATCH 13/24] feat(systemd*): include systemd config files from + /usr/lib/systemd + +and also use proper variables for the paths, and fixup invalid paths. +-- + +The new systemd reads from both /etc and /usr/, so to accomodate this, +I've added new paths to install configs from (I probably haven't covered +all). This changes only hostonly behaviour; uses global variables: + +systemdutilconfdir: "/etc/systemd" +systemdutildir: "/lib/systemd:/lib/systemd/systemd-udevd" "/usr/lib/systemd:/usr/lib/systemd/systemd-udevd" + +(cherry picked from commit ea4905e944a2acd75ba3a48a5dfeaba417f724e8) + +Resolves: RHEL-32506 +--- + modules.d/00systemd/module-setup.sh | 6 ++++-- + modules.d/01systemd-coredump/module-setup.sh | 3 ++- + modules.d/01systemd-pstore/module-setup.sh | 2 ++ + modules.d/01systemd-resolved/module-setup.sh | 1 + + modules.d/01systemd-timesyncd/module-setup.sh | 1 + + 5 files changed, 10 insertions(+), 3 deletions(-) + +diff --git a/modules.d/00systemd/module-setup.sh b/modules.d/00systemd/module-setup.sh +index d173c99f..0f151289 100755 +--- a/modules.d/00systemd/module-setup.sh ++++ b/modules.d/00systemd/module-setup.sh +@@ -42,6 +42,8 @@ install() { + "$systemdutildir"/system-generators/systemd-debug-generator \ + "$systemdutildir"/system-generators/systemd-fstab-generator \ + "$systemdutildir"/system-generators/systemd-gpt-auto-generator \ ++ "$systemdutildir"/system.conf \ ++ "$systemdutildir"/system.conf.d/*.conf \ + "$systemdsystemunitdir"/debug-shell.service \ + "$systemdsystemunitdir"/cryptsetup.target \ + "$systemdsystemunitdir"/cryptsetup-pre.target \ +@@ -94,8 +96,8 @@ install() { + + if [[ $hostonly ]]; then + inst_multiple -H -o \ +- /etc/systemd/system.conf \ +- /etc/systemd/system.conf.d/*.conf \ ++ "$systemdutilconfdir"/system.conf \ ++ "$systemdutilconfdir"/system.conf.d/*.conf \ + /etc/hosts \ + /etc/hostname \ + /etc/nsswitch.conf \ +diff --git a/modules.d/01systemd-coredump/module-setup.sh b/modules.d/01systemd-coredump/module-setup.sh +index 47666b6c..17deb088 100755 +--- a/modules.d/01systemd-coredump/module-setup.sh ++++ b/modules.d/01systemd-coredump/module-setup.sh +@@ -33,6 +33,7 @@ install() { + inst_multiple -o \ + "$sysctld"/50-coredump.conf \ + "$systemdutildir"/coredump.conf \ ++ "$systemdutildir/coredump.conf.d/*.conf" \ + "$systemdutildir"/systemd-coredump \ + "$systemdsystemunitdir"/systemd-coredump.socket \ + "$systemdsystemunitdir"/systemd-coredump@.service \ +@@ -51,7 +52,7 @@ install() { + if [[ $hostonly ]]; then + inst_multiple -H -o \ + "$systemdutilconfdir"/coredump.conf \ +- "$systemdsystemconfdir/coredump.conf.d/*.conf" \ ++ "$systemdutilconfdir/coredump.conf.d/*.conf" \ + "$systemdsystemconfdir"/systemd-coredump.socket \ + "$systemdsystemconfdir/systemd-coredump.socket.d/*.conf" \ + "$systemdsystemconfdir"/systemd-coredump@.service \ +diff --git a/modules.d/01systemd-pstore/module-setup.sh b/modules.d/01systemd-pstore/module-setup.sh +index 67034bbf..5de5db4b 100755 +--- a/modules.d/01systemd-pstore/module-setup.sh ++++ b/modules.d/01systemd-pstore/module-setup.sh +@@ -34,6 +34,8 @@ install() { + inst_dir /var/lib/systemd/pstore + inst_multiple -o \ + "$tmpfilesdir/systemd-pstore.conf" \ ++ "$systemdutildir"/pstore.conf \ ++ "$systemdutildir/pstore.conf.d/*.conf" \ + "$systemdutildir"/systemd-pstore \ + "$systemdsystemunitdir"/systemd-pstore.service \ + "$systemdsystemunitdir/systemd-pstore.service.d/*.conf" +diff --git a/modules.d/01systemd-resolved/module-setup.sh b/modules.d/01systemd-resolved/module-setup.sh +index 0c2e8c28..7b4b26e8 100755 +--- a/modules.d/01systemd-resolved/module-setup.sh ++++ b/modules.d/01systemd-resolved/module-setup.sh +@@ -49,6 +49,7 @@ install() { + # Install the hosts local user configurations if enabled. + if [[ $hostonly ]]; then + inst_multiple -H -o \ ++ "$systemdutilconfdir"/resolv.conf \ + "$systemdutilconfdir"/resolved.conf \ + "$systemdutilconfdir/resolved.conf.d/*.conf" \ + "$systemdsystemconfdir"/systemd-resolved.service \ +diff --git a/modules.d/01systemd-timesyncd/module-setup.sh b/modules.d/01systemd-timesyncd/module-setup.sh +index a2c67540..77f7b113 100755 +--- a/modules.d/01systemd-timesyncd/module-setup.sh ++++ b/modules.d/01systemd-timesyncd/module-setup.sh +@@ -38,6 +38,7 @@ install() { + "$systemdntpunits/*.list" \ + "$systemdutildir"/systemd-timesyncd \ + "$systemdutildir"/systemd-time-wait-sync \ ++ "$systemdutildir"/timesyncd.conf \ + "$systemdutildir/timesyncd.conf.d/*.conf" \ + "$systemdsystemunitdir"/systemd-timesyncd.service \ + "$systemdsystemunitdir/systemd-timesyncd.service.d/*.conf" \ +-- +2.42.0 + diff --git a/0013-feat-znet-use-zdev-for-consolidated-device-configura.patch b/0013-feat-znet-use-zdev-for-consolidated-device-configura.patch deleted file mode 100644 index 5181de5..0000000 --- a/0013-feat-znet-use-zdev-for-consolidated-device-configura.patch +++ /dev/null @@ -1,149 +0,0 @@ -From 86b6e2979999cf5ecce8c76c6230d1f085b3a333 Mon Sep 17 00:00:00 2001 -From: Steffen Maier -Date: Tue, 25 Jul 2023 19:43:05 +0200 -Subject: [PATCH 13/23] feat(znet): use zdev for consolidated device - configuration - -Remove any distribution-specifics from s390 channel-attached network device -configuration. - -Similar to 95qeth_rules, copy the existing persistent network configuration -into the initrd. This needs to go via chzdev import so chzdev updates (adds -to) the cio_ignore persistent config inside the initrd, because other -dracut modules such as zdev from s390-tools also import -persistent (non-network) config into initrd and the set union of devices -needs to end up in the cio_ignore persistent config inside the initrd. - -Additional debugging output can be generated with e.g. dracut option -"--stdlog 5" (or short -L5). It shows the chzdev export result, the output -of chzdev imports, and an overview of the resulting persistent config -within the initrd. Typically combined with "--debug" to get a shell trace -from building an initrd (Note: --debug does not increase the log levels). - -Note that nm-initrd-generator also parses rd.znet and rd.znet_ifname -to fill in s390 options of a NetworkManager connection definition. - -Signed-off-by: Steffen Maier ---- - modules.d/95znet/module-setup.sh | 37 +++++++++++++++++++++++-- - modules.d/95znet/parse-ccw.sh | 47 ++++++++++++++++++++++++++++++-- - 2 files changed, 78 insertions(+), 6 deletions(-) - -diff --git a/modules.d/95znet/module-setup.sh b/modules.d/95znet/module-setup.sh -index df37c660..95164bba 100755 ---- a/modules.d/95znet/module-setup.sh -+++ b/modules.d/95znet/module-setup.sh -@@ -5,7 +5,7 @@ check() { - arch=${DRACUT_ARCH:-$(uname -m)} - [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1 - -- require_binaries znet_cio_free grep sed seq readlink || return 1 -+ require_binaries grep sed seq readlink chzdev || return 1 - - return 0 - } -@@ -24,6 +24,37 @@ installkernel() { - # called by dracut - install() { - inst_hook cmdline 30 "$moddir/parse-ccw.sh" -- inst_rules 81-ccw.rules -- inst_multiple znet_cio_free grep sed seq readlink /lib/udev/ccw_init -+ inst_multiple grep sed seq readlink chzdev -+ if [[ $hostonly ]]; then -+ local _tempfile -+ _tempfile=$(mktemp --tmpdir="${DRACUT_TMPDIR}" dracut-zdev.XXXXXX) -+ { -+ chzdev qeth --export - --configured --persistent --quiet --type -+ chzdev lcs --export - --configured --persistent --quiet --type -+ chzdev ctc --export - --configured --persistent --quiet --type -+ } 2> /dev/null > "$_tempfile" -+ ddebug < "$_tempfile" -+ chzdev --import "$_tempfile" --persistent --base "/etc=$initdir/etc" \ -+ --yes --no-root-update --force 2>&1 | ddebug -+ lszdev --configured --persistent --info \ -+ --base "/etc=$initdir/etc" 2>&1 | ddebug -+ rm -f "$_tempfile" -+ # these are purely generated udev rules so we have to glob expand -+ # within $initdir and strip the $initdir prefix for mark_hostonly -+ local -a _array -+ # shellcheck disable=SC2155 -+ local _nullglob=$(shopt -p nullglob) -+ shopt -u nullglob -+ # shellcheck disable=SC2086 -+ readarray -t _array < <( -+ ls -1 $initdir/etc/udev/rules.d/41-*.rules 2> /dev/null -+ ) -+ [[ ${#_array[@]} -gt 0 ]] && mark_hostonly "${_array[@]#$initdir}" -+ # shellcheck disable=SC2086 -+ readarray -t _array < <( -+ ls -1 $initdir/etc/modprobe.d/s390x-*.conf 2> /dev/null -+ ) -+ [[ ${#_array[@]} -gt 0 ]] && mark_hostonly "${_array[@]#$initdir}" -+ $_nullglob -+ fi - } -diff --git a/modules.d/95znet/parse-ccw.sh b/modules.d/95znet/parse-ccw.sh -index d8953605..aacc988e 100755 ---- a/modules.d/95znet/parse-ccw.sh -+++ b/modules.d/95znet/parse-ccw.sh -@@ -1,7 +1,50 @@ - #!/bin/bash - -+znet_base_args="--no-settle --yes --no-root-update --force" -+ -+# at this point in time dracut's vinfo() only logs to journal which is hard for -+# s390 users to find and access on a line mode console such as 3215 mode -+# so use a vinfo alternative that still prints to the console via kmsg -+znet_vinfo() { -+ while read -r _znet_vinfo_line || [ -n "$_znet_vinfo_line" ]; do -+ # Prefix "<30>" represents facility LOG_DAEMON 3 and loglevel INFO 6: -+ # (facility << 3) | level. -+ echo "<30>dracut: $_znet_vinfo_line" > /dev/kmsg -+ done -+} -+ - for ccw_arg in $(getargs rd.ccw -d 'rd_CCW=') $(getargs rd.znet -d 'rd_ZNET='); do -- echo "$ccw_arg" >> /etc/ccw.conf -+ ( -+ SAVED_IFS="$IFS" -+ IFS="," -+ # shellcheck disable=SC2086 -+ set -- $ccw_arg -+ IFS="$SAVED_IFS" -+ type="$1" -+ subchannel1="$2" -+ subchannel2="$3" -+ subchannel3="$4" -+ echo "rd.znet ${ccw_arg} :" | znet_vinfo -+ if [ "$#" -lt 3 ]; then -+ echo "rd.znet needs at least 3 list items: type,subchannel1,subchannel2" | znet_vinfo -+ fi -+ if [ "$1" = "qeth" ]; then -+ if [ "$#" -lt 4 ]; then -+ echo "rd.znet for type qeth needs at least 4 list items: qeth,subchannel1,subchannel2,subchannel3" | znet_vinfo -+ fi -+ subchannels="$subchannel1:$subchannel2:$subchannel3" -+ shift 4 -+ # shellcheck disable=SC2086 -+ chzdev --enable --persistent $znet_base_args \ -+ "$type" "$subchannels" "$@" 2>&1 | znet_vinfo -+ else -+ subchannels="$subchannel1:$subchannel2" -+ shift 3 -+ # shellcheck disable=SC2086 -+ chzdev --enable --persistent $znet_base_args \ -+ "$type" "$subchannels" "$@" 2>&1 | znet_vinfo -+ fi -+ ) - done - - for ifname in $(getargs rd.znet_ifname); do -@@ -21,5 +64,3 @@ for ifname in $(getargs rd.znet_ifname); do - } > /etc/udev/rules.d/81-ccw-ifname.rules - fi - done -- --znet_cio_free --- -2.42.0 - diff --git a/0014-docs-dracut.cmdline-generalize-description-of-rd.zne.patch b/0014-docs-dracut.cmdline-generalize-description-of-rd.zne.patch deleted file mode 100644 index e92bccd..0000000 --- a/0014-docs-dracut.cmdline-generalize-description-of-rd.zne.patch +++ /dev/null @@ -1,36 +0,0 @@ -From addb383b375fd0db07eacf8a9f5d9b4e23343855 Mon Sep 17 00:00:00 2001 -From: Steffen Maier -Date: Fri, 26 May 2023 19:25:41 +0200 -Subject: [PATCH 14/23] docs(dracut.cmdline): generalize description of rd.znet - -As of the preceding commit ("feat(znet): use zdev for consolidated device -configuration"), rd.znet is no longer specific to RHEL/Fedora. - -Signed-off-by: Steffen Maier ---- - man/dracut.cmdline.7.asc | 9 ++++++--- - 1 file changed, 6 insertions(+), 3 deletions(-) - -diff --git a/man/dracut.cmdline.7.asc b/man/dracut.cmdline.7.asc -index c31dbfc6..e6b8d988 100644 ---- a/man/dracut.cmdline.7.asc -+++ b/man/dracut.cmdline.7.asc -@@ -1018,9 +1018,12 @@ rd.zfcp=0.0.4000 - ZNET - ~~~~ - **rd.znet=**____,____,____:: -- The whole parameter is appended to /etc/ccw.conf, which is used on -- RHEL/Fedora with ccw_init, which is called from udev for certain -- devices on z-series. -+ Activates a channel-attached network interface on s390 architecture. -+ is one of: qeth, lcs, ctc. -+ is a comma-separated list of ccw device bus-IDs. -+ The list consists of 3 entries with nettype qeth, and 2 for other nettype. -+ is a comma-separated list of = pairs, -+ where refers to a device sysfs attribute to which gets written. - rd.znet can be specified multiple times on the kernel command line. - - **rd.znet_ifname=**____:____:: --- -2.42.0 - diff --git a/0014-fix-resume-always-include-the-resume-module.patch b/0014-fix-resume-always-include-the-resume-module.patch new file mode 100644 index 0000000..3df298c --- /dev/null +++ b/0014-fix-resume-always-include-the-resume-module.patch @@ -0,0 +1,34 @@ +From 53d78f4eb236500465279c424c296ff576421c7c Mon Sep 17 00:00:00 2001 +From: Pavel Valena +Date: Thu, 8 Aug 2024 00:21:12 +0200 +Subject: [PATCH 14/24] fix(resume): always include the resume module + +as we can't determine with certainity that it won't be needed. + +rhel-only + +Resolves: RHEL-53350 +--- + modules.d/95resume/module-setup.sh | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/modules.d/95resume/module-setup.sh b/modules.d/95resume/module-setup.sh +index d419566e..c0f04a6c 100755 +--- a/modules.d/95resume/module-setup.sh ++++ b/modules.d/95resume/module-setup.sh +@@ -1,7 +1,12 @@ + #!/bin/bash + + # called by dracut ++# shellcheck disable=SC2317 + check() { ++ ++ # Always include resume module ++ return 0 ++ + swap_on_netdevice() { + local _dev + for _dev in "${swap_devs[@]}"; do +-- +2.42.0 + diff --git a/0015-feat-dracut-init.sh-allow-changing-the-destination-d.patch b/0015-feat-dracut-init.sh-allow-changing-the-destination-d.patch new file mode 100644 index 0000000..dd265bc --- /dev/null +++ b/0015-feat-dracut-init.sh-allow-changing-the-destination-d.patch @@ -0,0 +1,197 @@ +From b8b7e0245bb3c645b45d4a31847ed227a8431ec8 Mon Sep 17 00:00:00 2001 +From: Philipp Rudo +Date: Mon, 22 Jul 2024 16:46:47 +0200 +Subject: [PATCH 15/24] feat(dracut-init.sh): allow changing the destination + directory for inst et al + +When using 99squash dracut actually builds two separate initrds. The +"normal" one, that gets squashed into a squashfs image, and a +"minimalistic" one, whose only task is to mount and switch_root to the +squashfs image. + +This is currently done the following way: +1. Skipp install() for 99squash during the "normal" installation phase. +2. Trigger a special postinstall hook in 99squash that moves the content + of $initdir to $squashdir and installs the "minimalistic" initrd to + $initdir. +3. Strip the binaries in $initdir (of which $squashdir is a sub + directory of). +4. Squash the content of $squashdir into the squashfs image and remove + $squashdir. + +The problem with this approach is that the steps 2 and 4 specific to +99squash but need to be done in dracut.sh. Thus a lot of special +handling for 99squash is needed in dracut.sh. This will get even more +complex once support for different filesystem images, e.g. erofs, are +implemented. + +In order to be able to move most of the functionality into 99squash +itself a new approach will be chosen, i.e. +1. During the installation phase install the "normal" initrd into + $initdir and the "minimalistic" initrd into $squashdir. +2. Strip the binaries in $initdir. +3. Trigger a special postinstall hook in 99squash that squashes the + content of $initdir (excluding $squashdir) into the squashfs image, + removes the content of $intidir (excluding $suqashdir) and, moves the + content of $squashdir into $initdir. + +With that the only special handling remaining in dracut.sh is triggering +the postinstall hook. + +However, in inst et al. the destination directory is hard coded to +$initdir. Thus allow setting a different destination directory in inst +et al. to get the new approach to work. For the time being only do that +for the functions required by 99squash. + +Signed-off-by: Philipp Rudo + +(cherry picked from commit 5ab4470cf136c2d9983564b84b49fd700d4b8514) + +Related: RHEL-43460 +--- + dracut-init.sh | 40 +++++++++++++++++++++++++--------------- + 1 file changed, 25 insertions(+), 15 deletions(-) + +diff --git a/dracut-init.sh b/dracut-init.sh +index 863df0cb..58e657b5 100755 +--- a/dracut-init.sh ++++ b/dracut-init.sh +@@ -240,34 +240,36 @@ inst_dir() { + } + + inst() { ++ local dstdir="${dstdir:-"$initdir"}" + local _ret _hostonly_install + if [[ $1 == "-H" ]]; then + _hostonly_install="-H" + shift + fi +- [[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there +- if $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"; then ++ [[ -e ${dstdir}/"${2:-$1}" ]] && return 0 # already there ++ if $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${dstdir:+-D "$dstdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"; then + return 0 + else + _ret=$? +- derror FAILED: "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" ++ derror FAILED: "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${dstdir:+-D "$dstdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" + return $_ret + fi + } + + inst_simple() { ++ local dstdir="${dstdir:-"$initdir"}" + local _ret _hostonly_install + if [[ $1 == "-H" ]]; then + _hostonly_install="-H" + shift + fi +- [[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there +- [[ -e $1 ]] || return 1 # no source +- if $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@"; then ++ [[ -e ${dstdir}/"${2:-$1}" ]] && return 0 # already there ++ [[ -e $1 ]] || return 1 # no source ++ if $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${dstdir:+-D "$dstdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@"; then + return 0 + else + _ret=$? +- derror FAILED: "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@" ++ derror FAILED: "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${dstdir:+-D "$dstdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@" + return $_ret + fi + } +@@ -290,16 +292,17 @@ inst_symlink() { + } + + inst_multiple() { ++ local dstdir="${dstdir:-"$initdir"}" + local _ret _hostonly_install + if [[ $1 == "-H" ]]; then + _hostonly_install="-H" + shift + fi +- if $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"; then ++ if $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${dstdir:+-D "$dstdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"; then + return 0 + else + _ret=$? +- derror FAILED: "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" ++ derror FAILED: "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${dstdir:+-D "$dstdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" + return $_ret + fi + } +@@ -566,6 +569,8 @@ inst_rules_wildcard() { + + # make sure that library links are correct and up to date + build_ld_cache() { ++ local dstdir="${dstdir:-"$initdir"}" ++ + for f in "$dracutsysrootdir"/etc/ld.so.conf "$dracutsysrootdir"/etc/ld.so.conf.d/*; do + [[ -f $f ]] && inst_simple "${f#"$dracutsysrootdir"}" + done +@@ -1047,13 +1052,15 @@ for_each_module_dir() { + } + + dracut_kernel_post() { ++ local dstdir="${dstdir:-"$initdir"}" ++ + for _f in modules.builtin modules.builtin.alias modules.builtin.modinfo modules.order; do + [[ -e $srcmods/$_f ]] && inst_simple "$srcmods/$_f" "/lib/modules/$kernel/$_f" + done + + # generate module dependencies for the initrd +- if [[ -d $initdir/lib/modules/$kernel ]] \ +- && ! depmod -a -b "$initdir" "$kernel"; then ++ if [[ -d $dstdir/lib/modules/$kernel ]] \ ++ && ! depmod -a -b "$dstdir" "$kernel"; then + dfatal "\"depmod -a $kernel\" failed." + exit 1 + fi +@@ -1067,6 +1074,7 @@ instmods() { + # can be e.g. "=block" or "=drivers/usb/storage" + # -c check + # -s silent ++ local dstdir="${dstdir:-"$initdir"}" + local _optional="-o" + local _silent + local _ret +@@ -1092,7 +1100,7 @@ instmods() { + fi + + $DRACUT_INSTALL \ +- ${initdir:+-D "$initdir"} \ ++ ${dstdir:+-D "$dstdir"} \ + ${dracutsysrootdir:+-r "$dracutsysrootdir"} \ + ${loginstall:+-L "$loginstall"} \ + ${hostonly:+-H} \ +@@ -1106,7 +1114,7 @@ instmods() { + if ((_ret != 0)) && [[ -z $_silent ]]; then + derror "FAILED: " \ + "$DRACUT_INSTALL" \ +- ${initdir:+-D "$initdir"} \ ++ ${dstdir:+-D "$dstdir"} \ + ${dracutsysrootdir:+-r "$dracutsysrootdir"} \ + ${loginstall:+-L "$loginstall"} \ + ${hostonly:+-H} \ +@@ -1123,14 +1131,16 @@ instmods() { + + if [[ "$(ln --help)" == *--relative* ]]; then + ln_r() { +- ln -sfnr "${initdir}/$1" "${initdir}/$2" ++ local dstdir="${dstdir:-"$initdir"}" ++ ln -sfnr "${dstdir}/$1" "${dstdir}/$2" + } + else + ln_r() { ++ local dstdir="${dstdir:-"$initdir"}" + local _source=$1 + local _dest=$2 + [[ -d ${_dest%/*} ]] && _dest=$(readlink -f "${_dest%/*}")/${_dest##*/} +- ln -sfn -- "$(convert_abs_rel "${_dest}" "${_source}")" "${initdir}/${_dest}" ++ ln -sfn -- "$(convert_abs_rel "${_dest}" "${_source}")" "${dstdir}/${_dest}" + } + fi + +-- +2.42.0 + diff --git a/0015-feat-qeth_rules-remove-qeth-handling-consolidated-in.patch b/0015-feat-qeth_rules-remove-qeth-handling-consolidated-in.patch deleted file mode 100644 index 827881a..0000000 --- a/0015-feat-qeth_rules-remove-qeth-handling-consolidated-in.patch +++ /dev/null @@ -1,90 +0,0 @@ -From 7ad6fef8fe110093939c422b5c3b381ebe47e4e9 Mon Sep 17 00:00:00 2001 -From: Steffen Maier -Date: Fri, 26 May 2023 19:51:09 +0200 -Subject: [PATCH 15/23] feat(qeth_rules): remove qeth handling consolidated in - 95znet - -Dracut module 95znet handles a superset of qeth_rules as of the preceding -commit ("feat(znet): use zdev for consolidated device configuration"). - -The instmods list in installkernel() seemed to have been incomplete because -qeth needs one or both of qeth_l2 and qeth_l3 but qeth intentionally does -not depend on them so depmod cannot resolve that. - -In contrast to the old dracut module 95znet, 95qeth_rules also did not seem -to have parsing for the upstream dracut cmdline options "rd.znet=" and -"rd.znet_ifname=". - -Signed-off-by: Steffen Maier ---- - modules.d/95qeth_rules/module-setup.sh | 58 -------------------------- - 1 file changed, 58 deletions(-) - delete mode 100755 modules.d/95qeth_rules/module-setup.sh - -diff --git a/modules.d/95qeth_rules/module-setup.sh b/modules.d/95qeth_rules/module-setup.sh -deleted file mode 100755 -index a84ac151..00000000 ---- a/modules.d/95qeth_rules/module-setup.sh -+++ /dev/null -@@ -1,58 +0,0 @@ --#!/bin/bash -- --# called by dracut --check() { -- local _arch=${DRACUT_ARCH:-$(uname -m)} -- local _online=0 -- [ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1 -- dracut_module_included network || return 1 -- -- [[ $hostonly ]] && { -- for i in /sys/devices/qeth/*/online; do -- [ ! -f "$i" ] && continue -- read -r _online < "$i" -- [ "$_online" -eq 1 ] && return 0 -- done -- } -- return 255 --} -- --# called by dracut --installkernel() { -- instmods qeth --} -- --# called by dracut --install() { -- ccwid() { -- qeth_path=$(readlink -e -q "$1"/device) -- basename "$qeth_path" -- } -- -- inst_rules_qeth() { -- for rule in /etc/udev/rules.d/{4,5}1-qeth-${1}.rules; do -- # prefer chzdev generated 41- rules -- if [ -f "$rule" ]; then -- inst_rules "$rule" -- break -- fi -- done -- } -- -- has_carrier() { -- carrier=0 -- # not readable in qeth interfaces -- # that have just been assembled, ignore -- # read error and assume no carrier -- read -r carrier 2> /dev/null < "$1/carrier" -- [ "$carrier" -eq 1 ] && return 0 -- return 1 -- } -- -- for dev in /sys/class/net/*; do -- has_carrier "$dev" || continue -- id=$(ccwid "$dev") -- [ -n "$id" ] && inst_rules_qeth "$id" -- done -- --} --- -2.42.0 - diff --git a/0016-fix-dracut-init.sh-add-module-to-mods_to_load-before.patch b/0016-fix-dracut-init.sh-add-module-to-mods_to_load-before.patch new file mode 100644 index 0000000..eff9951 --- /dev/null +++ b/0016-fix-dracut-init.sh-add-module-to-mods_to_load-before.patch @@ -0,0 +1,82 @@ +From c81d6422d71b02ed9158a67c00fa0a5eec232f37 Mon Sep 17 00:00:00 2001 +From: Philipp Rudo +Date: Thu, 25 Jul 2024 12:47:00 +0200 +Subject: [PATCH 16/24] fix(dracut-init.sh): add module to mods_to_load before + checking dependencies + +When implementing erofs support for 99squash we end up with three +modules 99squash, 95squash-squashfs and 95squash-erofs. Where 99squash +contains the common code for filesystem images and +95squash-{squashfs,erofs} the special handing depending on the +filesystem used. This leads to a dependency cycle as we want to allow +users both to choose 99squash, when the exact filesystem doesn't matter, +as well as 95squash-{squashfs,erofs} when a specific filesystem is +required. + +But when 99squash is added as a dependency calling +dracut_module_included fails in its depends() function. This lead to +cases where both handlers, 95squash-squashfs and 95squash-erofs, were +added to the initrd. + +Reason for the failure is that a module only is marked to be loaded +after all it's dependencies have been checked as well. Thus a child +module cannot detect which parent module wants it to be included. Fix +this by marking modules to be loaded before checking its dependencies in +check_module. Do the same change in check_mount for consistency. + +Signed-off-by: Philipp Rudo + +(cherry picked from commit 634b4a5c6fbe595eb240cd529d669d21eadd510c) + +Related: RHEL-43460 +--- + dracut-init.sh | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/dracut-init.sh b/dracut-init.sh +index 58e657b5..840c6167 100755 +--- a/dracut-init.sh ++++ b/dracut-init.sh +@@ -915,6 +915,9 @@ check_mount() { + fi + fi + ++ [[ " $mods_to_load " == *\ $_mod\ * ]] \ ++ || mods_to_load+=" $_mod " ++ + for _moddep in $(module_depends "$_mod" "$_moddir"); do + # handle deps as if they were manually added + [[ " $dracutmodules " == *\ $_mod\ * ]] \ +@@ -933,9 +936,6 @@ check_mount() { + fi + done + +- [[ " $mods_to_load " == *\ $_mod\ * ]] \ +- || mods_to_load+=" $_mod " +- + return 0 + } + +@@ -990,6 +990,9 @@ check_module() { + fi + fi + ++ [[ " $mods_to_load " == *\ $_mod\ * ]] \ ++ || mods_to_load+=" $_mod " ++ + for _moddep in $(module_depends "$_mod" "$_moddir"); do + # handle deps as if they were manually added + [[ " $dracutmodules " == *\ $_mod\ * ]] \ +@@ -1008,9 +1011,6 @@ check_module() { + fi + done + +- [[ " $mods_to_load " == *\ $_mod\ * ]] \ +- || mods_to_load+=" $_mod " +- + return 0 + } + +-- +2.42.0 + diff --git a/0016-fix-znet-append-to-udev-rules-so-each-rd.znet_ifname.patch b/0016-fix-znet-append-to-udev-rules-so-each-rd.znet_ifname.patch deleted file mode 100644 index a4055fb..0000000 --- a/0016-fix-znet-append-to-udev-rules-so-each-rd.znet_ifname.patch +++ /dev/null @@ -1,44 +0,0 @@ -From cbc5eece88b8f6d0e69fdfbb8f34eabb45425c86 Mon Sep 17 00:00:00 2001 -From: Steffen Maier -Date: Fri, 26 May 2023 19:47:35 +0200 -Subject: [PATCH 16/23] fix(znet): append to udev rules so each rd.znet_ifname - is effective - -Otherwise the last rd.znet_ifname statement overwrites the persistent -network interface settings of previous such statements. - -Signed-off-by: Steffen Maier ---- - modules.d/95znet/parse-ccw.sh | 14 ++++++++------ - 1 file changed, 8 insertions(+), 6 deletions(-) - -diff --git a/modules.d/95znet/parse-ccw.sh b/modules.d/95znet/parse-ccw.sh -index aacc988e..ccf05bc6 100755 ---- a/modules.d/95znet/parse-ccw.sh -+++ b/modules.d/95znet/parse-ccw.sh -@@ -53,14 +53,16 @@ for ifname in $(getargs rd.znet_ifname); do - warn "Invalid arguments for rd.znet_ifname=" - else - { -- ifname_subchannels=${ifname_subchannels//,/|} -+ ifname_subchannels="${ifname_subchannels//,/|}" -+ # sanitize for use in udev label: replace non-word characters by _ -+ ifname_if_label="${ifname_if//[^[:word:]]/_}" - -- echo 'ACTION!="add|change", GOTO="ccw_ifname_end"' -- echo 'ATTR{type}!="1", GOTO="ccw_ifname_end"' -- echo 'SUBSYSTEM!="net", GOTO="ccw_ifname_end"' -+ echo "ACTION!=\"add|change\", GOTO=\"ccw_ifname_${ifname_if_label}_end\"" -+ echo "ATTR{type}!=\"1\", GOTO=\"ccw_ifname_${ifname_if_label}_end\"" -+ echo "SUBSYSTEM!=\"net\", GOTO=\"ccw_ifname_${ifname_if_label}_end\"" - echo "SUBSYSTEMS==\"ccwgroup\", KERNELS==\"$ifname_subchannels\", DRIVERS==\"?*\" NAME=\"$ifname_if\"" -- echo 'LABEL="ccw_ifname_end"' -+ echo "LABEL=\"ccw_ifname_${ifname_if_label}_end\"" - -- } > /etc/udev/rules.d/81-ccw-ifname.rules -+ } >> /etc/udev/rules.d/81-ccw-ifname.rules - fi - done --- -2.42.0 - diff --git a/0017-feat-squash-move-mksquashfs-to-99squash-modules-setu.patch b/0017-feat-squash-move-mksquashfs-to-99squash-modules-setu.patch new file mode 100644 index 0000000..ebd3dbc --- /dev/null +++ b/0017-feat-squash-move-mksquashfs-to-99squash-modules-setu.patch @@ -0,0 +1,192 @@ +From bbb64f449a4f3cd76ea63d73ebc1043a3dd14118 Mon Sep 17 00:00:00 2001 +From: Philipp Rudo +Date: Mon, 22 Jul 2024 16:30:50 +0200 +Subject: [PATCH 17/24] feat(squash): move mksquashfs to 99squash/modules-setup + +When using 99squash dracut actually builds two separat initrds. The +"normal" one, that gets squashed into a squashfs image, and a +"minimalistic" one, whose only task is to mount and switch_root to the +squashfs image. + +For that 99squash currently requires a lot of special handling in +dracut.sh. Move most of this special handling into 99squash itself. This +requires a new approach when building the "minimalistic" initrd. The new +approach works the following way + +1. During the installation phase install the "normal" initrd into + $initdir and the "minimalistic" initrd into $squashdir. +2. Strip the binaries in $initdir. +3. Trigger a special postinstall hook in 99squash that squashes the + content of $initdir (excluding $squashdir) into the squashfs image, + removes the content of $intidir (excluding $suqashdir) and, moves the + content of $squashdir into $initdir. + +Signed-off-by: Philipp Rudo + +(cherry picked from commit 7a4dd89ca732329893628b886fe8e78337d896e8) + +Related: RHEL-43460 +--- + dracut.sh | 35 ++++-------------- + modules.d/99squash/module-setup.sh | 58 +++++++++++++++++++++--------- + 2 files changed, 49 insertions(+), 44 deletions(-) + +diff --git a/dracut.sh b/dracut.sh +index cc6d6f28..68bdf33b 100755 +--- a/dracut.sh ++++ b/dracut.sh +@@ -1277,6 +1277,7 @@ trap ' + trap 'exit 1;' SIGINT + + readonly initdir="${DRACUT_TMPDIR}/initramfs" ++readonly squashdir="$initdir/squash_root" + mkdir -p "$initdir" + + if [[ $early_microcode == yes ]] || { [[ $acpi_override == yes ]] && [[ -d $acpi_table_dir ]]; }; then +@@ -1804,7 +1805,8 @@ export initdir dracutbasedir \ + host_fs_types host_devs swap_devs sshkey add_fstab \ + DRACUT_VERSION \ + prefix filesystems drivers \ +- hostonly_cmdline loginstall ++ hostonly_cmdline loginstall \ ++ squashdir squash_compress + + mods_to_load="" + # check all our modules to see if they should be sourced. +@@ -1909,6 +1911,8 @@ if [[ $kernel_only != yes ]]; then + fi + fi + ++dracut_module_included "squash" && mkdir -p "$squashdir" ++ + _isize=0 #initramfs size + modules_loaded=" " + # source our modules. +@@ -2255,14 +2259,6 @@ if [[ $kernel_only != yes ]]; then + build_ld_cache + fi + +-if dracut_module_included "squash"; then +- readonly squash_dir="$initdir/squash/root" +- readonly squash_img="$initdir/squash-root.img" +- mkdir -p "$squash_dir" +- dinfo "*** Install squash loader ***" +- DRACUT_SQUASH_POST_INST=1 module_install "squash" +-fi +- + if [[ $do_strip == yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then + # stripping files negates (dedup) benefits of using reflink + [[ -n $enhanced_cpio ]] && ddebug "strip is enabled alongside cpio reflink" +@@ -2282,25 +2278,8 @@ fi + + if dracut_module_included "squash"; then + dinfo "*** Squashing the files inside the initramfs ***" +- declare squash_compress_arg +- # shellcheck disable=SC2086 +- if [[ $squash_compress ]]; then +- if ! mksquashfs /dev/null "$DRACUT_TMPDIR"/.squash-test.img -no-progress -comp $squash_compress &> /dev/null; then +- dwarn "mksquashfs doesn't support compressor '$squash_compress', failing back to default compressor." +- else +- squash_compress_arg="$squash_compress" +- fi +- fi +- +- # shellcheck disable=SC2086 +- if ! mksquashfs "$squash_dir" "$squash_img" \ +- -no-xattrs -no-exports -noappend -no-recovery -always-use-fragments \ +- -no-progress ${squash_compress_arg:+-comp $squash_compress_arg} 1> /dev/null; then +- dfatal "Failed making squash image" +- exit 1 +- fi +- +- rm -rf "$squash_dir" ++ DRACUT_SQUASH_POST_INST=1 module_install "squash" ++ rm -rf "$squashdir" + dinfo "*** Squashing the files inside the initramfs done ***" + + # Skip initramfs compress +diff --git a/modules.d/99squash/module-setup.sh b/modules.d/99squash/module-setup.sh +index dc2e0a20..96d097af 100755 +--- a/modules.d/99squash/module-setup.sh ++++ b/modules.d/99squash/module-setup.sh +@@ -12,26 +12,13 @@ depends() { + return 0 + } + +-installpost() { ++squash_install() { + local _busybox + _busybox=$(find_binary busybox) + +- # Move everything under $initdir except $squash_dir +- # itself into squash image +- for i in "$initdir"/*; do +- [[ $squash_dir == "$i"/* ]] || mv "$i" "$squash_dir"/ +- done +- + # Create mount points for squash loader + mkdir -p "$initdir"/squash/ +- mkdir -p "$squash_dir"/squash/ +- +- # Copy dracut spec files out side of the squash image +- # so dracut rebuild and lsinitrd can work +- for file in "$squash_dir"/usr/lib/dracut/*; do +- [[ -f $file ]] || continue +- DRACUT_RESOLVE_DEPS=1 dracutsysrootdir="$squash_dir" inst "${file#"$squash_dir"}" +- done ++ mkdir -p "$squashdir"/squash/ + + # Install required modules and binaries for the squash image init script. + if [[ $_busybox ]]; then +@@ -61,8 +48,47 @@ installpost() { + build_ld_cache + } + ++squash_installpost() { ++ local _img="$squashdir"/squash-root.img ++ local _comp _file ++ ++ # shellcheck disable=SC2086 ++ if [[ $squash_compress ]]; then ++ if ! mksquashfs /dev/null "$DRACUT_TMPDIR"/.squash-test.img -no-progress -comp $squash_compress &> /dev/null; then ++ dwarn "mksquashfs doesn't support compressor '$squash_compress', failing back to default compressor." ++ else ++ _comp="$squash_compress" ++ fi ++ fi ++ ++ # shellcheck disable=SC2086 ++ if ! mksquashfs "$initdir" "$_img" \ ++ -no-xattrs -no-exports -noappend -no-recovery -always-use-fragments \ ++ -no-progress ${_comp:+-comp $_comp} \ ++ -e "$squashdir" 1> /dev/null; then ++ dfatal "Failed making squash image" ++ exit 1 ++ fi ++ ++ # Rescue the dracut spec files so dracut rebuild and lsinitrd can work ++ for _file in "$initdir"/usr/lib/dracut/*; do ++ [[ -f $_file ]] || continue ++ DRACUT_RESOLVE_DEPS=1 dstdir=$squashdir inst "$_file" "${_file#"$initdir"}" ++ done ++ ++ # Remove everything that got squashed into the image ++ for _file in "$initdir"/*; do ++ [[ $_file == "$squashdir" ]] && continue ++ rm -rf "$_file" ++ done ++ mv "$squashdir"/* "$initdir" ++} ++ + install() { ++ + if [[ $DRACUT_SQUASH_POST_INST ]]; then +- installpost ++ squash_installpost ++ else ++ dstdir="$squashdir" squash_install + fi + } +-- +2.42.0 + diff --git a/0017-refactor-ifcfg-delete-code-duplication-using-iface_g.patch b/0017-refactor-ifcfg-delete-code-duplication-using-iface_g.patch deleted file mode 100644 index 7bdb334..0000000 --- a/0017-refactor-ifcfg-delete-code-duplication-using-iface_g.patch +++ /dev/null @@ -1,40 +0,0 @@ -From b6913f66b6c9e9ea81fd0832405c170876bc993a Mon Sep 17 00:00:00 2001 -From: Steffen Maier -Date: Wed, 26 Jul 2023 12:42:03 +0200 -Subject: [PATCH 17/23] refactor(ifcfg): delete code duplication using - iface_get_subchannels() - -Signed-off-by: Steffen Maier ---- - modules.d/45ifcfg/write-ifcfg.sh | 10 ++-------- - 1 file changed, 2 insertions(+), 8 deletions(-) - -diff --git a/modules.d/45ifcfg/write-ifcfg.sh b/modules.d/45ifcfg/write-ifcfg.sh -index 5550cce3..4ca96e98 100755 ---- a/modules.d/45ifcfg/write-ifcfg.sh -+++ b/modules.d/45ifcfg/write-ifcfg.sh -@@ -31,19 +31,13 @@ print_s390() { - local NETTYPE - local CONFIG_LINE - local i -- local channel - local OLD_IFS - - _netif="$1" - # if we find ccw channel, then use those, instead of - # of the MAC -- SUBCHANNELS=$({ -- for i in /sys/class/net/"$_netif"/device/cdev[0-9]*; do -- [ -e "$i" ] || continue -- channel=$(readlink -f "$i") -- printf '%s' "${channel##*/}," -- done -- }) -+ # [iface_get_subchannels() from /lib/net-lib.sh sourced at top of this file] -+ SUBCHANNELS=$(iface_get_subchannels "$_netif") - [ -n "$SUBCHANNELS" ] || return 1 - - SUBCHANNELS=${SUBCHANNELS%,} --- -2.42.0 - diff --git a/0018-feat-ifcfg-minimize-s390-specific-network-configurat.patch b/0018-feat-ifcfg-minimize-s390-specific-network-configurat.patch deleted file mode 100644 index 2a88e6a..0000000 --- a/0018-feat-ifcfg-minimize-s390-specific-network-configurat.patch +++ /dev/null @@ -1,95 +0,0 @@ -From 110fec3e41faf47277447f1c56635c5a876c1f96 Mon Sep 17 00:00:00 2001 -From: Steffen Maier -Date: Wed, 26 Jul 2023 12:59:19 +0200 -Subject: [PATCH 18/23] feat(ifcfg): minimize s390-specific network - configuration aspects - -Since consolidated s390 network device configuration with zdev is used, -it takes care of all s390-specific settings. -None of the s390-specific ifcfg variables should be used anymore. -NETTYPE and OPTIONS can be removed entirely. -SUBCHANNELS is kept because there are some dependency chains -(probably around the interface identifiying key, which is not HWADDR): - -modules.d/35network-legacy/module-setup.sh -parses (sources) each of /etc/sysconfig/network-scripts/ifcfg-* -and if that contains SUBCHANNELS, creates a symlink from the ifcfg file to -/etc/sysconfig/network-scripts/ccw-${SUBCHANNELS}.conf - -modules.d/35network-legacy/ifup.sh installed as /sbin/ifup -checks during team setup if a slave interface is an s390 channel-attached -network interface and then parses (sources) -/etc/sysconfig/network-scripts/ccw-${SUBCHANNELS}.conf -from above, if that file exists - -Signed-off-by: Steffen Maier ---- - modules.d/45ifcfg/write-ifcfg.sh | 41 -------------------------------- - 1 file changed, 41 deletions(-) - -diff --git a/modules.d/45ifcfg/write-ifcfg.sh b/modules.d/45ifcfg/write-ifcfg.sh -index 4ca96e98..a7804b50 100755 ---- a/modules.d/45ifcfg/write-ifcfg.sh -+++ b/modules.d/45ifcfg/write-ifcfg.sh -@@ -10,28 +10,10 @@ mkdir -m 0755 -p /tmp/ifcfg/ - # shellcheck disable=SC2174 - mkdir -m 0755 -p /tmp/ifcfg-leases/ - --get_config_line_by_subchannel() { -- local CHANNELS -- local line -- -- CHANNELS="$1" -- while read -r line || [ -n "$line" ]; do -- if strstr "$line" "$CHANNELS"; then -- echo "$line" -- return 0 -- fi -- done < /etc/ccw.conf -- return 1 --} -- - print_s390() { - local _netif - local SUBCHANNELS -- local OPTIONS -- local NETTYPE -- local CONFIG_LINE - local i -- local OLD_IFS - - _netif="$1" - # if we find ccw channel, then use those, instead of -@@ -43,29 +25,6 @@ print_s390() { - SUBCHANNELS=${SUBCHANNELS%,} - echo "SUBCHANNELS=\"${SUBCHANNELS}\"" - -- CONFIG_LINE=$(get_config_line_by_subchannel "$SUBCHANNELS") -- # shellcheck disable=SC2181 -- [ $? -ne 0 -o -z "$CONFIG_LINE" ] && return 0 -- -- OLD_IFS=$IFS -- IFS="," -- # shellcheck disable=SC2086 -- set -- $CONFIG_LINE -- IFS=$OLD_IFS -- NETTYPE=$1 -- shift -- SUBCHANNELS="$1" -- OPTIONS="" -- shift -- while [ $# -gt 0 ]; do -- case $1 in -- *=*) OPTIONS="$OPTIONS $1" ;; -- esac -- shift -- done -- OPTIONS=${OPTIONS## } -- echo "NETTYPE=\"${NETTYPE}\"" -- echo "OPTIONS=\"${OPTIONS}\"" - return 0 - } - --- -2.42.0 - diff --git a/0018-feat-squash-split-95squash-squashfs-from-99squash.patch b/0018-feat-squash-split-95squash-squashfs-from-99squash.patch new file mode 100644 index 0000000..b1ee453 --- /dev/null +++ b/0018-feat-squash-split-95squash-squashfs-from-99squash.patch @@ -0,0 +1,183 @@ +From 1ef53f9d5ea7f74730b27b8016304c58b2d31871 Mon Sep 17 00:00:00 2001 +From: Philipp Rudo +Date: Tue, 23 Jul 2024 16:39:13 +0200 +Subject: [PATCH 18/24] feat(squash): split 95squash-squashfs from 99squash + +99squash only allows squashing the files using squashfs. In order to +make the implementation for different filesystems easier split out the +squashfs specific parts into 95squash-squashfs. + +While at it rename the root image contained in the initrd to +squashfs-root.img. This allows tools like lsinitrd to detect the +filesystem used later on. + +Signed-off-by: Philipp Rudo + +(cherry picked from commit f281606f110be1549cd6b1cd34828653879a5f50) + +Related: RHEL-43460 +--- + modules.d/95squash-squashfs/module-setup.sh | 48 ++++++++++++++++++ + modules.d/99squash/init-squash.sh | 2 +- + modules.d/99squash/module-setup.sh | 54 ++++++++++++--------- + 3 files changed, 80 insertions(+), 24 deletions(-) + create mode 100755 modules.d/95squash-squashfs/module-setup.sh + +diff --git a/modules.d/95squash-squashfs/module-setup.sh b/modules.d/95squash-squashfs/module-setup.sh +new file mode 100755 +index 00000000..83973700 +--- /dev/null ++++ b/modules.d/95squash-squashfs/module-setup.sh +@@ -0,0 +1,48 @@ ++#!/bin/bash ++ ++check() { ++ require_binaries mksquashfs unsquashfs || return 1 ++ require_kernel_modules squashfs || return 1 ++ ++ return 255 ++} ++ ++depends() { ++ echo "squash" ++ return 0 ++} ++ ++squashfs_install() { ++ hostonly="" instmods "squashfs" ++} ++ ++squashfs_installpost() { ++ local _img="$squashdir/squashfs-root.img" ++ local _comp ++ ++ # shellcheck disable=SC2086 ++ if [[ $squash_compress ]]; then ++ if ! mksquashfs /dev/null "$DRACUT_TMPDIR"/.squash-test.img -no-progress -comp $squash_compress &> /dev/null; then ++ dwarn "mksquashfs doesn't support compressor '$squash_compress', failing back to default compressor." ++ else ++ _comp="$squash_compress" ++ fi ++ fi ++ ++ # shellcheck disable=SC2086 ++ if ! mksquashfs "$initdir" "$_img" \ ++ -no-xattrs -no-exports -noappend -no-recovery -always-use-fragments \ ++ -no-progress ${_comp:+-comp $_comp} \ ++ -e "$squashdir" 1> /dev/null; then ++ dfatal "Failed making squash image" ++ exit 1 ++ fi ++} ++ ++install() { ++ if [[ $DRACUT_SQUASH_POST_INST ]]; then ++ squashfs_installpost ++ else ++ dstdir="$squashdir" squashfs_install ++ fi ++} +diff --git a/modules.d/99squash/init-squash.sh b/modules.d/99squash/init-squash.sh +index 59769f62..42a9a86f 100755 +--- a/modules.d/99squash/init-squash.sh ++++ b/modules.d/99squash/init-squash.sh +@@ -21,7 +21,7 @@ modprobe overlay + # Mount the squash image + mount -t ramfs ramfs /squash + mkdir -p /squash/root /squash/overlay/upper /squash/overlay/work +-mount -t squashfs -o ro,loop /squash-root.img /squash/root ++mount -t squashfs -o ro,loop /squashfs-root.img /squash/root + + # Setup new root overlay + mkdir /newroot +diff --git a/modules.d/99squash/module-setup.sh b/modules.d/99squash/module-setup.sh +index 96d097af..015944c2 100755 +--- a/modules.d/99squash/module-setup.sh ++++ b/modules.d/99squash/module-setup.sh +@@ -1,17 +1,42 @@ + #!/bin/bash + + check() { +- require_binaries mksquashfs unsquashfs || return 1 +- require_kernel_modules squashfs loop overlay || return 1 ++ require_kernel_modules loop overlay || return 1 + + return 255 + } + + depends() { +- echo "systemd-initrd" ++ local _handler ++ ++ _handler=$(squash_get_handler) || return 1 ++ ++ echo "systemd-initrd $_handler" + return 0 + } + ++squash_get_handler() { ++ local _module _handler ++ ++ for _module in squash-squashfs; do ++ if dracut_module_included "$_module"; then ++ _handler="$_module" ++ break ++ fi ++ done ++ ++ if [ -z "$_handler" ]; then ++ if check_module "squash-squashfs"; then ++ _handler="squash-squashfs" ++ else ++ dfatal "No valid handler for found" ++ return 1 ++ fi ++ fi ++ ++ echo "$_handler" ++} ++ + squash_install() { + local _busybox + _busybox=$(find_binary busybox) +@@ -36,7 +61,7 @@ squash_install() { + [[ $DRACUT_FIPS_MODE ]] && inst_libdir_file -o "libssl.so*" + fi + +- hostonly="" instmods "loop" "squashfs" "overlay" ++ hostonly="" instmods "loop" "overlay" + dracut_kernel_post + + # Install squash image init script. +@@ -49,26 +74,9 @@ squash_install() { + } + + squash_installpost() { +- local _img="$squashdir"/squash-root.img +- local _comp _file +- +- # shellcheck disable=SC2086 +- if [[ $squash_compress ]]; then +- if ! mksquashfs /dev/null "$DRACUT_TMPDIR"/.squash-test.img -no-progress -comp $squash_compress &> /dev/null; then +- dwarn "mksquashfs doesn't support compressor '$squash_compress', failing back to default compressor." +- else +- _comp="$squash_compress" +- fi +- fi ++ local _file + +- # shellcheck disable=SC2086 +- if ! mksquashfs "$initdir" "$_img" \ +- -no-xattrs -no-exports -noappend -no-recovery -always-use-fragments \ +- -no-progress ${_comp:+-comp $_comp} \ +- -e "$squashdir" 1> /dev/null; then +- dfatal "Failed making squash image" +- exit 1 +- fi ++ DRACUT_SQUASH_POST_INST=1 module_install "$(squash_get_handler)" + + # Rescue the dracut spec files so dracut rebuild and lsinitrd can work + for _file in "$initdir"/usr/lib/dracut/*; do +-- +2.42.0 + diff --git a/0019-feat-squash-add-module-95squash-erofs.patch b/0019-feat-squash-add-module-95squash-erofs.patch new file mode 100644 index 0000000..e0e7171 --- /dev/null +++ b/0019-feat-squash-add-module-95squash-erofs.patch @@ -0,0 +1,128 @@ +From 4e8ea763cb10ab4f3b65e865d2ad03c8a5393e04 Mon Sep 17 00:00:00 2001 +From: Philipp Rudo +Date: Tue, 23 Jul 2024 17:42:33 +0200 +Subject: [PATCH 19/24] feat(squash): add module 95squash-erofs + +Allow squashing the image in 99squash using erofs. Keep squashfs as +default to not change existing systems. I.e. only use erofs if the user +explicitly include 95squash-erofs or when the prereqs for squashfs are +missing. + +Signed-off-by: Philipp Rudo + +(cherry picked from commit e185d6ae1cc38af90f741d3d6c677458d69a345f) + +Resolves: RHEL-43460 +--- + modules.d/95squash-erofs/module-setup.sh | 45 ++++++++++++++++++++++++ + modules.d/99squash/init-squash.sh | 12 +++++-- + modules.d/99squash/module-setup.sh | 4 ++- + 3 files changed, 58 insertions(+), 3 deletions(-) + create mode 100755 modules.d/95squash-erofs/module-setup.sh + +diff --git a/modules.d/95squash-erofs/module-setup.sh b/modules.d/95squash-erofs/module-setup.sh +new file mode 100755 +index 00000000..71c2b672 +--- /dev/null ++++ b/modules.d/95squash-erofs/module-setup.sh +@@ -0,0 +1,45 @@ ++#!/bin/bash ++ ++check() { ++ require_binaries mkfs.erofs || return 1 ++ require_kernel_modules erofs || return 1 ++ ++ return 255 ++} ++ ++depends() { ++ echo "squash" ++ return 0 ++} ++ ++erofs_install() { ++ hostonly="" instmods "erofs" ++} ++ ++erofs_installpost() { ++ local _img="$squashdir/erofs-root.img" ++ local -a _erofs_args ++ ++ _erofs_args+=("--exclude-path=$squashdir") ++ _erofs_args+=("-E" "fragments") ++ ++ if [[ -n $squash_compress ]]; then ++ if mkfs.erofs "${_erofs_args[@]}" -z "$squash_compress" "$_img" "$initdir" &> /dev/null; then ++ return ++ fi ++ dwarn "mkfs.erofs doesn't support compressor '$squash_compress', failing back to default compressor." ++ fi ++ ++ if ! mkfs.erofs "${_erofs_args[@]}" "$_img" "$initdir" &> /dev/null; then ++ dfatal "Failed making squash image" ++ exit 1 ++ fi ++} ++ ++install() { ++ if [[ $DRACUT_SQUASH_POST_INST ]]; then ++ erofs_installpost ++ else ++ dstdir="$squashdir" erofs_install ++ fi ++} +diff --git a/modules.d/99squash/init-squash.sh b/modules.d/99squash/init-squash.sh +index 42a9a86f..31a39cfd 100755 +--- a/modules.d/99squash/init-squash.sh ++++ b/modules.d/99squash/init-squash.sh +@@ -13,15 +13,23 @@ grep -q '^devtmpfs /dev devtmpfs' /proc/self/mounts \ + grep -q '^tmpfs /run tmpfs' /proc/self/mounts \ + || (mkdir -p /run && mount -t tmpfs -o mode=755,noexec,nosuid,strictatime tmpfs /run) + ++if [ -e /erofs-root.img ]; then ++ _fs=erofs ++ _img=erofs-root.img ++else ++ _fs=squashfs ++ _img=squashfs-root.img ++fi ++ + # Load required modules + modprobe loop +-modprobe squashfs ++modprobe "$_fs" + modprobe overlay + + # Mount the squash image + mount -t ramfs ramfs /squash + mkdir -p /squash/root /squash/overlay/upper /squash/overlay/work +-mount -t squashfs -o ro,loop /squashfs-root.img /squash/root ++mount -t "$_fs" -o ro,loop /"$_img" /squash/root + + # Setup new root overlay + mkdir /newroot +diff --git a/modules.d/99squash/module-setup.sh b/modules.d/99squash/module-setup.sh +index 015944c2..5cbbec63 100755 +--- a/modules.d/99squash/module-setup.sh ++++ b/modules.d/99squash/module-setup.sh +@@ -18,7 +18,7 @@ depends() { + squash_get_handler() { + local _module _handler + +- for _module in squash-squashfs; do ++ for _module in squash-squashfs squash-erofs; do + if dracut_module_included "$_module"; then + _handler="$_module" + break +@@ -28,6 +28,8 @@ squash_get_handler() { + if [ -z "$_handler" ]; then + if check_module "squash-squashfs"; then + _handler="squash-squashfs" ++ elif check_module "squash-erofs"; then ++ _handler="squash-erofs" + else + dfatal "No valid handler for found" + return 1 +-- +2.42.0 + diff --git a/0019-fix-dracut-move-hooks-directory-from-usr-lib-to-var-.patch b/0019-fix-dracut-move-hooks-directory-from-usr-lib-to-var-.patch deleted file mode 100644 index b0a1efb..0000000 --- a/0019-fix-dracut-move-hooks-directory-from-usr-lib-to-var-.patch +++ /dev/null @@ -1,87 +0,0 @@ -From 55a56c546bde71fb42c99aadd96e98fca2199823 Mon Sep 17 00:00:00 2001 -From: Laszlo Gombos -Date: Fri, 5 Apr 2024 15:50:20 +0200 -Subject: [PATCH 19/23] fix(dracut): move hooks directory from /usr/lib to - /var/lib - -Since https://github.com/systemd/systemd/commit/ffc1ec73, /usr is mounted as -read-only in the initramfs by default. - -Fixes #2588 - -Co-authored-by: Antonio Alvarez Feijoo ---- - dracut-init.sh | 2 +- - dracut.sh | 6 +++++- - modules.d/99base/module-setup.sh | 5 ++++- - modules.d/99shutdown/module-setup.sh | 8 +++++--- - 4 files changed, 15 insertions(+), 6 deletions(-) - -diff --git a/dracut-init.sh b/dracut-init.sh -index c37038e3..1c7ca58a 100755 ---- a/dracut-init.sh -+++ b/dracut-init.sh -@@ -630,7 +630,7 @@ inst_hook() { - dfatal "No such hook type $1. Aborting initrd creation." - exit 1 - fi -- hook="/lib/dracut/hooks/${1}/${2}-${3##*/}" -+ hook="/var/lib/dracut/hooks/${1}/${2}-${3##*/}" - inst_simple "$3" "$hook" - chmod u+x "$initdir/$hook" - } -diff --git a/dracut.sh b/dracut.sh -index a0af3dd2..5d43f44c 100755 ---- a/dracut.sh -+++ b/dracut.sh -@@ -1883,7 +1883,11 @@ mkdir -p "${initdir}"/lib/dracut - - if [[ $kernel_only != yes ]]; then - mkdir -p "${initdir}/etc/cmdline.d" -- mkdir -m 0755 "${initdir}"/lib/dracut/hooks -+ mkdir -m 0755 -p "${initdir}"/var/lib/dracut/hooks -+ -+ # symlink to old hooks location for compatibility -+ ln_r /var/lib/dracut/hooks /lib/dracut/hooks -+ - for _d in $hookdirs; do - # shellcheck disable=SC2174 - mkdir -m 0755 -p "${initdir}/lib/dracut/hooks/$_d" -diff --git a/modules.d/99base/module-setup.sh b/modules.d/99base/module-setup.sh -index 54b0deb9..bfdc51d4 100755 ---- a/modules.d/99base/module-setup.sh -+++ b/modules.d/99base/module-setup.sh -@@ -45,7 +45,10 @@ install() { - - [ -e "${initdir}/lib" ] || mkdir -m 0755 -p "${initdir}"/lib - mkdir -m 0755 -p "${initdir}"/lib/dracut -- mkdir -m 0755 -p "${initdir}"/lib/dracut/hooks -+ mkdir -m 0755 -p "${initdir}"/var/lib/dracut/hooks -+ -+ # symlink to old hooks location for compatibility -+ ln_r /var/lib/dracut/hooks /lib/dracut/hooks - - mkdir -p "${initdir}"/tmp - -diff --git a/modules.d/99shutdown/module-setup.sh b/modules.d/99shutdown/module-setup.sh -index 2b999024..f53017ff 100755 ---- a/modules.d/99shutdown/module-setup.sh -+++ b/modules.d/99shutdown/module-setup.sh -@@ -17,9 +17,11 @@ install() { - inst_multiple umount poweroff reboot halt losetup stat sleep timeout - inst_multiple -o kexec - inst "$moddir/shutdown.sh" "$prefix/shutdown" -- [ -e "${initdir}/lib" ] || mkdir -m 0755 -p "${initdir}"/lib -- mkdir -m 0755 -p "${initdir}"/lib/dracut -- mkdir -m 0755 -p "${initdir}"/lib/dracut/hooks -+ mkdir -m 0755 -p "${initdir}"/var/lib/dracut/hooks -+ -+ # symlink to old hooks location for compatibility -+ ln_r /var/lib/dracut/hooks /lib/dracut/hooks -+ - for _d in $hookdirs shutdown shutdown-emergency; do - mkdir -m 0755 -p "${initdir}"/lib/dracut/hooks/"$_d" - done --- -2.42.0 - diff --git a/0020-feat-lsinitrd-add-support-for-erofs-images.patch b/0020-feat-lsinitrd-add-support-for-erofs-images.patch new file mode 100644 index 0000000..f00fbf8 --- /dev/null +++ b/0020-feat-lsinitrd-add-support-for-erofs-images.patch @@ -0,0 +1,240 @@ +From 327adc7782fd43f4cf9848f1c24f196c496b6b53 Mon Sep 17 00:00:00 2001 +From: Philipp Rudo +Date: Tue, 23 Jul 2024 18:33:37 +0200 +Subject: [PATCH 20/24] feat(lsinitrd): add support for erofs images + +Add support to handle erofs images in lsinitrd. Unfortunately the erofs +tooling is missing some functionality of unsquashfs, esp. the ability to +extract single files and list the content of the image. Work around this +deficiency by always extracting the full image and emulate the missing +functionality as close as possible. + +While at it also handle the rename of the squashfs image to +squashfs-root.img. + +Signed-off-by: Philipp Rudo + +(cherry picked from commit 009b4ccc94fe3fcf129dddc5aca4f25b1e1b1862) + +Resolves: RHEL-43460 +--- + lsinitrd.sh | 167 +++++++++++++++++++++++++++++++++++----------------- + 1 file changed, 113 insertions(+), 54 deletions(-) + +diff --git a/lsinitrd.sh b/lsinitrd.sh +index 1329ab70..952dbc9f 100755 +--- a/lsinitrd.sh ++++ b/lsinitrd.sh +@@ -172,10 +172,47 @@ dracutlibdirs() { + done + } + ++SQUASH_TMPFILE="" ++SQUASH_EXTRACT="$TMPDIR/squash-extract" ++ ++extract_squash_img() { ++ local _img _tmp ++ ++ [[ $SQUASH_TMPDIR == none ]] && return 1 ++ [[ -s $SQUASH_TMPFILE ]] && return 0 ++ ++ # Before dracut 104 the image was named squash-root.img. Keep the old name ++ # so newer versions of lsinitrd can inspect initrds build with older dracut ++ # versions. ++ for _img in squash-root.img squashfs-root.img erofs-root.img; do ++ _tmp="$TMPDIR/$_img" ++ $CAT "$image" 2> /dev/null | cpio --extract --verbose --quiet --to-stdout -- \ ++ $_img > "$_tmp" 2> /dev/null ++ [[ -s $_tmp ]] || continue ++ ++ SQUASH_TMPFILE="$_tmp" ++ ++ # fsck.erofs doesn't allow extracting single files or listing the ++ # content of the image. So always extract the full image. ++ if [[ $_img == erofs-root.img ]]; then ++ mkdir -p "$SQUASH_EXTRACT" ++ fsck.erofs --extract="$SQUASH_EXTRACT/erofs-root" --overwrite "$SQUASH_TMPFILE" 2> /dev/null ++ ((ret += $?)) ++ fi ++ ++ break ++ done ++ ++ if [[ -z $SQUASH_TMPFILE ]]; then ++ SQUASH_TMPFILE=none ++ return 1 ++ fi ++ ++ return 0 ++} ++ + extract_files() { +- SQUASH_IMG="squash-root.img" +- SQUASH_TMPFILE="$TMPDIR/initrd.root.sqsh" +- SQUASH_EXTRACT="$TMPDIR/squash-extract" ++ local nofileinfo + + ((${#filenames[@]} == 1)) && nofileinfo=1 + for f in "${!filenames[@]}"; do +@@ -183,18 +220,24 @@ extract_files() { + [[ $nofileinfo ]] || echo "========================================================================" + # shellcheck disable=SC2001 + [[ $f == *"\\x"* ]] && f=$(echo "$f" | sed 's/\\x.\{2\}/????/g') +- $CAT "$image" 2> /dev/null | cpio --extract --verbose --quiet --to-stdout "$f" 2> /dev/null +- ((ret += $?)) +- if [[ -z ${f/#squashfs-root*/} ]]; then +- if [[ ! -s $SQUASH_TMPFILE ]]; then +- $CAT "$image" 2> /dev/null | cpio --extract --verbose --quiet --to-stdout -- \ +- $SQUASH_IMG > "$SQUASH_TMPFILE" 2> /dev/null +- fi +- unsquashfs -force -d "$SQUASH_EXTRACT" -no-progress "$SQUASH_TMPFILE" "${f#squashfs-root/}" > /dev/null 2>&1 +- ((ret += $?)) +- cat "$SQUASH_EXTRACT/${f#squashfs-root/}" 2> /dev/null +- rm "$SQUASH_EXTRACT/${f#squashfs-root/}" 2> /dev/null +- fi ++ ++ case $f in ++ squashfs-root/*) ++ extract_squash_img ++ unsquashfs -force -d "$SQUASH_EXTRACT" -no-progress "$SQUASH_TMPFILE" "${f#squashfs-root/}" &> /dev/null ++ ((ret += $?)) ++ cat "$SQUASH_EXTRACT/${f#squashfs-root/}" 2> /dev/null ++ ;; ++ erofs-root/*) ++ extract_squash_img ++ cat "$SQUASH_EXTRACT/$f" 2> /dev/null ++ ;; ++ *) ++ $CAT "$image" 2> /dev/null | cpio --extract --verbose --quiet --to-stdout "$f" 2> /dev/null ++ ((ret += $?)) ++ ;; ++ esac ++ + [[ $nofileinfo ]] || echo "========================================================================" + [[ $nofileinfo ]] || echo + done +@@ -220,66 +263,82 @@ list_files() { + } + + list_squash_content() { +- SQUASH_IMG="squash-root.img" +- SQUASH_TMPFILE="$TMPDIR/initrd.root.sqsh" ++ extract_squash_img || return 0 + +- $CAT "$image" 2> /dev/null | cpio --extract --verbose --quiet --to-stdout -- \ +- $SQUASH_IMG > "$SQUASH_TMPFILE" 2> /dev/null +- if [[ -s $SQUASH_TMPFILE ]]; then +- echo "Squashed content ($SQUASH_IMG):" +- echo "========================================================================" +- unsquashfs -d "squashfs-root" -ll "$SQUASH_TMPFILE" | tail -n +4 +- echo "========================================================================" +- fi ++ echo "Squashed content (${SQUASH_TMPFILE##*/}):" ++ echo "========================================================================" ++ case $SQUASH_TMPFILE in ++ */squash-root.img | */squashfs-root.img) ++ unsquashfs -ll "$SQUASH_TMPFILE" | tail -n +4 ++ ;; ++ */erofs-root.img) ++ ( ++ cd "$SQUASH_EXTRACT" || return 1 ++ find erofs-root/ -ls ++ ) ++ ;; ++ esac ++ echo "========================================================================" + } + + list_cmdline() { +- # depends on list_squash_content() having run before +- SQUASH_IMG="squash-root.img" +- SQUASH_TMPFILE="$TMPDIR/initrd.root.sqsh" +- SQUASH_EXTRACT="$TMPDIR/squash-extract" + + echo "dracut cmdline:" + # shellcheck disable=SC2046 + $CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- \ + etc/cmdline.d/\*.conf 2> /dev/null + ((ret += $?)) +- if [[ -s $SQUASH_TMPFILE ]]; then +- unsquashfs -force -d "$SQUASH_EXTRACT" -no-progress "$SQUASH_TMPFILE" etc/cmdline.d/\*.conf > /dev/null 2>&1 +- ((ret += $?)) +- cat "$SQUASH_EXTRACT"/etc/cmdline.d/*.conf 2> /dev/null +- rm "$SQUASH_EXTRACT"/etc/cmdline.d/*.conf 2> /dev/null +- fi ++ ++ extract_squash_img || return 0 ++ case $SQUASH_TMPFILE in ++ */squash-root.img | */squashfs-root.img) ++ unsquashfs -force -d "$SQUASH_EXTRACT" -no-progress "$SQUASH_TMPFILE" etc/cmdline.d/\*.conf &> /dev/null ++ ((ret += $?)) ++ cat "$SQUASH_EXTRACT"/etc/cmdline.d/*.conf 2> /dev/null ++ ;; ++ */erofs-root.img) ++ cat "$SQUASH_EXTRACT"/erofs-root/etc/cmdline.d/*.conf 2> /dev/null ++ ;; ++ esac ++ + } + + unpack_files() { +- SQUASH_IMG="squash-root.img" +- SQUASH_TMPFILE="$TMPDIR/initrd.root.sqsh" +- + if ((${#filenames[@]} > 0)); then + for f in "${!filenames[@]}"; do + # shellcheck disable=SC2001 + [[ $f == *"\\x"* ]] && f=$(echo "$f" | sed 's/\\x.\{2\}/????/g') +- $CAT "$image" 2> /dev/null | cpio -id --quiet $verbose "$f" +- ((ret += $?)) +- if [[ -z ${f/#squashfs-root*/} ]]; then +- if [[ ! -s $SQUASH_TMPFILE ]]; then +- $CAT "$image" 2> /dev/null | cpio --extract --verbose --quiet --to-stdout -- \ +- $SQUASH_IMG > "$SQUASH_TMPFILE" 2> /dev/null +- fi +- unsquashfs -force -d "squashfs-root" -no-progress "$SQUASH_TMPFILE" "${f#squashfs-root/}" > /dev/null +- ((ret += $?)) +- fi ++ case $f in ++ squashfs-root/*) ++ extract_squash_img || continue ++ unsquashfs -force -d "squashfs-root" -no-progress "$SQUASH_TMPFILE" "${f#squashfs-root/}" > /dev/null ++ ((ret += $?)) ++ ;; ++ erofs-root/*) ++ extract_squash_img || continue ++ mkdir -p "${f%/*}" ++ cp -rf "$SQUASH_EXTRACT/$f" "$f" ++ ;; ++ *) ++ $CAT "$image" 2> /dev/null | cpio -id --quiet $verbose "$f" ++ ((ret += $?)) ++ ;; ++ esac + done + else + $CAT "$image" 2> /dev/null | cpio -id --quiet $verbose + ((ret += $?)) +- $CAT "$image" 2> /dev/null | cpio --extract --verbose --quiet --to-stdout -- \ +- $SQUASH_IMG > "$SQUASH_TMPFILE" 2> /dev/null +- if [[ -s $SQUASH_TMPFILE ]]; then +- unsquashfs -d "squashfs-root" -no-progress "$SQUASH_TMPFILE" > /dev/null +- ((ret += $?)) +- fi ++ ++ extract_squash_img || return 0 ++ case $SQUASH_TMPFILE in ++ */squash-root.img | */squashfs-root.img) ++ unsquashfs -d "squashfs-root" -no-progress "$SQUASH_TMPFILE" > /dev/null ++ ((ret += $?)) ++ ;; ++ */erofs-root.img) ++ cp -rf "$SQUASH_EXTRACT/erofs-root" . ++ ;; ++ esac + fi + } + +-- +2.42.0 + diff --git a/0020-fix-systemd-explicitly-install-some-libs-that-will-n.patch b/0020-fix-systemd-explicitly-install-some-libs-that-will-n.patch deleted file mode 100644 index 0d662cd..0000000 --- a/0020-fix-systemd-explicitly-install-some-libs-that-will-n.patch +++ /dev/null @@ -1,72 +0,0 @@ -From bad2bc80cdcfac8915374497cc47ce9d5670d015 Mon Sep 17 00:00:00 2001 -From: Antonio Alvarez Feijoo -Date: Thu, 4 Apr 2024 13:49:26 +0200 -Subject: [PATCH 20/23] fix(systemd): explicitly install some libs that will - not be statically included - -Some required libraries that used to be statically included are in the process -to be opened via `dlopen()`. - -References: -- https://github.com/systemd/systemd/pull/31131 -- https://github.com/systemd/systemd/pull/31550 -- https://github.com/systemd/systemd/pull/32019 - -Closes #2642 ---- - modules.d/00systemd/module-setup.sh | 2 ++ - modules.d/01systemd-coredump/module-setup.sh | 7 +++++++ - modules.d/01systemd-journald/module-setup.sh | 5 +++-- - 3 files changed, 12 insertions(+), 2 deletions(-) - -diff --git a/modules.d/00systemd/module-setup.sh b/modules.d/00systemd/module-setup.sh -index 66e08ea6..72341746 100755 ---- a/modules.d/00systemd/module-setup.sh -+++ b/modules.d/00systemd/module-setup.sh -@@ -260,6 +260,8 @@ EOF - # Install library file(s) - _arch=${DRACUT_ARCH:-$(uname -m)} - inst_libdir_file \ -+ {"tls/$_arch/",tls/,"$_arch/",}"libgcrypt.so*" \ -+ {"tls/$_arch/",tls/,"$_arch/",}"libkmod.so*" \ - {"tls/$_arch/",tls/,"$_arch/",}"libnss_*" - - } -diff --git a/modules.d/01systemd-coredump/module-setup.sh b/modules.d/01systemd-coredump/module-setup.sh -index 69ec9668..47666b6c 100755 ---- a/modules.d/01systemd-coredump/module-setup.sh -+++ b/modules.d/01systemd-coredump/module-setup.sh -@@ -40,6 +40,13 @@ install() { - "$sysusers"/systemd-coredump.conf \ - coredumpctl - -+ # Install library file(s) -+ _arch=${DRACUT_ARCH:-$(uname -m)} -+ inst_libdir_file \ -+ {"tls/$_arch/",tls/,"$_arch/",}"liblz4.so.*" \ -+ {"tls/$_arch/",tls/,"$_arch/",}"liblzma.so.*" \ -+ {"tls/$_arch/",tls/,"$_arch/",}"libzstd.so.*" -+ - # Install the hosts local user configurations if enabled. - if [[ $hostonly ]]; then - inst_multiple -H -o \ -diff --git a/modules.d/01systemd-journald/module-setup.sh b/modules.d/01systemd-journald/module-setup.sh -index 3cf2a1a1..276e7528 100755 ---- a/modules.d/01systemd-journald/module-setup.sh -+++ b/modules.d/01systemd-journald/module-setup.sh -@@ -53,9 +53,10 @@ install() { - # Install library file(s) - _arch=${DRACUT_ARCH:-$(uname -m)} - inst_libdir_file \ -+ {"tls/$_arch/",tls/,"$_arch/",}"libgcrypt.so*" \ - {"tls/$_arch/",tls/,"$_arch/",}"liblz4.so.*" \ -- {"tls/$_arch/",tls/,"$_arch/",}"libzstd.so.*" \ -- {"tls/$_arch/",tls/,"$_arch/",}"liblzma.so.*" -+ {"tls/$_arch/",tls/,"$_arch/",}"liblzma.so.*" \ -+ {"tls/$_arch/",tls/,"$_arch/",}"libzstd.so.*" - - # Install the hosts local user configurations if enabled. - if [[ $hostonly ]]; then --- -2.42.0 - diff --git a/0021-feat-dracut-initramfs-restore-unpack-erofs-images.patch b/0021-feat-dracut-initramfs-restore-unpack-erofs-images.patch new file mode 100644 index 0000000..0e88594 --- /dev/null +++ b/0021-feat-dracut-initramfs-restore-unpack-erofs-images.patch @@ -0,0 +1,59 @@ +From 0d90ae671e130b631383fb481a1f38a175167eff Mon Sep 17 00:00:00 2001 +From: Philipp Rudo +Date: Tue, 30 Jul 2024 17:24:28 +0200 +Subject: [PATCH 21/24] feat(dracut-initramfs-restore): unpack erofs images + +Follow the example for squashfs images and also unpack erofs images in +dracut-initramfs-restore. + +Signed-off-by: Philipp Rudo + +(cherry picked from commit b390e194911835e6bd24eeeb0946e374852b8ddc) + +Resolves: RHEL-43460 +--- + dracut-initramfs-restore.sh | 10 ++++++++-- + modules.d/95squash-erofs/module-setup.sh | 2 +- + 2 files changed, 9 insertions(+), 3 deletions(-) + +diff --git a/dracut-initramfs-restore.sh b/dracut-initramfs-restore.sh +index cc561b22..015160b7 100755 +--- a/dracut-initramfs-restore.sh ++++ b/dracut-initramfs-restore.sh +@@ -74,12 +74,18 @@ else + exit 1 + fi + +-if [[ -d squash ]]; then +- if ! unsquashfs -no-xattrs -f -d . squash-root.img > /dev/null; then ++if [[ -f squashfs-root.img ]]; then ++ if ! unsquashfs -no-xattrs -f -d . squashfs-root.img > /dev/null; then + echo "Squash module is enabled for this initramfs but failed to unpack squash-root.img" >&2 + rm -f -- /run/initramfs/shutdown + exit 1 + fi ++elif [[ -f erofs-root.img ]]; then ++ if ! fsck.erofs --extract=. --overwrite erofs-root.img > /dev/null; then ++ echo "Squash module is enabled for this initramfs but failed to unpack erofs-root.img" >&2 ++ rm -f -- /run/initramfs/shutdown ++ exit 1 ++ fi + fi + + if grep -q -w selinux /sys/kernel/security/lsm 2> /dev/null \ +diff --git a/modules.d/95squash-erofs/module-setup.sh b/modules.d/95squash-erofs/module-setup.sh +index 71c2b672..d763a902 100755 +--- a/modules.d/95squash-erofs/module-setup.sh ++++ b/modules.d/95squash-erofs/module-setup.sh +@@ -1,7 +1,7 @@ + #!/bin/bash + + check() { +- require_binaries mkfs.erofs || return 1 ++ require_binaries mkfs.erofs fsck.erofs || return 1 + require_kernel_modules erofs || return 1 + + return 255 +-- +2.42.0 + diff --git a/0021-fix-nvmf-move-etc-nvme-host-nqn-id-requirement-to-ho.patch b/0021-fix-nvmf-move-etc-nvme-host-nqn-id-requirement-to-ho.patch deleted file mode 100644 index d097ade..0000000 --- a/0021-fix-nvmf-move-etc-nvme-host-nqn-id-requirement-to-ho.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 10b86edba3ffe0ce13c5f43ff0193cdf04661358 Mon Sep 17 00:00:00 2001 -From: Tomas Bzatek -Date: Thu, 21 Sep 2023 14:31:07 +0200 -Subject: [PATCH 21/23] fix(nvmf): move /etc/nvme/host{nqn,id} requirement to - hostonly - -When creating initramfs for universal boot image such as an installer, -we can't include any machine-specific IDs. Let's move the check -for /etc/nvme/hostnqn and /etc/nvme/hostid files presence to -the hostonly section to avoid unsatisfied requirements. - -Signed-off-by: Tomas Bzatek - -Resolves: #2266331 ---- - modules.d/95nvmf/module-setup.sh | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/modules.d/95nvmf/module-setup.sh b/modules.d/95nvmf/module-setup.sh -index a8f30341..6a1e3f5b 100755 ---- a/modules.d/95nvmf/module-setup.sh -+++ b/modules.d/95nvmf/module-setup.sh -@@ -3,8 +3,6 @@ - # called by dracut - check() { - require_binaries nvme jq || return 1 -- [ -f /etc/nvme/hostnqn ] || return 255 -- [ -f /etc/nvme/hostid ] || return 255 - - is_nvmf() { - local _dev=$1 -@@ -36,6 +34,8 @@ check() { - } - - [[ $hostonly ]] || [[ $mount_needs ]] && { -+ [ -f /etc/nvme/hostnqn ] || return 255 -+ [ -f /etc/nvme/hostid ] || return 255 - pushd . > /dev/null - for_each_host_dev_and_slaves is_nvmf - local _is_nvmf=$? -@@ -130,8 +130,8 @@ install() { - _nvmf_args=$(cmdline) - [[ "$_nvmf_args" ]] && printf "%s" "$_nvmf_args" >> "${initdir}/etc/cmdline.d/95nvmf-args.conf" - fi -- inst_simple "/etc/nvme/hostnqn" -- inst_simple "/etc/nvme/hostid" -+ inst_simple -H "/etc/nvme/hostnqn" -+ inst_simple -H "/etc/nvme/hostid" - - inst_multiple ip sed - --- -2.42.0 - diff --git a/0022-fix-squash-explicitly-create-required-directories.patch b/0022-fix-squash-explicitly-create-required-directories.patch new file mode 100644 index 0000000..6cd8b5f --- /dev/null +++ b/0022-fix-squash-explicitly-create-required-directories.patch @@ -0,0 +1,55 @@ +From a3ca60929c50f1a1d41cf4567e3a4a8231a92642 Mon Sep 17 00:00:00 2001 +From: Philipp Rudo +Date: Tue, 30 Jul 2024 13:35:17 +0200 +Subject: [PATCH 22/24] fix(squash): explicitly create required directories + +At the moment 99squash relies on dracut-install to create the required +directories it later links to. This approach is error prone and will +cause problems when switching to use 99busybox later on, which tries to +add a link to /usr/sbin that hasn't been created. Thus explicitly +create the expected directories before installing the minimal initrd. + +Signed-off-by: Philipp Rudo +(cherry picked from commit dde95b10ff6b28330370fd697350f8bc5da422da) + +Related: RHEL-43460 +--- + modules.d/99squash/module-setup.sh | 13 +++++++------ + 1 file changed, 7 insertions(+), 6 deletions(-) + +diff --git a/modules.d/99squash/module-setup.sh b/modules.d/99squash/module-setup.sh +index 5cbbec63..6aa649b7 100755 +--- a/modules.d/99squash/module-setup.sh ++++ b/modules.d/99squash/module-setup.sh +@@ -40,12 +40,15 @@ squash_get_handler() { + } + + squash_install() { +- local _busybox ++ local _busybox _dir + _busybox=$(find_binary busybox) + +- # Create mount points for squash loader +- mkdir -p "$initdir"/squash/ +- mkdir -p "$squashdir"/squash/ ++ # Create mount points for squash loader and basic directories ++ mkdir -p "$initdir"/squash ++ for _dir in squash usr/bin usr/sbin usr/lib; do ++ mkdir -p "$squashdir/$_dir" ++ [[ $_dir == usr/* ]] && ln_r "/$_dir" "${_dir#usr}" ++ done + + # Install required modules and binaries for the squash image init script. + if [[ $_busybox ]]; then +@@ -67,8 +70,6 @@ squash_install() { + dracut_kernel_post + + # Install squash image init script. +- ln_r /usr/bin /bin +- ln_r /usr/sbin /sbin + inst_simple "$moddir"/init-squash.sh /init + + # make sure that library links are correct and up to date for squash loader +-- +2.42.0 + diff --git a/0023-fix-squash-use-99busybox-instead-of-installing-it-ma.patch b/0023-fix-squash-use-99busybox-instead-of-installing-it-ma.patch new file mode 100644 index 0000000..fa4d6c0 --- /dev/null +++ b/0023-fix-squash-use-99busybox-instead-of-installing-it-ma.patch @@ -0,0 +1,64 @@ +From a6e8e41cd1d67bb4ee64b2bf107e98c18bf8afdf Mon Sep 17 00:00:00 2001 +From: Philipp Rudo +Date: Tue, 30 Jul 2024 13:44:32 +0200 +Subject: [PATCH 23/24] fix(squash): use 99busybox instead of installing it + manually + +Make use of 99busybox in 99squash rather than installing it manually. +This not only removes duplicate code but allows mixing of busybox with +tools from coreutils. This requires a small change in 99busybox to +remove the hard coded use of $initdir. + +Suggested-by: Laszlo Gombos +Signed-off-by: Philipp Rudo + +(cherry picked from commit 395366278f473038badba239f76cac391428b149) + +Related: RHEL-43460 +--- + modules.d/05busybox/module-setup.sh | 5 +++++ + modules.d/99squash/module-setup.sh | 5 +---- + 2 files changed, 6 insertions(+), 4 deletions(-) + +diff --git a/modules.d/05busybox/module-setup.sh b/modules.d/05busybox/module-setup.sh +index 86b3761a..857145c9 100755 +--- a/modules.d/05busybox/module-setup.sh ++++ b/modules.d/05busybox/module-setup.sh +@@ -15,6 +15,7 @@ depends() { + # called by dracut + install() { + local _i _path _busybox ++ local _dstdir="${dstdir:-"$initdir"}" + local _progs=() + _busybox=$(find_binary busybox) + inst "$_busybox" /usr/bin/busybox +@@ -26,6 +27,10 @@ install() { + for _i in "${_progs[@]}"; do + _path=$(find_binary "$_i") + [ -z "$_path" ] && continue ++ ++ # do not remove existing destination files ++ [ -e "${_dstdir}/$_path" ] && continue ++ + ln_r /usr/bin/busybox "$_path" + done + } +diff --git a/modules.d/99squash/module-setup.sh b/modules.d/99squash/module-setup.sh +index 6aa649b7..56f70774 100755 +--- a/modules.d/99squash/module-setup.sh ++++ b/modules.d/99squash/module-setup.sh +@@ -52,10 +52,7 @@ squash_install() { + + # Install required modules and binaries for the squash image init script. + if [[ $_busybox ]]; then +- inst "$_busybox" /usr/bin/busybox +- for _i in sh echo mount modprobe mkdir switch_root grep umount; do +- ln_r /usr/bin/busybox /usr/bin/$_i +- done ++ module_install "busybox" + else + DRACUT_RESOLVE_DEPS=1 inst_multiple sh mount modprobe mkdir switch_root grep umount + +-- +2.42.0 + diff --git a/0024-feat-dmdquash-live-add-support-for-using-erofs.patch b/0024-feat-dmdquash-live-add-support-for-using-erofs.patch new file mode 100644 index 0000000..fb9fc51 --- /dev/null +++ b/0024-feat-dmdquash-live-add-support-for-using-erofs.patch @@ -0,0 +1,69 @@ +From 3b4fe88a4259ec576a41d98b6aaee324a6b48b0f Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Wed, 10 Jul 2024 16:30:09 -0700 +Subject: [PATCH 24/24] feat(dmdquash-live): add support for using erofs + +This adds support for rootfs compressed with erofs. Either as a plain +erofs image or a LiveOS/rootfs.img ext4 filesystem compressed with +erofs. + +This patch does not make any attempt to change the squashfs directory +naming (or variable names) in order to make these changes as small as +possible and easy to review. It also does not make any attempt to +support the multitude of available options other than what is needed by +anaconda-dracut calling this script to setup the boot.iso root +filesystem. + +(which isn't to say it doesn't work, it just hasn't been tested and is +outside the scope of this change). + +(cherry picked commit ca5ae5d3466eec40d118fc96d450478aa6faebb6) + +Resolves: RHEL-43460 +--- + modules.d/90dmsquash-live/dmsquash-live-root.sh | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/modules.d/90dmsquash-live/dmsquash-live-root.sh b/modules.d/90dmsquash-live/dmsquash-live-root.sh +index 4518852b..a376185e 100755 +--- a/modules.d/90dmsquash-live/dmsquash-live-root.sh ++++ b/modules.d/90dmsquash-live/dmsquash-live-root.sh +@@ -97,7 +97,6 @@ det_img_fs() { + blkid -s TYPE -u noraid -o value "$1" + } + +-load_fstype squashfs + CMDLINE=$(getcmdline) + for arg in $CMDLINE; do + case $arg in +@@ -112,14 +111,15 @@ if [ -f "$livedev" ]; then + # check filesystem type and handle accordingly + fstype=$(det_img_fs "$livedev") + case $fstype in +- squashfs) SQUASHED=$livedev ;; +- auto) die "cannot mount live image (unknown filesystem type)" ;; ++ squashfs | erofs) SQUASHED=$livedev ;; ++ auto) die "cannot mount live image (unknown filesystem type $fstype)" ;; + *) FSIMG=$livedev ;; + esac + load_fstype "$fstype" + else + livedev_fstype=$(det_fs "$livedev") +- if [ "$livedev_fstype" = "squashfs" ]; then ++ load_fstype "$livedev_fstype" ++ if [ "$livedev_fstype" = "squashfs" ] || [ "$livedev_fstype" = "erofs" ]; then + # no mount needed - we've already got the LiveOS image in $livedev + SQUASHED=$livedev + elif [ "$livedev_fstype" != "ntfs" ]; then +@@ -336,7 +336,7 @@ if [ -e "$SQUASHED" ]; then + SQUASHED_LOOPDEV=$(losetup -f) + losetup -r "$SQUASHED_LOOPDEV" $SQUASHED + mkdir -m 0755 -p /run/initramfs/squashfs +- mount -n -t squashfs -o ro "$SQUASHED_LOOPDEV" /run/initramfs/squashfs ++ mount -n -o ro "$SQUASHED_LOOPDEV" /run/initramfs/squashfs + + if [ -d /run/initramfs/squashfs/LiveOS ]; then + if [ -f /run/initramfs/squashfs/LiveOS/rootfs.img ]; then +-- +2.42.0 + diff --git a/dracut.spec b/dracut.spec index fca6cd0..bfa0104 100644 --- a/dracut.spec +++ b/dracut.spec @@ -7,8 +7,8 @@ %global __requires_exclude pkg-config Name: dracut -Version: 101 -Release: 2%{?dist} +Version: 102 +Release: 1%{?dist} Summary: Initramfs generator using udev @@ -22,79 +22,82 @@ URL: https://github.com/dracut-ng/dracut-ng/wiki/ Source0: https://github.com/dracut-ng/dracut-ng/archive/refs/tags/%{version}.tar.gz Source1: https://www.gnu.org/licenses/lgpl-2.1.txt -# feat(kernel-install): do nothing when $KERNEL_INSTALL_INITRD_GENERATOR says so -# Author: Zbigniew Jędrzejewski-Szmek -Patch1: 0001-feat-kernel-install-do-nothing-when-KERNEL_INSTALL_I.patch -# fix(kernel-install): do not generate an initrd when one was specified -# Author: Zbigniew Jędrzejewski-Szmek -Patch2: 0002-fix-kernel-install-do-not-generate-an-initrd-when-on.patch -# refactor(cms): use zdev to simplify handling CMSDASD=... boot option -# Author: Steffen Maier -Patch3: 0003-refactor-cms-use-zdev-to-simplify-handling-CMSDASD-..patch -# refactor(cms): use consolidated zfcp config with zdev from s390-tools -# Author: Steffen Maier -Patch4: 0004-refactor-cms-use-consolidated-zfcp-config-with-zdev-.patch -# refactor(cms): use consolidated dasd config with zdev from s390-tools -# Author: Steffen Maier -Patch5: 0005-refactor-cms-use-consolidated-dasd-config-with-zdev-.patch -# refactor(cms): use consolidated network config with zdev from s390-tools -# Author: Steffen Maier -Patch6: 0006-refactor-cms-use-consolidated-network-config-with-zd.patch -# refactor(cms): remove now unnecessary inclusion of full s390utils-base -# Author: Steffen Maier -Patch7: 0007-refactor-cms-remove-now-unnecessary-inclusion-of-ful.patch -# feat(zfcp_rules): remove zfcp handling consolidated in s390-tools -# Author: Steffen Maier -Patch8: 0008-feat-zfcp_rules-remove-zfcp-handling-consolidated-in.patch -# feat(zfcp): minimize zfcp handling consolidated in s390-tools -# Author: Steffen Maier -Patch9: 0009-feat-zfcp-minimize-zfcp-handling-consolidated-in-s39.patch -# feat(dasd_rules): remove dasd handling consolidated in s390-tools -# Author: Steffen Maier -Patch10: 0010-feat-dasd_rules-remove-dasd-handling-consolidated-in.patch -# feat(dasd_mod): minimize dasd handling consolidated in s390-tools -# Author: Steffen Maier -Patch11: 0011-feat-dasd_mod-minimize-dasd-handling-consolidated-in.patch -# feat(dasd): minimize dasd handling consolidated in s390-tools -# Author: Steffen Maier -Patch12: 0012-feat-dasd-minimize-dasd-handling-consolidated-in-s39.patch -# feat(znet): use zdev for consolidated device configuration -# Author: Steffen Maier -Patch13: 0013-feat-znet-use-zdev-for-consolidated-device-configura.patch -# docs(dracut.cmdline): generalize description of rd.znet -# Author: Steffen Maier -Patch14: 0014-docs-dracut.cmdline-generalize-description-of-rd.zne.patch -# feat(qeth_rules): remove qeth handling consolidated in 95znet -# Author: Steffen Maier -Patch15: 0015-feat-qeth_rules-remove-qeth-handling-consolidated-in.patch -# fix(znet): append to udev rules so each rd.znet_ifname is effective -# Author: Steffen Maier -Patch16: 0016-fix-znet-append-to-udev-rules-so-each-rd.znet_ifname.patch -# refactor(ifcfg): delete code duplication using iface_get_subchannels() -# Author: Steffen Maier -Patch17: 0017-refactor-ifcfg-delete-code-duplication-using-iface_g.patch -# feat(ifcfg): minimize s390-specific network configuration aspects -# Author: Steffen Maier -Patch18: 0018-feat-ifcfg-minimize-s390-specific-network-configurat.patch -# fix(dracut): move hooks directory from /usr/lib to /var/lib -# Author: Laszlo Gombos -Patch19: 0019-fix-dracut-move-hooks-directory-from-usr-lib-to-var-.patch -# fix(systemd): explicitly install some libs that will not be statically included -# Author: Antonio Alvarez Feijoo -Patch20: 0020-fix-systemd-explicitly-install-some-libs-that-will-n.patch -# fix(nvmf): move /etc/nvme/host{nqn,id} requirement to hostonly -# Author: Tomas Bzatek -Patch21: 0021-fix-nvmf-move-etc-nvme-host-nqn-id-requirement-to-ho.patch # feat(hwdb): add hwdb module to install hwdb.bin on demand # Author: Pavel Valena -Patch22: 0022-feat-hwdb-add-hwdb-module-to-install-hwdb.bin-on-dem.patch +Patch0001: 0001-feat-hwdb-add-hwdb-module-to-install-hwdb.bin-on-dem.patch # fix(rngd): install system service file # Author: Pavel Valena -Patch23: 0023-fix-rngd-install-system-service-file.patch +Patch0002: 0002-fix-rngd-install-system-service-file.patch +# revert: "fix(install.d): correctly install pre-genned image and die if no args" +# Author: Pavel Valena +Patch0003: 0003-revert-fix-install.d-correctly-install-pre-genned-im.patch +# feat(kernel-install): do nothing when $KERNEL_INSTALL_INITRD_GENERATOR says so +# Author: Zbigniew Jędrzejewski-Szmek +Patch0004: 0004-feat-kernel-install-do-nothing-when-KERNEL_INSTALL_I.patch +# fix(kernel-install): do not generate an initrd when one was specified +# Author: Zbigniew Jędrzejewski-Szmek +Patch0005: 0005-fix-kernel-install-do-not-generate-an-initrd-when-on.patch +# fix(crypt): decryption when rd.luks.name is set +# Author: Laszlo Gombos +Patch0006: 0006-fix-crypt-decryption-when-rd.luks.name-is-set.patch +# fix: incorrectly applied patch in commit c6d18c3c71597e78572378fc4dde391f1845b8 +# Author: Pavel Valena +Patch0007: 0007-fix-incorrectly-applied-patch-in-commit-c6d18c3c7159.patch +# revert: "fix(crypt): unlock encrypted devices by default during boot" +# Author: Pavel Valena +Patch0008: 0008-revert-fix-crypt-unlock-encrypted-devices-by-default.patch +# fix(90kernel-modules): install blk modules using symbol blk_alloc_disk +# Author: Pavel Valena +Patch0009: 0009-fix-90kernel-modules-install-blk-modules-using-symbo.patch +# test: do not force include dash, let sh module make a selection +# Author: Laszlo Gombos +Patch0010: 0010-test-do-not-force-include-dash-let-sh-module-make-a-.patch +# fix(dracut-functions): allow for \ in get_maj_min file path +# Author: Pavel Valena +Patch0011: 0011-fix-dracut-functions-allow-for-in-get_maj_min-file-p.patch +# fix(dracut-functions.sh): only return block devices from get_persistent_dev +# Author: Fabian Vogt +Patch0012: 0012-fix-dracut-functions.sh-only-return-block-devices-fr.patch +# feat(systemd*): include systemd config files from /usr/lib/systemd +# Author: Pavel Valena +Patch0013: 0013-feat-systemd-include-systemd-config-files-from-usr-l.patch +# fix(resume): always include the resume module +# Author: Pavel Valena +Patch0014: 0014-fix-resume-always-include-the-resume-module.patch +# feat(dracut-init.sh): allow changing the destination directory for inst et al +# Author: Philipp Rudo +Patch0015: 0015-feat-dracut-init.sh-allow-changing-the-destination-d.patch +# fix(dracut-init.sh): add module to mods_to_load before checking dependencies +# Author: Philipp Rudo +Patch0016: 0016-fix-dracut-init.sh-add-module-to-mods_to_load-before.patch +# feat(squash): move mksquashfs to 99squash/modules-setup +# Author: Philipp Rudo +Patch0017: 0017-feat-squash-move-mksquashfs-to-99squash-modules-setu.patch +# feat(squash): split 95squash-squashfs from 99squash +# Author: Philipp Rudo +Patch0018: 0018-feat-squash-split-95squash-squashfs-from-99squash.patch +# feat(squash): add module 95squash-erofs +# Author: Philipp Rudo +Patch0019: 0019-feat-squash-add-module-95squash-erofs.patch +# feat(lsinitrd): add support for erofs images +# Author: Philipp Rudo +Patch0020: 0020-feat-lsinitrd-add-support-for-erofs-images.patch +# feat(dracut-initramfs-restore): unpack erofs images +# Author: Philipp Rudo +Patch0021: 0021-feat-dracut-initramfs-restore-unpack-erofs-images.patch +# fix(squash): explicitly create required directories +# Author: Philipp Rudo +Patch0022: 0022-fix-squash-explicitly-create-required-directories.patch +# fix(squash): use 99busybox instead of installing it manually +# Author: Philipp Rudo +Patch0023: 0023-fix-squash-use-99busybox-instead-of-installing-it-ma.patch +# feat(dmdquash-live): add support for using erofs +# Author: Brian C. Lane +Patch0024: 0024-feat-dmdquash-live-add-support-for-using-erofs.patch # Please use source-git to work with this spec file: # HowTo: https://packit.dev/source-git/work-with-source-git -# Source-git repository: https://github.com/redhat-plumbers/dracut-rhel10 +# Source-git repository: https://github.com/redhat-plumbers/dracut-rhel10/ BuildRequires: bash BuildRequires: git-core @@ -213,6 +216,7 @@ This package contains tools to assemble the local initrd and host configuration. Summary: dracut module to build an initramfs with most files in a squashfs image Requires: %{name} = %{version}-%{release} Requires: squashfs-tools +Suggests: erofs-utils %description squash This package provides a dracut module to build an initramfs, but store most files @@ -322,6 +326,7 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/ %{dracutlibdir}/modules.d/01fips %{dracutlibdir}/modules.d/01systemd-ac-power %{dracutlibdir}/modules.d/01systemd-ask-password +%{dracutlibdir}/modules.d/01systemd-bsod %{dracutlibdir}/modules.d/01systemd-coredump %{dracutlibdir}/modules.d/01systemd-creds %{dracutlibdir}/modules.d/01systemd-hostnamed @@ -374,9 +379,12 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/ %{dracutlibdir}/modules.d/90mdraid %{dracutlibdir}/modules.d/90multipath %{dracutlibdir}/modules.d/90nvdimm +%{dracutlibdir}/modules.d/90numlock %{dracutlibdir}/modules.d/90overlayfs %{dracutlibdir}/modules.d/90ppcmac +%{dracutlibdir}/modules.d/90pcmcia %{dracutlibdir}/modules.d/90qemu +%{dracutlibdir}/modules.d/90systemd-cryptsetup %{dracutlibdir}/modules.d/91crypt-gpg %{dracutlibdir}/modules.d/91crypt-loop %{dracutlibdir}/modules.d/91fido2 @@ -482,6 +490,8 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/ %files squash %{dracutlibdir}/modules.d/99squash +%{dracutlibdir}/modules.d/95squash-erofs +%{dracutlibdir}/modules.d/95squash-squashfs %files config-generic %{dracutlibdir}/dracut.conf.d/02-generic-image.conf @@ -491,6 +501,10 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/ %{_prefix}/lib/kernel/install.d/51-dracut-rescue.install %changelog +* Tue Jun 04 2024 Pavel Valena - 102-1 +- Update to dracut 102. + Resolves: RHEL-43460,RHEL-32237,RHEL-32506,RHEL-43460,RHEL-47145,RHEL-49744,RHEL-53350 + * Mon Jun 24 2024 Troy Dawson - 101-2 - Bump release for June 2024 mass rebuild diff --git a/sources b/sources index 975c2f3..6f44cf7 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (101.tar.gz) = 827f073b749a374b703f317ba249479312043ed54af82609ce45332c27349870a68a1d9883118e0a3ecd1cbb33d64aca8bcf6aac56eb75f721fd3380bd12005b +SHA512 (102.tar.gz) = 463ad75f0508392431d58796763a41accf5a1dc17fe27d36e37d588153ca9c5b32b453faa9149524ea2dc2906805126d1e023feecb6554206595a972508f6a32