Skip to contentSkip to conversation

Mandatory install device check for PowerPC

PATCH Superseded Avnish Chouhan 2 participants 2 messages Nov 8, 2024

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Mandatory install device check for PowerPC

This patch adds a check on install_device while installing grub for PowerPC. If install_device is not mentioned in grub2-install and machine is detected as PowerPC, the error will be thrown and it will terminates the grub2-install operation. Running grub2-install on PowerPC without the install_device may result in bootlist corruption. When no install device is specified, it attempts to load images from the filesystem, which leads to nvram bootlist corruption. The idea is to fail the operation and avoid creating the invalid boot entry.

---
 grub-install.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
util/grub-install.c +11 -0
index 7dc5657..a049f53 100644
@@ -1289,6 +1289,17 @@ main (int argc, char *argv[])
 	      is_prep = 0;
 	    }
 	}
+      else
+        {
+         /*
+	   * As the machine has been detected as PowerPC and not the PowerMac. We need to check
+	   * whether the install_device has been mentioned while installing. If no device has been
+	   * mentioned, we need to exit and mark it as an error as the install_device is required for
+	   * PowerPC installation. An installation with no device mentioned may lead to corruptions.
+	   */
+           if (!install_device)
+             grub_util_error ("%s", _("install device isn't specified required for PowerPC"));
+        }
     }
 
   size_t ndev = 0;
Signature · 7 lines
2.39.3


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#1 lore raw

As discussed in another thread, this breaks installing from x86 onto removable disk for PPC Mac which is a supported workflow

Quoted 45 lines · Avnish Chouhan

This patch adds a check on install_device while installing grub for PowerPC.
If install_device is not mentioned in grub2-install and machine is detected as PowerPC, the error will be thrown and it will terminates the grub2-install
operation. Running grub2-install on PowerPC without the install_device may result in bootlist corruption. When no install device is specified, it attempts
to load images from the filesystem, which leads to nvram bootlist corruption.
The idea is to fail the operation and avoid creating the invalid boot entry.

---
 grub-install.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
util/grub-install.c +4 -0
index 7dc5657..a049f53 100644
@@ -1289,6 +1289,17 @@ main (int argc, char *argv[])
              is_prep = 0;
            }
        }
+      else
+        {
+         /*
+          * As the machine has been detected as PowerPC and not the

PowerMac. We need to check
+ * whether the install_device has been mentioned while
installing. If no device has been
+ * mentioned, we need to exit and mark it as an error as the
install_device is required for
+ * PowerPC installation. An installation with no device
mentioned may lead to corruptions.

util/grub-install.c +3 -0
+          */
+           if (!install_device)
+             grub_util_error ("%s", _("install device isn't specified

required for PowerPC"));
+ }

     }
   size_t ndev = 0;
Quoted 9 lines

--
2.39.3

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel