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>

Signed-off-by: Ismael Luceno <iluc...@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);
+}
+
 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

Reply via email to