50 Commits

Author SHA1 Message Date
Simon Glass
ceab1d8010 bootctl: Allow switching between logos
The bootctl tests are currently disabled due to some image
incompatibilities: the multi UI uses one image and the simple UI uses a
different one.

Update the logic to switch between these logos when the layout changes.
For now, use the U-Boot logo in both cases.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-07 17:18:57 -07:00
Simon Glass
0b73c9a73a bootctl: Set the password flag on the passphrase edit text
The SCENEOF_PASSWORD flag is set on the textline object, but the
rendering code checks the flag on the text object being rendered. Set
the flag on the edit text object so the passphrase renders as asterisks
instead of showing the actual characters.

Mark the textline object as hidden while we are here, so it disappears
when switching to the simple bootmenu.

Co-developed-by: Claude <claude@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-07 17:18:57 -07:00
Simon Glass
6f3b890455 expo: Consider an item selected when a password is entered
When the user types in an unlock password then presses 'enter', select
the item containing the password. This avoids needing to click on an
item as well.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-07 12:01:57 -07:00
Simon Glass
f2278377be expo: Fix textline edit text not updating in bootflow menu
The edit text object for the passphrase textline is created with an
empty string literal "", rather than pointing to the textline's buffer.
This means that when the user types, tline->buf is updated but the text
object still displays the original empty string.

Fix this by creating the edit text object with abuf_data(&tline->buf) so
it points to the textline's buffer. This matches how expo_build.c
creates textlines for cedit.

Co-developed-by: Claude <claude@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-07 11:53:55 -07:00
Simon Glass
7e8bf42d2d expo: Use better names for objects in bootflow_menu_add()
Use descriptive names like "item0.label", "item0.desc", "item0.pass"
instead of generic "label", "desc", "passphrase". This makes debugging
easier when multiple bootflow items exist.

Co-developed-by: Claude <claude@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-07 11:53:55 -07:00
Simon Glass
16dad5cc12 expo: Support disk-passphrase entry in the menu
Provide fields to show that a disk is locked and allow the user to
enter a passphrase to unlock it.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-14 12:00:31 -07:00
Simon Glass
f56c1b0238 expo: Correct handling of mouse clicks
Due to a missing return in bootflow_menu_poll() a click on any object is
handled as if it were a click on the settings object. Fix this by
returning the correct error code for unrecognised clicks.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: e94de63e6c ("expo: Add a way to select settings")
2025-10-23 09:20:35 +01:00
Simon Glass
187b79b6a7 boot: Allow switching back to another layout
Implement the settings button to permit the user to switch to another
UI layout, if available.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-18 09:38:25 +01:00
Simon Glass
baa5d1ada4 boot: Set the item properties with the boot menu
Initially there may be no items. But when switching to the basic menu
there may well be items already present. Set up their properties so that
they follow the basic-menu theme.

Series-to: concept
Cover-letter:
boot: Separate out the boot-menu style
This series refactors the boot menu so that it is possible to create the
items and then (later) change the style/position to the simple style.
This allows swapping back and forth between a different style and the
simple style.

It also adjusts how the mouse is set up, so that the initial mouse
position is only set up once the video device is known. This allows the
position to be centred on the display, a better starting point than the
top left.
END

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-14 10:57:32 +01:00
Simon Glass
0272cb8d59 boot: Explicitly set up the theme with the boot menu
Set up the theme colour and apply it in bootflow_menu_set_props() so
that the simple menu always looks the same when selected.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-14 10:57:32 +01:00
Simon Glass
6cd4a27491 boot: Explicitly request that the menu position its objects
Manual mode is not enabled by default, but we should explicitly clear
it with the basic menu, since a different style may have set the flag.

Set manual mode to false in bootflow_menu_set_props()

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-14 10:57:31 +01:00
Simon Glass
ef69636d8e boot: Move text for desc and label items to after setup
Use the bootflow_menu_set_item_props() to set the text in these items,
since it can be presented differently depending on the layout.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-14 10:57:31 +01:00
Simon Glass
6f8917c619 boot: Add the distro version and box into the menu
These can be used if desired, so add them to the menu. Since they are
not part of the simple menu, hide them in that case, via a new function
which sets up the properties of items.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-14 10:57:31 +01:00
Simon Glass
9fd5cb407c boot: Hide unwanted objects and show the menu pointer
The basic menu uses a pointer to show the current menu item. Show this
and hide some other objects which are not wanted.

Mark the box as unfilled, since this is how it is used with the basic
menu.

Explicitly disable the mouse pointer.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-14 10:57:31 +01:00
Simon Glass
838c5e4b9c boot: Move prompt strings into bootflow_menu_set_props()
These strings are part of the basic menu and may be different for other
menus. Rather than setting them up on creation, add them as part of
setting the properties of the objects. Provide a way to set the title
as well.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-14 10:57:31 +01:00
Simon Glass
6471b40e54 boot: Split out setting menu properties from menu creation
The existing menu is functional but basic. It would be useful to be able
to create the objects but apply a different layout or style for them.
The bootflow_menu_new() function is quite long in any case.

