File: hwmatch-only-on-grub-pc-platform.patch

package info (click to toggle)
grub2 2.12-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie, trixie-updates
  • size: 70,780 kB
  • sloc: ansic: 424,740; asm: 16,228; sh: 9,525; cpp: 2,095; makefile: 1,590; python: 1,468; sed: 431; lex: 393; yacc: 268; awk: 85; lisp: 54; perl: 31
file content (47 lines) | stat: -rw-r--r-- 1,467 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
From: Mauricio Faria de Oliveira <mfo@canonical.com>
Date: Fri, 20 Aug 2021 10:15:06 -0300
Subject: Call hwmatch only on the grub-pc platform

Call hwmatch only on i386/pc as it is only available there.
This avoids "error: can't find command `hwmatch'." on e.g., x86_64/efi.

The equivalent behavior is linux_gfx_mode=keep because grub is special:
the `if hwmatch` clause is true on that error and `$match = 0` is true
too, as it is undefined (confirmed in grub shell.) A quick fix for now.

Before and After:

    grub> hwmatch
    error: can't find command `hwmatch'.

    grub> echo $grub_platform
    efi

    grub> echo $linux_gfx_mode
    keep

Signed-off-by: Mauricio Faria de Oliveira <mfo@canonical.com>

Bug-Ubuntu: https://bugs.launchpad.net/bugs/1840560
Bug-Debian: https://bugs.debian.org/990836
Forwarded: no
Last-Update: 2020-08-20
---
 util/grub.d/10_linux.in | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index 0cea76b..041521c 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -262,7 +262,9 @@ else
   cat << EOF
 if [ "\${recordfail}" != 1 ]; then
   if [ -e \${prefix}/gfxblacklist.txt ]; then
-    if hwmatch \${prefix}/gfxblacklist.txt 3; then
+    if [ \${grub_platform} != pc ]; then
+      set linux_gfx_mode=keep
+    elif hwmatch \${prefix}/gfxblacklist.txt 3; then
       if [ \${match} = 0 ]; then
         set linux_gfx_mode=keep
       else