Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1jOfLW-0007Ag-Uc for mharc-grub-devel@gnu.org; Wed, 15 Apr 2020 06:32:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44376) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jOfLU-00077K-4g for grub-devel@gnu.org; Wed, 15 Apr 2020 06:32:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jOfLS-0008TL-CA for grub-devel@gnu.org; Wed, 15 Apr 2020 06:32:40 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:59865 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 1jOfLS-0008SS-7o for grub-devel@gnu.org; Wed, 15 Apr 2020 06:32:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586946757; 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=4xx+GHRZ4j2HL4bG0oJH1gUSNokPcq1TzmRyA6MBKrg=; b=Nh6JUS17uJr1ZPrge42DMx7jQMD+JjUpTaJgkuVeZdysin05ewpxtIx15MvFMl86ibDzib sF6bDaFq7OWNvkZ93nuoBHETrK1yuVyUEunmG0k0YIB7B2J68Z1qkndMDo5u4GOWo+sidk wuLQaD4sDAo7YfSB+xMGB41klpFimuM= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-192-nzvbvQaXMJuDExYDxQmsrQ-1; Wed, 15 Apr 2020 06:32:33 -0400 X-MC-Unique: nzvbvQaXMJuDExYDxQmsrQ-1 Received: by mail-wr1-f70.google.com with SMTP id m15so10418790wrb.0 for ; Wed, 15 Apr 2020 03:32:33 -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=CFrTRE5c/DL3VjOz4apvJIfjkcPjoTZCP8CjrANn1zA=; b=V2GAAzTbFqzYYdx/eOPhp7ZnhXc0upRESwRgu+26HuvgWkuPDotGQH4vqn2gIxkdd5 FUkWJsC4LyPOAQoH46h2VJ93PwzxEXUKEIq9XPgp6H1Ce5TjFiM2uOFipMzNAg4WpOmY RnJhRmmHrl+eplrWVpRXMP+E4MXtZO6xSqQgM0uR4alBgc2jtaSrl40puRF7r6vqlvkR gb0pjxvKftD3/i5cb2bKdqp51PjVKdfK2aERiPLLvUfCawL/SeBUqdS2I+h5s3Hq8nw9 2ZvAMUPncCVDDCORRLwRpH164UJHcLGkJd5i0fJiub8dmenVX9ClFxRb//vkJ6bCCH9j FCYA== X-Gm-Message-State: AGi0PubhdepOo/uUBZNNM49Dvl9BsZuDqAB8SEyv2IfjW2FTLQb+CRtZ hcxvRuACgTGQ27koy/giPd8DX7wMXg5qGgoFFXnYx2Md7QLYX5axUxERIWRQY/YW1FlzwWuvyUf O6s7GgIX3fFw= X-Received: by 2002:a05:6000:f:: with SMTP id h15mr4161856wrx.408.1586946752272; Wed, 15 Apr 2020 03:32:32 -0700 (PDT) X-Google-Smtp-Source: APiQypK+Sp+NRTb93XwE2CvvHHL3OjCWApdX9kjAWkSqkjNE+7WVqAh6eZE0ypc8wMl+LEOYe7jZPA== X-Received: by 2002:a05:6000:f:: with SMTP id h15mr4161831wrx.408.1586946752020; Wed, 15 Apr 2020 03:32:32 -0700 (PDT) Received: from minerva.redhat.com ([2a01:c50f:ab80:6700:527f:85b3:5615:ff0b]) by smtp.gmail.com with ESMTPSA id i16sm4898134wrm.8.2020.04.15.03.32.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Apr 2020 03:32:31 -0700 (PDT) From: Javier Martinez Canillas To: grub-devel@gnu.org Cc: Steve Langasek , Dimitri John Ledkov , Hans de Goede , Javier Martinez Canillas , Daniel Kiper Subject: [PATCH v3] templates: Output a menu entry for firmware setup on UEFI FastBoot systems Date: Wed, 15 Apr 2020 12:32:17 +0200 Message-Id: <20200415103217.1894249-1-javierm@redhat.com> X-Mailer: git-send-email 2.25.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: Wed, 15 Apr 2020 10:32:41 -0000 From: Steve Langasek The fwsetup command allows to reboot into the EFI firmware setup menu, add a template to include a menu entry on EFI systems that makes use of that command to reboot into the EFI firmware settings. This is useful for users since the hotkey to enter into the EFI setup menu may not be the same on all systems so users can use the menu entry without needing to figure out what key needs to be pressed. Also, if fastboot is enabled in the BIOS then often it is not possible to enter the firmware setup menu. So the entry is again useful for this case. Signed-off-by: Steve Langasek Signed-off-by: Dimitri John Ledkov Signed-off-by: Hans de Goede Signed-off-by: Javier Martinez Canillas Reviewed-by: Daniel Kiper --- Changes in v3: - Fix date in copyright notice. Changes in v2: - Improve commit message. - Squash latest changes from the Ubuntu branch. - Address issues pointed out by Daniel Kiper in v1. Patch-cc: Daniel Kiper Makefile.util.def | 6 +++++ util/grub.d/30_uefi-firmware.in | 44 +++++++++++++++++++++++++++++++++ 2 files changed, 50 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..d344d3883d7 --- /dev/null +++ b/util/grub.d/30_uefi-firmware.in @@ -0,0 +1,44 @@ +#! /bin/sh +set -e + +# grub-mkconfig helper script. +# Copyright (C) 2020 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@" + +. "$pkgdatadir/grub-mkconfig_lib" + +EFI_VARS_DIR=3D/sys/firmware/efi/efivars +EFI_GLOBAL_VARIABLE=3D8be4df61-93ca-11d2-aa0d-00e098032b8c +OS_INDICATIONS=3D"$EFI_VARS_DIR/OsIndicationsSupported-$EFI_GLOBAL_VARIABL= E" + +if [ -e "$OS_INDICATIONS" ] && \ + [ "$(( $(printf 0x%x \'"$(cat $OS_INDICATIONS | cut -b5)"\') & 1 ))" = =3D 1 ]; then + LABEL=3D"UEFI Firmware Settings" + + gettext_printf "Adding boot menu entry for UEFI Firmware Settings ...\n"= >&2 + + cat << EOF +menuentry '$LABEL' \$menuentry_id_option 'uefi-firmware' { +=09fwsetup +} +EOF +fi --=20 2.25.1