Split out the parts which adjust the position, alignment, etc. of the
objects into a separate function. We can (later) call this from
elsewhere to apply the basic styling.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-14 10:57:31 +01:00
Simon Glass
e94de63e6c expo: Add a way to select settings
In some cases it is useful to provide a settings scene, or perhaps just
a button to change the layout. Add support for this.
2025-10-10 03:11:26 +01:00
Simon Glass
47e05ed19e expo: Support clicking on any type of object
It is sometimes useful to be able to click on an image (sometimes called
an icon). Allow this within expo and return new click action.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-10 03:11:18 +01:00
Simon Glass
47b3b6d969 boot: Tidy up positioning in bootflow_menu_new()
Several items use the SCENEOB_DISPLAY_MAX setting which does not work
with alignment. Some others have a negative height, which is now
checked, so results in the item being invisible.

Fix these problems.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-25 09:47:09 -06:00
Simon Glass
4eb8f8319a expo: Enable the mouse when available
When creating a new bootflow menu or cedit, enable the mouse, so the
user can interact with the expo more easily.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 13:23:13 -06:00
Simon Glass
9f3b86c8f6 expo: Support boxes fully
At present boxes are not supported in the expo_build format. Also, it is
now possible to draw filled boxes, a recently added feature to the video
API.

Expand the box feature slightly to resolve these two items.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 13:23:12 -06:00
Simon Glass
c9b4950ed5 boot: Use the new label finder in bootflow_menu_add()
Make use of bootflow_guess_label() to get the label for a menu, since it
provides more information for the EFI app.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-02 08:45:36 -06:00
Simon Glass
872733ec11 expo: Allow the nominal display-size to be selected
At present all coordinates are absolute and must fit within the display.
This makes it hard to create an expo which can work on any size of
display, a key goal of expo.

Add the concept of a nominal size, to which all coordinates conform. Once
the real display-size is known, expo can in principle (i.e. with later
work) scale the coordinates and objects according.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-05 13:59:50 -06:00
Simon Glass
ca46bc3115 bootstd: Indicate refresh need with bootflow_menu_poll()
When the user presses 'up' when on the top menu item, it is a waste of
time to refresh since nothing has changed.

Add a new return code from this function to indicate that the UI must be
refreshed.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-05 13:59:50 -06:00
Simon Glass
04110615e0 expo: Separate out reading the theme from applying it
Rename the existing expo_apply_theme() to expo_setup_theme() and adjust
the former so that it applies a theme which has already been read into
the struct. This will make it easier for tests to check theme
adjustments, since they won't have to put them in a node.

Add the white-on-black property into the theme struct while we are.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-24 08:19:01 +01:00
Simon Glass
f20a1818cf expo: Create a function to arrange the current scene
Provide a convenient function which arranges the current scene in an
expo. Make use of this in bootflow_menu

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-24 08:19:01 +01:00
Simon Glass
e57c6e3c58 expo: Use a different logo for the second menu-item
When testing menu items it is easier to check that the correct preview
is shown if the preview images are different. Make a copy of the image
and modify the palette for the second menu item, so this is obvious.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-24 08:19:01 +01:00
Simon Glass
3f1260ac46 expo: Drop the special theme code for bootflow_menu
The expo now has all that is needed to apply a suitable theme, so drop
this unnecessary code. Any further tweaks can be added to the generic
expo code.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-02 09:45:52 -06:00
Simon Glass
63d2b852f9 expo: Set up menu fully in bootflow_menu_start()
Apply the theme, calculate dimensions, highlight the menu and arrange
the scene correctly, so that everything is ready to go when the expo
is rendered.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-02 09:45:52 -06:00
Simon Glass
7a856f8630 expo: Split setting up the menu from adding items
Some callers may wish to add items later as they are discovered. Split
the setup code into its own function, to permit this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-02 09:45:52 -06:00
Simon Glass
62680f2c24 expo: Update bootflow_menu_poll() to return a sequence ID
Rather than returning a bootflow, return the index of the bootflow. This
will allow callers to do their own translation to bootflows or some
other data structure.

Also return a special code when the user tries to move the pointer, so
that the caller can cancel the boot-menu timeout, if this is in use.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-02 09:45:52 -06:00
Simon Glass
1a0434517a expo: Improve the visual appearance of the menu
The menu is currently quite basic. Make use of some recently added
features in expo, to:

- Show proper prompts
- Highlight the current item
- Centre text
- Use multi-line text instead of two independent lines
- Put a box around the items

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-02 09:45:52 -06:00
Simon Glass
032c434721 expo: Drop the gap between groups of menu items
The gap is intended to separate options which are on different bootdevs,
but most of the time there is only one. So drop this gap.

