summarylogtreecommitdiffstats
path: root/ovmf.patch
blob: d8729bea040b5892b167b72dd3d7ac4410dd0de5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
--- src/platform/backends/qemu/qemu_vm_process_spec.cpp.orig    2024-05-20 18:04:46.308380873 -0400
+++ src/platform/backends/qemu/qemu_vm_process_spec.cpp 2024-05-20 18:05:36.668903896 -0400
@@ -87,6 +87,47 @@
              << "chardev:char0"
              // TODO Add a debugging mode with access to console
              << "-nographic";
+
+        // Firmware directories
+        try
+        {
+            mu::snap_dir();
+        }
+        catch (const mp::SnapEnvironmentException&)
+        {
+            // Add a list of directories to check
+            QStringList dirs = QStringList();
+            dirs << "/usr/share/seabios/"
+                 << "/usr/share/seabios/x64/"
+                 << "/usr/share/ovmf/"
+                 << "/usr/share/ovmf/x64/"
+                 << "/usr/share/qemu/"
+                 << "/usr/share/qemu/x64/"
+                 << "/usr/share/qemu-efi/"
+                 << "/usr/share/qemu-efi/x64/"
+                 << "/usr/local/share/seabios/"
+                 << "/usr/local/share/seabios/x64/"
+                 << "/usr/local/share/ovmf/"
+                 << "/usr/local/share/ovmf/x64/"
+                 << "/usr/local/share/qemu/"
+                 << "/usr/local/share/qemu/x64/"
+                 << "/usr/local/share/qemu-efi/"
+                 << "/usr/local/share/qemu-efi/x64/";
+
+            // Now check every directory in the options, to make sure they exist
+            // If they do, add them to the args
+            for (const auto& value : dirs)
+            {
+                if (QDir(value).exists())
+                {
+                    mpl::log(mpl::Level::debug, desc.vm_name, fmt::format("Adding firmware directory: {}", value));
+                    args << "-L" << value;
+                }
+            }
+
+        }
+
+
         // Cloud-init disk
         args << "-cdrom" << desc.cloud_init_iso;
     }
@@ -203,7 +244,7 @@
     catch (const mp::SnapEnvironmentException&)
     {
         signal_peer = "unconfined";
-        firmware = "/usr{,/local}/share/{seabios,ovmf,qemu,qemu-efi}/*";
+        firmware = "/usr{,/local}/share/{seabios,ovmf,qemu,qemu-efi}{,/x64,/ia32}/*";
     }

     return profile_template.arg(apparmor_profile_name(), signal_peer, firmware, root_dir, program(),