grub2/debian/patches/install_efi_fallback.patch
Colin Watson 2933c9f7a1 Import replacement CRC operations from libgcrypt
Repack upstream tarball without grub-core/lib/libgcrypt*/cipher/crc.c,
and provide a replacement implementation backported from more recent
versions of libgcrypt.

Closes: #745409
2018-02-16 11:08:25 +00:00

63 lines
1.9 KiB
Diff

From 6adb5d9c36756bf65e8f0d8c95749c427c79d8e1 Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Mon, 13 Jan 2014 12:13:05 +0000
Subject: 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.
Forwarded: no
Last-Update: 2013-12-20
Patch-Name: install_efi_fallback.patch
---
grub-core/osdep/linux/platform.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/grub-core/osdep/linux/platform.c b/grub-core/osdep/linux/platform.c
index 775b6c031..35f1bcc0e 100644
--- a/grub-core/osdep/linux/platform.c
+++ b/grub-core/osdep/linux/platform.c
@@ -19,10 +19,12 @@
#include <config.h>
#include <grub/util/install.h>
+#include <grub/emu/config.h>
#include <grub/emu/exec.h>
#include <grub/emu/misc.h>
#include <sys/types.h>
#include <dirent.h>
+#include <stdlib.h>
#include <string.h>
#include <sys/utsname.h>
@@ -113,11 +115,24 @@ grub_install_get_default_x86_platform (void)
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 (read_platform_size() == 64)
- 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 ..");