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