Add subcommand support:
- compare: Compare branches (existing functionality)
- test: Run the functional tests
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Add a tool to check the number of commits in a source branch
(us/next) that are not in the master branch (ci/master), and find
the last common commit between them.
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
- a8c07ac497 alist: Mention the error condition in alist_add_placeholder()
- 13bd298499 alist: Add a comment for alist_init_struct()
- 6668d860f7 alist: Expand the comment for alist_get()
- 2ce146a3de alist: Add a way to get the next element
- 83bc5989fc alist: Add for-loop helpers
- 70f5f17415 alist: Add a function to empty the list
- d01c58acb7 alist: Add a way to efficiently filter an alist
- b84c13f37d alist: Add maintainer
- cedf9ccaa2 dm: core: Add a function to see if a device exists
- 6e625484f5 test: boot: Use a consistent name for the script bootmeth
- 57e77dc80e arm: dts: e850-96: Remove TRNG node from appended dts
- 33ddfc059e driver: sifive ccache: enable TRUNKCLOCKGATE and REGIONCLOCKGATE
- e83a99cb67 configs: visionfive2: re-enable SPL_SYS_MMCSD_RAW_MODE
- d86ff34285 xilinx: mbv: Place DTB by default to DDR location
- e4b8d8be4e xilinx: mbv: Align smode_defconfig with upstream QEMU
- d5f5e77818 riscv: Introduce configuration for 64bit version Microblaze V
- a7a96a37cb Merge https://source.denx.de/u-boot/custodians/u-boot-riscv
To restore MMC boot, enable SPL_SYS_MMCSD_RAW_MODE and recover
SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION and
SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION.
Fixes: 2a00d73d08 ("spl: mmc: Try to clean up raw-mode options")
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
(cherry picked from commit e83a99cb67)
The x250 and SE250 are series of 10G L2+ switches from Allied Telesis.
There are a number of them in the range but as far as U-Boot is
concerned all the CPU block components are the same so there's only one
board defined.
Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
(cherry picked from commit 7446e29db5)
Enable IPV6 support for the x530 board.
Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
(cherry picked from commit f337b5aaad)
The x530 board doesn't use EFI and our toolchains don't include gnutls
so disable the tool in the defconfig.
Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
(cherry picked from commit c6b17af142)
As things have been moved to Kconfig there are a number of dead comments
left over in x530.h. Remove them.
Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
(cherry picked from commit 1b46176532)
Enable IPV6 support for the x240 board.
Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
(cherry picked from commit b25b2d4f67)
The x240 board doesn't use EFI and our toolchains don't include gnutls
so disable the tool in the defconfig.
Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
(cherry picked from commit cbbfa8d778)
Use standard boot instead of the distro boot scripts. Regenerate the
board defconfig now that some options are selected automatically.
Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
(cherry picked from commit 27b2488735)
Remove CFG_SYS_BAUDRATE_TABLE as there's no reason not to use the
defaults defined via config_fallbacks.h.
Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
(cherry picked from commit 3eef899b57)
In getvar_partition_type() we attempt to find a filesystem driver for
the partition (of the list of driver enabled in U-Boot), on failure we
return the error to fastboot and completely bail out of the operation.
However, this should not be a failure, instead we should just default to
"raw". This allows commands like "fastboot format:ext4 userdata" to work
if userdata didn't already have an ext4 partition table (or if FS_EXT4
is disabled in U-Boot), as failing to determine the current partition
type is not an error in this case.
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Link: https://lore.kernel.org/r/20241113050607.1850472-1-caleb.connolly@linaro.org
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
(cherry picked from commit 06b8aafd68)
Commit 136b7b6d2e ("Subtree merge tag 'v6.11-dts' of dts repo [1] into
dts/upstream") updates the upstream dts for E850-96 board, bringing
upstream TRNG node. There is no need to keep TRNG node in appended dts
anymore, so remove it.
Tested on E850-96 board by running 'rng' command in U-Boot shell.
Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
(cherry picked from commit 57e77dc80e)
unsigned int count is used to capture return of dev_read_string_count.
When an error occurs dev_read_string_count returns -ve, which can
hence not be handled correctly. Use int instead of unsigned int so
that errors are detected.
Fixes: 16ca80adc5 ("pinctrl: Add pinctrl driver support for Exynos7420 SoC")
Signed-off-by: Henrik Grimler <henrik@grimler.se>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
(cherry picked from commit e5565c24bb)
Add a description of how test parameters work. This helps to make it
easier to write C tests which need setup to be done in Python.
Series-to: concept
Series-cc: heinrich
Cover-letter:
test: Add support for passing arguments to C unit tests
This series adds infrastructure for passing runtime arguments from Python
tests to C unit tests. This makes it easier to support a hybrid testing
approach where Python handles complex setup (filesystem images,
environment configuration) while C handles the actual test logic with
better debuggability.
A few other things are included to make this work:
- A fix for linker list alignment that was causing garbage values like
"Running -858993444 bloblist tests" due to GCC's magic-number division
optimization failing when padding breaks exact multiples
- A fix fix for serial output with sandbox, since it sometimes misses
output at the end when running tests with gnome terminal
- Improvements to the linker-list script to detect padding and
pointer-arithmetic bugs
- A new UNIT_TEST_ARGS() macro for declaring tests with typed arguments,
along with argument parsing in the ut command (name=value format)
- Argument-accessor macros ut_str(), ut_int(), and ut_bool() with
type-checking and bounds validation
- A private buffer (uts->priv) for test-local temporary data, which
makes it a little easier to write shorter tests
- Tests for the argument feature (test_args) covering type checking,
bounds checking, and argument-parsing failures
As an example, the basic filesystem tests are converted from pure Python
to C with Python wrappers.
Some improved printf documentation and support for Linux's %pV format
are provided.
The slight increase in size causes qemu-riscv64_spl to fail, so this
series also includes a patch to increase the SPL-malloc() space.
END
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Update test_basic.py to call the new C-based filesystem tests via the
'ut' command. This allows tests to run more directly, calling the actual
FS layer, without having to go through the command interface and
worrying about which filesystem command to use.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Add C implementations of filesystem tests that can be called via
the 'ut fs' command. These tests use UTF_MANUAL flag since they require
external setup, i.e. creation of filesystem images.
This covers the existing TestFsBasic tests.
The tests use typed arguments (fs_type, fs_image, md5 values) passed
via the command line.
Add a few helpers to make the code easier to read.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Add a set of tests to check the behaviour of test arguments and the ut
command. This includes failure cases, where the wrong type or a
non-existent argument is requested.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Update the 'ut' command to have a -R command option to prevent ut_fail()
and ut_failf() from clearing GD_FLG_RECORD. This is useful when testing
the test framework itself, where error messages need to be captured.
Refactor ut_fail() and ut_failf() to call ut_unsilence_console() instead
of duplicating the flag-clearing logic.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Add a priv[] buffer to struct unit_test_state that tests can use for
their own data. This avoids the need to allocate memory or use global
variables for test-specific state.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Add ut_get_str(), ut_get_int(), and ut_get_bool() functions with
corresponding ut_str(), ut_int(), and ut_bool() macros for accessing
test arguments with type checking.
These functions check that the argument index is within bounds and the
type matches what was requested.
The first failure for a test is reported via ut_failf() which should
make it fairly easy to debug the test.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Update the ut command to permit passing arguments to tests.
Usage: ut -f fs test_name key1=value1 key2=value2
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Add support for passing key=value arguments to unit tests. The test
framework parses arguments based on definitions provided by each test
and makes them available via uts->args[]
For now the 'ut' command does not support this new feature.
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Add a UNIT_TEST_ARGS() macro to declare and register a test with inline
argument definitions. The variadic arguments use struct ut_arg_def and
a NULL terminator is added automatically to the list.
Example usage:
static int my_test(struct unit_test_state *uts) { ... }
UNIT_TEST_ARGS(my_test, UTF_CONSOLE, my_suite,
{ "path", UT_ARG_STR },
{ "count", UT_ARG_INT, UT_ARGF_OPTIONAL, { .vint = 10 } });
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Add types for declaring and storing unit test arguments:
- enum ut_arg_type: INT, BOOL, STR types
- enum ut_arg_flags: OPTIONAL flag for non-required args
- struct ut_arg_def: declares expected args with defaults
- struct ut_arg: holds parsed argument values
This prepares for passing key=value arguments to tests via the 'ut'
command instead of needing to use environment variables.
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Add a new ut_assert_nextline_regex() macro and ut_check_console_line_regex()
helper to check console output against a regex pattern. This is useful when
the exact output varies (e.g., file paths or line numbers in error messages).
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Move the -f flag before the suite name since ut parses flags
before the suite argument.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Change the alignment of end markers in ll_entry_end() and ll_end_decl()
from __aligned(4) and __aligned(CONFIG_LINKER_LIST_ALIGN) respectively
to __aligned(1).
The linker places zero-size end markers at aligned boundaries based on
what follows them. When the next list's start marker has a high alignment
requirement (e.g., 32 bytes), padding gets inserted before the end marker.
This causes the byte span (end - start) to not be an exact multiple of
the struct size.
The compiler optimizes pointer subtraction (end - start) using magic-number
multiplication for division. This optimization only produces correct results
when the byte span is an exact multiple of the struct size. With padding,
the result is garbage (e.g., -858993444 instead of 15).
By using __aligned(1), the end marker is placed immediately after the last
entry with no padding, ensuring (end - start) equals exactly n * sizeof
where n is the number of entries. This makes ll_entry_count() and direct
pointer arithmetic work correctly.
Fixes: 0b2fa98aa5 ("linker_lists: Fix alignment issue")
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
When linker-inserted padding breaks list integrity, pointer arithmetic
like (end - start) / sizeof(struct) produces garbage. GCC optimizes
division by constants using multiplicative inverses, which only works
when the dividend is an exact multiple. With padding, outputs like
"Running -858993444 bloblist tests" appear instead of the correct count.
Enhance the linker list checking script to detect these problems by
adding symbol size tracking using nm -S. This enables:
1. Padding detection: Compare symbol sizes to gaps. If gap > size,
padding was inserted, breaking contiguous array assumptions.
2. Pointer arithmetic bugs: Check if (end - start) marker span is a
multiple of struct size.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Add support for the %pV format-specifier which allows printing a
struct va_format. This is used by the Linux kernel for recursive
printf() formatting and is needed by the ext4l filesystem driver.
Add the struct to include/linux/printk.h to match the kernel location.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Add documentation for the tiny printf implementation used in SPL, TPL,
and VPL when CONFIG_SPL_USE_TINY_PRINTF (or equivalent) is enabled.
Document the supported format specifiers, limitations, and the warning
about snprintf() not performing bounds checking in this implementation.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Expand the printf format documentation to include information on all
printf-style functions. Mention CONFIG depencies as well.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
When characters cannot be sent to the serial port, return an error code
so that the uclass can try again.
This fixes a problem with gnome-terminal which seems to get behind and
then drop output when a large amount of output is produced quickly (e.g.
100K in under a second). Since sandbox often writes to the device one
character at a time it does place a substantial load on the other end of
the PTY. Quite possibly it does not empty the pipe quickly enough and so
writing to the PTY fails.
Signed-off-by: Simon Glass <simon.glass@canonical.com>
If something goes wrong when writing to the serial device, take notice
of the error code and try again, if needed.
Signed-off-by: Simon Glass <simon.glass@canonical.com>
On several RISC-V boards we have seen that 1 MiB is a insufficient value
for CONFIG_SPL_SYS_MALLOC_SIZE.
For instance qemu-riscv32_spl_defconfig fails booting because u-boot.itb
exceeds 1 MiB.
8 MiB is a reasonable value that allows adding FPGA blobs or splash images
to main U-boot.
Reported-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
(cherry picked from commit 8b410cab51)
Dropped modifications to all files except common/spl/Kconfig:
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Update the malloc() with more info about the debugging features:
- CONFIG_MALLOC_DEBUG and CONFIG_MCHECK_HEAP_PROTECTION Kconfig options
- The malloc command with info and dump subcommands
- Caller backtrace display when mcheck is enabled
Series-to: concept
Series-cc: heinrich
Series-version: 2
Cover-letter:
malloc: Add heap debugging commands and mcheck caller tracking
This series adds improved heap-debugging capabilities.
As part of this, the recently added backtrace feature is reworked to
avoid itself using malloc(), which makes it difficult for malloc() to
use.
A new 'malloc' command with 'info' and 'dump' subcommands allows
inspecting the heap state at runtime.
The mcheck heap-protection feature is integrated into Kconfig and can be
used to to track caller information for each allocation, showing the
function name and line number.
The caller info can be seen with 'malloc dump', including for freed
chunks where possible.
The 'malloc info' command shows a few more heap statistics:
=> malloc info
total bytes = 96 MiB
in use bytes = 700.9 KiB
malloc count = 1234
free count = 567
realloc count = 89
The 'malloc dump' command walks the heap showing each chunk:
=> malloc dump
Heap dump: 19a0e000 - 1fa10000
Address Size Status
----------------------------------
19a0e000 10 (chunk header)
19a0e010 a0 log_init:453 <-board_init_r:774 <-sandbox_flow:
19a0e0b0 20070 membuf_new:420 <-console_record_init:880 <-boar
19a2e120 170 membuf_new:420 <-console_record_init:886 <-boar
19a2e290 150 unflatten_device_tree:299 <-of_live_build:328 <
19a2e3e0 a0 uclass_get:157 <-device_bind_common:59 <-device
...
19a4b080 70 free done_word:2489 <-parse_stream_outer:3190 <-pars
...
This is useful for debugging memory leaks, understanding allocation
patterns, and tracking down heap corruption issues.
Some additional patches are included to make all this work:
- format_size() for human-readable size formatting
- ut_asserteq_regex() for flexible test assertions
- backtrace_str() for condensed backtrace output
Finally, this series includes a few patches for some of the more obvious
memory leaks (scmi and some test drivers), plus a reduction in truetype
memory allocations and a fix for a watchdog crash with 'ut dm'.
END
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Use a static bool flag to ensure the overflow warning is printed only
once, avoiding repeated messages when the registry is full.
Make sure to set the flag before calling printf(), which can itself do
allocations with sandbox / Truetype.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
When CONFIG_MCHECK_HEAP_PROTECTION is enabled, show the original
caller info for freed chunks. This helps identify what code allocated
memory that is now free.
The mcheck header's canary and caller fields survive after free since
dlmalloc only overwrites the first 16 bytes (size, aln_skip) with its
free list pointers (fd, bk). We detect freed headers by looking for
the MAGICFREE canary pattern.
For small chunks or coalesced chunks where the header is not preserved,
the caller info is simply omitted.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>