From 0923b4093bdfe71643e5ac2f73b86d8261b75640 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Sat, 20 May 2017 13:49:00 +0200 Subject: [PATCH] Workaround for buggy dracut in Fedora 25 dracut --kmoddir is broken in dracut-044 (mangles module path inside initramfs). This is already fixed upstream, but updated package still haven't been uploaded to Fedora 25. For now, postprocess the initramfs fixing the path. https://bugzilla.redhat.com/show_bug.cgi?id=1431317 https://github.com/dracutdevs/dracut/issues/194 QubesOS/qubes-issues#2574 --- kernel.spec | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/kernel.spec b/kernel.spec index b342fd5..2ed0767 100644 --- a/kernel.spec +++ b/kernel.spec @@ -329,7 +329,26 @@ PATH="/sbin:$PATH" dracut --nomdadmconf --nolvmconf \ --modules "kernel-modules qubes-vm-simple" \ --conf /dev/null --confdir /var/empty \ -d "xenblk xen-blkfront cdrom ext4 jbd2 crc16 dm_snapshot" \ - %buildroot/%vm_install_dir/initramfs %kernelrelease + %buildroot/%vm_install_dir/initramfs %kernelrelease || exit 1 + +# workaround for buggy dracut-044 in Fedora 25 +# https://bugzilla.redhat.com/show_bug.cgi?id=1431317 +# https://github.com/dracutdevs/dracut/issues/194 +modules_dep=$(lsinitrd "%buildroot/%vm_install_dir/initramfs" \ + "usr/lib/modules/%kernelrelease/modules.dep") +if [ -z "$modules_dep" ]; then + tmpdir=$(mktemp -d) + zcat "%buildroot/%vm_install_dir/initramfs" | cpio -imd -D "$tmpdir" || exit 1 + mv "$tmpdir"/%buildroot/lib/modules/%kernelrelease/kernel \ + "$tmpdir"/lib/modules/%kernelrelease/ || exit 1 + depmod -F %buildroot/boot/System.map-%kernelrelease \ + -b "$tmpdir" -a %kernelrelease || exit 1 + pushd "$tmpdir" + find . -print0 | sort -z \ + | cpio --null -R 0:0 -H newc -o --quiet \ + | gzip > %buildroot/%vm_install_dir/initramfs || exit 1 + popd +fi cp -p arch/x86/boot/bzImage %buildroot/%vm_install_dir/vmlinuz