Commit Graph

99562 Commits

Author SHA1 Message Date
GitLab CI
634ace57a6 chore: Bump version for release candidate 2025.12-rc3 c2025.12-rc3 2025-11-17 10:39:37 +00:00
Simon Glass
826b435241 Merge branch 'secf' into 'master'
Continue TKey development This series add

See merge request u-boot/u-boot!210
2025-11-15 21:49:58 +00:00
Simon Glass
a809e8959e boot: Detect encrypted partitions with extlinux
We don't have an explicit indication of whether the root disk is
encrypted or not. For now, try to detect it and set the flag if
found.

Series-to: concept
Cover-letter:
Continue TKey development
This series adds the ability to provide a user-supplied secret to the
TKey and use that to obtain a disk-encryption key.

Expo is enhanced to support password entry and bootflows can now record
whether the root disk is encrypted or not.

Further work will enable the TKey in the UI and actually unlock an
encrypted disk.
END

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-15 09:50:23 -07:00
Simon Glass
0a2b56c8ce boot: Show an indication for encrypted bootflows
We don't support storing the OS on an encrypted partition, but in some
cases the root partition may be encrypted. Add an indication of this
when listing the bootflows.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-15 09:50:22 -07:00
Simon Glass
a85e22cd0b boot: Use constants for a few common strings
The header and the extlinux image on mmc1 appear in several tests. Add
a shared constant for this.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-14 12:00:31 -07:00
Simon Glass
e4bbfb6d58 tkey: Provide a real tkey device with test.dts
It is sometimes useful to use a real TKey even when running with the
test devicetree. Put it first, so it becomes the default. Update tests
to select the emulator explicitly.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-14 12:00:31 -07:00
Simon Glass
9c97e30ef6 tkey: Allow selecting the TKey device by name
Enhance the 'tkey connect' command to allow the device name to be
specified. This will be useful in tests.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-14 12:00:31 -07:00
Simon Glass
cb9b0f0e88 tkey: sandbox: Avoid returning -ENODEV from the driver
With driver model, -ENODEV has a specific meaning, i.e. there is no
device. Return -EIO instead, since the device actually does exist in
driver model, even if it is not currently connected.

Remove a few error messages which we are here.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-14 12:00:31 -07:00
Simon Glass
3b61461616 tkey: Use SHA256 to obtain the disk-encryption key
Rather than Blake2b, use SHA256 to obtain the disk-encryption key based
on the key material provided by the TKey. This matches the upcoming
disk-encryption test.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-14 12:00:31 -07:00
Simon Glass
2f8d7e7815 tkey: Provide some back-door functions for TKey tests
The tests need to reset the emulated TKey and put it into a known state.
Add a few more functions to help with this.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-14 12:00:31 -07:00
Simon Glass
00834d3aa6 tkey: Support loading an app with a user-supplied secret
One useful feature a the TKey is the ability to set up its app with an
key modified by a user-supplied secret. Add support for this.

Take this opportunity to make the API more expo-friendly by allowing
loading of the TKey to take place iteratively. The TKey runs fairly
slowly (about 60Kbaud) and loading an app takes 6 seconds or so.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-14 12:00:31 -07:00
Simon Glass
a60f0e34c8 tkey: Allow modelling the tkey being disconnected
Provide some plat data which tracks whether the emulated tkey is
connected or not, to allow testing of re-inserting a tkey to reset the
passphrase.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-14 12:00:31 -07:00
Simon Glass
8b54227528 expo: Allow entering text into textline in non-popup expos
Currently textlines only support text entry when with popup expos. In
some cases we want to have menu items to support this, e.g. to enter a
passphrase to unlock an encrypted disk.

Add the missing logic.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-14 12:00:31 -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
6926f89a20 expo: Support hiding password entry
Some fields may have sensitive information. Allow it to be obscured
during entry, in case someone is watching the display nearby.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-14 12:00:31 -07:00
Simon Glass
be1ea51b83 input: Provide a way for tests to register a mouse click
In tests it is useful to fake a mouse click to check that expo handles
it correctly. Create a function for this.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-14 12:00:31 -07:00
Simon Glass
c22bf794bf emulation: Support the bootcmd more generally
The code for obtaining a bootcmd from the host when running until QEMU
is currently x86-specific. In fact it can be supported on other
architecture.

Move it into a common place and update the documentation.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-14 12:00:30 -07:00
Simon Glass
76aa68ed86 aes: Use const pointers for read-only parameters
Update AES function signatures to use const pointers for parameters that
are not modified. This improves type safety and makes it easier to see
which parameters are read-only.

Fix the Nuvoton npcm_ae driver as well since it implements the API.
Really that should be handled by a driver, but leave that for now.

