From patchwork Mon Dec 8 02:32:13 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 843 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765161216; bh=LN2JG0I1a1bFJOs3nU5sH24ra8pIc5zJf45gEA1jwtE=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=ZRZ8RFxzlG/HA8MtlYMhSTeFIUOooQjzVL81m3RKXDXlU1cCWRBRf6p+ZrzAZvAw1 HaVJ8IgpkE3ckc8zv2h1yh8GCAzEDJCbJUVc+YnS9aI0YhOr0g1azEkHyarjdy0Lkx +qla5HsMbv9sxq9SvSqve3FvmyAiQcF8J6HqSAY+DcBJJeHcJXF/VROdbaYd/ZgvRo 206lu6IOnmYTh+vWxvRGJbIE1LdBb2lpdNcGlx1ZnYN1VuiR/Svx0Qde0fxFjUCUu6 5YzgubwsZmm4rYMbkxPeObZUVOmk0LPSZk8uqz5vePFBnm8ecXPiwWkJWPXVMy1qih l+6qyEVHwZbkw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6C3B3689C2 for ; Sun, 7 Dec 2025 19:33:36 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id gPCNtPwb8NK8 for ; Sun, 7 Dec 2025 19:33:36 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765161216; bh=LN2JG0I1a1bFJOs3nU5sH24ra8pIc5zJf45gEA1jwtE=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=ZRZ8RFxzlG/HA8MtlYMhSTeFIUOooQjzVL81m3RKXDXlU1cCWRBRf6p+ZrzAZvAw1 HaVJ8IgpkE3ckc8zv2h1yh8GCAzEDJCbJUVc+YnS9aI0YhOr0g1azEkHyarjdy0Lkx +qla5HsMbv9sxq9SvSqve3FvmyAiQcF8J6HqSAY+DcBJJeHcJXF/VROdbaYd/ZgvRo 206lu6IOnmYTh+vWxvRGJbIE1LdBb2lpdNcGlx1ZnYN1VuiR/Svx0Qde0fxFjUCUu6 5YzgubwsZmm4rYMbkxPeObZUVOmk0LPSZk8uqz5vePFBnm8ecXPiwWkJWPXVMy1qih l+6qyEVHwZbkw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5C47968900 for ; Sun, 7 Dec 2025 19:33:36 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765161214; bh=u/rPLyEnxcJyCg2ySnWQuBAZ7H+pK17cpJu77bgg5z4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rKlb3wZXyUzUKnJw0KtpqFZQnqf90ow6Abb0ORkJgxhn6lcMQ1xiuI50LJoAkwqrx JDfb/XqLEjnJuO48BwxUypOQGho2ePTXt9feUdKuwnaTsmXhgANRmtatdwSkPuqeOC zVmkyM0XwG0qL0cscDPJLhZKO21KVRU3sBLLR0IQYce7/HuA7akdHaCgHRWMqDOva2 h4+z34q5anp38TI+/pE32upB4pBPfVcsZSuT9YcrhNVBTDdQRukBo689ODMlM8+OC7 8iqGE7pWtUpmBE3qi4IQMKl2OI6LR00KLdR4tvm3VTL2Rd7CGOatSNvJn3pwNB7dpa HzZDLnY/j9P1w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E6BAF6883E; Sun, 7 Dec 2025 19:33:34 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id sypeI2malIrl; Sun, 7 Dec 2025 19:33:34 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765161210; bh=EMtDr5zJs4UON815TAM1Fah6BT6mbz428hlON59RMvA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ErXtNTe5bvg/JoJuJHCojNIMu7olNKjg3RYw9ivIdERfessrg412bzvLDsFX1/IL6 RLLNcHFaP3mi5GTfhzvmpNdNM4CDG3DcgrBK2h/JZQX7lFg5PrXP+jisV3UoZ9hbB0 XirNpLfMyeOvSBfds0tjw7Ypf0BOXFQnjAjdJOpIU7z3OurjGq1As+dzy86SJNq+sC h2BQmCyv+ka63BUmn5d2ZNW/MtxiaEDP+mSQrkdPBJe70du/0d6BDkAKTWyvZTzeOK os+T61twdAJ9agxYWH0GQWiMDSGMmzM9mExPQb7S4jmsG0EC5i+x6cuD91pYa/kuyr dtppK0pT1laCw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id A47CD688F0; Sun, 7 Dec 2025 19:33:30 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 7 Dec 2025 19:32:13 -0700 Message-ID: <20251208023229.3929910-11-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251208023229.3929910-1-sjg@u-boot.org> References: <20251208023229.3929910-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: VHYOB37PZ25FR2NVNLHDU6K5MY27DGOJ X-Message-ID-Hash: VHYOB37PZ25FR2NVNLHDU6K5MY27DGOJ X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 10/19] bootctl: Provide an extra poll between select and booting List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Selecting an OS may cause the UI to change, so give it a chance to show those changes before booting. Signed-off-by: Simon Glass --- boot/bootctl/logic.c | 14 ++++++++++++++ include/bootctl/logic.h | 6 ++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/boot/bootctl/logic.c b/boot/bootctl/logic.c index e2ec2c679ec..d3ee7b2fa6c 100644 --- a/boot/bootctl/logic.c +++ b/boot/bootctl/logic.c @@ -242,8 +242,22 @@ static int logic_poll(struct udevice *dev) struct osinfo *os; os = alist_getw(&priv->osinfo, seq, struct osinfo); + if (!os) + return log_msg_ret("gos", -ENOENT); + priv->ready_to_boot = false; + priv->selected_seq = seq; + } + + if (priv->ready_to_boot) { + struct osinfo *os; + + seq = priv->selected_seq; + os = alist_getw(&priv->osinfo, seq, struct osinfo); + if (!os) + return log_msg_ret("gbo", -ENOENT); log_info("Selected %d: %s\n", seq, os->bflow.os_name); + priv->ready_to_boot = false; /* * try to read the images first; some methods don't support * this diff --git a/include/bootctl/logic.h b/include/bootctl/logic.h index 1aefac29128..a1de68235ac 100644 --- a/include/bootctl/logic.h +++ b/include/bootctl/logic.h @@ -37,10 +37,10 @@ struct udevice; * @default_os: name of the default OS to boot * @osinfo: List of OSes to show * @refresh: true if we need to refresh the UI because something has changed + * @selected_seq: sequence number of OS waiting for passphrase, or -1 if none + * @ready_to_boot: true if success message shown, ready to boot on next poll * * @iter: oslist iterator, used to find new OSes - * @selected: index of selected OS in osinfo alist, or -1 if none has been - * selected yet * @meas: TPM-measurement device * @oslist: provides OSes to boot; we iterate through each osinfo driver to find * all OSes @@ -68,6 +68,8 @@ struct logic_priv { const char *default_os; struct alist osinfo; bool refresh; + int selected_seq; + bool ready_to_boot; struct oslist_iter iter; struct udevice *meas;