|
|
c0334e |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
c0334e |
From: Jan Hlavac <jhlavac@redhat.com>
|
|
|
c0334e |
Date: Fri, 20 Nov 2020 23:51:47 +0100
|
|
|
c0334e |
Subject: [PATCH] grub-install: disable support for EFI platforms
|
|
|
c0334e |
|
|
|
c0334e |
For each platform, GRUB is shipped as a kernel image and a set of
|
|
|
c0334e |
modules. These files are then used by the grub-install utility to
|
|
|
c0334e |
install GRUB on a specific device. However, in order to support UEFI
|
|
|
c0334e |
Secure Boot, the resulting EFI binary must be signed by a recognized
|
|
|
c0334e |
private key. For this reason, for EFI platforms, most distributions also
|
|
|
c0334e |
ship prebuilt EFI binaries signed by a distribution-specific private
|
|
|
c0334e |
key. In this case, however, the grub-install utility should not be used
|
|
|
c0334e |
because it would overwrite the signed EFI binary.
|
|
|
c0334e |
|
|
|
c0334e |
The current fix is suboptimal because it preserves all EFI-related code.
|
|
|
c0334e |
A better solution could be to modularize the code and provide a
|
|
|
c0334e |
build-time option.
|
|
|
c0334e |
|
|
|
c0334e |
Resolves: rhbz#1737444
|
|
|
c0334e |
|
|
|
c0334e |
Signed-off-by: Jan Hlavac <jhlavac@redhat.com>
|
|
|
c0334e |
---
|
|
|
c0334e |
util/grub-install.c | 35 ++++++++++++++++-------------------
|
|
|
c0334e |
docs/grub.texi | 7 +++++++
|
|
|
c0334e |
util/grub-install.8 | 4 +++-
|
|
|
c0334e |
3 files changed, 26 insertions(+), 20 deletions(-)
|
|
|
c0334e |
|
|
|
c0334e |
diff --git a/util/grub-install.c b/util/grub-install.c
|
|
|
f6e916 |
index 3bf0e063a..65bb2f99e 100644
|
|
|
c0334e |
--- a/util/grub-install.c
|
|
|
c0334e |
+++ b/util/grub-install.c
|
|
|
c0334e |
@@ -888,6 +888,22 @@ main (int argc, char *argv[])
|
|
|
c0334e |
|
|
|
c0334e |
platform = grub_install_get_target (grub_install_source_directory);
|
|
|
c0334e |
|
|
|
c0334e |
+ switch (platform)
|
|
|
c0334e |
+ {
|
|
|
c0334e |
+ case GRUB_INSTALL_PLATFORM_ARM_EFI:
|
|
|
c0334e |
+ case GRUB_INSTALL_PLATFORM_ARM64_EFI:
|
|
|
c0334e |
+ case GRUB_INSTALL_PLATFORM_I386_EFI:
|
|
|
c0334e |
+ case GRUB_INSTALL_PLATFORM_IA64_EFI:
|
|
|
c0334e |
+ case GRUB_INSTALL_PLATFORM_X86_64_EFI:
|
|
|
c0334e |
+ is_efi = 1;
|
|
|
c0334e |
+ grub_util_error (_("this utility cannot be used for EFI platforms"
|
|
|
c0334e |
+ " because it does not support UEFI Secure Boot"));
|
|
|
c0334e |
+ break;
|
|
|
c0334e |
+ default:
|
|
|
c0334e |
+ is_efi = 0;
|
|
|
c0334e |
+ break;
|
|
|
c0334e |
+ }
|
|
|
c0334e |
+
|
|
|
c0334e |
{
|
|
|
c0334e |
char *platname = grub_install_get_platform_name (platform);
|
|
|
c0334e |
fprintf (stderr, _("Installing for %s platform.\n"), platname);
|
|
|
c0334e |
@@ -994,26 +1010,7 @@ main (int argc, char *argv[])
|
|
|
c0334e |
grub_hostfs_init ();
|
|
|
c0334e |
grub_host_init ();
|
|
|
c0334e |
|
|
|
c0334e |
- switch (platform)
|
|
|
c0334e |
- {
|
|
|
c0334e |
- case GRUB_INSTALL_PLATFORM_I386_EFI:
|
|
|
c0334e |
- case GRUB_INSTALL_PLATFORM_X86_64_EFI:
|
|
|
c0334e |
- case GRUB_INSTALL_PLATFORM_ARM_EFI:
|
|
|
c0334e |
- case GRUB_INSTALL_PLATFORM_ARM64_EFI:
|
|
|
c0334e |
- case GRUB_INSTALL_PLATFORM_IA64_EFI:
|
|
|
c0334e |
- is_efi = 1;
|
|
|
c0334e |
- break;
|
|
|
c0334e |
- default:
|
|
|
c0334e |
- is_efi = 0;
|
|
|
c0334e |
- break;
|
|
|
c0334e |
-
|
|
|
c0334e |
- /* pacify warning. */
|
|
|
c0334e |
- case GRUB_INSTALL_PLATFORM_MAX:
|
|
|
c0334e |
- break;
|
|
|
c0334e |
- }
|
|
|
c0334e |
-
|
|
|
c0334e |
/* Find the EFI System Partition. */
|
|
|
c0334e |
-
|
|
|
c0334e |
if (is_efi)
|
|
|
c0334e |
{
|
|
|
c0334e |
grub_fs_t fs;
|
|
|
c0334e |
diff --git a/docs/grub.texi b/docs/grub.texi
|
|
|
f6e916 |
index c54bee316..fa11cc0af 100644
|
|
|
c0334e |
--- a/docs/grub.texi
|
|
|
c0334e |
+++ b/docs/grub.texi
|
|
|
c0334e |
@@ -6185,6 +6185,13 @@ grub2-install @var{install_device}
|
|
|
c0334e |
The device name @var{install_device} is an OS device name or a GRUB
|
|
|
c0334e |
device name.
|
|
|
c0334e |
|
|
|
c0334e |
+In order to support UEFI Secure Boot, the resulting GRUB EFI binary must
|
|
|
c0334e |
+be signed by a recognized private key. For this reason, for EFI
|
|
|
c0334e |
+platforms, most distributions also ship prebuilt GRUB EFI binaries
|
|
|
c0334e |
+signed by a distribution-specific private key. In this case, however,
|
|
|
c0334e |
+@command{grub2-install} should not be used because it would overwrite
|
|
|
c0334e |
+the signed EFI binary.
|
|
|
c0334e |
+
|
|
|
c0334e |
@command{grub2-install} accepts the following options:
|
|
|
c0334e |
|
|
|
c0334e |
@table @option
|
|
|
c0334e |
diff --git a/util/grub-install.8 b/util/grub-install.8
|
|
|
f6e916 |
index 76272a39d..02371930f 100644
|
|
|
c0334e |
--- a/util/grub-install.8
|
|
|
c0334e |
+++ b/util/grub-install.8
|
|
|
c0334e |
@@ -1,4 +1,4 @@
|
|
|
c0334e |
-.TH GRUB-INSTALL 1 "Wed Feb 26 2014"
|
|
|
c0334e |
+.TH GRUB-INSTALL 1 "Fri Nov 20 2020"
|
|
|
c0334e |
.SH NAME
|
|
|
c0334e |
\fBgrub-install\fR \(em Install GRUB on a device.
|
|
|
c0334e |
|
|
|
c0334e |
@@ -31,6 +31,8 @@
|
|
|
c0334e |
.SH DESCRIPTION
|
|
|
c0334e |
\fBgrub-install\fR installs GRUB onto a device. This includes copying GRUB images into the target directory (generally \fI/boot/grub\fR), and on some platforms may also include installing GRUB onto a boot sector.
|
|
|
c0334e |
|
|
|
c0334e |
+In order to support UEFI Secure Boot, the resulting GRUB EFI binary must be signed by a recognized private key. For this reason, for EFI platforms, most distributions also ship prebuilt GRUB EFI binaries signed by a distribution-specific private key. In this case, however, the \fBgrub-install\fR utility should not be used because it would overwrite the signed EFI binary.
|
|
|
c0334e |
+
|
|
|
c0334e |
.SH OPTIONS
|
|
|
c0334e |
.TP
|
|
|
c0334e |
\fB--modules\fR=\fIMODULES\fR\!
|