mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-25 08:39:28 +00:00
util/grub-install: Ensure a functional /dev/nvram
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> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
1 parent
fc8768bdc3
commit
67e90bf743
1 file changed
+27
@@ -827,6 +827,19 @@ fill_core_services (const char *core_services)
|
||||
free (sysv_plist);
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
static void
|
||||
try_open (const char *path)
|
||||
{
|
||||
FILE *f;
|
||||
|
||||
f = grub_util_fopen (path, "r+");
|
||||
if (f == NULL)
|
||||
grub_util_error (_("Unable to open %s: %s"), path, strerror (errno));
|
||||
fclose (f);
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
@@ -1026,6 +1039,20 @@ 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_. */
|
||||
if (update_nvram)
|
||||
try_open ("/dev/nvram");
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/* Find the EFI System Partition. */
|
||||
|
||||
if (is_efi)
|
||||
|
||||
Reference in new issue
Block a user