Hi,

As FAT is basically a case insensitive file system, we should ignore
case when opening files.

For example, normally efi image would be placed in EFI/grub directory.
After startup, the prefix would be set to something like
(hd0,1)/EFI/grub/. But inside grub, it convert pathname to lowercase,
EFI would become efi, so grub can't open it anymore. With this patch,
fat ignore case, so we can access files using /efi/grub as well as
/EFI/grub.

-- 
Bean
diff --git a/fs/fat.c b/fs/fat.c
index 63979b4..fb89e3a 100644
--- a/fs/fat.c
+++ b/fs/fat.c
@@ -35,6 +35,8 @@
 #define GRUB_FAT_ATTR_DIRECTORY	0x10
 #define GRUB_FAT_ATTR_ARCHIVE	0x20
 
+#define GRUB_FAT_MAXPATH	260
+
 #define GRUB_FAT_ATTR_LONG_NAME	(GRUB_FAT_ATTR_READ_ONLY \
 				 | GRUB_FAT_ATTR_HIDDEN \
 				 | GRUB_FAT_ATTR_SYSTEM \
@@ -629,7 +631,7 @@ grub_fat_find_dir (grub_disk_t disk, struct grub_fat_data *data,
 	  if (hook (filename, dir.attr & GRUB_FAT_ATTR_DIRECTORY))
 	    break;
 	}
-      else if (grub_strcmp (dirname, filename) == 0)
+      else if (grub_strncasecmp (dirname, filename, GRUB_FAT_MAXPATH) == 0)
 	{
 	  if (call_hook)
 	    hook (filename, dir.attr & GRUB_FAT_ATTR_DIRECTORY);
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to