diff --git a/sys-kernel/dracut/Manifest b/sys-kernel/dracut/Manifest index 8d054b9..929f43a 100644 --- a/sys-kernel/dracut/Manifest +++ b/sys-kernel/dracut/Manifest @@ -1,6 +1,11 @@ +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 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-r1.ebuild 4813 BLAKE2B d758878d3b68088a2583ea1d52d193e25f7c65d1f4561e4b7879a5c72f5157ea2356fe0cbecc74f31282756e265c17a37bad775c133c1053a03f23cd44ccbb1e SHA512 2b269d6c00a3ab886b652d8a4296989c3b3f86878f139b9fd7876c90b026ed1917fe9c078b1ba6b5260cc9c714a9441f1cf8dace4999d050d356cd40359d068e +EBUILD dracut-059-r5.ebuild 4463 BLAKE2B 4e7d0c49ae70e6427314dd77b646866416bcd8aa78faedb01d1f4d3f1fe727bec678d44f91b3c500f8f8f2480f63e2cd0d0d25a58f264f837068abb98dd16741 SHA512 91611751dd893922a19941b124d00b72ec0861f80f12809218ae0dd319193a1e7b9c7acee92f5f532f0513ea062176c141d861c1c7acb063f6e81f8f133e69f6 MISC metadata.xml 479 BLAKE2B 76b6d6da8d9ee65fac81f1a30999f3a095a9cbd8c91fbee63edaad61c0a429d5ba43f18979e10cd73ba6a87d89213397a9ee6621f61168c1bd461bb866c4f02b SHA512 e4b9f639c157b0104058c0e124be1d3d1f01e836e7182f0c8ec6852133ed36a52b5cfe0ec83142f185ad3f9b20192c719b83e2ee405b874420bb4e09ec01a38b diff --git a/sys-kernel/dracut/dracut-059-r1.ebuild b/sys-kernel/dracut/dracut-059-r5.ebuild similarity index 75% rename from sys-kernel/dracut/dracut-059-r1.ebuild rename to sys-kernel/dracut/dracut-059-r5.ebuild index 540a99e..8fdb166 100644 --- a/sys-kernel/dracut/dracut-059-r1.ebuild +++ b/sys-kernel/dracut/dracut-059-r5.ebuild @@ -1,9 +1,9 @@ -# Copyright 1999-2022 Gentoo Authors +# Copyright 1999-2023 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 optfeature systemd toolchain-funcs if [[ ${PV} == 9999 ]] ; then inherit git-r3 @@ -64,6 +64,11 @@ 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 "${FILESDIR}"/crypt-ssh-luks.patch ) @@ -115,33 +120,6 @@ src_install() { } pkg_postinst() { - 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 - optfeature "Networking support" net-misc/networkmanager optfeature "Legacy networking support" net-misc/curl "net-misc/dhcp[client]" \ sys-apps/iproute2 "net-misc/iputils[arping]" @@ -156,18 +134,26 @@ pkg_postinst() { optfeature \ "Allows use of dash instead of default bash (on your own risk)" \ app-shells/dash + optfeature \ + "Allows use of busybox instead of default bash (on your own risk)" \ + sys-apps/busybox optfeature "Support iSCSI" sys-block/open-iscsi - optfeature "Support Logical Volume Manager" sys-fs/lvm2 + optfeature "Support Logical Volume Manager" sys-fs/lvm2[lvm] optfeature "Support MD devices, also known as software RAID devices" \ - sys-fs/mdadm + sys-fs/mdadm sys-fs/dmraid optfeature "Support Device Mapper multipathing" sys-fs/multipath-tools optfeature "Plymouth boot splash" '>=sys-boot/plymouth-0.8.5-r5' optfeature "Support network block devices" sys-block/nbd optfeature "Support NFS" net-fs/nfs-utils net-nds/rpcbind optfeature \ "Install ssh and scp along with config files and specified keys" \ - net-misc/openssh + virtual/openssh optfeature "Enable logging with rsyslog" app-admin/rsyslog + optfeature "Support Squashfs" sys-fs/squashfs-tools + 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 \ "Enable rngd service to help generating entropy early during boot" \ sys-apps/rng-tools diff --git a/sys-kernel/dracut/files/059-gawk.patch b/sys-kernel/dracut/files/059-gawk.patch new file mode 100644 index 0000000..5f1da79 --- /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 +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 +--- 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 0000000..9bbf357 --- /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-uefi-split-usr.patch b/sys-kernel/dracut/files/059-uefi-split-usr.patch new file mode 100644 index 0000000..8adb880 --- /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 +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 +--- + 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 0000000..e8b5248 --- /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 +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 +--- 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 0000000..8061d68 --- /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 +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