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 1/4] 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 From ead3bc9b6641a4c83f4b4d549926ec5f0f957788 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Sat, 20 May 2017 14:06:07 +0200 Subject: [PATCH 2/4] Add kernel and initramfs to modules.img QubesOS/qubes-issues#2822 --- kernel.spec | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel.spec b/kernel.spec index 2ed0767..f083626 100644 --- a/kernel.spec +++ b/kernel.spec @@ -450,12 +450,14 @@ Qubes domU kernel. %post qubes-vm mkdir /tmp/qubes-modules-%kernelrelease -truncate -s 400M /tmp/qubes-modules-%kernelrelease.img +truncate -s 500M /tmp/qubes-modules-%kernelrelease.img mkfs -t ext3 -F /tmp/qubes-modules-%kernelrelease.img > /dev/null mount /tmp/qubes-modules-%kernelrelease.img /tmp/qubes-modules-%kernelrelease -o loop cp -a -t /tmp/qubes-modules-%kernelrelease %vm_install_dir/modules/%kernelrelease mkdir /tmp/qubes-modules-%kernelrelease/firmware cp -a -t /tmp/qubes-modules-%kernelrelease/firmware %vm_install_dir/modules/firmware/%kernelrelease +cp %vm_install_dir/vmlinuz /tmp/qubes-modules-%kernelrelease/ +cp %vm_install_dir/initramfs /tmp/qubes-modules-%kernelrelease/ umount /tmp/qubes-modules-%kernelrelease rmdir /tmp/qubes-modules-%kernelrelease mv /tmp/qubes-modules-%kernelrelease.img %vm_install_dir/modules.img From 268a2dd0ecf906616b2e1e4466c1a0a95eea8843 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Thu, 25 May 2017 03:52:56 +0200 Subject: [PATCH 3/4] version 4.9.29-17 --- rel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rel b/rel index b6a7d89..98d9bcb 100644 --- a/rel +++ b/rel @@ -1 +1 @@ -16 +17 From 77f8e8ef6d6b1a804192906ba64c93f9c1ea899c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Fri, 2 Jun 2017 21:44:11 +0200 Subject: [PATCH 4/4] rpm: include kernel headers in modules.img for VM Distributing kernel-devel built for dom0 to VMs is major PITA, including problems like copying between different build environments, inability to install it in Debian etc. Lets include kernel headers there by default, without any additional package needed. Fixes QubesOS/qubes-issues#2692 --- Makefile.builder | 11 ----------- kernel.spec | 5 +++++ 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/Makefile.builder b/Makefile.builder index 424f563..6007c88 100644 --- a/Makefile.builder +++ b/Makefile.builder @@ -1,14 +1,3 @@ ifeq ($(PACKAGE_SET),dom0) RPM_SPEC_FILES := kernel.spec -else ifeq ($(PACKAGE_SET),vm) - -ifdef UPDATE_REPO -# If DIST_DOM0 defined, copy kernel-devel from there -ifneq ($(DIST_DOM0),) -# Include kernel-devel packages in VM repo - dummy spec file -RPM_SPEC_FILES := kernel-devel.spec -OUTPUT_DIR = pkgs/$(DIST_DOM0) -endif -endif - endif diff --git a/kernel.spec b/kernel.spec index f083626..db06514 100644 --- a/kernel.spec +++ b/kernel.spec @@ -358,6 +358,11 @@ cp -a %buildroot/lib/modules/%kernelrelease %buildroot%vm_install_dir/modules/ mkdir -p %buildroot%vm_install_dir/modules/firmware cp -a %buildroot/lib/firmware/%kernelrelease %buildroot%vm_install_dir/modules/firmware/ +# Include kernel headers for Qubes VM in "/lib/modules" - so kernel-devel +# package will be unnecessary there, regardless of distribution +rm -f %buildroot%vm_install_dir/modules/%kernelrelease/build +cp -a %buildroot/%src_install_dir %buildroot%vm_install_dir/modules/%kernelrelease/build + # remove files that will be auto generated by depmod at rpm -i time for i in alias alias.bin ccwmap dep dep.bin ieee1394map inputmap isapnpmap ofmap pcimap seriomap symbols symbols.bin usbmap do