grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
From: Avnish Chouhan <avnish@linux.ibm.com>
To: "Michal Suchánek" <msuchanek@suse.de>
Cc: grub-devel@gnu.org, daniel.kiper@oracle.com,
	brking@linux.ibm.com, meghanaprakash@in.ibm.com, mchang@suse.com
Subject: Re: [PATCH v3] Mandatory install device check for PowerPC
Date: Wed, 15 Oct 2025 14:22:18 +0530	[thread overview]
Message-ID: <fb5fa3f6fbbbe785546049d3dae37e47@linux.ibm.com> (raw)
In-Reply-To: <aOzPfbCx3gcbtemj@kitsune.suse.cz>

On 2025-10-13 15:37, Michal Suchánek wrote:
> On Mon, Oct 13, 2025 at 03:09:59PM +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.
> 

Hi Michal,
Hope you're doing wonderful!
Thank you so much for your response!

Surely the changes can be done the way you mentioned. But in my honest 
opinion, keeping this check in "else" make the code looks lot more 
understandable (if we see the complete if else condition). Keeping this 
in as added  "else" part clearly stats that this check is only specific 
to PowerPC. And it has no impact on PowerMac.
Thank you!

Regards,
Avnish Chouhan

> Hello,
> 
> there is the part
> if (install_device)
>   is_prep = 1;
> 
> The check added by this patch now assumes PReP.
> 
> For consistency this should be set unconditionally now.
> 
> 
>> 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 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)
> Then instead of nesting inside else you could change the condition to
> 
> if (is_prep && !install_device)
> 
> That clarifies what it is checking for, and will cover the cases when
> there is a partition that is checked for macppc content but none is
> found.
> 
> Thanks
> 
> Michal
>> +            grub_util_error ("%s", _("install device isn't specified 
>> required for PowerPC"));
> 
> I think this can be worded better.
> 
> Something like "No install device specified and no PowerPC Mac 
> partition found."
> 
> Thanks
> 
> Michal
> 
>> +       }
>> +#endif /* __powerpc__ */
>>      }
>> 
>>    size_t ndev = 0;
>> --
>> 2.47.3
>> 

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

      reply	other threads:[~2025-10-15  8:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-13  9:39 [PATCH v3] Mandatory install device check for PowerPC Avnish Chouhan
2025-10-13  9:56 ` John Paul Adrian Glaubitz
2025-10-13 10:14   ` Michal Suchánek
2025-10-13 10:17   ` Avnish Chouhan
2025-10-13 10:07 ` Michal Suchánek
2025-10-15  8:52   ` Avnish Chouhan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fb5fa3f6fbbbe785546049d3dae37e47@linux.ibm.com \
    --to=avnish@linux.ibm.com \
    --cc=brking@linux.ibm.com \
    --cc=daniel.kiper@oracle.com \
    --cc=grub-devel@gnu.org \
    --cc=mchang@suse.com \
    --cc=meghanaprakash@in.ibm.com \
    --cc=msuchanek@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).