Commit Graph

250 Commits

Author SHA1 Message Date
Simon Glass
92cc80eab9 expo: Allow searching for any object type by position
At present only highlightable objects can be clicked on, i.e. menus and
textlines. Update scene_find_obj_within() so that it can find any type
of object, if requested. Update all the callers to false, so things work
the same.

Since the scene is drawn by iterating through the list of objects, when
the user clicks somewhere we should look at the top-most object under
the mouse first. So reverse the direction of the object search.

Update the tests to cover this new feature.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-10 03:11:12 +01:00
Simon Glass
d221a4178c expo: Allow searching click positions from top to bottom
Since the scene is drawn by iterating through the list of objects, when
the user clicks somewhere we should look at the top-most object under
the mouse first.

This is not true when a menu is popped up, since we only care about the
menu in that case.

Add a way to reverse the direction of the object search. For now there
are no new test cases, since OBJ_OVERLAP is a text object and cannot
currently be clicked on.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-10 03:10:42 +01:00
Simon Glass
4d4caecd26 expo: Export scene_find_obj_within() and add a test
It is easier to test this function directly than via click_check(). Set up
a test expo with an extra overlapping object and add some tests.

Update the existing render test to take account of the new object.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-10 03:10:36 +01:00
Simon Glass
7d91a4b457 expo: Provide a way to dump an expo
For debugging it is sometimes helpful to dump an expo. Add an
implementation of this, writing to a membuf.

Add a MAINTAINERS entry for expo, including this next file.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-10 02:24:07 +01:00
Simon Glass
9c11744488 expo: Provide user-friendly output of scene enums
Add a few functions which can convert a flag and an object type to
strings.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-10 02:24:07 +01:00
Simon Glass
9d9e00b3de expo: Add FPS tracking to test mode
In test mode, show the FPS (frames per second) below the frame count.
This is helpful for performance monitoring during development.

The FPS calculation averages over the last 5 seconds to provide a
stable reading.

Add a test for the FPS calculation logic as well.

Mention expo's test mode in the documentation.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-07 10:54:13 +00:00
Simon Glass
6825579c41 expo: Add test mode to display frame count
When expo-test is enabled, show the frame count in the top right of the
display. This allows an easy visual check that expo is working correctly,
and provides an indication of performance.

Add a test for this also.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-07 10:54:13 +00:00
Simon Glass
f2909a4cde expo: Set dirty flag when an object bbox changes
Add a flag to indicate that am object must be redrawn. Set this flag
when an object's bounding box changes.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-06 10:11:04 -06:00
Simon Glass
9f00a0e3f3 boot: Run the EFI bootmgr just before network devices
At present the EFI bootmgr scans all devices in the system before
deciding which one to boot. Ideally it would use the bootstd iterator
for this, but in the meantime, give it a lower priority, so it runs
just before the network devices.

Note that if there are no hunted network devices hunted, then it will
run at the end, after all bootdevs are exhausted. In other words, it
will always run.

Series-changes: 2
- Update commit message to indicate the bootmeth will always run
- Document how the priority was chosen

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-30 17:23:58 -06:00
Simon Glass
1200d2b52f boot: Don't change the method count after global bootmeths
At present before scanning global bootmeths, the iterator sets the
method count to the index of the first global bootmeth. Now that we
support scanning the global bootmeths multiple times, we must leave this
count alone.

Check against have_global and first_glob_method instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-30 17:14:45 -06:00
Simon Glass
07326c0baf boot: Keep track of which bootmeths have been used
Add a bitfield which tracks when bootmeths have been used. This will be
needed when global bootmeths can be used later in the iteration.

Fix a missing bootflow_free() while here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-30 17:14:45 -06:00
Simon Glass
37cabfe0b1 boot: Add a flag for whether there are global bootmeths
The current 'doing_global' refers to being in the state of processing
global bootmeths. Since global bootmeths are currently used once at the
start, it becomes false once the last global bootmeth has been used.

