nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

Blame SOURCES/0219-powerpc-fix-prefix-signed-grub-special-case-for-Powe.patch

8e15ce
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
8e15ce
From: Daniel Axtens <dja@axtens.net>
8e15ce
Date: Mon, 16 Aug 2021 16:01:47 +1000
8e15ce
Subject: [PATCH] powerpc: fix prefix + signed grub special case for PowerVM
8e15ce
8e15ce
Mea culpa: when testing the PowerPC special case for signed grub, I
8e15ce
assumed qemu and PowerVM would behave identically. This was wrong, and
8e15ce
with hindsight a pretty dumb error.
8e15ce
8e15ce
This fixes it. This time, I am actually testing on PowerVM.
8e15ce
8e15ce
Signed-off-by: Daniel Axtens <dja@axtens.net>
8e15ce
---
8e15ce
 grub-core/kern/main.c | 15 +++++++++++++--
8e15ce
 1 file changed, 13 insertions(+), 2 deletions(-)
8e15ce
8e15ce
diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c
8e15ce
index e809a5edec1..2d0d2bbd4cf 100644
8e15ce
--- a/grub-core/kern/main.c
8e15ce
+++ b/grub-core/kern/main.c
8e15ce
@@ -236,9 +236,20 @@ grub_set_prefix_and_root (void)
8e15ce
 	    which will have now been extended to device=$fwdisk,partition
8e15ce
 	    and path=/path
8e15ce
 
8e15ce
-	 So we only need to act if device = ieee1275/disk exactly.
8e15ce
+	  - PowerVM will give us device names like
8e15ce
+	    ieee1275//vdevice/v-scsi@3000006c/disk@8100000000000000
8e15ce
+	    and we don't want to try to encode some sort of truth table about
8e15ce
+	    what sorts of paths represent disks with partition tables and those
8e15ce
+	    without partition tables.
8e15ce
+
8e15ce
+	 So we act unless there is a comma in the device, which would indicate
8e15ce
+	 a partition has already been specified.
8e15ce
+
8e15ce
+	 (If we only have a path, the code in normal to discover config files
8e15ce
+	 will try both without partitions and then with any partitions so we
8e15ce
+	 will cover both CDs and HDs.)
8e15ce
        */
8e15ce
-      if (grub_strncmp (device, "ieee1275/disk", 14) == 0)
8e15ce
+      if (grub_strchr (device, ',') == NULL)
8e15ce
         grub_env_set ("prefix", path);
8e15ce
       else
8e15ce
 #endif