grub-install: Check for arm-efi as a default target

Much like on x86, we can work out if the system is running on top
of EFI firmware. If so, return "arm-efi". If not, fall back to
"arm-uboot" as previously.

Heavily inspired by the existing code for x86.

Signed-off-by: Steve McIntyre <93sam@debian.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
Steve McIntyre 2019-02-11 02:42:34 +00:00 committed by Vincent Batts
parent 38854336c2
commit 65a251af6f
4 changed files with 32 additions and 1 deletions

View file

@ -97,6 +97,28 @@ read_platform_size (void)
return ret;
}
const char *
grub_install_get_default_arm_platform (void)
{
/*
* On Linux, we need the efivars kernel modules. If no EFI is available this
* module just does nothing besides a small hello and if we detect efi we'll
* load it anyway later. So it should be safe to try to load it here.
*/
grub_util_exec_redirect_all ((const char * []){ "modprobe", "efivars", NULL },
NULL, NULL, "/dev/null");
grub_util_info ("Looking for /sys/firmware/efi ..");
if (is_not_empty_directory ("/sys/firmware/efi"))
{
grub_util_info ("...found");
return "arm-efi";
}
grub_util_info ("... not found");
return "arm-uboot";
}
const char *
grub_install_get_default_x86_platform (void)
{