Commit Graph

835 Commits

Author SHA1 Message Date
Simon Glass
f893dfc3a9 vbe: Add a bootmeth driver for abrec
Add a VBE-ABrec bootmeth so that the VBE state can be accessed.

Series-changes: 2
- Add new patch with a bootmeth driver for abrec

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-09 16:24:23 -06:00
Simon Glass
207bf34de7 boot: efi: Use an event to relocate the OS
Rather than a weak function, use the recently added event to adjust the
OS load-address. Tidy up the code a little while here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-05 14:42:47 -06: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
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
fee414857c bootstd: Improve parsing on extlinux.conf files
These files can have tabs, but they are currently parsed as separate
lines. Fix this.

Also, some files provide a separate 'menu label' which has more
information than the 'label', so use that if available.

Finally, we don't yet have the ability to parse all entries in the
file until the user actually boots the extlinux.conf file. At present,
this means that the last entry is shown. It seems better to use the
first entry, so update it.

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
b03ea854d4 expo: Indicate with the pointed-to item has changed
Allow the caller to detect when a keypress has actually resulted in a
change of the item that is pointed to.

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
855adaaa02 boot: Allow zboot without CMDLINE in pxe_utils
Use CONFIG_ZBOOT instead of CONFIG_CMD_ZBOOT as the condition for
supporting booting from a zImage, so that this works when CONFIG_CMDLINE
is disabled.

Series-to: heinrich
Cover-letter:
boot: Enable bootstd features without CMDLINE
This series refactors various Kconfig options to allow programmatic boot
to operate on x86.
END

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-02 13:36:47 -06:00
Simon Glass
c3ceb98841 boot: Enable ext4 by default for booting
OS files are typicallly provided on an ext4 filesystem. This is normally
enabled due to other options, but enable it in case not. This is needed
by the EFI app when CMDLINE is not enabled, for example.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-02 13:36:47 -06:00
Simon Glass
7f96861ab2 boot: Move BOOTM_EFI option into /boot
This option does not related to commands. Move it into boot/Kconfig and
adjust it to depend on CONFIG_BOOT rather than CONFIG_CMD_BOOTM

Simplify the 'depends on' while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-02 13:36:47 -06:00
Simon Glass
881f4c6ea1 boot: Move BOOTM_ELF option into /boot
This option does not related to commands. Move it into boot/Kconfig and
adjust it to depend on CONFIG_BOOT

Simplify the 'depends on' while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-02 13:36:47 -06:00
Simon Glass
12a4b1e912 boot: Move OS options into /boot
These options belong in boot/Kconfig since they are not related to
commands. Move them and adjust them to depend on CONFIG_BOOT

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-02 13:36:47 -06:00
Simon Glass
2ffe3ef03d boot: Use BOOT for pulling in bootm files
The bootm.c and bootm_os.c files are used by various boot commands, not
just bootm.

Update the Makefile condition to use CONFIG_BOOT instead of
CONFIG_CMD_BOOTM so that this code can be used when CMDLINE is disabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-02 13:36:47 -06:00
Simon Glass
6cbad6bb9b boot: Create a new CONFIG_BOOT option
At present we assume that the cmdline is enabled, so CMD_BOOTM is used
to determine the presence of the boot_run() function.

As a first step towards enabling boot_run() without CONFIG_CMDLINE,
create a new BOOT option. Select it in BOOT_DEFAULTS and make CMD_BOOTM
depend on it. Make it default y to mirror the bootm command.

The intention with this option is that it covers the core code used by
all boot commands (e.g. zboot, bootm, booti). This includes
bootm_run_states() and functions called from there.

The name 'BOOT' is used instead of 'BOOTM', since bootm is actually a
command and it may be that we might wish, for example, to enable the
'zboot' part of the boot functionality, without enabling the 'bootm'
part of it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-02 13:36:47 -06:00
Simon Glass
ef9851d8f9 vbe: Avoid accessing TEXT_BASE if undefined
Use a condition to ensure this symbol is not accessed in the EFI app.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-02 08:25:41 -06:00
Paul HENRYS
09e29ee2ee boot: Add support of the pre-load signature for host tools
Signed-off-by: Paul HENRYS <paul.henrys_ext@softathome.com>
2025-05-27 10:12:02 +01:00
Aristo Chen
e6ba997fe6 bootm: improve error message when gzip decompression buffer is too small
Currently, when decompressing a gzip-compressed image during bootm, a
generic error such as "inflate() returned -5" is shown when the buffer is
too small. However, it is not immediately clear that this is caused by
CONFIG_SYS_BOOTM_LEN being too small.