Functions updated:
- aes_expand_key(): key parameter
- aes_encrypt(): in and expkey parameters
- aes_decrypt(): in and expkey parameters
- aes_apply_cbc_chain_data(): cbc_chain_data and src parameters
- aes_cbc_encrypt_blocks(): key_exp, iv, and src parameters
- aes_cbc_decrypt_blocks(): key_exp, iv, and src parameters
- add_round_key(): key parameter (internal)
- debug_print_vector(): data parameter (internal)

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-14 11:28:34 -07:00
Simon Glass
33f5f5cb3f Merge branch 'fat' into 'master'
fat: Some code improvements

See merge request u-boot/u-boot!209
2025-11-14 03:55:09 +00:00
Simon Glass
20652517c8 fat: Use standard types for fixed-size values
Convert all __u8, __u16, and __u32 types to their u8, u16, u32
equivalents throughout the FAT filesystem code.

Series-to: u-boot
Series-cc: heinrich
Cover-letter:
fat: Some code improvements
This is an attempt to improve the structure of the FAT code, since it
doesn't fully follow the U-Boot conventions:

- fat_write.c includes fat.c which is odd
- use of __u32 and its ilk
- use of typedef
- old-style struct comments

This series resolves these problems, making it easier to take on other
improvements in future.
END

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-13 19:59:03 -07:00
Simon Glass
5026a22549 fat: Convert fat.h to kernel-doc style
Add kernel-doc comments to structs and public functions in fat.h so that
it is easier to understand the code.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-13 19:58:50 -07:00
Simon Glass
aa6f5484e6 fat: Remove typedefs in fat.h
Convert all typedefs in fat.h to normal struct declarations.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-12 18:39:22 -07:00
Simon Glass
ffb7d606ff fat: Update struct fat_itr to kernel-doc style
Convert the struct fat_itr documentation from the older style with
separate @field comments to the standard kernel-doc style where field
descriptions are listed in the header comment block.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-12 18:39:13 -07:00
Simon Glass
cb30dcb8b6 fat: Separate fat.c from fat_write.c
Currently fat_write.c includes fat.c directly, which is unusual and
makes the code harder to maintain. Use the internal header file to hold
shared functions, to avoid this.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-12 18:39:11 -07:00
Simon Glass
b92ee1a12f fat: Create an internal header file
As a first step towards separating fat.c from fat_write.c, create a
header file for the definitions.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-12 18:28:57 -07:00
Simon Glass
d3df5a8ca1 Merge branch 'edc' into 'master'
expo: Ensure that cyclic tasks can run

See merge request u-boot/u-boot!208
2025-11-12 18:13:41 +00:00
Simon Glass
dffd7b41a5 expo: Ensure that cyclic tasks can run
Since expo now runs with no delays it can trigger the watchdog on
sandbox. Add a call to schedule() to avoid this.

Series-to: concept
Signed-off-by: Simon Glass <sjg@chromium.org>

Change-Id: 0b1b9f90177b7b2e682d57f3df20cf3cdb453517
Series-links: 1:60
2025-11-12 10:20:02 -07:00
Simon Glass
95e9d0e699 Merge branch 'laca' into 'master'
ulib: Various improvements (part A)

See merge request u-boot/u-boot!207
2025-11-12 17:19:48 +00:00
Simon Glass
9553cc4e50 x86: efi: Set linker symbols for embedded dtb
The embedded dtb cannot currently be found with ulib, likely due to the
symbols being dropped when building. Add them explicitly into the linker
scripts.

Series-to: concept
Cover-letter:
ulib: Various improvements (part A)
This series collects together a large number of minor improvements to
the U-Boot library (ulib):

- Allow use of ulib with relocating board
- Add support for qemu-x86 (32-bit only so far)
- Supress startup-output with non-EFI builds
- Reserve space for the efi_priv struct before relocation
- A few minor build tweaks
- support custom firmware in build-efi
END

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-12 08:40:05 -07:00
Simon Glass
5ea9e69b82 efi: Add a flag to enable ulib
When running as an EFI app we should set the ulib flag early so as to
avoid printing unwanted output on start. Add a parameter to
efi_startup() to control whether ulib is used.

Drop the starting message in this case.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-12 08:40:05 -07:00
Simon Glass
dc475d0c11 efi: Allow init messages to be optional
Add a 'verbose' argument to efi_init() so that the init messages can be
suppressed if desired.

For now, keep them as they are.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-12 08:40:05 -07:00
Simon Glass
93ce7858e3 efi: Allow memory messages to be optional
Add a 'verbose' argument to setup_memory() so that the memory messages
can be suppressed if desired.

