qubes-linux-utils/rpm_spec/qubes-kernel-vm-support.spec.in
Marek Marczykowski-Górecki de2150e3d3
Add xen_scrub_pages=0 kernel option only if initramfs was rebuilt
Rebuild initramfs on package upgrade (already done for Debian
previously) and store 1 into /var/lib/qubes/initramfs-updated. Then,
only add xen_scrub_pages=0 kernel option if
/var/lib/qubes/initramfs-updated is there (with "1" or greater number).
This way, if initramfs rebuild doesn't happen for any reason,
xen_scrub_pages=0 will not be added.

Fixes 456fe99 "Disable scrubbing memory pages during initial balloon down"
QubesOS/qubes-issues#1963
2019-02-25 06:38:53 +01:00

98 lines
3.0 KiB
RPMSpec

#
# The Qubes OS Project, http://www.qubes-os.org
#
# Copyright (C) 2015 Marek Marczykowski-Górecki
# <marmarek@invisiblethingslab.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
Name: qubes-kernel-vm-support
Version: @VERSION@
Release: 1%{?dist}
Summary: Qubes VM kernel and initramfs modules
Source0: qubes-utils-%{version}.tar.gz
Group: Qubes
Vendor: Invisible Things Lab
License: GPL v2 only
URL: http://www.qubes-os.org
Requires: dracut
Requires: dkms
%description
This package contains:
1. Dracut module required to setup Qubes VM root filesystem. This package is
needed in VM only when the VM uses its own kernel (via pvgrub or so). Otherwise
initrd is provided by dom0.
2. u2mfn kernel module sources (dkms) required by GUI agent and R2 version of
libvchan library.
%prep
%setup -q -n qubes-utils-%{version}
%install
make install-fedora-kernel-support DESTDIR=%{buildroot}
%files
/usr/lib/dracut/modules.d/90qubes-vm
/usr/lib/dracut/modules.d/90qubes-vm-modules
/usr/lib/dracut/modules.d/90qubes-vm-simple
/usr/lib/dracut/modules.d/80xen-scrub-pages
/usr/src/u2mfn-%{version}/
/usr/sbin/qubes-prepare-vm-kernel
%config(noreplace) /etc/default/grub.qubes-kernel-vm-support
%triggerin -- grub2-tools
if ! grep -q '/etc/default/grub.qubes-kernel-vm-support$' /etc/default/grub 2>/dev/null; then
# do not keep Qubes-related settings directly in user-controlled config,
# include another file
echo '. /etc/default/grub.qubes-kernel-vm-support' >> /etc/default/grub
fi
%post
dkms add -m u2mfn -v %{version} --rpm_safe_upgrade
%preun
dkms remove -m u2mfn -v %{version} --all --rpm_safe_upgrade
if [ $1 -eq 0 ]; then
if grep -q '/etc/default/grub.qubes-kernel-vm-support$' /etc/default/grub 2>/dev/null; then
sed -i -e '/grub.qubes-kernel-vm-support$/d' /etc/default/grub
fi
fi
%posttrans
# Rebuild all initramfs images to include updated modules
if [ -r /usr/share/qubes/marker-vm ] && [ -x /usr/bin/dracut ]; then
ret=0
for img in /boot/initramfs-*.img; do
kver="${img#*initramfs-}"
kver="${kver%.img}"
dracut -f "$img" "$kver" || ret=$?
done
if [ "$ret" -eq 0 ]; then
# "milestone" initramfs update version:
# 1 - addition of xen scrub_pages enabling code
echo 1 > /var/lib/qubes/initramfs-updated
fi
fi
%changelog
@CHANGELOG@