This patch improves error handling by:
- Detecting Z_BUF_ERROR (-5) returned from the inflate() call
- Suggesting the user to increase CONFIG_SYS_BOOTM_LEN when applicable
- Preserving the original return code from zunzip() instead of overwriting
  it with -1

By providing clearer hints when decompression fails due to insufficient
buffer size, this change helps users diagnose and fix boot failures more
easily.

Signed-off-by: Aristo Chen <aristo.chen@canonical.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
2025-05-27 05:17:50 +01:00
Tom Rini
947dadf8a9 bootstd: Rework BLK dependency
The bootstd code itself does not have any dependency on BLK in order to
build. However, in order to minimize size growth of non-migrated
platforms, change this from being "default y" to "default y if BLK".
This will make it easier to begin migration of platforms which do not
have any BLK-class device but do want to use bootstd.

Signed-off-by: Tom Rini <trini@konsulko.com>
2025-05-27 05:15:10 +01:00
Simon Glass
869fa318fe booti: Allow using 10x the uncompressed size with booti
The booti command does not use the CONFIG_SYS_BOOTM_LEN value and
instead sets a maximum decompression-buffer size of 10x the size of the
compressed data.

Add this as an option in bootm_load_os() so that booting without the
command-line works in the same way as the 'booti' command.

Link: https://lore.kernel.org/u-boot/2ad3b1c5-b6e7-47e2-b225-834b821cc5c4@kwiboo.se/

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Jonas Karlman <jonas@kwiboo.se>
Fixes: b13408021d ("boot: pxe: Use bootm_...() functions where possible")
2025-05-25 06:26:00 +01:00
Simon Glass
48cd422a9c bootm: Add RISC-V support in booti_is_supported()
RISC-V uses a similar linux 'Image' format to ARM64, so add support for
it in bootm_load_os()

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2025-05-25 06:26:00 +01:00
Simon Glass
2c32a8da46 boot: Add a function to check if a linux Image is supported
Move this logic into a function so we can give it a sensible name.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2025-05-25 06:26:00 +01: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
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
a9a4c58b2c expo: Use a var to arrange horizonal positions in menu
At present the components of each menu item are set at fixed positions.
Use an 'x' variable instead, so that we can eventually move to taking
account of the actual dimensions of the items.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-24 08:19:01 +01:00
Simon Glass
ab474b3ead expo: Simplify scene_textline dimension calculation
The goal here is to obtain the dimensions of the edit field, which does
not change.

Since scene_arrange() now handles setting the bounding-box size based on
the dimensions there is no need to do it here.

Adjust the code to simply set up the dimensions.

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
Simon Glass
a6ec4daf24 expo: Move menu dims calculations into scene_menu_arrange()
A menu's dimensions are currently only used for positioning the
component parts of the menu, i.e. the label, key, description and
preview.

Move the logic for this entirely into the scene_menu file and drop the
logic at the top level.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-24 08:19:01 +01:00
Simon Glass
bd5e1e62e8 expo: Provide a few functions for working with dimensions
Allow expanding dimensions using the dimensions of an object or another
dimensions struct.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-24 08:19:01 +01:00
Simon Glass
4795e2b4bd expo: Arrange cedit after setting dimensions
Switch the order of these two calls since dims for each object should be
figured out before moving to arranging things.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-24 08:19:01 +01:00
Simon Glass
d854e1a777 expo: Record the pointer position in the menu item
Rather than drawing the poointer with a hard-coded position elsewhere in
the code, add a field to hold this value.

