Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1jCpn0-0002QQ-6c for mharc-grub-devel@gnu.org; Fri, 13 Mar 2020 15:16:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42269) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jCpmx-0002QK-JL for grub-devel@gnu.org; Fri, 13 Mar 2020 15:16:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jCpmw-0002y7-9J for grub-devel@gnu.org; Fri, 13 Mar 2020 15:16:07 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:20208 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jCpmw-0002wH-4x for grub-devel@gnu.org; Fri, 13 Mar 2020 15:16:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584126965; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=j1JQsMILRoJRBq0BWwDjJgu3eo55ICNQskuO8lkmfsQ=; b=KnNWVjBqNGckx37HrKJwk8gV05YVzJAPJeqe0y6/lbtNieCZcj34NAU3ZOtPggLkz+ZpiB Olzck8rkC0YbvvGCxepMSGuEZUyJsyPG1LwBuQmMlL9WnVpjmkwpUpvWvttMtnutGuHac9 3uzNcsUcS/vyHFSF2KjxyXESOMDIhVw= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-464-d-RBflU9Ov6e7GSyvrhm8Q-1; Fri, 13 Mar 2020 15:16:01 -0400 X-MC-Unique: d-RBflU9Ov6e7GSyvrhm8Q-1 Received: by mail-wm1-f71.google.com with SMTP id g26so3315612wmk.6 for ; Fri, 13 Mar 2020 12:16:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=prjKKZRr+PkAgfaw9IFE9T9Uj/uMbG3obZqhD2/Z2YE=; b=lJKZyhIqwzTwjmEz8e9kIjRXnrDlD/PxG62E4Oji0exQOvYlUchkdQfynM9Sg3gIu0 x/wL0TnSiltxSs3Y2h3bXkIMWWqBK60uvpNBHZ96lNrfuqm/5J/AcQ39SlvNAeCrQD2C vfO0iHCtIOtN2DEsXvnnDlxBabSIomzrKhBvPIQVS+DkzffkpUSycT4lWPP+J4sD2m+F VvmBbWgOJRlx09bSCxVFuwnSV7ILkP61ut6c8WTq/9SscdZ/4eDfLe3Lt4dqC2WlnqDL IR2qGfT8uU6lC6AnBAfevQwXAHu/z2bewdgKMA1CaPEsbxhFPfAAjCFpijzY6oS3zfWW uYMQ== X-Gm-Message-State: ANhLgQ2R1xadlBG7lntNuU4sRzcmTAKWzeKW76TIt6awB2QCSEfuOl59 XlNKR1K/9uTEmKZMW7G/TlWPATqg9C7Vi1FX2HJDI8N8J3br9Xa/aHVEA6H1wKEy9DhBfqVZcyn gisMGQ90bHo8= X-Received: by 2002:a1c:648b:: with SMTP id y133mr3392378wmb.173.1584126958627; Fri, 13 Mar 2020 12:15:58 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvy3KIrZOM/4xcJSJYEX7i8gt8b5wRf5BWsFNj2PAPbC+4u4OEvjRNqv4XoQIK2YIDAEqEskg== X-Received: by 2002:a1c:648b:: with SMTP id y133mr3392354wmb.173.1584126958311; Fri, 13 Mar 2020 12:15:58 -0700 (PDT) Received: from minerva.redhat.com ([2a01:c50f:ab80:6700:527f:85b3:5615:ff0b]) by smtp.gmail.com with ESMTPSA id t81sm17741387wmb.15.2020.03.13.12.15.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Mar 2020 12:15:57 -0700 (PDT) From: Javier Martinez Canillas To: grub-devel@gnu.org Cc: Daniel Kiper , Hans de Goede , Steve Langasek , Javier Martinez Canillas Subject: [PATCH 08/10] templates: Output a menu entry for firmware setup on UEFI FastBoot systems Date: Fri, 13 Mar 2020 20:15:53 +0100 Message-Id: <20200313191553.828329-1-javierm@redhat.com> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.61 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Mar 2020 19:16:09 -0000 From: Steve Langasek If fastboot is enabled in the BIOS then often it is not possible to enter the firmware setup menu, add a menu entry for this. hdegoede: Cherry picked the Ubuntu patch from: https://git.launchpad.net/~ubuntu-core-dev/grub/+git/ubuntu/tree/debian/pat= ches/uefi_firmware_setup.patch Into the Fedora / RH grub version According to: https://git.launchpad.net/~ubuntu-core-dev/grub/+git/ubuntu/tree/debian/cop= yright The patch is licensed under GPL-3+ Signed-off-by: Steve Langasek [hdegoede: fix use with /sys/firmware/efi/efivars] Signed-off-by: Hans de Goede Signed-off-by: Javier Martinez Canillas --- Makefile.util.def | 6 +++++ util/grub.d/30_uefi-firmware.in | 46 +++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 util/grub.d/30_uefi-firmware.in diff --git a/Makefile.util.def b/Makefile.util.def index 1e0799a68f9..d9e2bd84de8 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -515,6 +515,12 @@ script =3D { installdir =3D grubconf; }; =20 +script =3D { + name =3D '30_uefi-firmware'; + common =3D util/grub.d/30_uefi-firmware.in; + installdir =3D grubconf; +}; + script =3D { name =3D '40_custom'; common =3D util/grub.d/40_custom.in; diff --git a/util/grub.d/30_uefi-firmware.in b/util/grub.d/30_uefi-firmware= .in new file mode 100644 index 00000000000..93ececffea7 --- /dev/null +++ b/util/grub.d/30_uefi-firmware.in @@ -0,0 +1,46 @@ +#! /bin/sh +set -e + +# grub-mkconfig helper script. +# Copyright (C) 2012 Free Software Foundation, Inc. +# +# GRUB is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# GRUB is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GRUB. If not, see . + +prefix=3D"@prefix@" +exec_prefix=3D"@exec_prefix@" +datarootdir=3D"@datarootdir@" + +export TEXTDOMAIN=3D@PACKAGE@ +export TEXTDOMAINDIR=3D"@localedir@" + +. "@datadir@/@PACKAGE@/grub-mkconfig_lib" + +efi_vars_dir=3D/sys/firmware/efi/efivars +EFI_GLOBAL_VARIABLE=3D8be4df61-93ca-11d2-aa0d-00e098032b8c +OsIndications=3D"$efi_vars_dir/OsIndicationsSupported-$EFI_GLOBAL_VARIABLE= " + +if [ -e "$OsIndications" ] && \ + [ "$(( $(printf 0x%x \'"$(cat $OsIndications | cut -b5)") & 1 ))" =3D 1= ]; then + LABEL=3D"System setup" + + gettext_printf "Adding boot menu entry for EFI firmware configuration\n"= >&2 + + onstr=3D"$(gettext_printf "(on %s)" "${DEVICE}")" + + cat << EOF +menuentry '$LABEL' \$menuentry_id_option 'uefi-firmware' { +=09fwsetup +} +EOF +fi --=20 2.24.1