bootctl: Provide an extra poll between select and booting

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>
This commit is contained in:
Simon Glass
2025-11-18 15:20:26 -07:00
parent 4eaef8aa12
commit 9bdd221a14
2 changed files with 18 additions and 2 deletions

View File

@@ -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

View File

@@ -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;