diff --git a/kernel.spec.in b/kernel.spec.in index 2fc2801e..39363017 100644 --- a/kernel.spec.in +++ b/kernel.spec.in @@ -107,6 +107,7 @@ Provides: kernel-drm-nouveau = 16 Provides: kernel-modules-extra = %kernelrelease Provides: kernel-modeset = 1 +Requires: %name-modules = %kernelrelease Requires(pre): coreutils gawk Requires(post): dracut binutils Requires: qubes-core-dom0-linux-kernel-install @@ -151,6 +152,20 @@ Patch26: 0001-sound-Disable-SG-buffer.patch %description Qubes Dom0 kernel. +%package modules +Summary: Kernel modules +License: GPL v2 only +Provides: multiversion(kernel) +Provides: %name-modules = %kernelrelease +%if "%{?name_suffix}" != "" +Provides: kernel-modules = %kernelrelease +%endif +Provides: kernel-modules-uname-r = %kernelrelease +AutoReqProv: on + +%description modules +This package provides kernel modules. + %prep SYMBOLS="xen-dom0 pvops" @@ -499,40 +514,12 @@ if [ -e /usr/lib/dracut/modules.d/90qubes-vm-simple/xen-scrub-pages-supported ]; fi echo "$def_kernelopts " > %buildroot/%vm_install_dir/default-kernelopts-common.txt -# Modules for Qubes VM -mkdir -p %buildroot%vm_install_dir/modules -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 - -# include kernel+initramfs also inside modules.img, for direct kernel boot with -# stubdomain -cp %buildroot%vm_install_dir/vmlinuz %buildroot%vm_install_dir/modules/ -cp %buildroot%vm_install_dir/initramfs %buildroot%vm_install_dir/modules/ - -%if 0%{?fedora} >= 32 -flags=,no_copy_xattrs,hash_seed=dcee2318-92bd-47a5-a15d-e79d1412cdce -%else -flags= -%endif - -PATH=/usr/sbin:/sbin:$PATH mkfs.ext3 -F "-Enum_backup_sb=0,root_owner=0:0$flags" \ - -d %buildroot%vm_install_dir/modules %buildroot%vm_install_dir/modules.img 768M - -%if 0%{?fedora} >= 32 -SOURCE_DATE_EPOCH=$SOURCE_DATE_EPOCH %{_builddir}/genfs %buildroot%vm_install_dir/modules.img %kernelrelease immutable=yes -e2fsck -pDfE optimize_extents -- %buildroot%vm_install_dir/modules.img -resize2fs -M -- %buildroot%vm_install_dir/modules.img -e2fsck -pDfE optimize_extents -- %buildroot%vm_install_dir/modules.img -SOURCE_DATE_EPOCH=$SOURCE_DATE_EPOCH %{_builddir}/genfs %buildroot%vm_install_dir/modules.img -%endif +# Create a dummy modules.img with roughly the size the real one will have. +# That way, rpm will know that this package requires some additional +# space in /boot. +dd if=/dev/zero of=%buildroot/%vm_install_dir/modules.img \ + bs=1M count=500 -rm -rf %buildroot%vm_install_dir/modules # 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 @@ -540,7 +527,7 @@ do rm -f %buildroot/lib/modules/%kernelrelease/modules.$i done -%post +%post modules /sbin/depmod -a %{kernelrelease} %posttrans @@ -571,6 +558,8 @@ fi /boot/symvers-%kernelrelease.gz %attr(0644, root, root) /boot/vmlinuz-%{kernelrelease} /lib/firmware/%{kernelrelease} + +%files modules /lib/modules/%{kernelrelease} %package devel @@ -624,8 +613,10 @@ Provides: kernel-xen-domU Provides: kernel-qubes-domU Requires(pre): coreutils gawk -Requires(post): dracut Requires(post): qubes-core-dom0 +Requires(post): qubes-prepare-vm-kernel >= 2 +Requires(post): kernel-devel = %kernelrelease +Requires(post): kernel-modules = %kernelrelease Conflicts: sysfsutils < 2.0 # root-lvm only works with newer udevs @@ -649,8 +640,9 @@ if [ "$current_default_package" = "%{name}-qubes-vm" ]; then type qubes-prefs &>/dev/null && qubes-prefs --set default-kernel %upstream_version-%plainrel fi -# make modules.img sparse (again) -fallocate --dig-holes %vm_install_dir/modules.img +SOURCE_DATE_EPOCH=$(stat -c %%Y %vm_install_dir/initramfs) +export SOURCE_DATE_EPOCH +qubes-prepare-vm-kernel --modules-only --include-devel %kernelrelease "%upstream_version-%{plainrel}" exit 0 @@ -670,7 +662,7 @@ exit 0 %files qubes-vm %defattr(-, root, root) %dir %vm_install_dir -%attr(0644, root, root) %vm_install_dir/modules.img +%ghost %attr(0644, root, root) %vm_install_dir/modules.img %attr(0644, root, root) %vm_install_dir/initramfs %attr(0644, root, root) %vm_install_dir/vmlinuz %attr(0644, root, root) %vm_install_dir/default-kernelopts-common.txt