Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1m0gyP-0007dU-OW for mharc-grub-devel@gnu.org; Tue, 06 Jul 2021 05:02:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57794) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m0gyO-0007Zq-Db for grub-devel@gnu.org; Tue, 06 Jul 2021 05:02:32 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:59640) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m0gyM-00028Y-9Y for grub-devel@gnu.org; Tue, 06 Jul 2021 05:02:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625562149; 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=sdAbgw7KJFgsJarO64vE4mI9y2tutRdNajNId/Y+Svs=; b=LwXX5sYN2UmwLggSnbxvT3Bry0BmH0ZisgaXZnrxAiUUk3f2BCguKbVBIGx/NP4gVeAaN3 pe5LP29X3y6yE9gudwGEGCjW8COEwoJyfyB4F4jofGBKWpxttT3mFMlNB68S9YLzqiBH+R R9Qxw0Q5IMJxJgL5HMGkJSziUJmJmZY= 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-61-ttq8Lwl9PCielhZmomPAOA-1; Tue, 06 Jul 2021 05:02:26 -0400 X-MC-Unique: ttq8Lwl9PCielhZmomPAOA-1 Received: by mail-wm1-f71.google.com with SMTP id d16-20020a1c73100000b02901f2d21e46efso637300wmb.6 for ; Tue, 06 Jul 2021 02:02:26 -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=sdAbgw7KJFgsJarO64vE4mI9y2tutRdNajNId/Y+Svs=; b=SrCemivtGaumEppBrJuT41iVY8CYdORdrkuj05G59MBbU5CZk68LJ+/7ZUTQwm2For R52DEAkcIQgnRCLAp/YsBIZubdGacsRFXJ1+r+PegJ6PctOGRU36EF7YGTKrL7hcYHNX Qew0BcuGyqQR2DHmd4VpgBpcTOdIjj7ZB/judWgI70GQT2PxwrKhNFI24MUDdAxKi45+ y9ecWTuwFSbS34PVeZlMjrOAVIheTgpEP21VFFkFXYmJeX1qg/63mX4dZ//NtS9nMRr8 yaWDJ7UNCMwuSKdHNlWytuhvOyXYuPY2OH/ZcT6qjwgUM9HHrcechwk1yUgqVM8tti0r mxCQ== X-Gm-Message-State: AOAM5328/kMJkbRy1uzddATvxgDzCvYpEf0b6HyKPLomVaC9MepzT+UB 9abBMmANGD7Z9EUDb0gnFbHLCfCuMbr6lC6uHZlcBjCcvwFzyqryx5A2JhZplvu2qPh114rPf1i KspPLxRTUfa9+KMantmQzeek73QOfRvmc9Ab6CuWg3LTLRASH7qJDfxpolXeuIg== X-Received: by 2002:a5d:498a:: with SMTP id r10mr6245391wrq.110.1625562144943; Tue, 06 Jul 2021 02:02:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw8IZ3BkLgEYLW8KWZeGktBaVMtHgpxVn7b37TxZGoKAisoK/vLZW6gO9Jriau+L4b2APuumw== X-Received: by 2002:a5d:498a:: with SMTP id r10mr6245362wrq.110.1625562144728; Tue, 06 Jul 2021 02:02:24 -0700 (PDT) Received: from minerva.redhat.com ([92.176.231.106]) by smtp.gmail.com with ESMTPSA id g15sm12224705wmh.16.2021.07.06.02.02.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jul 2021 02:02:24 -0700 (PDT) From: Javier Martinez Canillas To: grub-devel@gnu.org Cc: Peter Robinson , Alberto Ruiz , Daniel Kiper , Paul Whalen , Javier Martinez Canillas Subject: [PATCH 0/2] Improve logic to check for fwsetup support Date: Tue, 6 Jul 2021 11:02:13 +0200 Message-Id: <20210706090215.3724658-1-javierm@redhat.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=javierm@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Received-SPF: pass client-ip=216.205.24.124; envelope-from=javierm@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.442, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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, 06 Jul 2021 09:02:32 -0000 The fwsetup command can be used for rebooting to the firmware setup UI but this can only be used on machines that have support for this feature. Curently, this is achieved by checking in the 30_uefi-firmware template if OsIndicationsSupported is present and has EFI_OS_INDICATIONS_BOOT_TO_FW_UI set. This is again checked in the efifwsetup module init function and the fwsetup command is only registered if that condition is meet. But this logic has a comple of problems, since it assumes that the config file is always generated in the same machine than the one that's booted. If that's not the case, any of the following situations could happen: * A config file generated on a non-EFI machine, will not have the fwsetup menu entry even when booting with EFI. * A config file generated on an EFI machine, will have a fwsetup even when is not booted with EFI. * A config file generated on an EFI machine that supports rebooting to the firmware setup, will have the fwsetup even if booting on an EFI machine that does not support that feature. To prevent these, let's change when the check is done. Instead of doing it at config generation time, do it at runtime with grub_platform == "efi" and when the command is executed. That way, the 30_uefi-firmware template won't make any assumption about the firmware support of the machine that's booted. Best regards, Javier Javier Martinez Canillas (2): templates: Check for EFI at runtime instead of config generation time efi: Print an error if boot to firmware setup is not supported grub-core/commands/efi/efifwsetup.c | 43 +++++++++++++++-------------- util/grub.d/30_uefi-firmware.in | 21 ++++++-------- 2 files changed, 31 insertions(+), 33 deletions(-) -- 2.31.1