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

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