In preparation for allowing bootmeths to run at other points in the
bootstd interation, add a new 'have_global' flag which tracks whether
there are any global bootmeths in the method_order[] list. It is set up
when iteration starts. Unlike doing_global which resets back to false
after the global bootmeths have been handled, once have_global is set to
true, it remains true for the entire iteration process. This provides a
quick check as to whether global-bootmeth processing is needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-30 17:14:45 -06:00
Simon Glass
cd6424c4c3 boot: Update first_glob_method when dropping a bootmeth
For now we only support dropping non-global bootmeths from the
iteration. Update first_glob_method in that case and add a few checks
that things are correct.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-30 17:14:45 -06:00
Simon Glass
7e9ee27101 boot: Add a new test for global bootmeths
These have different behaviour from normal bootmeths and we are about to
enhance it. So add a test and also an extra check in bootflow_iter()

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-30 17:14:45 -06:00
Simon Glass
f89d2779c3 boot: Improve comments related to global bootmeths
Add a few comments about global bootmeths and first_glob_method

Fix a broken line in bootmeth_setup_iter_order() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2025-09-30 17:10:48 -06:00
Simon Glass
d9152ea75e bootctl: Initial experimentation
This provides a basic prototype for boot control.

Some documentation is in boot/bootctl/README.rst
2025-09-28 14:32:36 -06:00
Simon Glass
3b3ec58450 expo: Provide a test of expo mouse behaviour
Check the behaviour of non-popup menus with a mouse.

Series-to: concept
Series-cc: heinrich
Cover-letter:
expo: Support interactions with a mouse or touchpad
So far expo only supports user interaction with a keyboard. This is the
common case, but for PC devices it is typical to have a mouse or
touchpad available as well.

Particularly for the configuration editor, these devices are often more
convenient for selecting options than moving up and down with with the
keyboard.

This series adds mouse support to expo, providing a function to process
a click similar to processing of a keypress. The core of this is a new
expo_send_click() function. Within scenes, the logic to search for
objects by and x and y position is provided.

As with keypresses, expo provides clear separation between the
processing of a click (which may or may not produce an action) and the
handling of that action. This allows expo to be used within an existing
event loop.

Expo uses a mouse by default if available.

This series also includes a few other minor improvements, including some
code tidy-ups and support for filled boxes.
END
Signed-off-by: Simon Glass <sjg@chromium.org>
Series-links: 1:34
2025-09-15 13:23:13 -06:00
Simon Glass
f44080081c expo: Provide a test of cedit mouse behaviour
Add a test which checks the various expected features of a cedit when
used with a mouse. This includes clicking on menu items and textlines.

For now, textedit is not supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 13:23:13 -06:00
Simon Glass
c4544d59f0 expo: Add a test helper for clicking on objects
Provide a way to click on an object and check that the expected action
resulted. Put it in a common file so it can be used by cedit and expo
tests.

Tidy up the include-order in both cedit and expo.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 13:23:13 -06:00
Simon Glass
9d34fbe2e8 expo: Allow checking if a position is within a textline
For a textline it is possible to click into the edit field. Provide a
function to check whether a position is within this field.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 13:23:12 -06:00
Simon Glass
1e65b5e22e expo: Provide a way to check if a position is within a menu
To implement mouse clicks we need a way to figure out what the user has
clicked on. As a starting point, create a scene_menu_within() function
which returns the item containing an x, y coordinate.

Provide a helper function in scene.c for use with this. Add a simple
for completeness.

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
c65b6e50cf expo: test: Move expo creation into a separate function
In preparation for adding more tests which use a common expo, move the
creation code out of expo_render_image() and into a new function.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 13:23:12 -06:00
Simon Glass
932b6cfd23 expo: Tidy up image position with the menu
The bootflow menu creates an image at position -4, expecting that it
will be relative to the right side of the display.

With the recently added alignment feature, this is not supported. Update
the implementation to calculation the correct position instead. Update
the tests to match.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 13:23:12 -06:00
Simon Glass
d738ddf73f expo: Provide a way to enable the mouse
In some cases it is useful to use expo with a mouse (or touchpad). Add
a way to tell expo to find and record a mouse device.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 13:23:12 -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
bd78e82720 boot: Move obtaining the label into a common file
The 'bootflow list' command supports looking at the EFI device-path when
available. Move this piece into a common function so it can be used
elsewhere.

