File: test-run-qemu-support-UEFI-on-ARM.patch

package info (click to toggle)
dracut 109-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,592 kB
  • sloc: sh: 24,498; ansic: 5,234; makefile: 346; perl: 186; python: 48; javascript: 19
file content (65 lines) | stat: -rw-r--r-- 2,382 bytes parent folder | download
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
61
62
63
64
65
From: Benjamin Drung <benjamin.drung@canonical.com>
Date: Wed, 26 Nov 2025 00:16:43 +0100
Subject: test(run-qemu): support UEFI on ARM

The OVMF firmware files are builds of EDK II for 64-bit x86 virtual
machines. They do not work on other architectures.

So search for AAVMF files on ARM. Remove the `cfi.pflash01` driver
setting because it does not work on Ubuntu arm64 and `readonly=on` is
already set for the firmware file.

Fixes: https://github.com/dracut-ng/dracut-ng/issues/1861
Forwarded: https://github.com/dracut-ng/dracut-ng/pull/1872
---
 test/run-qemu | 30 +++++++++++++++++++++---------
 1 file changed, 21 insertions(+), 9 deletions(-)

diff --git a/test/run-qemu b/test/run-qemu
index 0f09c4a..f0f86a1 100755
--- a/test/run-qemu
+++ b/test/run-qemu
@@ -36,13 +36,26 @@ get_initrd() {
 # Print UEFI firmware file on stdout on success.
 # Return 1 in case no UEFI firmware file was found.
 get_uefi_code() {
-    for path in \
-        "/usr/share/OVMF/OVMF_CODE.fd" \
-        "/usr/share/OVMF/OVMF_CODE_4M.fd" \
-        "/usr/share/edk2/x64/OVMF_CODE.fd" \
-        "/usr/share/edk2/x64/OVMF_CODE.4m.fd" \
-        "/usr/share/edk2-ovmf/OVMF_CODE.fd" \
-        "/usr/share/qemu/ovmf-x86_64-4m.bin"; do
+    local paths=()
+    case "$ARCH" in
+        aarch64 | arm64)
+            paths=("/usr/share/AAVMF/AAVMF_CODE.no-secboot.fd")
+            ;;
+        amd64 | x86_64)
+            paths=(
+                "/usr/share/OVMF/OVMF_CODE.fd"
+                "/usr/share/OVMF/OVMF_CODE_4M.fd"
+                "/usr/share/edk2/x64/OVMF_CODE.fd"
+                "/usr/share/edk2/x64/OVMF_CODE.4m.fd"
+                "/usr/share/edk2-ovmf/OVMF_CODE.fd"
+                "/usr/share/qemu/ovmf-x86_64-4m.bin"
+            )
+            ;;
+        arm | armhf | armv7l)
+            paths=("/usr/share/AAVMF/AAVMF32_CODE.fd")
+            ;;
+    esac
+    for path in "${paths[@]}"; do
         if [[ -s $path ]]; then
             echo -n "$path"
             return 0
@@ -146,8 +159,7 @@ case "$ARCH" in
 esac
 
 if uefi_code=$(get_uefi_code); then
-    ARGS+=(-drive "if=pflash,format=raw,readonly=on,unit=0,file=$uefi_code"
-        -global "driver=cfi.pflash01,property=secure,value=on")
+    ARGS+=(-drive "if=pflash,format=raw,readonly=on,unit=0,file=$uefi_code")
 fi
 
 # Provide rng device sourcing the hosts /dev/urandom and other standard parameters