From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1oXgf1-0000Hv-Iq for mharc-grub-devel@gnu.org; Mon, 12 Sep 2022 06:27:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33998) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oXgez-00008u-43 for grub-devel@gnu.org; Mon, 12 Sep 2022 06:27:25 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:32682) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oXget-0007ml-1z for grub-devel@gnu.org; Mon, 12 Sep 2022 06:27:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1662978435; 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: in-reply-to:in-reply-to:references:references; bh=+4StsMgCjsAiGRGMp9clotrljEH4/NKBSWhRRrYK6lM=; b=AAA75AUBX/JYww0QgWG3RJY83dyUTNLrqIdwt+PsbdH+qyxbRscpQeeKBVXpnA7QrHhHEi xOdrw9/V7xMl33oQGPiADCNZhDADb5qkMgO/VjMRORnl6XZEoCojhZ7vRkwLQJQ/CibVY5 MmvpOvssi/IeWsXR9MC48BiWU2ZZbSI= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-203-cSEqzD6xMt-xJ9g51cZVfw-1; Mon, 12 Sep 2022 06:27:06 -0400 X-MC-Unique: cSEqzD6xMt-xJ9g51cZVfw-1 Received: by mail-qk1-f200.google.com with SMTP id g6-20020a05620a40c600b006bbdeb0b1f2so7030350qko.22 for ; Mon, 12 Sep 2022 03:27:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date; bh=+4StsMgCjsAiGRGMp9clotrljEH4/NKBSWhRRrYK6lM=; b=2uDkPXJhpYw2m8/Bh3VHLAneaD59B356M6D1bZJ08ww18eHxsQ0MQ3B8Y4wL/K1U6m HJFDsjPnSvtyc12JMBTzwkp27seqWnLGIeUsBXffO85xfUkZEMd9CA2HNvzZB08Nyb9g 3aiOwqqxuyTOQhKWyexV0MQGzOuyfpzKOSGpBoetpID6D6mA7ZXjjPYoAvzeKi69w7pN WcKvaDdioEU5IUvCBJS8lq09ib0J2wc6hNX6lu7MV4Me5/oEPwbR2EfDbZkPWUm7hacn 0RAkXUTcyFUWX/p0p21Zm3ZRPi+8QwLndh9CZKduVVzdD8xrqxDM1VJcbIAGoAnhq/05 28bQ== X-Gm-Message-State: ACgBeo2rNi6zymX+cS6UE51GfECCrZSqtQ3CU1lDAzgfT2rbhMfoHlyc OBlk1srP25oLXYJa1TLGax7lou/6umbVUT0xMQeOFvFin4AdasEcQNZIqxbs53CtMXubGyPyx3Q ado0MeTf6eNw= X-Received: by 2002:a05:620a:2809:b0:6bc:5e0d:d7b1 with SMTP id f9-20020a05620a280900b006bc5e0dd7b1mr18362796qkp.545.1662978426111; Mon, 12 Sep 2022 03:27:06 -0700 (PDT) X-Google-Smtp-Source: AA6agR48fsBigcW1N0d4vCmfzCAN8FdCpUI6etbnIzxf8KEKblfopwiYPa4vT2twaOxcy7ErNRf0oA== X-Received: by 2002:a05:620a:2809:b0:6bc:5e0d:d7b1 with SMTP id f9-20020a05620a280900b006bc5e0dd7b1mr18362781qkp.545.1662978425769; Mon, 12 Sep 2022 03:27:05 -0700 (PDT) Received: from localhost (pool-96-252-89-222.bstnma.fios.verizon.net. [96.252.89.222]) by smtp.gmail.com with ESMTPSA id s5-20020a05620a254500b006b9b7879964sm7319545qko.28.2022.09.12.03.27.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Sep 2022 03:27:05 -0700 (PDT) From: Robbie Harwood To: Felipe Contreras , grub-devel@gnu.org Cc: Felipe Contreras , Javier Martinez Canillas , Dimitri John Ledkov Subject: Re: [PATCH] efi: add feature_efifwsetup_check In-Reply-To: <20220910144833.2986-1-felipe.contreras@gmail.com> References: <20220910144833.2986-1-felipe.contreras@gmail.com> Date: Mon, 12 Sep 2022 06:26:59 -0400 Message-ID: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Received-SPF: pass client-ip=170.10.129.124; envelope-from=rharwood@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Sep 2022 10:27:25 -0000 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Felipe Contreras writes: > In commit 26031d3b1 (efi: Don't display a uefi-firmware entry if it's > not supported, 2022-08-18) an unconditional call to `fwsetup > --is-supported` was added which causes the system to reboot if > `grub-install` hasn't been run because `fwsetup` doesn't have the new > option. > > This is a huge regression. > > To make sure `fwsetup --is-supported` works we add a new feature that > only newer GRUB installations have: feature_efifwsetup_check. > > If the feature is available the current behavior is maintained (`fwsetup > --is-supported`) but if it's not available the behavior before 26031d3b1 > is maintained (unconditionally show the menu entry on EFI platforms). > > Also do this only on the EFI platform as Dimitri John Ledkov suggested. > > Cc: Javier Martinez Canillas > Cc: Robbie Harwood > Cc: Dimitri John Ledkov > Signed-off-by: Felipe Contreras > --- > grub-core/normal/main.c | 2 +- > util/grub.d/30_uefi-firmware.in | 16 +++++++++++----- > 2 files changed, 12 insertions(+), 6 deletions(-) > > diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c > index cb0e8e7fd..072e8e681 100644 > --- a/grub-core/normal/main.c > +++ b/grub-core/normal/main.c > @@ -506,7 +506,7 @@ static const char *features[] =3D { > "feature_chainloader_bpb", "feature_ntldr", "feature_platform_search_h= int", > "feature_default_font_path", "feature_all_video_module", > "feature_menuentry_id", "feature_menuentry_options", "feature_200_fina= l", > - "feature_nativedisk_cmd", "feature_timeout_style" > + "feature_nativedisk_cmd", "feature_timeout_style", "feature_efifwsetup= _check" > }; >=20=20 > GRUB_MOD_INIT(normal) > diff --git a/util/grub.d/30_uefi-firmware.in b/util/grub.d/30_uefi-firmwa= re.in > index c1731e5bb..c23d84741 100644 > --- a/util/grub.d/30_uefi-firmware.in > +++ b/util/grub.d/30_uefi-firmware.in > @@ -31,10 +31,16 @@ LABEL=3D"UEFI Firmware Settings" > gettext_printf "Adding boot menu entry for UEFI Firmware Settings ...\n"= >&2 >=20=20 > cat << EOF > -fwsetup --is-supported > -if [ "\$grub_platform" =3D "efi" -a "\$?" =3D 0 ]; then > - menuentry '$LABEL' \$menuentry_id_option 'uefi-firmware' { > - fwsetup > - } > +if [ "\$grub_platform" =3D "efi" ]; then > + if [ "\$feature_efifwsetup_check" =3D "y" ] ; then > + fwsetup --is-supported > + else > + true > + fi > + if [ "\$?" =3D 0 ]; then > + menuentry '$LABEL' \$menuentry_id_option 'uefi-firmware' { > + fwsetup > + } > + fi > fi > EOF > --=20 > 2.37.3 Thanks for your interest, but I prefer Javier's proposed approach. Be well, =2D-Robbie --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJIBAEBCgAyFiEEA5qc6hnelQjDaHWqJTL5F2qVpEIFAmMfCXMUHHJoYXJ3b29k QHJlZGhhdC5jb20ACgkQJTL5F2qVpEJS2BAAu7uT0ODlWqkXcVi8/ueduPqchZCR UH62lxqAR2kULtXjvTvbE/oWyg72NN3qXAImvcHPomQNeDln2ps9U+p6TUwWb5c9 ROMpZ5YaZaqiDzTNZjhkCxjlEw/OCRq1qg5ZI+55iI49s7vZtA8XF6+4QCCQYa/c oKvDCiRidu12U1so1rhptksSIUYWMoahU4YoPRZ3eQOaaPbkt33ww5iIX16pD898 VnJu5iT4wabFmlfpi6P0ya2gcFhiF2tuMv9uPLnPPPBqw6sRdDdT5C7rHEsWAoKR UUxANPWLO+0StJSmr86e1K2Igd27/5zMbUUHubVZvr1Y8FXvHLxtsoBbRaSyXkt7 ddz4tS1/MCH02dOeVmCiMIrB9t9vzCRh0uZMbsl1Y41H7OC1+nSkhOtKclYyRwdP UgDM6N0yZy7p1lT6KaCLCQxhjkTKu4SNpQHFKAwfXD7VaoFHsw5cQemK8yFmNV2/ 7658pp/y7PRkl0JZxudGomkvi0GCm/Z+Hxs4i0Jcqi70okSv1r2LMYKYFTCgWTec 0IB5GJiki1CasdQM9cMqG43QFXVufUzB4o6hjL4Zn9VtDoeV6zsaTTjhJ4UHB1ko JzqRQeHKSsxug0PUc8T2bV9tq8n1m2MCUzxsHerR+mTvHhAelEFn4ygRrOBgltN6 U0fn3GRvKQgbfqk= =HwGk -----END PGP SIGNATURE----- --=-=-=--