2018-07-12 14:56:34 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2016-03-04 18:32:29 +00:00
|
|
|
From: Peter Jones <pjones@redhat.com>
|
|
|
|
Date: Tue, 6 Oct 2015 16:09:25 -0400
|
2018-07-10 19:08:14 +00:00
|
|
|
Subject: [PATCH] Make any of the loaders that link in efi mode honor secure
|
|
|
|
boot.
|
2016-03-04 18:32:29 +00:00
|
|
|
|
|
|
|
And in this case "honor" means "even if somebody does link this in, they
|
|
|
|
won't register commands if SB is enabled."
|
|
|
|
|
|
|
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
|
|
|
---
|
2021-03-12 21:54:28 +00:00
|
|
|
grub-core/commands/iorw.c | 7 +++++++
|
|
|
|
grub-core/commands/memrw.c | 7 +++++++
|
|
|
|
grub-core/kern/dl.c | 3 ++-
|
|
|
|
grub-core/kern/efi/efi.c | 34 ----------------------------------
|
|
|
|
grub-core/loader/efi/appleloader.c | 7 +++++++
|
2016-03-04 18:32:29 +00:00
|
|
|
grub-core/loader/efi/chainloader.c | 1 +
|
2021-03-12 21:54:28 +00:00
|
|
|
grub-core/loader/i386/bsd.c | 7 +++++++
|
|
|
|
grub-core/loader/i386/linux.c | 7 +++++++
|
|
|
|
grub-core/loader/i386/pc/linux.c | 7 +++++++
|
|
|
|
grub-core/loader/multiboot.c | 7 +++++++
|
|
|
|
grub-core/loader/xnu.c | 7 +++++++
|
2016-03-04 18:32:29 +00:00
|
|
|
include/grub/efi/efi.h | 1 -
|
2016-08-25 18:42:57 +00:00
|
|
|
include/grub/ia64/linux.h | 0
|
|
|
|
include/grub/mips/linux.h | 0
|
|
|
|
include/grub/powerpc/linux.h | 0
|
|
|
|
include/grub/sparc64/linux.h | 0
|
2021-03-12 21:54:28 +00:00
|
|
|
16 files changed, 59 insertions(+), 36 deletions(-)
|
2016-08-25 18:42:57 +00:00
|
|
|
create mode 100644 include/grub/ia64/linux.h
|
|
|
|
create mode 100644 include/grub/mips/linux.h
|
2016-04-07 14:44:51 +00:00
|
|
|
create mode 100644 include/grub/powerpc/linux.h
|
2016-08-25 18:42:57 +00:00
|
|
|
create mode 100644 include/grub/sparc64/linux.h
|
2016-03-04 18:32:29 +00:00
|
|
|
|
|
|
|
diff --git a/grub-core/commands/iorw.c b/grub-core/commands/iorw.c
|
2022-03-31 21:21:43 +00:00
|
|
|
index 584baec8f..7b2999b14 100644
|
2016-03-04 18:32:29 +00:00
|
|
|
--- a/grub-core/commands/iorw.c
|
|
|
|
+++ b/grub-core/commands/iorw.c
|
2021-03-12 21:54:28 +00:00
|
|
|
@@ -24,6 +24,7 @@
|
2016-03-04 18:32:29 +00:00
|
|
|
#include <grub/cpu/io.h>
|
|
|
|
#include <grub/i18n.h>
|
2021-03-12 21:54:28 +00:00
|
|
|
#include <grub/lockdown.h>
|
2016-03-04 18:32:29 +00:00
|
|
|
+#include <grub/efi/sb.h>
|
|
|
|
|
|
|
|
GRUB_MOD_LICENSE ("GPLv3+");
|
|
|
|
|
2021-03-12 21:54:28 +00:00
|
|
|
@@ -119,6 +120,9 @@ grub_cmd_write (grub_command_t cmd, int argc, char **argv)
|
2016-03-04 18:32:29 +00:00
|
|
|
|
|
|
|
GRUB_MOD_INIT(memrw)
|
|
|
|
{
|
2021-03-12 21:54:28 +00:00
|
|
|
+ if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED)
|
2016-03-04 18:32:29 +00:00
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
cmd_read_byte =
|
|
|
|
grub_register_extcmd ("inb", grub_cmd_read, 0,
|
|
|
|
N_("PORT"), N_("Read 8-bit value from PORT."),
|
2021-03-12 21:54:28 +00:00
|
|
|
@@ -147,6 +151,9 @@ GRUB_MOD_INIT(memrw)
|
2016-03-04 18:32:29 +00:00
|
|
|
|
|
|
|
GRUB_MOD_FINI(memrw)
|
|
|
|
{
|
2021-03-12 21:54:28 +00:00
|
|
|
+ if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED)
|
2016-03-04 18:32:29 +00:00
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
grub_unregister_extcmd (cmd_read_byte);
|
|
|
|
grub_unregister_extcmd (cmd_read_word);
|
|
|
|
grub_unregister_extcmd (cmd_read_dword);
|
|
|
|
diff --git a/grub-core/commands/memrw.c b/grub-core/commands/memrw.c
|
2022-03-31 21:21:43 +00:00
|
|
|
index d401a6db0..39cf3a06d 100644
|
2016-03-04 18:32:29 +00:00
|
|
|
--- a/grub-core/commands/memrw.c
|
|
|
|
+++ b/grub-core/commands/memrw.c
|
2021-03-12 21:54:28 +00:00
|
|
|
@@ -23,6 +23,7 @@
|
2016-03-04 18:32:29 +00:00
|
|
|
#include <grub/env.h>
|
|
|
|
#include <grub/i18n.h>
|
2021-03-12 21:54:28 +00:00
|
|
|
#include <grub/lockdown.h>
|
2016-03-04 18:32:29 +00:00
|
|
|
+#include <grub/efi/sb.h>
|
|
|
|
|
|
|
|
GRUB_MOD_LICENSE ("GPLv3+");
|
|
|
|
|
2021-03-12 21:54:28 +00:00
|
|
|
@@ -121,6 +122,9 @@ grub_cmd_write (grub_command_t cmd, int argc, char **argv)
|
2016-03-04 18:32:29 +00:00
|
|
|
|
|
|
|
GRUB_MOD_INIT(memrw)
|
|
|
|
{
|
2021-03-12 21:54:28 +00:00
|
|
|
+ if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED)
|
2016-03-04 18:32:29 +00:00
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
cmd_read_byte =
|
|
|
|
grub_register_extcmd ("read_byte", grub_cmd_read, 0,
|
|
|
|
N_("ADDR"), N_("Read 8-bit value from ADDR."),
|
2021-03-12 21:54:28 +00:00
|
|
|
@@ -149,6 +153,9 @@ GRUB_MOD_INIT(memrw)
|
2016-03-04 18:32:29 +00:00
|
|
|
|
|
|
|
GRUB_MOD_FINI(memrw)
|
|
|
|
{
|
2021-03-12 21:54:28 +00:00
|
|
|
+ if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED)
|
2016-03-04 18:32:29 +00:00
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
grub_unregister_extcmd (cmd_read_byte);
|
|
|
|
grub_unregister_extcmd (cmd_read_word);
|
|
|
|
grub_unregister_extcmd (cmd_read_dword);
|
2018-07-17 14:20:54 +00:00
|
|
|
diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c
|
2022-03-31 21:21:43 +00:00
|
|
|
index b71493709..7afb9e6f7 100644
|
2018-07-17 14:20:54 +00:00
|
|
|
--- a/grub-core/kern/dl.c
|
|
|
|
+++ b/grub-core/kern/dl.c
|
|
|
|
@@ -32,6 +32,7 @@
|
|
|
|
#include <grub/env.h>
|
|
|
|
#include <grub/cache.h>
|
|
|
|
#include <grub/i18n.h>
|
|
|
|
+#include <grub/efi/sb.h>
|
|
|
|
|
|
|
|
/* Platforms where modules are in a readonly area of memory. */
|
|
|
|
#if defined(GRUB_MACHINE_QEMU)
|
2021-03-12 21:54:28 +00:00
|
|
|
@@ -704,7 +705,7 @@ grub_dl_load_file (const char *filename)
|
|
|
|
grub_dl_t mod = 0;
|
|
|
|
|
|
|
|
#ifdef GRUB_MACHINE_EFI
|
|
|
|
- if (grub_efi_secure_boot ())
|
|
|
|
+ if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED)
|
|
|
|
{
|
|
|
|
#if 0
|
|
|
|
/* This is an error, but grub2-mkconfig still generates a pile of
|
2016-03-04 18:32:29 +00:00
|
|
|
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
|
2022-03-31 21:21:43 +00:00
|
|
|
index 4a2259aa1..8cff7be02 100644
|
2016-03-04 18:32:29 +00:00
|
|
|
--- a/grub-core/kern/efi/efi.c
|
|
|
|
+++ b/grub-core/kern/efi/efi.c
|
2021-03-12 21:54:28 +00:00
|
|
|
@@ -286,40 +286,6 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid,
|
|
|
|
return grub_efi_get_variable_with_attributes (var, guid, datasize_out, data_out, NULL);
|
2016-03-04 18:32:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
-grub_efi_boolean_t
|
|
|
|
-grub_efi_secure_boot (void)
|
|
|
|
-{
|
|
|
|
- grub_efi_guid_t efi_var_guid = GRUB_EFI_GLOBAL_VARIABLE_GUID;
|
|
|
|
- grub_size_t datasize;
|
|
|
|
- char *secure_boot = NULL;
|
|
|
|
- char *setup_mode = NULL;
|
|
|
|
- grub_efi_boolean_t ret = 0;
|
|
|
|
-
|
|
|
|
- secure_boot = grub_efi_get_variable("SecureBoot", &efi_var_guid, &datasize);
|
|
|
|
- if (datasize != 1 || !secure_boot)
|
2018-07-17 14:20:54 +00:00
|
|
|
- {
|
|
|
|
- grub_dprintf ("secureboot", "No SecureBoot variable\n");
|
|
|
|
- goto out;
|
|
|
|
- }
|
|
|
|
- grub_dprintf ("secureboot", "SecureBoot: %d\n", *secure_boot);
|
2016-03-04 18:32:29 +00:00
|
|
|
-
|
|
|
|
- setup_mode = grub_efi_get_variable("SetupMode", &efi_var_guid, &datasize);
|
|
|
|
- if (datasize != 1 || !setup_mode)
|
2018-07-17 14:20:54 +00:00
|
|
|
- {
|
|
|
|
- grub_dprintf ("secureboot", "No SetupMode variable\n");
|
|
|
|
- goto out;
|
|
|
|
- }
|
|
|
|
- grub_dprintf ("secureboot", "SetupMode: %d\n", *setup_mode);
|
2016-03-04 18:32:29 +00:00
|
|
|
-
|
|
|
|
- if (*secure_boot && !*setup_mode)
|
|
|
|
- ret = 1;
|
|
|
|
-
|
|
|
|
- out:
|
|
|
|
- grub_free (secure_boot);
|
|
|
|
- grub_free (setup_mode);
|
|
|
|
- return ret;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
#pragma GCC diagnostic ignored "-Wcast-align"
|
|
|
|
|
|
|
|
/* Search the mods section from the PE32/PE32+ image. This code uses
|
|
|
|
diff --git a/grub-core/loader/efi/appleloader.c b/grub-core/loader/efi/appleloader.c
|
2022-03-31 21:21:43 +00:00
|
|
|
index 74888c463..585f2b573 100644
|
2016-03-04 18:32:29 +00:00
|
|
|
--- a/grub-core/loader/efi/appleloader.c
|
|
|
|
+++ b/grub-core/loader/efi/appleloader.c
|
|
|
|
@@ -24,6 +24,7 @@
|
|
|
|
#include <grub/misc.h>
|
|
|
|
#include <grub/efi/api.h>
|
|
|
|
#include <grub/efi/efi.h>
|
|
|
|
+#include <grub/efi/sb.h>
|
|
|
|
#include <grub/command.h>
|
|
|
|
#include <grub/i18n.h>
|
|
|
|
|
|
|
|
@@ -227,6 +228,9 @@ static grub_command_t cmd;
|
|
|
|
|
|
|
|
GRUB_MOD_INIT(appleloader)
|
|
|
|
{
|
2021-03-12 21:54:28 +00:00
|
|
|
+ if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED)
|
2016-03-04 18:32:29 +00:00
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
cmd = grub_register_command ("appleloader", grub_cmd_appleloader,
|
|
|
|
N_("[OPTS]"),
|
|
|
|
/* TRANSLATORS: This command is used on EFI to
|
|
|
|
@@ -238,5 +242,8 @@ GRUB_MOD_INIT(appleloader)
|
|
|
|
|
|
|
|
GRUB_MOD_FINI(appleloader)
|
|
|
|
{
|
2021-03-12 21:54:28 +00:00
|
|
|
+ if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED)
|
2016-03-04 18:32:29 +00:00
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
grub_unregister_command (cmd);
|
|
|
|
}
|
|
|
|
diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c
|
2022-03-31 21:21:43 +00:00
|
|
|
index e6a8d4ad0..07c493789 100644
|
2016-03-04 18:32:29 +00:00
|
|
|
--- a/grub-core/loader/efi/chainloader.c
|
|
|
|
+++ b/grub-core/loader/efi/chainloader.c
|
|
|
|
@@ -34,6 +34,7 @@
|
|
|
|
#include <grub/efi/disk.h>
|
|
|
|
#include <grub/efi/pe32.h>
|
|
|
|
#include <grub/efi/linux.h>
|
|
|
|
+#include <grub/efi/sb.h>
|
|
|
|
#include <grub/command.h>
|
|
|
|
#include <grub/i18n.h>
|
|
|
|
#include <grub/net.h>
|
|
|
|
diff --git a/grub-core/loader/i386/bsd.c b/grub-core/loader/i386/bsd.c
|
2022-03-31 21:21:43 +00:00
|
|
|
index 5f3290ce1..54befc266 100644
|
2016-03-04 18:32:29 +00:00
|
|
|
--- a/grub-core/loader/i386/bsd.c
|
|
|
|
+++ b/grub-core/loader/i386/bsd.c
|
2021-03-12 21:54:28 +00:00
|
|
|
@@ -40,6 +40,7 @@
|
2016-03-04 18:32:29 +00:00
|
|
|
#ifdef GRUB_MACHINE_PCBIOS
|
|
|
|
#include <grub/machine/int.h>
|
|
|
|
#endif
|
|
|
|
+#include <grub/efi/sb.h>
|
|
|
|
|
|
|
|
GRUB_MOD_LICENSE ("GPLv3+");
|
|
|
|
|
2021-03-12 21:54:28 +00:00
|
|
|
@@ -2137,6 +2138,9 @@ static grub_command_t cmd_netbsd_module_elf, cmd_openbsd_ramdisk;
|
2016-03-04 18:32:29 +00:00
|
|
|
|
|
|
|
GRUB_MOD_INIT (bsd)
|
|
|
|
{
|
2021-03-12 21:54:28 +00:00
|
|
|
+ if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED)
|
2016-03-04 18:32:29 +00:00
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
/* Net and OpenBSD kernels are often compressed. */
|
|
|
|
grub_dl_load ("gzio");
|
|
|
|
|
2021-03-12 21:54:28 +00:00
|
|
|
@@ -2176,6 +2180,9 @@ GRUB_MOD_INIT (bsd)
|
2016-03-04 18:32:29 +00:00
|
|
|
|
|
|
|
GRUB_MOD_FINI (bsd)
|
|
|
|
{
|
2021-03-12 21:54:28 +00:00
|
|
|
+ if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED)
|
2016-03-04 18:32:29 +00:00
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
grub_unregister_extcmd (cmd_freebsd);
|
|
|
|
grub_unregister_extcmd (cmd_openbsd);
|
|
|
|
grub_unregister_extcmd (cmd_netbsd);
|
|
|
|
diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c
|
2022-03-31 21:21:43 +00:00
|
|
|
index dccf3bb30..4aeb0e4b9 100644
|
2016-03-04 18:32:29 +00:00
|
|
|
--- a/grub-core/loader/i386/linux.c
|
|
|
|
+++ b/grub-core/loader/i386/linux.c
|
2021-03-12 21:54:28 +00:00
|
|
|
@@ -37,6 +37,7 @@
|
2016-03-04 18:32:29 +00:00
|
|
|
#include <grub/linux.h>
|
2019-08-15 06:01:31 +00:00
|
|
|
#include <grub/machine/kernel.h>
|
2021-03-12 21:54:28 +00:00
|
|
|
#include <grub/safemath.h>
|
2016-03-04 18:32:29 +00:00
|
|
|
+#include <grub/efi/sb.h>
|
|
|
|
|
|
|
|
GRUB_MOD_LICENSE ("GPLv3+");
|
|
|
|
|
2021-03-12 21:54:28 +00:00
|
|
|
@@ -1138,6 +1139,9 @@ static grub_command_t cmd_linux, cmd_initrd;
|
2016-03-04 18:32:29 +00:00
|
|
|
|
|
|
|
GRUB_MOD_INIT(linux)
|
|
|
|
{
|
2021-03-12 21:54:28 +00:00
|
|
|
+ if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED)
|
2016-03-04 18:32:29 +00:00
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
cmd_linux = grub_register_command ("linux", grub_cmd_linux,
|
|
|
|
0, N_("Load Linux."));
|
|
|
|
cmd_initrd = grub_register_command ("initrd", grub_cmd_initrd,
|
2021-03-12 21:54:28 +00:00
|
|
|
@@ -1147,6 +1151,9 @@ GRUB_MOD_INIT(linux)
|
2016-03-04 18:32:29 +00:00
|
|
|
|
|
|
|
GRUB_MOD_FINI(linux)
|
|
|
|
{
|
2021-03-12 21:54:28 +00:00
|
|
|
+ if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED)
|
2016-03-04 18:32:29 +00:00
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
grub_unregister_command (cmd_linux);
|
|
|
|
grub_unregister_command (cmd_initrd);
|
|
|
|
}
|
|
|
|
diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c
|
2022-03-31 21:21:43 +00:00
|
|
|
index 4b1750e36..e3fa1221e 100644
|
2016-03-04 18:32:29 +00:00
|
|
|
--- a/grub-core/loader/i386/pc/linux.c
|
|
|
|
+++ b/grub-core/loader/i386/pc/linux.c
|
2021-03-12 21:54:28 +00:00
|
|
|
@@ -36,6 +36,7 @@
|
2016-03-04 18:32:29 +00:00
|
|
|
#include <grub/lib/cmdline.h>
|
|
|
|
#include <grub/linux.h>
|
2021-03-12 21:54:28 +00:00
|
|
|
#include <grub/safemath.h>
|
2016-03-04 18:32:29 +00:00
|
|
|
+#include <grub/efi/sb.h>
|
|
|
|
|
|
|
|
GRUB_MOD_LICENSE ("GPLv3+");
|
|
|
|
|
2021-03-12 21:54:28 +00:00
|
|
|
@@ -487,6 +488,9 @@ static grub_command_t cmd_linux, cmd_linux16, cmd_initrd, cmd_initrd16;
|
2016-03-04 18:32:29 +00:00
|
|
|
|
|
|
|
GRUB_MOD_INIT(linux16)
|
|
|
|
{
|
2021-03-12 21:54:28 +00:00
|
|
|
+ if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED)
|
2016-03-04 18:32:29 +00:00
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
cmd_linux =
|
2018-07-17 14:20:54 +00:00
|
|
|
grub_register_command ("linux", grub_cmd_linux,
|
2016-03-04 18:32:29 +00:00
|
|
|
0, N_("Load Linux."));
|
2021-03-12 21:54:28 +00:00
|
|
|
@@ -504,6 +508,9 @@ GRUB_MOD_INIT(linux16)
|
2016-03-04 18:32:29 +00:00
|
|
|
|
|
|
|
GRUB_MOD_FINI(linux16)
|
|
|
|
{
|
2021-03-12 21:54:28 +00:00
|
|
|
+ if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED)
|
2016-03-04 18:32:29 +00:00
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
grub_unregister_command (cmd_linux);
|
2018-07-17 14:20:54 +00:00
|
|
|
grub_unregister_command (cmd_linux16);
|
2016-03-04 18:32:29 +00:00
|
|
|
grub_unregister_command (cmd_initrd);
|
|
|
|
diff --git a/grub-core/loader/multiboot.c b/grub-core/loader/multiboot.c
|
2022-03-31 21:21:43 +00:00
|
|
|
index facb13f3d..47e481f45 100644
|
2016-03-04 18:32:29 +00:00
|
|
|
--- a/grub-core/loader/multiboot.c
|
|
|
|
+++ b/grub-core/loader/multiboot.c
|
2018-07-10 19:08:14 +00:00
|
|
|
@@ -50,6 +50,7 @@
|
2016-03-04 18:32:29 +00:00
|
|
|
#include <grub/video.h>
|
|
|
|
#include <grub/memory.h>
|
|
|
|
#include <grub/i18n.h>
|
|
|
|
+#include <grub/efi/sb.h>
|
|
|
|
|
|
|
|
GRUB_MOD_LICENSE ("GPLv3+");
|
|
|
|
|
2019-08-15 06:01:31 +00:00
|
|
|
@@ -444,6 +445,9 @@ static grub_command_t cmd_multiboot, cmd_module;
|
2016-03-04 18:32:29 +00:00
|
|
|
|
|
|
|
GRUB_MOD_INIT(multiboot)
|
|
|
|
{
|
2021-03-12 21:54:28 +00:00
|
|
|
+ if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED)
|
2016-03-04 18:32:29 +00:00
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
cmd_multiboot =
|
|
|
|
#ifdef GRUB_USE_MULTIBOOT2
|
|
|
|
grub_register_command ("multiboot2", grub_cmd_multiboot,
|
2019-08-15 06:01:31 +00:00
|
|
|
@@ -464,6 +468,9 @@ GRUB_MOD_INIT(multiboot)
|
2016-03-04 18:32:29 +00:00
|
|
|
|
|
|
|
GRUB_MOD_FINI(multiboot)
|
|
|
|
{
|
2021-03-12 21:54:28 +00:00
|
|
|
+ if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED)
|
2016-03-04 18:32:29 +00:00
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
grub_unregister_command (cmd_multiboot);
|
|
|
|
grub_unregister_command (cmd_module);
|
|
|
|
}
|
|
|
|
diff --git a/grub-core/loader/xnu.c b/grub-core/loader/xnu.c
|
2022-03-31 21:21:43 +00:00
|
|
|
index 1c0cf6a43..baa54e652 100644
|
2016-03-04 18:32:29 +00:00
|
|
|
--- a/grub-core/loader/xnu.c
|
|
|
|
+++ b/grub-core/loader/xnu.c
|
2021-03-12 21:54:28 +00:00
|
|
|
@@ -35,6 +35,7 @@
|
2016-03-04 18:32:29 +00:00
|
|
|
#include <grub/i18n.h>
|
2019-08-15 06:01:31 +00:00
|
|
|
#include <grub/verify.h>
|
2021-03-12 21:54:28 +00:00
|
|
|
#include <grub/safemath.h>
|
2016-03-04 18:32:29 +00:00
|
|
|
+#include <grub/efi/sb.h>
|
|
|
|
|
|
|
|
GRUB_MOD_LICENSE ("GPLv3+");
|
|
|
|
|
2021-03-12 21:54:28 +00:00
|
|
|
@@ -1497,6 +1498,9 @@ static grub_extcmd_t cmd_splash;
|
2016-03-04 18:32:29 +00:00
|
|
|
|
|
|
|
GRUB_MOD_INIT(xnu)
|
|
|
|
{
|
2021-03-12 21:54:28 +00:00
|
|
|
+ if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED)
|
2016-03-04 18:32:29 +00:00
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
cmd_kernel = grub_register_command ("xnu_kernel", grub_cmd_xnu_kernel, 0,
|
|
|
|
N_("Load XNU image."));
|
|
|
|
cmd_kernel64 = grub_register_command ("xnu_kernel64", grub_cmd_xnu_kernel64,
|
2021-03-12 21:54:28 +00:00
|
|
|
@@ -1540,6 +1544,9 @@ GRUB_MOD_INIT(xnu)
|
2016-03-04 18:32:29 +00:00
|
|
|
|
|
|
|
GRUB_MOD_FINI(xnu)
|
|
|
|
{
|
2021-03-12 21:54:28 +00:00
|
|
|
+ if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED)
|
2016-03-04 18:32:29 +00:00
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
#ifndef GRUB_MACHINE_EMU
|
|
|
|
grub_unregister_command (cmd_resume);
|
|
|
|
#endif
|
|
|
|
diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h
|
2022-03-31 21:21:43 +00:00
|
|
|
index 6295df85f..585fa6662 100644
|
2016-03-04 18:32:29 +00:00
|
|
|
--- a/include/grub/efi/efi.h
|
|
|
|
+++ b/include/grub/efi/efi.h
|
2021-03-12 21:54:28 +00:00
|
|
|
@@ -91,7 +91,6 @@ EXPORT_FUNC (grub_efi_set_variable) (const char *var,
|
2016-03-04 18:32:29 +00:00
|
|
|
const grub_efi_guid_t *guid,
|
|
|
|
void *data,
|
|
|
|
grub_size_t datasize);
|
|
|
|
-grub_efi_boolean_t EXPORT_FUNC (grub_efi_secure_boot) (void);
|
|
|
|
int
|
|
|
|
EXPORT_FUNC (grub_efi_compare_device_paths) (const grub_efi_device_path_t *dp1,
|
|
|
|
const grub_efi_device_path_t *dp2);
|
2016-08-25 18:42:57 +00:00
|
|
|
diff --git a/include/grub/ia64/linux.h b/include/grub/ia64/linux.h
|
|
|
|
new file mode 100644
|
2022-03-31 21:21:43 +00:00
|
|
|
index 000000000..e69de29bb
|
2016-08-25 18:42:57 +00:00
|
|
|
diff --git a/include/grub/mips/linux.h b/include/grub/mips/linux.h
|
|
|
|
new file mode 100644
|
2022-03-31 21:21:43 +00:00
|
|
|
index 000000000..e69de29bb
|
2016-04-07 14:44:51 +00:00
|
|
|
diff --git a/include/grub/powerpc/linux.h b/include/grub/powerpc/linux.h
|
|
|
|
new file mode 100644
|
2022-03-31 21:21:43 +00:00
|
|
|
index 000000000..e69de29bb
|
2016-08-25 18:42:57 +00:00
|
|
|
diff --git a/include/grub/sparc64/linux.h b/include/grub/sparc64/linux.h
|
|
|
|
new file mode 100644
|
2022-03-31 21:21:43 +00:00
|
|
|
index 000000000..e69de29bb
|