Keep the code around in case it becomes useful to have it in the style,
or based on some other mechanism.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-02 09:45:52 -06:00
Simon Glass
3ee085905a expo: Use a simpler name for USB media
For USB devices we use the string 'usb_mass_storage' which is a bit
verbose. Use 'USB' instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-02 09:45:52 -06:00
Simon Glass
a2d70450dd expo: Support rendering multiple lines of text
Use the measurement info to write each line of text separately, thus
respecting word-wrapping and newlines.

Fix up the comment for scene_obj_render() while we are here.

Since a lineedit does not support alignment, add a special case to just
display the text if there is no measurement. This happens assuming the
lineedit is initially empty.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-02 09:45:52 -06:00
Simon Glass
72f4843e7a expo: Allow adding a single bootflow to a menu
Refactor bootflow_menu_add_all() to call a new bootflow_menu_add() to
add each of its bootflows.

Move the last_bootdev value into struct menu_priv to make this work.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-02 09:45:51 -06:00
Simon Glass
0c2670cea7 expo: Split bootflow_menu_new() into two pieces
Split the iteration piece of this function into bootflow_menu_add_all()
so that it is possible for the caller to be in control of adding items
to the menu.

Move the expo_destroy() call into the caller.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-02 09:45:51 -06:00
Simon Glass
ad1f799a1c expo: Split bootflow_menu_run() into two pieces
Split the starting piece of this function into bootflow_menu_start()
and the polling part into bootflow_menu_poll() so that it is possible
for the caller to be in control of the event loop.

Move the expo_destroy() call into the caller.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-02 09:45:51 -06:00
Simon Glass
203e56d806 expo: Adjust how menu items are highlighted
At present when the user moves to a new menu item, the menu code
handles this immediately. This means it is not possible to use an expo
action to effect the same change.

Update this so that EXPOACT_POINT_ITEM is handled in cedit_do_action().

Expand the test to cover this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-02 09:45:51 -06:00
Simon Glass
a781c37746 expo: Add a function to poll for input
Both bootflow_menu and cedit use similar logic to poll an expo. Move
this into the expo library so the code can be shared.

Update bootflow_menu_run() to return -EPIPE when the user quits without
choosing anything, since -EAGAIN is ambiguous and elsewhere means that
there is no input yet.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-02 09:45:51 -06:00
Simon Glass
280b9bf36f expo: Add CLI context to the expo
An expo generally needs to keep track of the keyboard state while it is
running, so move the context into struct expo

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-02 09:45:51 -06:00
Quentin Schulz
05b9665f09 boot: bootflow_menu: fix crash for EFI BOOTMGR global bootmeth
The global bootmeths don't set the dev in bootflow struct which means
the dev_get_parent(bflow->dev) triggers a NULL-pointer dereference and
crash U-Boot.

So before trying to handle a bootflow, check that the associated
bootmeth isn't global, otherwise skip it.

Suggested-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2024-06-20 11:41:43 -06:00
Tom Rini
03de305ec4 Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet"
As part of bringing the master branch back in to next, we need to allow
for all of these changes to exist here.

Reported-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Tom Rini <trini@konsulko.com>
2024-05-20 13:35:03 -06:00
Tom Rini
d678a59d2d Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""
When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay
Ethernet"' I failed to notice that b4 noticed it was based on next and
so took that as the base commit and merged that part of next to master.

This reverts commit c8ffd1356d, reversing
changes made to 2ee6f3a5f7.

Reported-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Tom Rini <trini@konsulko.com>
2024-05-19 08:16:36 -06:00
Tom Rini
c4b646d436 boot: Remove <common.h> and add needed includes
Remove <common.h> from all "boot/" files and when needed add
missing include files directly.

Signed-off-by: Tom Rini <trini@konsulko.com>
2024-05-06 15:05:04 -06:00
Heinrich Schuchardt
3a7744ed1e boot: superfluous assignment in bootflow_menu_new()
ret is assigned a value 0 which is never used but
is immediately overwritten in the next statement.

Addresses-Coverity-ID: 453304 ("Unused value")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-01-18 17:50:27 -05:00
Simon Glass
5904d953a1 expo: Rename exp_set_text_mode()
Rename this function to match its peers, using the full "expo' prefix.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14 12:54:51 -04:00
Simon Glass
14a86a5107 expo: Avoid automatically arranging the scene
This should ideally be done once after all scene changes have been made.
Require an explicit call when everything is ready.

Always arrange after a key it sent, just for convenience.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14 12:54:51 -04:00
Simon Glass
e64c29521c bootstd: Support setting a theme for the menu
Allow a theme to be set. For now this is very simple, just a default font
size to use for all elements.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-16 18:26:51 -05:00
Simon Glass
02d929bfb2 bootstd: Support creating a boot menu
Create an expo to handle the boot menu. For now this is quite simple, with
just a header, some menu items and a pointer to show the current one.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-16 18:26:50 -05:00