Hello,

how is this different from the previous revision?

On Tue, Jan 27, 2026 at 07:18:14PM +0530, Avnish Chouhan wrote:
> 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 <[email protected]>
> ---
>  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__)

Is this ifdef needed?

This whole block is already in
if (platform == GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275)
and the same ifdef selects it as the default platform.

Presumably grub-install should be able to install for other platforms,
and as aresult such ifdefs are not welcome.

> +     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.
Corruptions of what?
> +        */
> +          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)

Thanks

Michal

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

Reply via email to