sys-kernel/dracut: version bump

This commit is contained in:
Stefan Reimer 2024-08-22 11:04:39 +00:00
parent aa358c4bbf
commit 5de357efbe
11 changed files with 105 additions and 460 deletions

View File

@ -1,11 +1,7 @@
AUX 059-gawk.patch 1349 BLAKE2B a4c778afb4bded425fd578a4b5b93f4a83924148e64b7ef3c68967626eaa1072b322b3c6ee87dcfcae013ecb12869f3d51977926357cab83cb3404dcecba5787 SHA512 a50e1b74186450fafb3f396c11744b964d67923740627c88d381b0041e3b870a5fea6df8c2119d67ecfdd560d8ea26bf72fea7e7ab70b4fae9e8d035d72d0fe0
AUX 059-kernel-install-uki.patch 5396 BLAKE2B fe6ecd2b6a3b549cc2f54bd9f933495cd081761b960528a7cf3fcdecf441057325d03e32b0f04f6bf5698ce225892cc841484d4925a66d9f3e4f4b9e59dd4e2a SHA512 08ab3b47a6f4a0507ec12647ced54cf64a20d2df4b7653aa1882c9184be53b9cc8290854c2d3bd84888b0a22105d3e513d9e019d232db82bdd1a888bf50f3212
AUX 059-uefi-split-usr.patch 1567 BLAKE2B 6abde1671c49e6314e181747ff504f50b7d6d1c9268f5f93a859edfdbbe823f48e33287dfa426b33f2dc967f1895d5499460e9bb865731e784a658d350ba7a3f SHA512 d1b27993003e5da1634a7e287a42ee0c4b8789a411024472e1b8b5a9923d94788dfe0bc4b48da9071bf62bb857aedbb18a5be7324e6d4c0919b329d85cc6b160
AUX 059-uki-systemd-254.patch 6162 BLAKE2B 60d7fdb8189d26d30fa92c8964e0b6a26b7cfab3d07f006fdad60582fcfbad4a7e9aed91eb9443eafd2f325be59224896ef7dbfa83170c8968aeccf290eeb093 SHA512 83462ef22148ce75b2a94f72c89af6a135d6f8b41fc64fe7d6db3553b409105f1a65eba84727e23c44e3cd61cbc66c132ca5a0f5c103ad974747145fac8c3070
AUX crypt-ssh-luks.patch 4280 BLAKE2B 28d9e5ff0ae5c75a959b16aa40af6dacdd2645b6336ced98318095f483af6d6d86ffe3781f1870d4b493e7590193a80bf4c2142b51dce986822669c62d9739b6 SHA512 7a12fe767950c77ca76e895fecfd7f6d29df9da9646a5f8d6f6e7112391cd6e11e8f081783a0a535a7c8d49842a7edc42b173c924f43ace457a66c721f1d377d
AUX dracut-059-dmsquash-live.patch 936 BLAKE2B 6dcbc59561179bba5d7e998f901cda99d8deeeba15886c267e4f77033ab8308cf39b8aaa8ad4c99eca13b2689a052226fdbee6cdae370039bcf40f0e070a8c41 SHA512 34a1b34a09186fd05901f8114260170bf3a51cf96967aa58872c99d6bb1fb1673b8f0246171368837b88e0a1c83c5aac9c20e2f73ed88ed69df72362d55f911f
AUX crypt-ssh-luks.patch 4281 BLAKE2B 0588c4791c279a89be00da1fcdf4dcb38a88cac199fd0f34c0849e50262f86d7c6f194755a439fbf17abbd8b5ffd30833de27daf0d1e32001199b64e92ae73c1 SHA512 3c1274ae5449e31bade2d466080d66a5324d1d3e6539e67adf2fb47cda69cea9dc8962765dd8c539f6f23b27a36a331de771ccc401b0818692b3fd932ead764b
AUX dracut-103-acct-user-group-gentoo.patch 915 BLAKE2B 75747b3775d04dd777d2a0f61116bbb83784b1a58656655ee6b441e79d1dc8e35a940dfbb0d4018ff27ba80c0581949d98326ebbc6804348004546a2ee1285ed SHA512 e6b4115a6121289a4ec814ddf4e4394f64096b298c3ab6393e197b19235ff494258478d8d74b9dfc570b122cc2122375b24c088a037b0ebf2ac5d9f6a54dcb67
AUX dracut-103-systemd-udev-256-kmod.patch 1616 BLAKE2B f1c15c4cd57d947f92f286c1fd9a4b045837017e965aa9b2707a15dea4426b0c349ad65e53f0b6a6e4dc7ddc999773a1af161cac2eac724d047a8d3109a8aeaa SHA512 359dfc2ee79d7647676c2b343f1b4bc23f11bc296c6b6c9be1525f87965be1ee8d4105f25dc6dc39dcdbca7a0d229a704a11416e7757739159493c6dc930f182
AUX gentoo-ldconfig-paths-r1.patch 1423 BLAKE2B e8bce9ee4b1b2546d4dbaa22a6167f9e3520df4f5f3b67509e430e4a6dd89d9fd18e53328c4bd6ee817e6b27ffcccf29fbdd922707c98f4fe67f6d44d76de2ff SHA512 fd44643e671d59ca51822d0f68b7ce7756035faca780ec784e64950770944f0aefd00a1dd2424f07568d5d97d46c0080c8e740856e0bff79bcf6a7e14b08ab8f
AUX gentoo-network-r1.patch 1002 BLAKE2B 719ff76c315e29c2a40f0a485e315622d6678ef0a325681af22ca060189649119ce08024b1b81be02b28cf532d33165918f5707742bb9927abd08ce49ee0565d SHA512 694f493384e2c0b6a46508f2290efca78d1b6f742fe8441f970837280558d160a711e36ba835ca767cfd158bf191856017af146ae19c5aa1aecbd10a69be38a1
DIST dracut-059.tar.gz 486487 BLAKE2B 86bbe18875cd3507e187b724cab212dc82e1daca7cedf79aeef13c34601adfff72bf2c0ba4c652e715b43c9a16f7be6a4a2b29dc75bef014640e1ec07c8d455b SHA512 196bc8bf18703c72bffb51a7e0493719c58173ad2da7d121eb42f9a8de47e953af36d109214dc4a10b2dc2d3bd19e844f7f51c2bdec087e064ea11f75124032d
EBUILD dracut-059-r5.ebuild 4463 BLAKE2B 4e7d0c49ae70e6427314dd77b646866416bcd8aa78faedb01d1f4d3f1fe727bec678d44f91b3c500f8f8f2480f63e2cd0d0d25a58f264f837068abb98dd16741 SHA512 91611751dd893922a19941b124d00b72ec0861f80f12809218ae0dd319193a1e7b9c7acee92f5f532f0513ea062176c141d861c1c7acb063f6e81f8f133e69f6
DIST dracut-103.tar.gz 567713 BLAKE2B 7781c0b7fc83a2c0c461f6398687e053226b489fb5405b3132b30d8e7a4f3cea2bb73aa0fe6e4c4b27187d6270ba623f403916ec38025a912930ae347a7e25ce SHA512 ba0dbefbcbecb09c44ce240664bc4f4ee25dfb8be7bc060028ae3b1ccf7d70410491c105e64fcef3d6f44d2794cb6162bcea9404125906be46bf3dff098e0277
EBUILD dracut-103-r2.ebuild 4735 BLAKE2B 7c4521a5eb8a1c38f9c0aa9bf1d8c797e9172c0da65d6748ef9541d99af0429eef09e8e212c4691077e0f76af189cffe5b87e127a4bc07a3d94c7e446153d063 SHA512 c376469d1fb552e9fdc40a963b4f2533b8c32aeaf5534f0c317c767dda5cd8c7590a2dde033f08815942407edde7f5747f6ba0673b56cf33f11a87430ac9cc32
MISC metadata.xml 479 BLAKE2B 76b6d6da8d9ee65fac81f1a30999f3a095a9cbd8c91fbee63edaad61c0a429d5ba43f18979e10cd73ba6a87d89213397a9ee6621f61168c1bd461bb866c4f02b SHA512 e4b9f639c157b0104058c0e124be1d3d1f01e836e7182f0c8ec6852133ed36a52b5cfe0ec83142f185ad3f9b20192c719b83e2ee405b874420bb4e09ec01a38b