This updates the output from 'bootflow list'.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-02 08:45:35 -06:00
Simon Glass
a32b0df1f7 test: vbe: Free the bootflow after use
The bootflow contains fields which are connected to the struct. It
should be freed when it is finished with.

It isn't exactly clear why this fixes the problem, which shows up as:

   => ut -f bootstd vbe_test_abrec_oem_norun
   Test: bootstd_setup_for_tests: bootstd_common.c
   common/dlmalloc.c:793: do_check_free_chunk:
     Assertion `next->prev_size == sz' failed.

Fix it by adding a bootflow_free() at the end, which is good practice in
any case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: 07f5b96985 ("boot: test: Add a test for the VBE OS flow")
2025-08-17 06:01:25 -06:00
Simon Glass
07f5b96985 boot: test: Add a test for the VBE OS flow
Create two new images (vbe0 and vbe1) containing the two types of VBE-OS
setups: with and without an OEM FIT. Put this in a new img/ subdirectory
since the test_ut.py file is getting quite large.

Most of the test is in C, with just the image-setup done in Python.

Enable the test for non-SPL sandbox builds.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-04 14:40:00 -06:00
Simon Glass
684fc8c4d7 Revert "Merge branch 'loadg' into 'master'"
This reverts merge request !141
2025-08-02 19:50:30 +00:00
Simon Glass
3c2f152a9b boot: test: Add a test for the VBE OS flow
Create two new images (vbe0 and vbe1) containing the two types of VBE-OS
setups: with and without an OEM FIT. Put this in a new img/ subdirectory
since the test_ut.py file is getting quite large.

Most of the test is in C, with just the image-setup done in Python.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-02 12:31:52 -06:00
Simon Glass
7a37413818 pxe_utils: Support the SAY command
This shows a message for the user. Implement it to keep the user
informed.

Series-to: u-boot
pxe: Support an automatic localboot
It seems that extlinux expects that boards know how to boot a local OS
from attached media. U-Boot currently assumes that boards define a
"localcmd" environment variable to support this. None does.

Provide an automatic means to find a kernel and ramdisk, using common
filenames. This addresses booting on MAAS, at least.
END

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2025-07-30 15:01:52 +12:00
Simon Glass
de881bfad7 pxe_utils: Support a backup for localboot
The current localboot implementation assumes that a 'localcmd'
environment variable is provided, with the instructions to follow. This
may not be included, so provide a fallback in that case.

Add a test image and test as well.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-30 15:00:59 +12:00
Simon Glass
80b4557092 test: bootflow: Avoid a confusing error condition
The prep_mmc_bootdev() function replaces bootstd's bootdev_order with
its own static version, then returns it.

From then on std->bootdev_order cannot be freed, since it was not
allocated.

So long as the test passes, all is well. But if a test fails, the test
system will try to free std->bootdev_order and this will fail.

Adjust prep_mmc_bootdev() to allocate the boot_dev order, instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-30 14:59:33 +12:00
Simon Glass
bd57096c36 bootm: Do bootstage processing in bootm_final()
Mark kernel start before booting. If enabled, show a bootstage report.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-12 16:13:03 -06:00
Simon Glass
1490f70f9d bootm: Add a message when booting
Add a message about starting the kernel. For EFI this will be printed
when boot-services are exited.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-12 16:07:03 -06:00
Simon Glass
9a4aa22a70 virtio: Increase the bootdev priority
The current priority of BOOTDEVP_4_SCAN_FAST means that virtio is
scanned after SCSI. But virtio-scsi provides higher performance.

It seems better to regard virtio has an internal device, since it is
paravirtualised and thus fast. Change its bootdev priority to
BOOTDEVP_2_INTERNAL_FAST

Disable the virtio-fs feature on sandbox, since the virtio queue is not
not yet supported by the emulator.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-09 23:33:26 +02:00
Simon Glass
d347548467 fs: Add simple sandbox test
Add a simple test of a filesystem on sandbox.
2025-06-28 12:30:56 -06:00
Simon Glass
48655e4aa9 fs: Add support for a filesystem
The existing filesystem support is fairly basic. It supports access to
only one filesystem at a time, does not allow caching, does not have an
equivalent of Linux's VFS and uses global variables to keep track of
which one is in use.

As a starting point to improving this, provide a filesystem uclass. For
now it only includes operations to mount and unmount.

Provide a bootdev so that it is possible to locate bootflows on a
filesystem.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-28 12:30:56 -06:00
Simon Glass
c963c7c5d9 bootstd: Use an enum for hunter numbers
Add more enum values so we can use these in the tests, instead of adding
comments. This makes it easier to adjust tests when new hunters are
added.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-28 12:30:56 -06:00
Simon Glass
2e1d6e0db8 boot: Add a way to get writable image information
The bootflow_img_find() function does not permit updating the image.
Some bootmeths may want to do this, e.g. to change the address. Add a
function which returns a writeable pointer.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-12 19:43:54 +00:00
Simon Glass
bcfc136d73 expo: Reduce menu margin
The current margin between the menu label and the following objects is
much larger than is needed. Reduce it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-05 13:59:50 -06:00
Simon Glass
2b226cb9e7 expo: Allow changing scene_img data
In some cases we want to change the image data used by a scene_img. Add
a function to handle this.

Adjust the BMP function to use a const for the data, since it is not
allowed to change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-05 13:59:50 -06:00
Simon Glass
2d55616504 bootstd: Add a function to find an image by type
Provide a way to locate an image in a bootflow based on its type.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-04 15:07:08 -06:00
Simon Glass
f0669de445 expo: video: Correct kerning output in console_truetype_putc_xy()
While the text is measured correctly, taking account of kerning
information, this is not used when actually displaying the text. This
results in a mismatch between the measurement and the output.

Fix this by adding the kerning offset to each character position.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-04 15:07:08 -06:00
Simon Glass
e27b36c015 expo: Tidy up insets and improve tests
Insets are handled inconsistently at present, since menus use them to
offset the label text, whereas textlines don't. This is done because
menus need the margin to be visible when opened. However this causes an
alignment issue when menus and textlines appear in the same cedit.

Remove the offsets from menus and compensate by adjusting the bounding
boxes used for highlighting and the opened menu.

Line up menu items and textlines vertically and add a style option for
textlines to control how much padding is added.

Add a test to check the positions of objects in a cedit, since this is
more direct than the rendering tests. Add style information so that the
impact can be seen.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-24 08:19:02 +01:00
Simon Glass
502aa8bc31 expo: Honour the textline edit_id when building
There is no need to create a new ID and it makes it harder for tests to
locate objects. Use the ID provided in the file, if any.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-24 08:19:02 +01:00
Simon Glass
44ac51e503 expo: Separate requested bbox from actual
With fixed coordinates it is difficult to create scenes that can work on
any display size. Add a separate 'requested' bounding box for each
object and sync it when required.

With future work, this will allow scaling the nominal coordinates so
that an expo can be rendered correctly on a wider range of displays.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-24 08:19:02 +01:00
Simon Glass
729da41a4a expo: Drop space from object name in test
Two of the objects have a space in their name. Change it to a hyphen to
match the other objects.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-24 08:19:02 +01:00
Simon Glass
31b92f28cc expo: Allow the menu pointer to be wider
Rather than hard-coding the distance between the labels and the key,
measure the width of the pointer to determine the space needed.

Tweak a few tests according. It isn't possible to get the same result
when the font-size differs.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-24 08:19:01 +01:00
Simon Glass
8441847f9f expo: Check dimensions before arranging a scene
It is possible that positions, styling or even text have changed since
the scene was initially arranged, so recalculate the dimensions of all
objects before arranging the scene.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-24 08:19:01 +01:00