dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

Blame SOURCES/0189-Output-a-menu-entry-for-firmware-setup-on-UEFI-FastB.patch

d9d99f
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
d9d99f
From: Steve Langasek <steve.langasek@ubuntu.com>
d9d99f
Date: Mon, 13 Jan 2014 12:13:12 +0000
d9d99f
Subject: [PATCH] Output a menu entry for firmware setup on UEFI FastBoot
d9d99f
 systems
d9d99f
d9d99f
If fastboot is enabled in the BIOS then often it is not possible to
d9d99f
enter the firmware setup menu, add a menu entry for this.
d9d99f
d9d99f
hdegoede: Cherry picked the Ubuntu patch from:
d9d99f
https://git.launchpad.net/~ubuntu-core-dev/grub/+git/ubuntu/tree/debian/patches/uefi_firmware_setup.patch
d9d99f
Into the Fedora / RH grub version
d9d99f
d9d99f
According to:
d9d99f
https://git.launchpad.net/~ubuntu-core-dev/grub/+git/ubuntu/tree/debian/copyright
d9d99f
The patch is licensed under GPL-3+
d9d99f
d9d99f
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
d9d99f
---
d9d99f
 Makefile.util.def               |  6 ++++++
d9d99f
 util/grub.d/30_uefi-firmware.in | 46 +++++++++++++++++++++++++++++++++++++++++
d9d99f
 2 files changed, 52 insertions(+)
d9d99f
 create mode 100644 util/grub.d/30_uefi-firmware.in
d9d99f
d9d99f
diff --git a/Makefile.util.def b/Makefile.util.def
d9d99f
index 0fdfdd91fb0..5a8c390a1da 100644
d9d99f
--- a/Makefile.util.def
d9d99f
+++ b/Makefile.util.def
d9d99f
@@ -529,6 +529,12 @@ script = {
d9d99f
   installdir = grubconf;
d9d99f
 };
d9d99f
 
d9d99f
+script = {
d9d99f
+  name = '30_uefi-firmware';
d9d99f
+  common = util/grub.d/30_uefi-firmware.in;
d9d99f
+  installdir = grubconf;
d9d99f
+};
d9d99f
+
d9d99f
 script = {
d9d99f
   name = '40_custom';
d9d99f
   common = util/grub.d/40_custom.in;
d9d99f
diff --git a/util/grub.d/30_uefi-firmware.in b/util/grub.d/30_uefi-firmware.in
d9d99f
new file mode 100644
d9d99f
index 00000000000..3c9f533d8c6
d9d99f
--- /dev/null
d9d99f
+++ b/util/grub.d/30_uefi-firmware.in
d9d99f
@@ -0,0 +1,46 @@
d9d99f
+#! /bin/sh
d9d99f
+set -e
d9d99f
+
d9d99f
+# grub-mkconfig helper script.
d9d99f
+# Copyright (C) 2012  Free Software Foundation, Inc.
d9d99f
+#
d9d99f
+# GRUB is free software: you can redistribute it and/or modify
d9d99f
+# it under the terms of the GNU General Public License as published by
d9d99f
+# the Free Software Foundation, either version 3 of the License, or
d9d99f
+# (at your option) any later version.
d9d99f
+#
d9d99f
+# GRUB is distributed in the hope that it will be useful,
d9d99f
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
d9d99f
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
d9d99f
+# GNU General Public License for more details.
d9d99f
+#
d9d99f
+# You should have received a copy of the GNU General Public License
d9d99f
+# along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
d9d99f
+
d9d99f
+prefix="@prefix@"
d9d99f
+exec_prefix="@exec_prefix@"
d9d99f
+datarootdir="@datarootdir@"
d9d99f
+
d9d99f
+export TEXTDOMAIN=@PACKAGE@
d9d99f
+export TEXTDOMAINDIR="@localedir@"
d9d99f
+
d9d99f
+. "@datadir@/@PACKAGE@/grub-mkconfig_lib"
d9d99f
+
d9d99f
+efi_vars_dir=/sys/firmware/efi/vars
d9d99f
+EFI_GLOBAL_VARIABLE=8be4df61-93ca-11d2-aa0d-00e098032b8c
d9d99f
+OsIndications="$efi_vars_dir/OsIndicationsSupported-$EFI_GLOBAL_VARIABLE/data"
d9d99f
+
d9d99f
+if [ -e "$OsIndications" ] && \
d9d99f
+   [ "$(( $(printf 0x%x \'"$(cat $OsIndications | cut -b1)") & 1 ))" = 1 ]; then
d9d99f
+  LABEL="System setup"
d9d99f
+
d9d99f
+  gettext_printf "Adding boot menu entry for EFI firmware configuration\n" >&2
d9d99f
+
d9d99f
+  onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
d9d99f
+
d9d99f
+  cat << EOF
d9d99f
+menuentry '$LABEL' \$menuentry_id_option 'uefi-firmware' {
d9d99f
+	fwsetup
d9d99f
+}
d9d99f
+EOF
d9d99f
+fi