grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 2/2] grub-install: Ensure a functional /dev/nvram


From: Michael Chang
Subject: Re: [PATCH v2 2/2] grub-install: Ensure a functional /dev/nvram
Date: Mon, 5 Sep 2022 18:04:22 +0800
User-agent: Mutt/1.10.1 (2018-07-13)

On Mon, Aug 29, 2022 at 04:36:25PM +0200, Ismael Luceno wrote:
> This enables an early failure; for i386-ieee1275 and powerpc-ieee1275 on
> Linux, without /dev/nvram the system may be left in an unbootable state.
> 
> Signed-off-by: Ismael Luceno <iluceno@suse.de>
> ---
>  util/grub-install.c | 23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
> 
> diff --git a/util/grub-install.c b/util/grub-install.c
> index 527b85e27aa7..c84a2fb0526f 100644
> --- a/util/grub-install.c
> +++ b/util/grub-install.c
> @@ -827,6 +827,16 @@ fill_core_services (const char *core_services)
>    free (sysv_plist);
>  }
>  
> +static void
> +try_open (const char *path)
> +{
> +  FILE *f;
> +  f = grub_util_fopen (path, "r+");
> +  if (!f)
> +    grub_util_error (_("Unable to open %s: %s"), path, strerror(errno));
> +  fclose (f);
> +}
> +
>  int
>  main (int argc, char *argv[])
>  {
> @@ -1026,6 +1036,19 @@ main (int argc, char *argv[])
>        break;
>      }
>  
> +  switch (platform)
> +    {
> +    case GRUB_INSTALL_PLATFORM_I386_IEEE1275:
> +    case GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275:
> +#ifdef __linux__
> +      /* On Linux, ensure /dev/nvram is _functional_.  */
> +      try_open ("/dev/nvram");

The update_nvram variable should be tested in case user has skipped it.

Thanks,
Michael

> +#endif
> +      break;
> +    default:
> +      break;
> +    }
> +
>    /* Find the EFI System Partition.  */
>  
>    if (is_efi)
> -- 
> 2.37.1
> 
> 
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]