summaryrefslogtreecommitdiff
path: root/sys-kernel
diff options
context:
space:
mode:
Diffstat (limited to 'sys-kernel')
-rw-r--r--sys-kernel/dracut/Manifest2
-rw-r--r--sys-kernel/dracut/dracut-059-r10.ebuild (renamed from sys-kernel/dracut/dracut-056-r10.ebuild)60
-rw-r--r--sys-kernel/dracut/files/056-fix-lvm-add-missing-grep-requirement.patch36
-rw-r--r--sys-kernel/dracut/files/056-musl.patch33
-rw-r--r--sys-kernel/dracut/files/056-redcore-change-default-initramfs-name.patch17
-rw-r--r--sys-kernel/dracut/files/059-gawk.patch35
-rw-r--r--sys-kernel/dracut/files/059-kernel-install-uki.patch150
-rw-r--r--sys-kernel/dracut/files/059-redcore-change-default-initramfs-name.patch21
-rw-r--r--sys-kernel/dracut/files/059-systemd-executor.patch31
-rw-r--r--sys-kernel/dracut/files/059-systemd-pcrphase.patch91
-rw-r--r--sys-kernel/dracut/files/059-uefi-split-usr.patch48
-rw-r--r--sys-kernel/dracut/files/059-uki-systemd-254.patch134
-rw-r--r--sys-kernel/dracut/files/dracut-059-dmsquash-live.patch26
-rw-r--r--sys-kernel/dracut/files/dracut-059-install-new-systemd-hibernate-resume.service.patch21
-rw-r--r--sys-kernel/dracut/files/gentoo-network-r1.patch29
15 files changed, 610 insertions, 124 deletions
diff --git a/sys-kernel/dracut/Manifest b/sys-kernel/dracut/Manifest
index 13b4cf9c..c623de52 100644
--- a/sys-kernel/dracut/Manifest
+++ b/sys-kernel/dracut/Manifest
@@ -1 +1 @@
-DIST dracut-056.tar.xz 384196 BLAKE2B e3e4fa3024b401cc954ba6069c54e95912691ff68a838e3c43bfc6a5b284bdee1669c782b30503c0246b7146c545ee8825febefcff93bae76ec46067cb7b87e1 SHA512 19268763e128984d20cab766bbdf2de12fe534ce2562fc688203099ef9b4cf83d0ccd2129499c70cdc6dd4ad53f0ffc2f3378eff5b8a15fda27c23b20f903df2
+DIST dracut-059.tar.gz 486487 BLAKE2B 86bbe18875cd3507e187b724cab212dc82e1daca7cedf79aeef13c34601adfff72bf2c0ba4c652e715b43c9a16f7be6a4a2b29dc75bef014640e1ec07c8d455b SHA512 196bc8bf18703c72bffb51a7e0493719c58173ad2da7d121eb42f9a8de47e953af36d109214dc4a10b2dc2d3bd19e844f7f51c2bdec087e064ea11f75124032d
diff --git a/sys-kernel/dracut/dracut-056-r10.ebuild b/sys-kernel/dracut/dracut-059-r10.ebuild
index c2d2b5b4..50a5fb81 100644
--- a/sys-kernel/dracut/dracut-056-r10.ebuild
+++ b/sys-kernel/dracut/dracut-059-r10.ebuild
@@ -1,15 +1,15 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
-inherit bash-completion-r1 linux-info optfeature systemd toolchain-funcs
+inherit bash-completion-r1 systemd toolchain-funcs
-KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~mips ppc ppc64 ~riscv sparc x86"
-SRC_URI="https://www.kernel.org/pub/linux/utils/boot/${PN}/${P}.tar.xz"
+KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~mips ppc ppc64 ~riscv sparc x86"
+SRC_URI="https://github.com/dracutdevs/dracut/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz"
DESCRIPTION="Generic initramfs generation tool"
-HOMEPAGE="https://dracut.wiki.kernel.org"
+HOMEPAGE="https://github.com/dracutdevs/dracut/wiki"
LICENSE="GPL-2"
SLOT="0"
@@ -17,7 +17,6 @@ IUSE="+cryptsetup +device-mapper +lvm +microcode +splash +mdadm selinux test"
RESTRICT="!test? ( test )"
-
COMMON_DEPEND="
cryptsetup? (
sys-fs/cryptsetup
@@ -40,11 +39,12 @@ COMMON_DEPEND="
)"
RDEPEND="${COMMON_DEPEND}
- app-arch/cpio
+ app-alternatives/cpio
>=app-shells/bash-4.0:0
sys-apps/coreutils[xattr(-)]
>=sys-apps/kmod-23[tools]
|| (
+ >=sys-apps/sysvinit-2.87-r3
sys-apps/openrc[sysv-utils(-),selinux?]
sys-apps/systemd[sysv-utils]
)
@@ -76,9 +76,16 @@ QA_MULTILIB_PATHS="usr/lib/dracut/.*"
PATCHES=(
"${FILESDIR}"/gentoo-ldconfig-paths-r1.patch
- "${FILESDIR}"/056-redcore-change-default-initramfs-name.patch
- "${FILESDIR}"/056-musl.patch
- "${FILESDIR}"/056-fix-lvm-add-missing-grep-requirement.patch
+ "${FILESDIR}"/gentoo-network-r1.patch
+ "${FILESDIR}"/059-kernel-install-uki.patch
+ "${FILESDIR}"/059-uefi-split-usr.patch
+ "${FILESDIR}"/059-uki-systemd-254.patch
+ "${FILESDIR}"/059-gawk.patch
+ "${FILESDIR}"/dracut-059-dmsquash-live.patch
+ "${FILESDIR}"/059-systemd-pcrphase.patch
+ "${FILESDIR}"/059-systemd-executor.patch
+ "${FILESDIR}"/dracut-059-install-new-systemd-hibernate-resume.service.patch
+ "${FILESDIR}"/059-redcore-change-default-initramfs-name.patch
)
src_configure() {
@@ -93,6 +100,11 @@ src_configure() {
echo ./configure "${myconf[@]}"
./configure "${myconf[@]}" || die
+
+ if [[ ${PV} != 9999 && ! -f dracut-version.sh ]] ; then
+ # Source tarball from github doesn't include this file
+ echo "DRACUT_VERSION=${PV}" > dracut-version.sh || die
+ fi
}
src_test() {
@@ -133,31 +145,5 @@ pkg_postinst() {
if [ $(stat -c %d:%i /) == $(stat -c %d:%i /proc/1/root/.) ]; then
_dracut_initramfs_regen
fi
-
- if linux-info_get_any_version && linux_config_exists; then
- ewarn ""
- ewarn "If the following test report contains a missing kernel"
- ewarn "configuration option, you should reconfigure and rebuild your"
- ewarn "kernel before booting image generated with this Dracut version."
- ewarn ""
-
- local CONFIG_CHECK="~BLK_DEV_INITRD ~DEVTMPFS"
-
- # Kernel configuration options descriptions:
- local ERROR_DEVTMPFS='CONFIG_DEVTMPFS: "Maintain a devtmpfs filesystem to mount at /dev" '
- ERROR_DEVTMPFS+='is missing and REQUIRED'
- local ERROR_BLK_DEV_INITRD='CONFIG_BLK_DEV_INITRD: "Initial RAM filesystem and RAM disk '
- ERROR_BLK_DEV_INITRD+='(initramfs/initrd) support" is missing and REQUIRED'
-
- check_extra_config
- echo
- else
- ewarn ""
- ewarn "Your kernel configuration couldn't be checked."
- ewarn "Please check manually if following options are enabled:"
- ewarn ""
- ewarn " CONFIG_BLK_DEV_INITRD"
- ewarn " CONFIG_DEVTMPFS"
- ewarn ""
- fi
}
+
diff --git a/sys-kernel/dracut/files/056-fix-lvm-add-missing-grep-requirement.patch b/sys-kernel/dracut/files/056-fix-lvm-add-missing-grep-requirement.patch
deleted file mode 100644
index ca24180f..00000000
--- a/sys-kernel/dracut/files/056-fix-lvm-add-missing-grep-requirement.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From 79f9d9e1c29a9c8fc046ab20765e5bde2aaa3428 Mon Sep 17 00:00:00 2001
-From: Antonio Alvarez Feijoo <antonio.feijoo@suse.com>
-Date: Mon, 11 Apr 2022 08:33:17 +0200
-Subject: [PATCH] fix(lvm): add missing grep requirement
-
-Since commit https://github.com/dracutdevs/dracut/commit/7ffc5e38
-lvm_scan.sh needs grep.
----
- modules.d/90lvm/module-setup.sh | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/modules.d/90lvm/module-setup.sh b/modules.d/90lvm/module-setup.sh
-index 25be0133..aa8c6db8 100755
---- a/modules.d/90lvm/module-setup.sh
-+++ b/modules.d/90lvm/module-setup.sh
-@@ -3,7 +3,7 @@
- # called by dracut
- check() {
- # No point trying to support lvm if the binaries are missing
-- require_binaries lvm || return 1
-+ require_binaries lvm grep || return 1
-
- [[ $hostonly ]] || [[ $mount_needs ]] && {
- for fs in "${host_fs_types[@]}"; do
-@@ -48,7 +48,7 @@ installkernel() {
-
- # called by dracut
- install() {
-- inst lvm
-+ inst_multiple lvm grep
-
- if [[ $hostonly_cmdline == "yes" ]]; then
- local _lvmconf
---
-2.35.1
-
diff --git a/sys-kernel/dracut/files/056-musl.patch b/sys-kernel/dracut/files/056-musl.patch
deleted file mode 100644
index ded18888..00000000
--- a/sys-kernel/dracut/files/056-musl.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From ce55a85ed5d902c19d75895508856f96ec2ceb1a Mon Sep 17 00:00:00 2001
-From: Laszlo Gombos <laszlo.gombos@gmail.com>
-Date: Sun, 20 Feb 2022 22:23:49 -0500
-Subject: [PATCH] fix(install): restore musl support
-
-__GLIBC_PREREQ is only defined in glibc.
----
- src/install/util.c | 4 +---
- 1 file changed, 1 insertion(+), 3 deletions(-)
-
-diff --git a/src/install/util.c b/src/install/util.c
-index 5721de89e..0af387c27 100644
---- a/src/install/util.c
-+++ b/src/install/util.c
-@@ -24,17 +24,15 @@
- #include <errno.h>
- #include <fcntl.h>
- #include <sys/types.h>
-+#include <sys/syscall.h>
-
- #include "util.h"
-
--#if __GLIBC_PREREQ(2, 30) == 0
--#include <sys/syscall.h>
- #ifndef SYS_gettid
- #error "SYS_gettid unavailable on this system"
- #endif
-
- #define gettid() ((pid_t) syscall(SYS_gettid))
--#endif /*__GLIBC_PREREQ */
-
- size_t page_size(void)
- {
diff --git a/sys-kernel/dracut/files/056-redcore-change-default-initramfs-name.patch b/sys-kernel/dracut/files/056-redcore-change-default-initramfs-name.patch
deleted file mode 100644
index c6539434..00000000
--- a/sys-kernel/dracut/files/056-redcore-change-default-initramfs-name.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-diff -Nur a/dracut.sh b/dracut.sh
---- a/dracut.sh 2022-02-18 11:32:53.000000000 +0000
-+++ b/dracut.sh 2022-09-07 15:01:59.055893269 +0100
-@@ -1054,11 +1054,11 @@
- outfile="$dracutsysrootdir$efidir/Linux/linux-$kernel${MACHINE_ID:+-${MACHINE_ID}}${BUILD_ID:+-${BUILD_ID}}.efi"
- else
- if [[ -e $dracutsysrootdir/boot/vmlinuz-$kernel ]]; then
-- outfile="/boot/initramfs-$kernel.img"
-+ outfile="/boot/initrd-$kernel"
- elif [[ $MACHINE_ID ]] && { [[ -d $dracutsysrootdir/boot/${MACHINE_ID} ]] || [[ -L $dracutsysrootdir/boot/${MACHINE_ID} ]]; }; then
- outfile="$dracutsysrootdir/boot/${MACHINE_ID}/$kernel/initrd"
- else
-- outfile="$dracutsysrootdir/boot/initramfs-$kernel.img"
-+ outfile="$dracutsysrootdir/boot/initrd-$kernel"
- fi
- fi
- fi
diff --git a/sys-kernel/dracut/files/059-gawk.patch b/sys-kernel/dracut/files/059-gawk.patch
new file mode 100644
index 00000000..5f1da79b
--- /dev/null
+++ b/sys-kernel/dracut/files/059-gawk.patch
@@ -0,0 +1,35 @@
+https://github.com/dracutdevs/dracut/pull/2436
+
+From 77214c229dadd1441f0d6243221ceed0708cbfcf Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Thu, 20 Jul 2023 04:36:01 +0100
+Subject: [PATCH] fix(dracut.sh): use gawk for strtonum
+
+strtonum is a gawkism and is not available in all awks, e.g. mawk. Use gawk
+to avoid failure.
+
+Fixes: f32e95bcadbc5158843530407adc1e7b700561b1
+Signed-off-by: Sam James <sam@gentoo.org>
+--- a/dracut-functions.sh
++++ b/dracut-functions.sh
+@@ -1047,7 +1047,7 @@ pe_file_format() {
+ if [[ $# -eq 1 ]]; then
+ local magic
+ magic=$(objdump -p "$1" \
+- | awk '{if ($1 == "Magic"){print strtonum("0x"$2)}}')
++ | gawk '{if ($1 == "Magic"){print strtonum("0x"$2)}}')
+ magic=$(printf "0x%x" "$magic")
+ # 0x10b (PE32), 0x20b (PE32+)
+ [[ $magic == 0x20b || $magic == 0x10b ]] && return 0
+--- a/dracut.sh
++++ b/dracut.sh
+@@ -2467,7 +2467,7 @@ if [[ $uefi == yes ]]; then
+ fi
+ fi
+
+- offs=$(objdump -h "$uefi_stub" 2> /dev/null | awk 'NF==7 {size=strtonum("0x"$3);\
++ offs=$(objdump -h "$uefi_stub" 2> /dev/null | gawk 'NF==7 {size=strtonum("0x"$3);\
+ offset=strtonum("0x"$4)} END {print size + offset}')
+ if [[ $offs -eq 0 ]]; then
+ dfatal "Failed to get the size of $uefi_stub to create UEFI image file"
+
diff --git a/sys-kernel/dracut/files/059-kernel-install-uki.patch b/sys-kernel/dracut/files/059-kernel-install-uki.patch
new file mode 100644
index 00000000..9bbf3574
--- /dev/null
+++ b/sys-kernel/dracut/files/059-kernel-install-uki.patch
@@ -0,0 +1,150 @@
+Combination of:
+- https://github.com/dracutdevs/dracut/pull/2405
+- https://github.com/dracutdevs/dracut/pull/2495
+- https://github.com/dracutdevs/dracut/pull/2521
+
+Fixes installing manually configured kernel in uki layout and
+allows dropping workaround from dist-kernel-utils.eclass
+
+Provides compatibility with systemd-254's ukify plugin
+
+--- a/dracut.sh
++++ b/dracut.sh
+@@ -2594,6 +2594,9 @@ freeze_ok_for_fstype() {
+ zfs)
+ return 1
+ ;;
++ tmpfs)
++ return 1
++ ;;
+ btrfs)
+ freeze_ok_for_btrfs "$outfile"
+ ;;
+--- a/install.d/50-dracut.install 2023-09-21 10:19:00.843827541 +0200
++++ b/install.d/50-dracut.install 2023-07-20 16:53:51.000000000 +0200
+@@ -11,27 +11,69 @@
+ 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
+- BOOT_DIR_ABS="/boot"
+- INITRD="initramfs-${KERNEL_VERSION}.img"
++ # 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
+
+ ret=0
++
+ case "$COMMAND" in
+ add)
+- INITRD_IMAGE_PREGENERATED=${KERNEL_IMAGE%/*}/initrd
+- if [[ -f ${INITRD_IMAGE_PREGENERATED} ]]; then
+- # we found an initrd at the same place as the kernel
++ 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
+- cp --reflink=auto "$INITRD_IMAGE_PREGENERATED" "$BOOT_DIR_ABS/$INITRD" \
+- && chown root:root "$BOOT_DIR_ABS/$INITRD" \
+- && chmod 0600 "$BOOT_DIR_ABS/$INITRD" \
++ [[ $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 [[ -f /etc/kernel/cmdline ]]; then
++ 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
+@@ -40,14 +82,14 @@
+
+ read -r -d '' -a line < /proc/cmdline
+ for i in "${line[@]}"; do
+- [[ "${i#initrd=*}" != "$i" ]] && continue
++ [[ ${i#initrd=*} != "$i" ]] && continue
+ BOOT_OPTIONS+=("$i")
+ done
+ fi
+
+ unset noimageifnotneeded
+
+- for ((i=0; i < "${#BOOT_OPTIONS[@]}"; i++)); do
++ for ((i = 0; i < "${#BOOT_OPTIONS[@]}"; i++)); do
+ # shellcheck disable=SC1001
+ if [[ ${BOOT_OPTIONS[$i]} == root\=PARTUUID\=* ]]; then
+ noimageifnotneeded="yes"
+@@ -55,16 +97,21 @@
+ fi
+ done
+
++ # shellcheck disable=SC2046
+ dracut -f \
+ ${noimageifnotneeded:+--noimageifnotneeded} \
+- $([[ "$KERNEL_INSTALL_VERBOSE" == 1 ]] && echo --verbose) \
+- "$BOOT_DIR_ABS/$INITRD" \
+- "$KERNEL_VERSION"
++ $([[ $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/$INITRD"
++ rm -f -- "$BOOT_DIR_ABS/$IMAGE"
+ ret=$?
+- ;;
++ ;;
+ esac
++
+ exit $ret
diff --git a/sys-kernel/dracut/files/059-redcore-change-default-initramfs-name.patch b/sys-kernel/dracut/files/059-redcore-change-default-initramfs-name.patch
new file mode 100644
index 00000000..1a1d083f
--- /dev/null
+++ b/sys-kernel/dracut/files/059-redcore-change-default-initramfs-name.patch
@@ -0,0 +1,21 @@
+diff -Nur a/dracut.sh b/dracut.sh
+--- a/dracut.sh 2022-12-24 16:49:27.000000000 +0000
++++ b/dracut.sh 2024-01-13 15:33:43.657110274 +0000
+@@ -1142,7 +1142,7 @@
+ elif [[ -f "$dracutsysrootdir"/lib/modules/${kernel}/initrd ]]; then
+ outfile="$dracutsysrootdir/lib/modules/${kernel}/initrd"
+ elif [[ -e $dracutsysrootdir/boot/vmlinuz-${kernel} ]]; then
+- outfile="$dracutsysrootdir/boot/initramfs-${kernel}.img"
++ outfile="$dracutsysrootdir/boot/initrd-${kernel}"
+ elif [[ -z $dracutsysrootdir ]] \
+ && [[ $MACHINE_ID ]] \
+ && mountpoint -q /efi; then
+@@ -1152,7 +1152,7 @@
+ && mountpoint -q /boot/efi; then
+ outfile="/boot/efi/${MACHINE_ID}/${kernel}/initrd"
+ else
+- outfile="$dracutsysrootdir/boot/initramfs-${kernel}.img"
++ outfile="$dracutsysrootdir/boot/initrd-${kernel}"
+ fi
+ fi
+ fi
diff --git a/sys-kernel/dracut/files/059-systemd-executor.patch b/sys-kernel/dracut/files/059-systemd-executor.patch
new file mode 100644
index 00000000..5ec1a138
--- /dev/null
+++ b/sys-kernel/dracut/files/059-systemd-executor.patch
@@ -0,0 +1,31 @@
+From bee1c4824a8cd47ce6c01892a548bdc07b1fa678 Mon Sep 17 00:00:00 2001
+From: Frantisek Sumsal <frantisek@sumsal.cz>
+Date: Sat, 14 Oct 2023 23:45:57 +0200
+Subject: [PATCH] feat(systemd): install systemd-executor
+
+In [0] systemd gained a new binary - systemd-executor - that's used to
+spawn processes forked off systemd. Let's copy it into the initrd if
+it's available.
+
+[0] https://github.com/systemd/systemd/pull/27890
+
+Signed-off-by: Brian Harring <ferringb@gmail.com>
+---
+ modules.d/00systemd/module-setup.sh | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/modules.d/00systemd/module-setup.sh b/modules.d/00systemd/module-setup.sh
+index 554c25a08..9a13a1dbb 100755
+--- a/modules.d/00systemd/module-setup.sh
++++ b/modules.d/00systemd/module-setup.sh
+@@ -34,6 +34,7 @@ install() {
+ "$systemdutildir"/systemd \
+ "$systemdutildir"/systemd-coredump \
+ "$systemdutildir"/systemd-cgroups-agent \
++ "$systemdutildir"/systemd-executor \
+ "$systemdutildir"/systemd-shutdown \
+ "$systemdutildir"/systemd-reply-password \
+ "$systemdutildir"/systemd-fsck \
+--
+2.41.0
+
diff --git a/sys-kernel/dracut/files/059-systemd-pcrphase.patch b/sys-kernel/dracut/files/059-systemd-pcrphase.patch
new file mode 100644
index 00000000..f653cdd5
--- /dev/null
+++ b/sys-kernel/dracut/files/059-systemd-pcrphase.patch
@@ -0,0 +1,91 @@
+https://github.com/dracutdevs/dracut/pull/2586
+
+From cd6f683d634970112a29867137431d0d57f8c957 Mon Sep 17 00:00:00 2001
+From: Antonio Alvarez Feijoo <antonio.feijoo@suse.com>
+Date: Thu, 9 Feb 2023 13:55:47 +0100
+Subject: [PATCH] fix(systemd-pcrphase): only include
+ systemd-pcrphase-initrd.service
+
+The only systemd-pcrphase related unit configured to run in the initrd is
+systemd-pcrphase-initrd.service.
+Both systemd-pcrphase.service and systemd-pcrphase-sysinit.service contain
+`ConditionPathExists=!/etc/initrd-release`.
+
+Signed-off-by: Brian Harring <ferringb@gmail.com>
+---
+ modules.d/01systemd-pcrphase/module-setup.sh | 8 --------
+ 1 file changed, 8 deletions(-)
+
+diff --git a/modules.d/01systemd-pcrphase/module-setup.sh b/modules.d/01systemd-pcrphase/module-setup.sh
+index 3dbb4974..fa960a42 100755
+--- a/modules.d/01systemd-pcrphase/module-setup.sh
++++ b/modules.d/01systemd-pcrphase/module-setup.sh
+@@ -28,10 +28,6 @@ install() {
+
+ inst_multiple -o \
+ "$systemdutildir"/systemd-pcrphase \
+- "$systemdsystemunitdir"/systemd-pcrphase.service \
+- "$systemdsystemunitdir/systemd-pcrphase.service.d/*.conf" \
+- "$systemdsystemunitdir"/systemd-pcrphase-sysinit.service \
+- "$systemdsystemunitdir/systemd-pcrphase-sysinit.service/*.conf" \
+ "$systemdsystemunitdir"/systemd-pcrphase-initrd.service \
+ "$systemdsystemunitdir/systemd-pcrphase-initrd.service.d/*.conf" \
+ "$systemdsystemunitdir"/initrd.target.wants/systemd-pcrphase-initrd.service
+@@ -39,10 +35,6 @@ install() {
+ # Install the hosts local user configurations if enabled.
+ if [[ $hostonly ]]; then
+ inst_multiple -H -o \
+- "$systemdsystemconfdir"/systemd-pcrphase.service \
+- "$systemdsystemconfdir/systemd-pcrphase.service.d/*.conf" \
+- "$systemdsystemconfdir"/systemd-pcrphase-sysinit.service \
+- "$systemdsystemconfdir/systemd-pcrphase-sysinit.service.d/*.conf" \
+ "$systemdsystemconfdir"/systemd-pcrphase-initrd.service \
+ "$systemdsystemconfdir/systemd-pcrphase-initrd.service.d/*.conf" \
+ "$systemdsystemconfdir"/initrd.target.wants/systemd-pcrphase-initrd.service
+--
+2.41.0
+
+From cd93aaa2e096a8cbd1f1789dcce06857067b35c9 Mon Sep 17 00:00:00 2001
+From: Brian Harring <ferringb@gmail.com>
+Date: Mon, 11 Dec 2023 17:10:20 -0800
+Subject: [PATCH] fix(systemd-255): handle systemd-pcr{phase -> extend} rename
+
+The binary systemd-pcrphase was renamed to systemd-pcrextend
+in systemd 255, but the backing units were all left named
+systemd-pcrphase.
+
+Fixes: #2583
+
+Signed-off-by: Brian Harring <ferringb@gmail.com>
+---
+ modules.d/01systemd-pcrphase/module-setup.sh | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/modules.d/01systemd-pcrphase/module-setup.sh b/modules.d/01systemd-pcrphase/module-setup.sh
+index fa960a42c..87efd0c1a 100755
+--- a/modules.d/01systemd-pcrphase/module-setup.sh
++++ b/modules.d/01systemd-pcrphase/module-setup.sh
+@@ -6,7 +6,11 @@
+ check() {
+
+ # If the binary(s) requirements are not fulfilled the module can't be installed.
+- require_binaries "$systemdutildir"/systemd-pcrphase || return 1
++ # systemd-255 renamed the binary, check for old and new location.
++ if ! require_binaries "$systemdutildir"/systemd-pcrphase && \
++ ! require_binaries "$systemdutildir"/systemd-pcrextend; then
++ return 1
++ fi
+
+ # Return 255 to only include the module, if another module requires it.
+ return 255
+@@ -28,6 +32,7 @@ install() {
+
+ inst_multiple -o \
+ "$systemdutildir"/systemd-pcrphase \
++ "$systemdutildir"/systemd-pcrextend \
+ "$systemdsystemunitdir"/systemd-pcrphase-initrd.service \
+ "$systemdsystemunitdir/systemd-pcrphase-initrd.service.d/*.conf" \
+ "$systemdsystemunitdir"/initrd.target.wants/systemd-pcrphase-initrd.service
+--
+2.41.0
+
diff --git a/sys-kernel/dracut/files/059-uefi-split-usr.patch b/sys-kernel/dracut/files/059-uefi-split-usr.patch
new file mode 100644
index 00000000..8adb8807
--- /dev/null
+++ b/sys-kernel/dracut/files/059-uefi-split-usr.patch
@@ -0,0 +1,48 @@
+https://github.com/dracutdevs/dracut/pull/2365
+
+From 3462e0ac6f3562a5247bbeda2dc41eaf4e4ebf5e Mon Sep 17 00:00:00 2001
+From: Mike Gilbert <floppym@gentoo.org>
+Date: Fri, 26 May 2023 15:56:45 -0400
+Subject: [PATCH] Fix path to UEFI stub on split-usr systems
+
+systemd always installs the UEFI stub in ${prefix}/lib/systemd/boot/efi.
+
+On split-usr systems, systemdutildir is ${rootprefix}/lib/systemd, which
+makes dracut look in the wrong place.
+
+Instead, grab 'prefix' from systemd.pc and store it in 'systemd_prefix'.
+
+Bug: https://bugs.gentoo.org/765208
+Signed-off-by: Mike Gilbert <floppym@gentoo.org>
+---
+ dracut.sh | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/dracut.sh b/dracut.sh
+index bbb34697..52a83061 100755
+--- a/dracut.sh
++++ b/dracut.sh
+@@ -1389,6 +1389,11 @@ esac
+
+ abs_outfile=$(readlink -f "$outfile") && outfile="$abs_outfile"
+
++[[ -n $systemd_prefix ]] \
++ || systemd_prefix=$(pkg-config systemd --variable=prefix 2> /dev/null)
++
++[[ -n $systemd_prefix ]] || systemd_prefix=/usr
++
+ [[ -d $dracutsysrootdir$systemdutildir ]] \
+ || systemdutildir=$(pkg-config systemd --variable=systemdutildir 2> /dev/null)
+
+@@ -1467,7 +1472,7 @@ if [[ ! $print_cmdline ]]; then
+ esac
+
+ if ! [[ -s $uefi_stub ]]; then
+- uefi_stub="$dracutsysrootdir${systemdutildir}/boot/efi/linux${EFI_MACHINE_TYPE_NAME}.efi.stub"
++ uefi_stub="$dracutsysrootdir${systemd_prefix}/lib/systemd/boot/efi/linux${EFI_MACHINE_TYPE_NAME}.efi.stub"
+ fi
+
+ if ! [[ -s $uefi_stub ]]; then
+--
+2.40.1
+
diff --git a/sys-kernel/dracut/files/059-uki-systemd-254.patch b/sys-kernel/dracut/files/059-uki-systemd-254.patch
new file mode 100644
index 00000000..e8b52480
--- /dev/null
+++ b/sys-kernel/dracut/files/059-uki-systemd-254.patch
@@ -0,0 +1,134 @@
+https://github.com/dracutdevs/dracut/issues/2431
+https://github.com/dracutdevs/dracut/commit/f32e95bcadbc5158843530407adc1e7b700561b1
+
+From f32e95bcadbc5158843530407adc1e7b700561b1 Mon Sep 17 00:00:00 2001
+From: Valentin Lefebvre <valentin.lefebvre@suse.com>
+Date: Mon, 13 Mar 2023 12:06:13 +0100
+Subject: [PATCH] fix(dracut.sh): use dynamically uefi's sections offset
+
+* Uefi section are creating by `objcopy` with hardcoded sections
+offset. This commit allow to have the correct offset between
+each part of the efi file, needed to create an UKI. Offsets
+are simply calculated so no sections overlap, as recommended
+in https://wiki.archlinux.org/title/Unified_kernel_image#Manually
+Moreover, efi stub file's header is parsed to apply the correct
+offsets according the section alignment factor.
+* Remove EFI_SECTION_VMA_INITRD, no need anymore as initrd
+section offset dynamically calculated
+
+Fixes dracutdevs#2275
+
+Signed-off-by: Valentin Lefebvre <valentin.lefebvre@suse.com>
+--- a/dracut-functions.sh
++++ b/dracut-functions.sh
+@@ -1023,3 +1023,26 @@ get_dev_module() {
+ fi
+ echo "$dev_drivers"
+ }
++
++# Check if file is in PE format
++pe_file_format() {
++ if [[ $# -eq 1 ]]; then
++ local magic
++ magic=$(objdump -p "$1" \
++ | awk '{if ($1 == "Magic"){print strtonum("0x"$2)}}')
++ magic=$(printf "0x%x" "$magic")
++ # 0x10b (PE32), 0x20b (PE32+)
++ [[ $magic == 0x20b || $magic == 0x10b ]] && return 0
++ fi
++ return 1
++}
++
++# Get the sectionAlignment data from the PE header
++pe_get_section_align() {
++ local align_hex
++ [[ $# -ne "1" ]] && return 1
++ [[ $(pe_file_format "$1") -eq 1 ]] && return 1
++ align_hex=$(objdump -p "$1" \
++ | awk '{if ($1 == "SectionAlignment"){print $2}}')
++ echo "$((16#$align_hex))"
++}
+--- a/dracut.sh
++++ b/dracut.sh
+@@ -1506,7 +1506,6 @@ if [[ ! $print_cmdline ]]; then
+ exit 1
+ fi
+ unset EFI_MACHINE_TYPE_NAME
+- EFI_SECTION_VMA_INITRD=0x3000000
+ case "${DRACUT_ARCH:-$(uname -m)}" in
+ x86_64)
+ EFI_MACHINE_TYPE_NAME=x64
+@@ -1516,8 +1515,6 @@ if [[ ! $print_cmdline ]]; then
+ ;;
+ aarch64)
+ EFI_MACHINE_TYPE_NAME=aa64
+- # aarch64 kernels are uncompressed and thus larger, so we need a bigger gap between vma sections
+- EFI_SECTION_VMA_INITRD=0x4000000
+ ;;
+ *)
+ dfatal "Architecture '${DRACUT_ARCH:-$(uname -m)}' not supported to create a UEFI executable"
+@@ -2467,29 +2464,57 @@ if [[ $uefi == yes ]]; then
+ fi
+ fi
+
++ offs=$(objdump -h "$uefi_stub" 2> /dev/null | awk 'NF==7 {size=strtonum("0x"$3);\
++ offset=strtonum("0x"$4)} END {print size + offset}')
++ if [[ $offs -eq 0 ]]; then
++ dfatal "Failed to get the size of $uefi_stub to create UEFI image file"
++ exit 1
++ fi
++ align=$(pe_get_section_align "$uefi_stub")
++ if [[ $? -eq 1 ]]; then
++ dfatal "Failed to get the sectionAlignment of the stub PE header to create the UEFI image file"
++ exit 1
++ fi
++ offs=$((offs + "$align" - offs % "$align"))
++ [[ -s $dracutsysrootdir/usr/lib/os-release ]] && uefi_osrelease="$dracutsysrootdir/usr/lib/os-release"
++ [[ -s $dracutsysrootdir/etc/os-release ]] && uefi_osrelease="$dracutsysrootdir/etc/os-release"
++ [[ -s $uefi_osrelease ]] \
++ && uefi_osrelease_offs=${offs} \
++ && offs=$((offs + $(stat -Lc%s "$uefi_osrelease"))) \
++ && offs=$((offs + "$align" - offs % "$align"))
++
+ if [[ $kernel_cmdline ]] || [[ $hostonly_cmdline == yes && -e "${uefi_outdir}/cmdline.txt" ]]; then
+ echo -ne "\x00" >> "$uefi_outdir/cmdline.txt"
+ dinfo "Using UEFI kernel cmdline:"
+ dinfo "$(tr -d '\000' < "$uefi_outdir/cmdline.txt")"
+ uefi_cmdline="${uefi_outdir}/cmdline.txt"
++ uefi_cmdline_offs=${offs}
++ offs=$((offs + $(stat -Lc%s "$uefi_cmdline")))
++ offs=$((offs + "$align" - offs % "$align"))
+ else
+ unset uefi_cmdline
+ fi
+
+- [[ -s $dracutsysrootdir/usr/lib/os-release ]] && uefi_osrelease="$dracutsysrootdir/usr/lib/os-release"
+- [[ -s $dracutsysrootdir/etc/os-release ]] && uefi_osrelease="$dracutsysrootdir/etc/os-release"
+ if [[ -s ${dracutsysrootdir}${uefi_splash_image} ]]; then
+ uefi_splash_image="${dracutsysrootdir}${uefi_splash_image}"
++ uefi_splash_offs=${offs}
++ offs=$((offs + $(stat -Lc%s "$uefi_splash_image")))
++ offs=$((offs + "$align" - offs % "$align"))
+ else
+ unset uefi_splash_image
+ fi
+
++ uefi_linux_offs="${offs}"
++ offs=$((offs + $(stat -Lc%s "$kernel_image")))
++ offs=$((offs + "$align" - offs % "$align"))
++ uefi_initrd_offs="${offs}"
++
+ if objcopy \
+- ${uefi_osrelease:+--add-section .osrel="$uefi_osrelease" --change-section-vma .osrel=0x20000} \
+- ${uefi_cmdline:+--add-section .cmdline="$uefi_cmdline" --change-section-vma .cmdline=0x30000} \
+- ${uefi_splash_image:+--add-section .splash="$uefi_splash_image" --change-section-vma .splash=0x40000} \
+- --add-section .linux="$kernel_image" --change-section-vma .linux=0x2000000 \
+- --add-section .initrd="${DRACUT_TMPDIR}/initramfs.img" --change-section-vma .initrd="${EFI_SECTION_VMA_INITRD}" \
++ ${uefi_osrelease:+--add-section .osrel="$uefi_osrelease" --change-section-vma .osrel=$(printf 0x%x "$uefi_osrelease_offs")} \
++ ${uefi_cmdline:+--add-section .cmdline="$uefi_cmdline" --change-section-vma .cmdline=$(printf 0x%x "$uefi_cmdline_offs")} \
++ ${uefi_splash_image:+--add-section .splash="$uefi_splash_image" --change-section-vma .splash=$(printf 0x%x "$uefi_splash_offs")} \
++ --add-section .linux="$kernel_image" --change-section-vma .linux="$(printf 0x%x "$uefi_linux_offs")" \
++ --add-section .initrd="${DRACUT_TMPDIR}/initramfs.img" --change-section-vma .initrd="$(printf 0x%x "$uefi_initrd_offs")" \
+ "$uefi_stub" "${uefi_outdir}/linux.efi"; then
+ if [[ -n ${uefi_secureboot_key} && -n ${uefi_secureboot_cert} ]]; then
+ if sbsign \
diff --git a/sys-kernel/dracut/files/dracut-059-dmsquash-live.patch b/sys-kernel/dracut/files/dracut-059-dmsquash-live.patch
new file mode 100644
index 00000000..8061d686
--- /dev/null
+++ b/sys-kernel/dracut/files/dracut-059-dmsquash-live.patch
@@ -0,0 +1,26 @@
+From 19e4839ab70a691f95a0284aa0152a247eb5c63d Mon Sep 17 00:00:00 2001
+From: Laszlo Gombos <laszlo.gombos@gmail.com>
+Date: Fri, 24 Feb 2023 01:57:19 +0000
+Subject: [PATCH] fix(dmsquash-live): restore compatibility with earlier
+ releases
+
+Follow-up to 40dd5c90e0efcb9ebaa9abb42a38c7316e9706bd .
+---
+ modules.d/90dmsquash-live/dmsquash-live-root.sh | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/modules.d/90dmsquash-live/dmsquash-live-root.sh b/modules.d/90dmsquash-live/dmsquash-live-root.sh
+index 62d1b5e7cd..a98e258c26 100755
+--- a/modules.d/90dmsquash-live/dmsquash-live-root.sh
++++ b/modules.d/90dmsquash-live/dmsquash-live-root.sh
+@@ -403,6 +403,10 @@ fi
+
+ ROOTFLAGS="$(getarg rootflags)"
+
++if [ "$overlayfs" = required ]; then
++ echo "rd.live.overlay.overlayfs=1" > /etc/cmdline.d/dmsquash-need-overlay.conf
++fi
++
+ if [ -n "$overlayfs" ]; then
+ if [ -n "$FSIMG" ]; then
+ mkdir -m 0755 -p /run/rootfsbase
diff --git a/sys-kernel/dracut/files/dracut-059-install-new-systemd-hibernate-resume.service.patch b/sys-kernel/dracut/files/dracut-059-install-new-systemd-hibernate-resume.service.patch
new file mode 100644
index 00000000..124bd6a9
--- /dev/null
+++ b/sys-kernel/dracut/files/dracut-059-install-new-systemd-hibernate-resume.service.patch
@@ -0,0 +1,21 @@
+From https://github.com/dracutdevs/dracut/pull/2527
+From a2fe89116db4b286fbf515f26bd1773b5e6ee8ad Mon Sep 17 00:00:00 2001
+From: Antonio Alvarez Feijoo <antonio.feijoo@suse.com>
+Date: Tue, 26 Sep 2023 09:43:37 +0200
+Subject: [PATCH] fix(resume): add new systemd-hibernate-resume.service
+
+Since https://github.com/systemd/systemd/commit/a628d933, the generator only
+does the initial validation of the system info and then enables the new
+`systemd-hibernate-resume.service`.
+
+Fixes #2513
+--- a/modules.d/95resume/module-setup.sh
++++ b/modules.d/95resume/module-setup.sh
+@@ -44,6 +44,7 @@ install() {
+ if dracut_module_included "systemd" && [[ -x $dracutsysrootdir$systemdutildir/systemd-hibernate-resume ]]; then
+ inst_multiple -o \
+ "$systemdutildir"/system-generators/systemd-hibernate-resume-generator \
++ "$systemdsystemunitdir"/systemd-hibernate-resume.service \
+ "$systemdsystemunitdir"/systemd-hibernate-resume@.service \
+ "$systemdutildir"/systemd-hibernate-resume
+ return 0
diff --git a/sys-kernel/dracut/files/gentoo-network-r1.patch b/sys-kernel/dracut/files/gentoo-network-r1.patch
new file mode 100644
index 00000000..3d5db25c
--- /dev/null
+++ b/sys-kernel/dracut/files/gentoo-network-r1.patch
@@ -0,0 +1,29 @@
+From 5443396f3cb591f2589888b25e07f21f03989057 Mon Sep 17 00:00:00 2001
+From: Laszlo Gombos <laszlo.gombos@gmail.com>
+Date: Sat, 24 Dec 2022 01:48:04 +0000
+Subject: [PATCH] When no systemd then only network-legacy is supported
+
+Bug: https://github.com/dracutdevs/dracut/issues/1756
+---
+ modules.d/40network/module-setup.sh | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/modules.d/40network/module-setup.sh b/modules.d/40network/module-setup.sh
+index 1ab13ef..da49947 100755
+--- a/modules.d/40network/module-setup.sh
++++ b/modules.d/40network/module-setup.sh
+@@ -16,6 +16,11 @@ depends() {
+ fi
+ done
+
++ # When systemd is not available only network-legacy is supported
++ if [ -z "$network_handler" ] && ! find_binary systemctl > /dev/null; then
++ network_handler="network-legacy"
++ fi
++
+ if [ -z "$network_handler" ]; then
+ if [[ -e $dracutsysrootdir$systemdsystemunitdir/wicked.service ]]; then
+ network_handler="network-wicked"
+--
+2.34.1
+