[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/2] Ensure nvram is available and functional on IEEE1275
From: |
Michael Chang |
Subject: |
Re: [PATCH 2/2] Ensure nvram is available and functional on IEEE1275 |
Date: |
Thu, 25 Aug 2022 12:24:17 +0800 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
On Wed, Aug 24, 2022 at 06:03:11PM +0200, Ismael Luceno wrote:
> Otherwise the installation will fail, and the system will be left in an
> unbootable state.
>
> On ppc64le, the boot process shows:
>
> Welcome to GRUB!
>
> error: ../../grub-core/kern/dl.c:380:symbol `grub_disk_get_size' not
> found.
> Entering rescue mode...
> grub rescue>
The symbol looking up failure due to failed grub-install attempt should
not happen in the first place given this commit should bail it out.
8ddbdc3bc2 grub-install: Add backup and restore
Apparently there's missing grub_set_install_backup_ponr between
successful image embedding and grub_install_register_ieee1275 and we
should fix that as well.
>
> Signed-off-by: Ismael Luceno <iluceno@suse.de>
> ---
> grub-core/osdep/unix/platform.c | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/grub-core/osdep/unix/platform.c b/grub-core/osdep/unix/platform.c
> index a5bf064b7cf5..fd23176e58a0 100644
> --- a/grub-core/osdep/unix/platform.c
> +++ b/grub-core/osdep/unix/platform.c
> @@ -192,12 +192,30 @@ grub_install_register_efi (grub_device_t
> efidir_grub_dev,
> return ret;
> }
>
> +static void
> +linux_ensure_nvram (void)
> +{
> + int fd;
> +#ifndef __linux__
> + return 0;
> +#endif
> + if (linux_kmod_load("nvram"))
> + grub_util_error (_("%s: kernel module not found"), "nvram");
> + fd = open ("/dev/nvram", O_RDWR);
> + if (fd == -1)
> + grub_util_error ("/dev/nvram: %s", strerror(errno));
> + close (fd);
> +}
> +
I'm wondering why it is needed. The nvram module should be loaded
on-demand via linux kernel's request_module() and modalias trick whever
/dev/nvram is accessed.
Thanks,
Michael
> void
> grub_install_register_ieee1275 (int is_prep, const char *install_device,
> int partno, const char *relpath)
> {
> char *boot_device;
>
> + /* On Linux, ensure nvram is available and functional. */
> + linux_ensure_nvram ();
> +
> if (grub_util_exec_redirect_null ((const char * []){ "ofpathname",
> "--version", NULL }))
> {
> /* TRANSLATORS: This message is shown when required executable `%s'
> --
> 2.37.1
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel