Skip to contentSkip to conversation

Mandatory install device check for PowerPC

PATCH In review Avnish Chouhan 4 participants 4 messages May 27, 2024 – May 29, 2024

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, the error will be thrown. Running grub2-install on PowerPC without the install_device may result in boot corruption.

---
 util/grub-install.c | 2 ++
 1 file changed, 2 insertions(+)
util/grub-install.c +2 -0
index 5babc7a..192d2a8 100644
@@ -970,6 +970,8 @@ main (int argc, char *argv[])
     case GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275:
       if (install_device)
 	is_prep = 1;
+      else
+        grub_util_error ("%s", _("install device isn't specified"));
       break;
     case GRUB_INSTALL_PLATFORM_MIPS_ARC:
     case GRUB_INSTALL_PLATFORM_MIPSEL_ARC:
Signature · 7 lines
2.39.3


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#1 lore raw
Quoted 7 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, the error will be thrown.
Running grub2-install on PowerPC without the install_device may result in boot corruption.

This breaks PowerMac booting which doesn't have install device.

Quoted 23 lines
---
 util/grub-install.c | 2 ++
 1 file changed, 2 insertions(+)
util/grub-install.c +2 -1
index 5babc7a..192d2a8 100644
@@ -970,6 +970,8 @@ main (int argc, char *argv[])
     case GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275:
       if (install_device)
        is_prep = 1;
+      else
+        grub_util_error ("%s", _("install device isn't specified"));
       break;
     case GRUB_INSTALL_PLATFORM_MIPS_ARC:
     case GRUB_INSTALL_PLATFORM_MIPSEL_ARC:
--

2.39.3

Quoted 5 lines

_______________________________________________
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

#2 lore raw
In reply to Avnish Chouhan

Hello,

Quoted 15 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, the error will be thrown. Running grub2-install on PowerPC without the install_device may result in boot corruption.

---
 util/grub-install.c | 2 ++
 1 file changed, 2 insertions(+)
util/grub-install.c +0 -0
index 5babc7a..192d2a8 100644

util/grub-install.c main (int argc, char *argv[]) · line 975

Quoted 6 lines
util/grub-install.c +2 -0
@@ -970,6 +970,8 @@ main (int argc, char *argv[])
     case GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275:
       if (install_device)
 	is_prep = 1;
+      else
+        grub_util_error ("%s", _("install device isn't specified"));
       break;

As far as I understand this is fine for us (support for pSeries and powernv platform).

However, this is not acceptable for upstream. Upstream also supports Apple hardawre, and there the grub binary is installed as a file on the filesystem rather than copied to a device.

Or to put it differently, there is the PReP sub-platform of GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275 and currently the code does not detect that is running on such platform (eg. by examining the device tree) but rather it infers is_prep solely based on user input (the device to install to) and in absence of the user input non-PReP platform is assumed, leading to bootlist corruption when no boot device is given on a PReP platform.

To fix this the logic should be inverted: Set is_prep should be set based on what system is detected, and require an install device for PReP platform.

Thanks

Michal

Quoted 5 lines
util/grub-install.c +0 -0
     case GRUB_INSTALL_PLATFORM_MIPS_ARC:
     case GRUB_INSTALL_PLATFORM_MIPSEL_ARC:
Signature · 1 line
2.39.3

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

#3 lore raw

Hi Michal,
Thank you so much for a response!

We'll work on to figure out the type of machine.

On no_prep, as per my analysis. Even with no install device given while installing. We observe boot corruption on some specific setups (mostly where we have multiple valid PReP partition available on the machine. And corruption probably due to wrong PReP picked up by installer. And as the installer picked the valid PReP available, we don't get any errors. Thank you!

Regards,
Avnish Chouhan

Quoted 40 lines · Michal Suchánek

Hello,

Quoted 15 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, the error will be thrown. Running grub2-install on PowerPC without the install_device may result in boot corruption.

---
 util/grub-install.c | 2 ++
 1 file changed, 2 insertions(+)
util/grub-install.c +0 -0
index 5babc7a..192d2a8 100644

util/grub-install.c main (int argc, char *argv[]) · line 975

Quoted 6 lines
util/grub-install.c +2 -0
@@ -970,6 +970,8 @@ main (int argc, char *argv[])
     case GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275:
       if (install_device)
 	is_prep = 1;
+      else
+        grub_util_error ("%s", _("install device isn't specified"));
       break;

As far as I understand this is fine for us (support for pSeries and powernv platform).

However, this is not acceptable for upstream. Upstream also supports Apple hardawre, and there the grub binary is installed as a file on the filesystem rather than copied to a device.

Or to put it differently, there is the PReP sub-platform of GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275 and currently the code does not detect that is running on such platform (eg. by examining the device tree) but rather it infers is_prep solely based on user input (the device to install to) and in absence of the user input non-PReP platform is assumed, leading to bootlist corruption when no boot device is given on a PReP platform.

Quoted 13 lines

To fix this the logic should be inverted: Set is_prep should be set based on what system is detected, and require an install device for PReP platform.

Thanks

Michal

Quoted 5 lines
util/grub-install.c +0 -1
     case GRUB_INSTALL_PLATFORM_MIPS_ARC:
     case GRUB_INSTALL_PLATFORM_MIPSEL_ARC:
--

2.39.3

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