From: Simon Glass <simon.glass@canonical.com> 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 <simon.glass@canonical.com> --- 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; -- 2.43.0