From: Mark Salter Date: Mon, 9 Jan 2023 23:30:39 +0000 (-0500) Subject: use fw_path prefix when fallback searching for grub config X-Git-Tag: archive/raspbian/2.12-8+rpi1~1^2~33 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=45be1ee8c70ea577508c82aaf92a515573a99695;p=grub2.git use fw_path prefix when fallback searching for grub config When PXE booting via UEFI firmware, grub was searching for grub.cfg in the fw_path directory where the grub application was found. If that didn't exist, a fallback search would look for config file names based on MAC and IP address. However, the search would look in the prefix directory which may not be the same fw_path. This patch changes that behavior to use the fw_path directory for the fallback search. Only if fw_path is NULL will the prefix directory be searched. Signed-off-by: Mark Salter Signed-off-by: Robbie Harwood Gbp-Pq: Topic network Gbp-Pq: Name use-fw_path-prefix-when-fallback-searching-for-grub-config.patch --- diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c index b1947c7..c0255a9 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -322,7 +322,7 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), char *config; const char *prefix, *fw_path; - fw_path = grub_env_get ("fw_path"); + prefix = fw_path = grub_env_get ("fw_path"); if (fw_path) { config = grub_xasprintf ("%s/grub.cfg", fw_path); @@ -345,7 +345,8 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), } } - prefix = grub_env_get ("prefix"); + if (!prefix) + prefix = grub_env_get ("prefix"); if (prefix) { grub_size_t config_len;