From: Michael Chang <mchang@suse.com>
To: The development of GNU GRUB <grub-devel@gnu.org>
Cc: Ismael Luceno <iluceno@suse.de>
Subject: Re: [PATCH 2/2] Ensure nvram is available and functional on IEEE1275
Date: Thu, 25 Aug 2022 12:24:17 +0800 [thread overview]
Message-ID: <20220825042416.GA14934@mazu> (raw)
In-Reply-To: <20220824160311.21160-3-iluceno@suse.de>
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
next prev parent reply other threads:[~2022-08-25 4:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-24 16:03 [PATCH 0/2] Fix installation issues on ppc64le Ismael Luceno
2022-08-24 16:03 ` [PATCH 1/2] Add helper to load linux kmods Ismael Luceno
2022-08-24 16:03 ` [PATCH 2/2] Ensure nvram is available and functional on IEEE1275 Ismael Luceno
2022-08-25 4:24 ` Michael Chang [this message]
2022-08-29 14:40 ` Ismael Luceno
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=20220825042416.GA14934@mazu \
--to=mchang@suse.com \
--cc=grub-devel@gnu.org \
--cc=iluceno@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.