From 1fe26ab4a0fc6ec961b661cc7fc9227db822c9be Mon Sep 17 00:00:00 2001 From: Matthew Garrett Date: Thu, 14 Nov 2013 15:53:32 +0100 Subject: [PATCH] * grub-core/kern/main.c (grub_set_prefix_and_root): Set variable cmdpath to firmware directory. --- ChangeLog | 5 +++++ grub-core/kern/main.c | 17 +++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a7e144694..efbef2dd0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-11-14 Matthew Garrett + + * grub-core/kern/main.c (grub_set_prefix_and_root): Set variable + cmdpath to firmware directory. + 2013-11-14 Vladimir Serbinenko * grub-core/kern/efi/efi.c (grub_efi_get_filename): Reset the pointer diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c index 19dc9885a..9cad0c448 100644 --- a/grub-core/kern/main.c +++ b/grub-core/kern/main.c @@ -125,6 +125,21 @@ grub_set_prefix_and_root (void) grub_register_variable_hook ("root", 0, grub_env_write_root); + grub_machine_get_bootlocation (&fwdevice, &fwpath); + + if (fwdevice) + { + char *cmdpath; + + cmdpath = grub_xasprintf ("(%s)%s", fwdevice, fwpath ? : ""); + if (cmdpath) + { + grub_env_set ("cmdpath", cmdpath); + grub_env_export ("cmdpath"); + grub_free (cmdpath); + } + } + if (prefix) { char *pptr = NULL; @@ -142,8 +157,6 @@ grub_set_prefix_and_root (void) if (pptr[0]) path = grub_strdup (pptr); } - if ((!device || device[0] == ',' || !device[0]) || !path) - grub_machine_get_bootlocation (&fwdevice, &fwpath); if (!device && fwdevice) device = fwdevice;