Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1jLp7C-000531-6L for mharc-grub-devel@gnu.org; Tue, 07 Apr 2020 10:22:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54371) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLp79-00052v-HI for grub-devel@gnu.org; Tue, 07 Apr 2020 10:22:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jLp77-0003QO-U9 for grub-devel@gnu.org; Tue, 07 Apr 2020 10:22:07 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:24404 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 1jLp77-0003Nh-QM for grub-devel@gnu.org; Tue, 07 Apr 2020 10:22:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586269325; 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=QLK/Ffn65QR/97m89o3W7Wy96+hAF65fV0iUAmvJ3wk=; b=AmqcuIItXKSwsgoGavXBM21pdBNJqG1UhuVV08q7LShj4/bqmugA0y9uW4nZzWFpzck3Re MYQWCW8gBtCgi8HQJLjUOIAXsJmbhveE+rI7K18sBuZNfJMEIJ4ifnHQDhh7vm+3JLIhlA VQkWYLEWcIgW8zQSpUxHlYw+EKA6Nlo= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-128-BOzybUF5NE2zLG98bRdrqQ-1; Tue, 07 Apr 2020 10:21:53 -0400 X-MC-Unique: BOzybUF5NE2zLG98bRdrqQ-1 Received: by mail-wr1-f71.google.com with SMTP id y6so1979901wrq.21 for ; Tue, 07 Apr 2020 07:21:53 -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=JDfCHMLqhmHtExD3jd4oF2ihjSPS/BJmATnvFREeVx8=; b=suFSR8TEsfSoTFqed42L9aJoQsPvjowuMr3+mmvScfiuyxMPlImVQloTt3pw7YXcDy 0Hw8v4+h1zq4rqt9tCzGvaMlTdfVxEOgZ10wpU3gPl7LC/RAXR4ljcYxYUoDfsN9Csya nLH5K7x/EanF9JWnt/al1R90gvNDd3MfrrMzReBs9XUGPsnLbwa4b8GSKrEPxhMrfZjq OcaBUQEUd/0X6KXu9jO1wjDNa+XR1VhnWi4/MXPc1ubY1wUi6OFDWkV0bTLwm+/TdlGk n+J7dsVKH8udZmjqMxn8K9qxkpzd8y0PX4MqNcPOH3DR3UBGSVOPWm2lqL41xu8JaU1/ jzvg== X-Gm-Message-State: AGi0Pua+OGDHofRxmA6rn1yRmUxxtW7MMboR3XV/dKJdVnVr18btZ0Qy sKp3lPshV884gwY2q5lCSTIV1Lpa1v913xdAlMmd6mvF8FFWBMUONFWrRNgfn4NM9xQSTuVsBuc VgIHIyl9sd1M= X-Received: by 2002:a5d:4cc7:: with SMTP id c7mr2901034wrt.375.1586269310861; Tue, 07 Apr 2020 07:21:50 -0700 (PDT) X-Google-Smtp-Source: APiQypIQy++9Y+ceZ5RaEY5OOFl0TQoFyfkRJVQavWxKDDmL7pUfjNLoReSxJxveiIk7OsG221hBGQ== X-Received: by 2002:a5d:4cc7:: with SMTP id c7mr2901017wrt.375.1586269310627; Tue, 07 Apr 2020 07:21:50 -0700 (PDT) Received: from minerva.redhat.com ([2a01:c50f:ab80:6700:527f:85b3:5615:ff0b]) by smtp.gmail.com with ESMTPSA id t67sm2781366wmg.40.2020.04.07.07.21.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Apr 2020 07:21:49 -0700 (PDT) From: Javier Martinez Canillas To: grub-devel@gnu.org Cc: Steve Langasek , Dimitri John Ledkov , Hans de Goede , Javier Martinez Canillas Subject: [PATCH v2] templates: Output a menu entry for firmware setup on UEFI FastBoot systems Date: Tue, 7 Apr 2020 16:21:39 +0200 Message-Id: <20200407142139.316705-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: Tue, 07 Apr 2020 14:22:08 -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 --- 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..8bdbceef4ee --- /dev/null +++ b/util/grub.d/30_uefi-firmware.in @@ -0,0 +1,44 @@ +#! /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@" + +. "$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