nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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