Blob Blame History Raw
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Daniel Axtens <dja@axtens.net>
Date: Mon, 16 Aug 2021 16:01:47 +1000
Subject: [PATCH] powerpc: fix prefix + signed grub special case for PowerVM

Mea culpa: when testing the PowerPC special case for signed grub, I
assumed qemu and PowerVM would behave identically. This was wrong, and
with hindsight a pretty dumb error.

This fixes it. This time, I am actually testing on PowerVM.

Signed-off-by: Daniel Axtens <dja@axtens.net>
---
 grub-core/kern/main.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c
index e809a5edec1..2d0d2bbd4cf 100644
--- a/grub-core/kern/main.c
+++ b/grub-core/kern/main.c
@@ -236,9 +236,20 @@ grub_set_prefix_and_root (void)
 	    which will have now been extended to device=$fwdisk,partition
 	    and path=/path
 
-	 So we only need to act if device = ieee1275/disk exactly.
+	  - PowerVM will give us device names like
+	    ieee1275//vdevice/v-scsi@3000006c/disk@8100000000000000
+	    and we don't want to try to encode some sort of truth table about
+	    what sorts of paths represent disks with partition tables and those
+	    without partition tables.
+
+	 So we act unless there is a comma in the device, which would indicate
+	 a partition has already been specified.
+
+	 (If we only have a path, the code in normal to discover config files
+	 will try both without partitions and then with any partitions so we
+	 will cover both CDs and HDs.)
        */
-      if (grub_strncmp (device, "ieee1275/disk", 14) == 0)
+      if (grub_strchr (device, ',') == NULL)
         grub_env_set ("prefix", path);
       else
 #endif