For now, keep them as they are.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-12 08:40:05 -07:00
Simon Glass
7b5f0041aa ulib: Restrict shared library build to sandbox only
Shared libraries are only meaningful for sandbox builds that run on the
host system. For bare-metal targets like x86, only the static library
(libu-boot.a) makes sense.

Make CONFIG_ULIB_SHARED_LIB depend on SANDBOX to avoid link errors about
missing C-runtime files.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-12 08:40:05 -07:00
Simon Glass
da77a8a26f board_r: Support calling the main program after ulib init
For boards where ulib starts first we need to jump to the main program
afterwards. Add the logic for this.

Drop the noreturn attribute from board_init_r() and board_init_f_r to
avoid needing #ifdef in the C file.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-12 08:40:05 -07:00
Simon Glass
5bdf2b673d Allow excluding efi_main from the library
In the case where this is provided by a Rust main program we don't want
to include it. Add the logic to remove it.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-12 08:40:05 -07:00
Simon Glass
89611203f0 efi: Use EVT_RESERVE_BOARD to reserve memory for efi_priv
Use the EVT_RESERVE_BOARD event handler to allocate the efi_priv struct
in the normal memory area. This avoids the caller needing to keep it on
the stack.

Copy the struct to the new place and start using it there.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-12 08:40:05 -07:00
Simon Glass
7477fe4d9b efi: Allow excluding efi_main()
In some cases this function may be provided outside the library, e.g. by
a Rust main program. Add a Kconfig to control this and refactor the code
so that it is optional.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-12 08:40:05 -07:00
Simon Glass
3df466ada2 board: Add a category for debugging
Provide a category in board_f and board_r so that log_debug() calls can
use the correct one.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-12 08:40:05 -07:00
Simon Glass
f81821c7f5 Add EVT_RESERVE_BOARD event for custom memory reservation
Add a new EVT_RESERVE_BOARD event that is triggered immediately after
the reserve_board() initcall completes during pre-relocation init. This
allows board or application code to reserve additional memory before
other reservations (global_data, fdt, etc).

The event is placed after EVT_FSP_INIT_F in the event enumeration and
is triggered in board_f.c right after the reserve_board initcall.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-12 08:40:05 -07:00
Simon Glass
eb8db20b2e event: Provide a way to return data
At present events pass data only in one directory, to the spy. Add a new
event_notify_resp() function which can return data from the spy. Mark
the existing function as having const data.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-12 08:40:05 -07:00
Simon Glass
01a1fa3a77 ulib: Add a flag to force use of the library
Provide a way to set the GD_FLG_ULIB flag early in boot. This is needed
where the main program cannot run first, such as where there is a
complex boot process still written in C.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-12 08:40:05 -07:00
Simon Glass
561c939a82 ulib: Allow undefined symbols in the library
At present it isn't possible for ulib to call a function outside the
library, since it produces a link error.

Relax this contraint, so we can call a main() function provided by the
main program.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-12 08:40:05 -07:00
Simon Glass
9b84b5c623 ulib: board_f: Skip showing board info with ulib
When running as a library, don't show the board information, to avoid
printing output before the main program starts.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-12 08:40:05 -07:00
Simon Glass
7850063907 ulib: board_f: Skip showing CPU info with ulib
When running as a library, don't show the CPU information, to avoid
printing output before the main program starts.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-12 08:40:05 -07:00
Simon Glass
52fde1afe0 ulib: x86: Skip showing CPU info with ulib
When running as a library, don't show the CPU information, to avoid
printing output before the main program starts.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-12 08:40:05 -07:00
Simon Glass
0f97a71491 efi: Add missing mmc and net checks from device_path
The MMC and network subsystems must be present to use device paths for
them. Add the missing checks.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-12 08:40:05 -07:00
Simon Glass
1ecf365eab efi: Drop the message about building the EFI capsule
This message is not very useful, so drop it.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-12 08:40:05 -07:00
Simon Glass
e9ac6dad87 x86: Enable ulib for qemu-x86
Add support for using ulib with this board, as an example of using ulib
outside the existing sandbox and EFI options.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-12 08:40:05 -07:00
Simon Glass
ef9b8d95c1 efi: Adjust condition for runtime relocation
Even if CONFIG_ULIB is enabled it may not actually be in use. If not,
we still need the EFI-runtime relocation to happen. Adjust the condition
in efi_runtime_relocate() to fix this.

For static linking with ulib examples, provide weak symbol definitions
for __efi_runtime_rel_start and __efi_runtime_rel_stop. These symbols
are normally defined in linker scripts but need fallback definitions
when linking statically against libu-boot.a.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-12 08:39:49 -07:00
Simon Glass
8fbcca0a85 x86: Expand the rom size for qemu-x86
The ROM is close to its limit and any main program using ulib will
overflow it. Expand the ROM size to 2MB.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-12 06:25:27 -07:00