c78952
From 24865a88781aef2a6a54433b5b383219108f54fa Mon Sep 17 00:00:00 2001
f4c76c
From: Fedora Ninjas <grub2-owner@fedoraproject.org>
f4c76c
Date: Wed, 19 Feb 2014 15:58:43 -0500
31cddd
Subject: [PATCH] use fw_path prefix when fallback searching for grub
f4c76c
 config
f4c76c
f4c76c
When PXE booting via UEFI firmware, grub was searching for grub.cfg
f4c76c
in the fw_path directory where the grub application was found. If
f4c76c
that didn't exist, a fallback search would look for config file names
f4c76c
based on MAC and IP address. However, the search would look in the
f4c76c
prefix directory which may not be the same fw_path. This patch
f4c76c
changes that behavior to use the fw_path directory for the fallback
f4c76c
search. Only if fw_path is NULL will the prefix directory be searched.
f4c76c
f4c76c
Signed-off-by: Mark Salter <msalter@redhat.com>
f4c76c
---
f4c76c
 grub-core/normal/main.c | 5 +++--
f4c76c
 1 file changed, 3 insertions(+), 2 deletions(-)
f4c76c
f4c76c
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
ec4acb
index 0ce59fdc3f0..a3713efcd90 100644
f4c76c
--- a/grub-core/normal/main.c
f4c76c
+++ b/grub-core/normal/main.c
f4c76c
@@ -343,7 +343,7 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)),
f4c76c
       char *config;
f4c76c
       const char *prefix, *fw_path;
f4c76c
 
f4c76c
-      fw_path = grub_env_get ("fw_path");
f4c76c
+      prefix = fw_path = grub_env_get ("fw_path");
f4c76c
       if (fw_path)
f4c76c
 	{
f4c76c
 	  config = grub_xasprintf ("%s/grub.cfg", fw_path);
f4c76c
@@ -366,7 +366,8 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)),
f4c76c
 	    }
f4c76c
 	}
f4c76c
 
f4c76c
-      prefix = grub_env_get ("prefix");
f4c76c
+      if (! prefix)
f4c76c
+	      prefix = grub_env_get ("prefix");
f4c76c
       if (prefix)
f4c76c
         {
f4c76c
           grub_size_t config_len;