View File

@ -1,42 +1,43 @@
# Copyright 1999-2023 Gentoo Authors
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit bash-completion-r1 optfeature systemd toolchain-funcs
inherit bash-completion-r1 edo optfeature systemd toolchain-funcs
if [[ ${PV} == 9999 ]] ; then
inherit git-r3
EGIT_REPO_URI="https://github.com/dracutdevs/dracut"
EGIT_REPO_URI="https://github.com/dracut-ng/dracut-ng"
else
if [[ "${PV}" != *_rc* ]]; then
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~mips ppc ppc64 ~riscv sparc x86"
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~mips ppc ppc64 ~riscv ~sparc x86"
fi
SRC_URI="https://github.com/dracutdevs/dracut/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz"
SRC_URI="https://github.com/dracut-ng/dracut-ng/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}/${PN}-ng-${PV}"
fi
DESCRIPTION="Generic initramfs generation tool"
HOMEPAGE="https://github.com/dracutdevs/dracut/wiki"
HOMEPAGE="https://github.com/dracut-ng/dracut-ng/wiki"
LICENSE="GPL-2"
SLOT="0"
IUSE="selinux test"
RESTRICT="!test? ( test )"
RDEPEND="
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/openrc-navi[sysv-utils(-),selinux?]
sys-apps/systemd[sysv-utils]
sys-apps/s6-linux-init[sysv-utils(-)]
)
>=sys-apps/util-linux-2.21
virtual/pkgconfig
virtual/pkgconfig[native-symlinks(+)]
virtual/udev
elibc_musl? ( sys-libs/fts-standalone )
@ -63,12 +64,10 @@ QA_MULTILIB_PATHS="usr/lib/dracut/.*"
PATCHES=(
"${FILESDIR}"/gentoo-ldconfig-paths-r1.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
# Gentoo specific acct-user and acct-group conf adjustments
"${FILESDIR}"/${PN}-103-acct-user-group-gentoo.patch
# https://github.com/dracut-ng/dracut-ng/pull/507
"${FILESDIR}"/${PN}-103-systemd-udev-256-kmod.patch
"${FILESDIR}"/crypt-ssh-luks.patch
)
@ -82,13 +81,7 @@ src_configure() {
tc-export CC PKG_CONFIG
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
edo ./configure "${myconf[@]}"
}
src_test() {
@ -107,9 +100,10 @@ src_install() {
AUTHORS
NEWS.md
README.md
docs/HACKING.md
docs/README.cross
docs/README.generic
docs/README.kernel
docs/RELEASE.md
docs/SECURITY.md
)
@ -153,8 +147,14 @@ pkg_postinst() {
optfeature "Support TPM 2.0 TSS" app-crypt/tpm2-tools
optfeature "Support Bluetooth (experimental)" net-wireless/bluez
optfeature "Support BIOS-given device names" sys-apps/biosdevname
optfeature "Support network NVMe" sys-apps/nvme-cli
optfeature "Support network NVMe" sys-apps/nvme-cli app-misc/jq
optfeature \
"Enable rngd service to help generating entropy early during boot" \
sys-apps/rng-tools
optfeature "building Unified Kernel Images with dracut (--uefi)" \
"sys-apps/systemd[boot]" "sys-apps/systemd-utils[boot]"
optfeature "automatically generating an initramfs on each kernel installation" \
"sys-kernel/installkernel[dracut]"
optfeature "automatically generating an UKI on each kernel installation" \
"sys-kernel/installkernel[dracut,uki]"
}

View File

@ -1,35 +0,0 @@
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"

View File

@ -1,150 +0,0 @@
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

View File

@ -1,48 +0,0 @@
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

View File

@ -1,134 +0,0 @@
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 \

View File

@ -2,11 +2,11 @@ diff --git a/modules.d/90crypt/cryptroot-ask.sh b/modules.d/90crypt/cryptroot-as
index 37a4deea..320eca82 100755
--- a/modules.d/90crypt/cryptroot-ask.sh
+++ b/modules.d/90crypt/cryptroot-ask.sh
@@ -174,15 +174,25 @@ fi
@@ -176,15 +176,25 @@ fi
if [ $ask_passphrase -ne 0 ]; then
luks_open="$(command -v cryptsetup) $cryptsetupopts luksOpen"
- _timeout=$(getargs "rd.luks.timeout")
- _timeout=$(getarg "rd.luks.timeout")
- _timeout=${_timeout:-0}
- ask_for_password --ply-tries 5 \
- --ply-cmd "$luks_open -T1 $device $luksname" \
@ -34,8 +34,8 @@ index 37a4deea..320eca82 100755
unset luks_open
- unset _timeout
fi
if [ "$is_keysource" -ne 0 -a "${luksname##luks-}" != "$luksname" ]; then
if [ "$is_keysource" -ne 0 ] && [ "${luksname##luks-}" != "$luksname" ]; then
diff --git a/modules.d/92crypt-ssh/crypt-ssh-cleanup.sh b/modules.d/92crypt-ssh/crypt-ssh-cleanup.sh
new file mode 100755
index 00000000..03b05d84

View File

@ -1,26 +0,0 @@
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

View File

@ -0,0 +1,30 @@
diff --git a/dracut-init.sh b/dracut-init.sh
index 986da96b..bd47bc92 100755
--- a/dracut-init.sh
+++ b/dracut-init.sh
@@ -711,10 +711,10 @@ inst_libdir_file() {
# install sysusers files
inst_sysusers() {
- inst_multiple -o "$sysusers/$*"
+ inst_multiple -o "$sysusers/acct-*-$*"
if [[ $hostonly ]]; then
- inst_multiple -H -o "$sysusersconfdir/$*"
+ inst_multiple -H -o "$sysusersconfdir/acct-*-$*"
fi
}
diff --git a/modules.d/91tpm2-tss/module-setup.sh b/modules.d/91tpm2-tss/module-setup.sh
index 4441f552..4b5654d5 100755
--- a/modules.d/91tpm2-tss/module-setup.sh
+++ b/modules.d/91tpm2-tss/module-setup.sh
@@ -30,7 +30,7 @@ installkernel() {
# Install the required file(s) and directories for the module in the initramfs.
install() {
- inst_sysusers tpm2-tss.conf
+ inst_sysusers tss.conf
inst_multiple -o \
"$tmpfilesdir"/tpm2-tss-fapi.conf \

View File

@ -0,0 +1,41 @@
From e16195f28669264227c169d45107ea95b83d8f48 Mon Sep 17 00:00:00 2001
From: Alexander Tsoy <alexander@tsoy.me>
Date: Tue, 16 Jul 2024 08:48:54 +0300
Subject: [PATCH] fix(systemd): move installation of libkmod to udev-rules
module
libkmod library should be installed even if systemd module is
omitted, so move its installation to udev-rules module.
---
modules.d/00systemd/module-setup.sh | 1 -
modules.d/95udev-rules/module-setup.sh | 6 +++++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/modules.d/00systemd/module-setup.sh b/modules.d/00systemd/module-setup.sh
index ce7bb520c..e4fb9a586 100755
--- a/modules.d/00systemd/module-setup.sh
+++ b/modules.d/00systemd/module-setup.sh
@@ -171,6 +171,5 @@ EOF
_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/95udev-rules/module-setup.sh b/modules.d/95udev-rules/module-setup.sh
index d82ed5eb9..6078751f6 100755
--- a/modules.d/95udev-rules/module-setup.sh
+++ b/modules.d/95udev-rules/module-setup.sh
@@ -93,7 +93,11 @@ install() {
"${udevdir}"/usb_id \
"${udevdir}"/v4l_id
- inst_libdir_file "libnss_files*"
+ # Install required libraries.
+ _arch=${DRACUT_ARCH:-$(uname -m)}
+ inst_libdir_file \
+ {"tls/$_arch/",tls/,"$_arch/",}"libkmod.so*" \
+ {"tls/$_arch/",tls/,"$_arch/",}"libnss_files*"
# Install the hosts local user configurations if enabled.
if [[ $hostonly ]]; then

View File

@ -1,29 +0,0 @@
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