All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4] Mandatory install device check for PowerPC
@ 2026-01-27 13:48 Avnish Chouhan
  2026-01-27 16:13 ` Michal Suchánek
  2026-01-29  9:52 ` Vladimir 'phcoder' Serbinenko
  0 siblings, 2 replies; 8+ messages in thread
From: Avnish Chouhan @ 2026-01-27 13:48 UTC (permalink / raw)
  To: grub-devel
  Cc: daniel.kiper, phcoder, mchang, msuchanek, glaubitz,
	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.

Signed-off-by: Avnish Chouhan <avnish@linux.ibm.com>
---
 util/grub-install.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/util/grub-install.c b/util/grub-install.c
index 0602465..f7389b3 100644
--- a/util/grub-install.c
+++ b/util/grub-install.c
@@ -1289,6 +1289,19 @@ main (int argc, char *argv[])
 	      is_prep = 0;
 	    }
 	}
+#if defined(__powerpc__)
+     else
+       {
+         /*
+	   * As the machine has been detected as PowerPC and not a 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"));
+       }
+#endif /* __powerpc__ */
     }
 
   size_t ndev = 0;
-- 
2.50.1 (Apple Git-155)


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-01-30 12:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-27 13:48 [PATCH v4] Mandatory install device check for PowerPC Avnish Chouhan
2026-01-27 16:13 ` Michal Suchánek
2026-01-29  9:48   ` Avnish Chouhan
2026-01-29  9:52 ` Vladimir 'phcoder' Serbinenko
2026-01-29 10:59   ` Avnish Chouhan
2026-01-29 11:14   ` Michal Suchánek
2026-01-30 10:38     ` Avnish Chouhan
2026-01-30 12:00       ` Michal Suchánek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.