From 33e30a1b2909403d9ad9a5390d995116e4ab22e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Mon, 25 Nov 2024 14:02:04 +0100 Subject: [PATCH 1/4] rpm: use the install target in boot/Makefile Fix the target to install file into /etc/default (it's not grub.d file). And then don't open-code it in the spec file. No functional change. --- boot/Makefile | 5 +++-- rpm_spec/core-agent.spec.in | 4 +--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/boot/Makefile b/boot/Makefile index 7cb97ff57..c9b4123f2 100644 --- a/boot/Makefile +++ b/boot/Makefile @@ -1,10 +1,11 @@ LIBDIR ?= /usr/lib SYSCONFDIR ?= /etc -GRUBCONFDIR ?= $(SYSCONFDIR)/grub.d +GRUBCONFDIR ?= $(SYSCONFDIR)/default DRACUTCONFDIR ?= $(LIBDIR)/dracut/dracut.conf.d +GRUBCFGNAME ?= grub.qubes .PHONY: install install: - install -D -m 0644 grub.qubes $(DESTDIR)$(GRUBCONFDIR)/30_qubes + install -D -m 0644 grub.qubes $(DESTDIR)$(GRUBCONFDIR)/$(GRUBCFGNAME) install -D -m 0644 dracut-qubes.conf $(DESTDIR)$(DRACUTCONFDIR)/30-qubes.conf diff --git a/rpm_spec/core-agent.spec.in b/rpm_spec/core-agent.spec.in index 6fa3a0e34..143dc02f0 100644 --- a/rpm_spec/core-agent.spec.in +++ b/rpm_spec/core-agent.spec.in @@ -487,6 +487,7 @@ usermod -L root make install-vm PYTHON=%{__python3} "DESTDIR=$RPM_BUILD_ROOT" SYSTEM_DROPIN_DIR=%{_unitdir} SYSLIBDIR=/usr/lib ENABLE_SELINUX=%with_selinux make -C app-menu DESTDIR=$RPM_BUILD_ROOT install +make -C boot DESTDIR=$RPM_BUILD_ROOT install make -C boot/redhat DESTDIR=$RPM_BUILD_ROOT install make -C config-overrides DESTDIR=$RPM_BUILD_ROOT install make -C filesystem DESTDIR=$RPM_BUILD_ROOT install @@ -520,9 +521,6 @@ sed -i \ $RPM_BUILD_ROOT/etc/yum.repos.d/qubes-*.repo %endif -install -D -m 0644 boot/dracut-qubes.conf $RPM_BUILD_ROOT/usr/lib/dracut/dracut.conf.d/30-qubes.conf -install -D -m 0644 boot/grub.qubes $RPM_BUILD_ROOT/etc/default/grub.qubes - %if ! %with_sysvinit rm -rf $RPM_BUILD_ROOT/etc/init.d/qubes-* $RPM_BUILD_ROOT/etc/sysconfig/modules/qubes-core.modules %endif From 8796b2b56e97b81ba3b9184c12c7bce4d8ac448c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Mon, 25 Nov 2024 14:08:13 +0100 Subject: [PATCH 2/4] debian: include all boot-related configs in the package This especially adds dracut config (that was previously installed in Fedora only). While dracut is not the default on Debian, it is possible to use it, so add the config to the package too. QubesOS/qubes-issues#8649 --- debian/qubes-core-agent.install | 1 + debian/rules | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/qubes-core-agent.install b/debian/qubes-core-agent.install index fecac009a..3015aa9fd 100644 --- a/debian/qubes-core-agent.install +++ b/debian/qubes-core-agent.install @@ -138,6 +138,7 @@ usr/bin/qvm-run-vm usr/bin/qvm-connect-tcp usr/bin/qvm-sync-clock usr/lib/environment.d/60-gnome-software-fix.conf +usr/lib/dracut/dracut.conf.d/30-qubes.conf usr/lib/python3/dist-packages/qubesagent-*.egg-info/* usr/lib/python3/dist-packages/qubesagent/* usr/lib/qubes-bind-dirs.d/30_cron.conf diff --git a/debian/rules b/debian/rules index 01ac851b9..63eb1dc59 100755 --- a/debian/rules +++ b/debian/rules @@ -30,7 +30,7 @@ override_dh_auto_install: make -C qubes-rpc/kde install make -C qubes-rpc/nautilus install make -C qubes-rpc/thunar install - install -D -m 0644 boot/grub.qubes $(DESTDIR)/etc/default/grub.d/30-qubes.cfg + make -C boot install GRUBCFGNAME=grub.d/30-qubes.cfg override_dh_fixperms: dh_fixperms -a -Xqfile-unpacker From 968d5f1922a116d61241417ce2377c544bc7a4ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Mon, 25 Nov 2024 15:09:40 +0100 Subject: [PATCH 3/4] archlinux: do not open-code boot configs install target Reuse makefile that is there already. This has a side effect of installing dracut config too. --- archlinux/PKGBUILD.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archlinux/PKGBUILD.in b/archlinux/PKGBUILD.in index 27e6dcb82..8e9b78cae 100644 --- a/archlinux/PKGBUILD.in +++ b/archlinux/PKGBUILD.in @@ -90,8 +90,8 @@ package_qubes-vm-core() { cd "${_pkgnvr}" - install -D -m 0644 -- "boot/grub.qubes" "${pkgdir}/etc/default/grub.qubes" # shellcheck disable=SC2154 + make -C boot DESTDIR="$pkgdir" install make install-corevm DESTDIR="$pkgdir" SBINDIR=/usr/bin LIBDIR=/usr/lib SYSLIBDIR=/usr/lib SYSTEM_DROPIN_DIR=/usr/lib/systemd/system USER_DROPIN_DIR=/usr/lib/systemd/user DIST=archlinux make -C app-menu install DESTDIR="$pkgdir" install LIBDIR=/usr/lib SYSLIBDIR=/usr/lib make -C misc install DESTDIR="$pkgdir" install LIBDIR=/usr/lib SYSLIBDIR=/usr/lib From e9e5b81659a22648bd4a21990a09971793dcd1ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Mon, 25 Nov 2024 23:44:05 +0100 Subject: [PATCH 4/4] dracut: add few more setting to reduce initramfs size on Debian Review content of initramfs on Debian, and remove biggest yet unused parts. QubesOS/qubes-issues#8649 --- boot/dracut-qubes.conf | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/boot/dracut-qubes.conf b/boot/dracut-qubes.conf index 9f65bbea0..ea6d6b69c 100644 --- a/boot/dracut-qubes.conf +++ b/boot/dracut-qubes.conf @@ -14,3 +14,10 @@ omit_dracutmodules+=" ifcfg qemu-net i18n resume mdraid terminfo crypt lunmask n # confidential computing is not a Qubes feature). This saves about 5MB (20%) of # initramfs size. omit_dracutmodules+=" tpm2-tss " + +# Exclude plymouth, as it pulls in a lot of graphical stack, including GPU +# drivers, and none of the boot screen is visible in a qube anyway +omit_dracutmodules+=" plymouth " + +# Exclude microcode, as VM cannot load it anyway, saves over 10MB of space +early_microcode="no"