Move the check for the pointer position up so that the ordering of the
tests matches the order that the fields are dealt with in
scene_menu_arrange()

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-24 08:19:01 +01: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
3434950961 expo: Drop the extra parameter to scene_calc_dims()
We always call this with false first, then true. Drop the parameter and
handle this within the function itself.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-24 08:19:01 +01:00
Simon Glass
817db7d12d expo: Avoid arranging the scene willy nilly
Moving from one scene to another should not result in the scene being
re-arranged. Drop this, so that tests can have more control of when
scenes are arranged.

Also drop the scene_arrange() call when applying a theme, for the same
reason.

Add the now-required scene_arrange() to cedit and bootmenu

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
Adriano Cordova
62020f17ed bootm: add support for initrd in do_bootm_efi
Pass a pointer to a memory mapped initrd and its size to
efi_binary_run. The EFI stack will register an EFI_LOAD_FILE2_PROTOCOL
for the next boot stage to access this initrd.

Signed-off-by: Adriano Cordova <adriano.cordova@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2025-05-16 17:03:18 +02:00
Adriano Cordova
822fe503fd efi_loader: binary_run: register an initrd
Add support to install an initrd when running an EFI binary
with efi_binary_run

Signed-off-by: Adriano Cordova <adriano.cordova@canonical.com>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2025-05-16 17:03:17 +02:00
Masahisa Kojima
d274a6f516 fdt: add support for adding pmem nodes
One of the problems an OS may face, when running in EFI, is that
a mounted ISO, after calling ExitBootServices goes away, if that ISO
is resident in RAM memory as a ramdisk.

ACPI has NFIT and NVDIMM support to provide ramdisks to the OS, but we
don't have anything in place for DTs. Linux and device trees have support
for persistent memory devices. So add a function that can inject a pmem
node in a DT, so we can pass information on the ramdisk the OS.

Signed-off-by: Masahisa Kojima <kojima.masahisa@socionext.com>
Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2025-05-16 14:45:25 +02:00
Dmitry Rokosov
e396aa543b common: fdt: hand over original fdt bootargs into board chosen handler
Sometimes, it is necessary to provide an additional bootargs string to
the kernel command line.

We have a real scenario where one U-Boot blob needs to boot several
kernel images: the vendor-patched kernel image and the latest upstream
kernel image. The Amlogic (Meson architecture) tty driver has different
tty suffixes in these kernels: the vendor uses 'ttySx', while the
upstream implementation uses 'ttyAMLx'. The initial console setup is
provided to the kernel using the kernel command line (bootargs). For the
vendor kernel, we should use 'console=ttyS0,115200', while for the
upstream kernel, it must be 'console=ttyAML0,115200'. This means we have
to use different command line strings depending on the kernel version.

To resolve this issue, we cannot use the CMDLINE_EXTEND kernel
configuration because it is considered legacy and is not supported for
the arm64 architecture. CMDLINE_EXTEND is outdated primarily because we
can provide additional command line strings through the
'chosen/bootargs' FDT node. However, U-Boot uses this node to inject the
U-Boot bootargs environment variable content, which results in U-Boot
silently overriding all data in the 'chosen/bootargs' node. While we do
have the board_fdt_chosen_bootargs() board hook to address such issues,
this function lacks any FDT context, such as the original value of the
'chosen/bootargs' node.

This patch introduces a read-only (RO) fdt_property argument to
board_fdt_chosen_bootargs() to share the original 'chosen/bootargs' data
with the board code. Consequently, the board developer can decide how to
handle this information for their board setup: whether to drop it or
merge it with the bootargs environment.

Signed-off-by: Dmitry Rokosov <ddrokosov@salutedevices.com>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
2025-05-16 14:45:24 +02:00
Dmitry Rokosov
28492faf1e fdt_support: board_fdt_chosen_bootargs() should return const char*
It should be structured this way to demonstrate to the caller that
freeing the return value is unnecessary and that the caller cannot
modify it.
The function fdt_setprop() includes a parameter with a const char*
prototype, so it is better to use the const qualifier.

Signed-off-by: Dmitry Rokosov <ddrokosov@salutedevices.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2025-05-16 14:45:24 +02: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
c0df894714 expo: Provide a way to position things relative to display
It is often necessary to centre objects within the display area. Add a
special position value to indicate this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-02 09:45:52 -06:00