Description: Fall back to i386-pc if booted using EFI but -efi is missing It may be possible, particularly in recovery situations, to be booted using EFI on x86 when only the i386-pc target is installed. There's nothing actually stopping us installing i386-pc from an EFI environment, and it's better than returning a confusing error. Author: Colin Watson Forwarded: no Last-Update: 2013-12-20 Index: b/grub-core/osdep/linux/platform.c =================================================================== --- a/grub-core/osdep/linux/platform.c +++ b/grub-core/osdep/linux/platform.c @@ -19,10 +19,12 @@ #include #include +#include #include #include #include #include +#include #include #include @@ -76,11 +78,24 @@ grub_util_info ("Looking for /sys/firmware/efi .."); if (is_not_empty_directory ("/sys/firmware/efi")) { + const char *pkglibdir = grub_util_get_pkglibdir (); + const char *platform; + char *pd; + int found; + grub_util_info ("...found"); if (is_64_kernel ()) - return "x86_64-efi"; + platform = "x86_64-efi"; + else + platform = "i386-efi"; + + pd = grub_util_path_concat (2, pkglibdir, platform); + found = grub_util_is_directory (pd); + free (pd); + if (found) + return platform; else - return "i386-efi"; + grub_util_info ("... but %s platform not available", platform); } grub_util_info ("... not found. Looking for /proc/device-tree ..");