Merge ~mfo/grub:lp1840560 into ~ubuntu-core-dev/grub/+git/ubuntu:ubuntu

Proposed by Mauricio Faria de Oliveira
Status: Merged
Approved by: Julian Andres Klode
Approved revision: 19b7423ac52e6c75290ca4f2f99e5f0a7ce5ed13
Merged at revision: f7ce633228cf1210a4c58a46a842361af31a5e09
Proposed branch: ~mfo/grub:lp1840560
Merge into: ~ubuntu-core-dev/grub/+git/ubuntu:ubuntu
Diff against target: 78 lines (+56/-0)
3 files modified
debian/changelog (+8/-0)
debian/patches/0241-Call-hwmatch-only-on-the-grub-pc-platform.patch (+47/-0)
debian/patches/series (+1/-0)
Reviewer Review Type Date Requested Status
Julian Andres Klode Approve
Ubuntu Core Development Team Pending
Review via email: mp+407470@code.launchpad.net

Description of the change

Fix "error: can't find command `hwmatch'." on non-i386/pc platforms such as x86_64/efi.
LP: #1840560

To post a comment you must log in.
Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote :

Rebased on top of latest grub on impish.

Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote :

Updated changelog for jammy (new development release).

Revision history for this message
Julian Andres Klode (juliank) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 043136b..ae31123 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,11 @@
6+grub2 (2.04-1ubuntu48) jammy; urgency=medium
7+
8+ * d/p/0241-Call-hwmatch-only-on-the-grub-pc-platform.patch:
9+ Fix "error: can't find command `hwmatch'." on non-i386/pc
10+ platforms such as x86_64/efi. (LP: #1840560)
11+
12+ -- Mauricio Faria de Oliveira <mfo@canonical.com> Thu, 04 Nov 2021 10:48:06 -0300
13+
14 grub2 (2.04-1ubuntu47) impish; urgency=medium
15
16 * Drop grub.cfg-400.patch (LP: #1933826)
17diff --git a/debian/patches/0241-Call-hwmatch-only-on-the-grub-pc-platform.patch b/debian/patches/0241-Call-hwmatch-only-on-the-grub-pc-platform.patch
18new file mode 100644
19index 0000000..9ae2fdf
20--- /dev/null
21+++ b/debian/patches/0241-Call-hwmatch-only-on-the-grub-pc-platform.patch
22@@ -0,0 +1,47 @@
23+From: Mauricio Faria de Oliveira <mfo@canonical.com>
24+Date: Fri, 20 Aug 2021 10:15:06 -0300
25+Subject: Call hwmatch only on the grub-pc platform
26+
27+Call hwmatch only on i386/pc as it is only available there.
28+This avoids "error: can't find command `hwmatch'." on e.g., x86_64/efi.
29+
30+The equivalent behavior is linux_gfx_mode=keep because grub is special:
31+the `if hwmatch` clause is true on that error and `$match = 0` is true
32+too, as it is undefined (confirmed in grub shell.) A quick fix for now.
33+
34+Before and After:
35+
36+ grub> hwmatch
37+ error: can't find command `hwmatch'.
38+
39+ grub> echo $grub_platform
40+ efi
41+
42+ grub> echo $linux_gfx_mode
43+ keep
44+
45+Signed-off-by: Mauricio Faria de Oliveira <mfo@canonical.com>
46+
47+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1840560
48+Bug-Debian: https://bugs.debian.org/990836
49+Forwarded: no
50+Last-Update: 2020-08-20
51+---
52+ util/grub.d/10_linux.in | 4 +++-
53+ 1 file changed, 3 insertions(+), 1 deletion(-)
54+
55+diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
56+index 47daf51..6aad5ba 100644
57+--- a/util/grub.d/10_linux.in
58++++ b/util/grub.d/10_linux.in
59+@@ -378,7 +378,9 @@ else
60+ cat << EOF
61+ if [ "\${recordfail}" != 1 ]; then
62+ if [ -e \${prefix}/gfxblacklist.txt ]; then
63+- if hwmatch \${prefix}/gfxblacklist.txt 3; then
64++ if [ \${grub_platform} != pc ]; then
65++ set linux_gfx_mode=keep
66++ elif hwmatch \${prefix}/gfxblacklist.txt 3; then
67+ if [ \${match} = 0 ]; then
68+ set linux_gfx_mode=keep
69+ else
70diff --git a/debian/patches/series b/debian/patches/series
71index 9b9ca92..11c2a0f 100644
72--- a/debian/patches/series
73+++ b/debian/patches/series
74@@ -237,3 +237,4 @@ cherry-fix-crash-on-http.patch
75 0238-util-grub-install-Fix-NULL-pointer-dereferences.patch
76 0239-arm-linux-Fix-ARM-Linux-header-layout.patch
77 0240-tests-ahci_test.in-Replace-ide-drive-with-ide-hd.patch
78+0241-Call-hwmatch-only-on-the-grub-pc-platform.patch

Subscribers

People subscribed via source and target branches