From a557c50977c7e11ee5e53e87d2e4c612e3802b51 Mon Sep 17 00:00:00 2001 From: "Kory Maincent (TI.com)" Date: Wed, 29 Oct 2025 15:33:44 +0100 Subject: [PATCH 1/8] doc: pytest: Complete dependencies list with missing packages Add missing dependencies to the pytest usage documentation and correct the device tree compiler package name from 'dtc' to 'device-tree-compiler'. This ensures users have the complete list of dependencies needed to run the pytest test suite without errors. Reviewed-by: Mattijs Korpershoek Signed-off-by: Kory Maincent (TI.com) Signed-off-by: Heinrich Schuchardt --- doc/develop/pytest/usage.rst | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/doc/develop/pytest/usage.rst b/doc/develop/pytest/usage.rst index 596b0397379..800a0323d0a 100644 --- a/doc/develop/pytest/usage.rst +++ b/doc/develop/pytest/usage.rst @@ -35,21 +35,26 @@ can be installed via the command pip install -r requirements.txt In order to execute certain tests on their supported platforms other tools -will be required. The following is an incomplete list: +will be required. The following packages may be needed: -* gdisk -* dfu-util -* dtc -* openssl -* e2fsprogs -* util-linux +* cgpt * coreutils +* device-tree-compiler +* dfu-util * dosfstools +* e2fsprogs * efitools +* fdisk +* gdisk +* libgnutls28-dev / gnutls-devel * mount * mtools +* openssl * sbsigntool +* swig * udisks2 +* util-linux +* vboot-kernel-utils / vboot-utils Please use the appropriate commands for your distribution to match these tools up with the package that provides them. @@ -63,7 +68,7 @@ The test script supports either: Further details are described later. The usage of the command ``sudo`` is not allowed in tests. Using elevated -priviledges can lead to security concerns. Furthermore not all users may have +privileges can lead to security concerns. Furthermore not all users may have administrator rights. Therefore the command ``sudo`` must not be used in tests. To create disk images we have helper functions located in ``test/py/tests/fs_helper.py`` which shall be used in any tests that require From 691eab09df03f3bfcc4e677122b11dad43d3b499 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Tue, 4 Nov 2025 21:56:46 +0100 Subject: [PATCH 2/8] efi_selftest: use Sphinx style comments in efi_console.c Convert function comments in efi_selftest_console.c to match Sphinx style. Correct function name in print_uuid() comment. Acked-by: Ilias Apalodimas Signed-off-by: Heinrich Schuchardt --- lib/efi_selftest/efi_selftest_console.c | 44 ++++++++++++------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/lib/efi_selftest/efi_selftest_console.c b/lib/efi_selftest/efi_selftest_console.c index fd2b3d09abc..0f8e9d28ef4 100644 --- a/lib/efi_selftest/efi_selftest_console.c +++ b/lib/efi_selftest/efi_selftest_console.c @@ -12,12 +12,12 @@ struct efi_simple_text_output_protocol *con_out; struct efi_simple_text_input_protocol *con_in; -/* - * Print a MAC address to an u16 string +/** + * mac() - print a MAC address to an u16 string * - * @pointer: mac address - * @buf: pointer to buffer address - * on return position of terminating zero word + * @pointer: mac address + * @buf: pointer to buffer address, + * on return position of terminating zero word */ static void mac(void *pointer, u16 **buf) { @@ -43,7 +43,7 @@ static void mac(void *pointer, u16 **buf) *buf = pos; } -/* +/** * printx() - print hexadecimal number to an u16 string * * @p: value to print @@ -71,7 +71,7 @@ static void printx(u64 p, int prec, u16 **buf) } /** - * print_guid() - print GUID to an u16 string + * print_uuid() - print GUID to an u16 string * * @p: GUID to print * @buf: pointer to buffer address, @@ -92,12 +92,12 @@ static void print_uuid(u8 *p, u16 **buf) } } -/* - * Print an unsigned 32bit value as decimal number to an u16 string +/** + * uint2dec() - print an unsigned 32bit value as decimal number to an u16 string * * @value: value to be printed * @prec: minimum number of digits to display - * @buf: pointer to buffer address + * @buf: pointer to buffer address, * on return position of terminating zero word */ static void uint2dec(u32 value, int prec, u16 **buf) @@ -132,13 +132,13 @@ static void uint2dec(u32 value, int prec, u16 **buf) *buf = pos; } -/* - * Print a signed 32bit value as decimal number to an u16 string +/** + * int2dec() - print a signed 32bit value as decimal number to an u16 string * * @value: value to be printed * @prec: minimum number of digits to display - * @buf: pointer to buffer address - * on return position of terminating zero word + * @buf: pointer to buffer address, + * on return position of terminating zero word */ static void int2dec(s32 value, int prec, u16 **buf) { @@ -155,12 +155,12 @@ static void int2dec(s32 value, int prec, u16 **buf) *buf = pos; } -/* - * Print a colored formatted string to the EFI console +/** + * efi_st_printc() - print a colored message * - * @color color, see constants in efi_api.h, use -1 for no color - * @fmt format string - * @... optional arguments + * @color: color, see constants in efi_api.h, use -1 for no color + * @fmt: printf style format string + * @...: arguments to be printed */ void efi_st_printc(int color, const char *fmt, ...) { @@ -271,10 +271,10 @@ void efi_st_printc(int color, const char *fmt, ...) con_out->set_attribute(con_out, EFI_LIGHTGRAY); } -/* - * Reads an Unicode character from the input device. +/** + * efi_st_get_key() - read an Unicode character from the input device * - * Return: Unicode character + * Return: Unicode character */ u16 efi_st_get_key(void) { From 479ba0cc4d6ef1dd74889826e0dbad82b29999a7 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Tue, 4 Nov 2025 22:50:25 +0100 Subject: [PATCH 3/8] efi_loader: typo 'eventfor' in efi_ipconfig.c %s/eventfor/event for/ Signed-off-by: Heinrich Schuchardt --- lib/efi_loader/efi_ipconfig.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/efi_loader/efi_ipconfig.c b/lib/efi_loader/efi_ipconfig.c index 9f51f77fa9a..b20de8c3e4b 100644 --- a/lib/efi_loader/efi_ipconfig.c +++ b/lib/efi_loader/efi_ipconfig.c @@ -168,8 +168,8 @@ static efi_status_t EFIAPI efi_ip4_config2_register_notify(struct efi_ip4_config } /* - * efi_ip4_config2_unregister_notify() - Remove a previously registered eventfor - * the specified configuration data + * efi_ip4_config2_unregister_notify() - Remove a previously registered event + * for the specified configuration data * * This function implements EFI_IP4_CONFIG2_PROTOCOL.UnregisterDataNotify() * See the Unified Extensible Firmware Interface From 033780768edb2cf3d115099277f50ce90400959f Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Tue, 4 Nov 2025 23:00:55 +0100 Subject: [PATCH 4/8] efi_client: don't include asm/global_data.h twice Remove duplicate #include. Acked-by: Ilias Apalodimas Signed-off-by: Heinrich Schuchardt --- lib/efi_client/efi_app.c | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/efi_client/efi_app.c b/lib/efi_client/efi_app.c index 9b94a93ee4f..da8e3432859 100644 --- a/lib/efi_client/efi_app.c +++ b/lib/efi_client/efi_app.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include From ea99509b67d92c261e8cc1d293edd8462974bc5a Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Tue, 4 Nov 2025 23:14:23 +0100 Subject: [PATCH 5/8] efi_client: correct memset() return value Memset() must return a pointer to the start of the updated memory block. Fixes: 476476e73b14 ("efi: Add support for loading U-Boot through an EFI stub") Signed-off-by: Heinrich Schuchardt --- lib/efi_client/efi_stub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/efi_client/efi_stub.c b/lib/efi_client/efi_stub.c index a083c7f1e9b..da7972444df 100644 --- a/lib/efi_client/efi_stub.c +++ b/lib/efi_client/efi_stub.c @@ -110,7 +110,7 @@ void *memset(void *inptr, int ch, size_t size) while (ptr < end) *ptr++ = ch; - return ptr; + return inptr; } static void jump_to_uboot(ulong cs32, ulong addr, ulong info) From e0adf4c5a44a026aa158c456a29b7f7d64c90f9d Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Mon, 10 Nov 2025 21:56:32 +0800 Subject: [PATCH 6/8] docker: Correct the linux/arm64 platform string The Dockerfile is using linux/arm64 without the /v8 suffix. Signed-off-by: Bin Meng Reviewed-by: Heinrich Schuchardt --- doc/build/docker.rst | 2 +- tools/docker/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/build/docker.rst b/doc/build/docker.rst index 4974a98d4af..791eb215617 100644 --- a/doc/build/docker.rst +++ b/doc/build/docker.rst @@ -36,7 +36,7 @@ To build the image yourself: .. code-block:: bash - sudo docker buildx build --platform linux/arm64/v8,linux/amd64 -t your-namespace:your-tag . + sudo docker buildx build --platform linux/arm64,linux/amd64 -t your-namespace:your-tag . Or to use an existing container diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile index d2384219c06..58f2a28daa0 100644 --- a/tools/docker/Dockerfile +++ b/tools/docker/Dockerfile @@ -6,7 +6,7 @@ FROM ubuntu:jammy-20251001 LABEL org.opencontainers.image.authors="Tom Rini " LABEL org.opencontainers.image.description=" This image is for building U-Boot inside a container" -# Used by docker to set the target platform: valid values are linux/arm64/v8 +# Used by Docker to set the target platform: valid values are linux/arm64 # and linux/amd64 ARG TARGETPLATFORM From b8f2614ecaca83b381a92af54e5e38eefaf7646f Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Thu, 6 Nov 2025 17:28:39 -0600 Subject: [PATCH 7/8] efi_selftest: efi_selftest_snp: Fix warning when building with clang When building with clang, we see a warning: lib/efi_selftest/efi_selftest_snp.c:63:18: error: field dhcp_hdr within 'struct dhcp' is less aligned than 'struct dhcp_hdr' and is usually due to 'struct dhcp' being packed, which can lead to unaligned accesses [-Werror,-Wunaligned-access] when building lib/efi_selftest/efi_selftest_snp.c. Resolve this error by packing struct dhcp_hdr as well, as the only place it is used also is packed. Signed-off-by: Tom Rini Reviewed-by: Ilias Apalodimas --- lib/efi_selftest/efi_selftest_snp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/efi_selftest/efi_selftest_snp.c b/lib/efi_selftest/efi_selftest_snp.c index b00c76c2f17..290ed3a28f2 100644 --- a/lib/efi_selftest/efi_selftest_snp.c +++ b/lib/efi_selftest/efi_selftest_snp.c @@ -43,7 +43,7 @@ struct dhcp_hdr { u8 chaddr[16]; u8 sname[64]; u8 file[128]; -}; +} __packed; /* * Message type option. From 8cc144227e13b50cd6d97c36ebb45f31f4d8c9cd Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Thu, 13 Nov 2025 12:55:49 +0100 Subject: [PATCH 8/8] efi_loader: Assure fitImage from capsule is used from 8-byte aligned address The fitImage may be stored in EFI update capsule at address that is not aligned to 8 bytes. Since fitImage is a DT, new version of libfdt 1.7.2 rejects such an unaligned DT. Patch the code and copy the fitImage into aligned buffer in case it is not aligned. This does increase overhead for unaligned fitImages in EFI capsules, but tries to keep the overhead low for aligned ones. Signed-off-by: Marek Vasut Reviewed-by: Heinrich Schuchardt --- lib/efi_loader/efi_firmware.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c index 216df83de67..b41969c70fd 100644 --- a/lib/efi_loader/efi_firmware.c +++ b/lib/efi_loader/efi_firmware.c @@ -651,6 +651,7 @@ efi_status_t EFIAPI efi_firmware_fit_set_image( efi_status_t status; struct fmp_state state = { 0 }; char *orig_dfu_env; + void *img; EFI_ENTRY("%p %d %p %zu %p %p %p\n", this, image_index, image, image_size, vendor_code, progress, abort_reason); @@ -677,7 +678,20 @@ efi_status_t EFIAPI efi_firmware_fit_set_image( return EFI_EXIT(EFI_DEVICE_ERROR); } - ret = fit_update(image); + /* Make sure the update fitImage is properly aligned to 8-bytes */ + if (!IS_ALIGNED((uintptr_t)image, 8)) { + img = memalign(8, image_size); + if (!img) + return EFI_EXIT(EFI_BAD_BUFFER_SIZE); + memcpy(img, image, image_size); + } else { + img = (void *)image; + } + + ret = fit_update(img); + + if (!IS_ALIGNED((uintptr_t)image, 8)) + free(img); if (env_set("dfu_alt_info", orig_dfu_env)) log_warning("Unable to restore env variable \"dfu_alt_info\". Further DFU operations may fail!\n");