Commit graph

97660 commits

Author SHA1 Message Date
Maks Mishin
f55fa90a95 tools: check result of lseek
Return value of function 'lseek', called at pblimage.c:211,
is not checked, but it is usually checked for this function.

This trigger was found using the Svace static analyzer.

Signed-off-by: Maks Mishin <maks.mishinFZ@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2025-01-26 11:35:46 -06:00
Tom Rini
6121676720 Merge a patch series for mx313xx RTC drivers
This series of patches from Mark Tomlinson fixes two problems with the
mx313xx series of RTC devices.

Link: https://lore.kernel.org/r/20250120015941.1849667-1-mark.tomlinson@alliedtelesis.co.nz
2025-01-26 11:33:17 -06:00
Mark Tomlinson
0e4c345ecf drivers: rtc: max313xx: Ensure correct date is read after setting
When setting the time on the MAX31343, the time is not updated
for one second, and reading the time in this interval will give
the old time. Wait one second after writing so that the date
command will show the correct time when setting the clock.

Signed-off-by: Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz>
Cc: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Chris Packham <judge.packham@gmail.com>
2025-01-26 11:33:13 -06:00
Mark Tomlinson
d86da7e2bd drivers: rtc: max313xx: Fix setting years 2100-2199
An invalid calculation made setting years 2100-2199 impossible.

Signed-off-by: Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz>
Cc: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Chris Packham <judge.packham@gmail.com>
2025-01-26 11:33:13 -06:00
Tom Rini
8a2a71a4ee Pull request efi-2025-04-rc1-2
Documentation:
 
 * describe creating a pflash file for qemu-system-riscv64
 
 UEFI:
 
 * correct logging StartImage()
 * use LOGC_EFI consistently
 * reduce UEFI size if HAS_BOARD_SIZE_LIMIT=y
 * Update efi_run_image() to accept image and device path
 * Add a version of efi_binary_run() with more parameters
 * Move the fallback code from efi_run_image()
 * Pass in the required parameters from EFI bootmeth
 * bootmeth_efi: Support PXE booting
 
 Other:
 
 * Enable log filtering by function name
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEK7wKXt3/btL6/yA+hO4vgnE3U0sFAmeWCwgACgkQhO4vgnE3
 U0u7qRAAusk/HO9ICJRm/BPnOsRim8dB58kZ/WTTzmxAIpLST4FKXGtvv+SHCJNA
 l/zFQ0Tijeh4mrEKurNvJWQ2LDMRDDO5czSfQG4OjfEq1RISASuIkI31yTKi9bZn
 AmvTkotg0XR7SbUQxdCBN1MCxecvPVrfASor1OGb64NN1EXdJybAhtAZ9XUEH/VX
 1tOnkSFXzFqVkNVlC0o1vanTRlV8VfAWHFE/pxiZzbsAca2ZGxht82d2WFios+Ri
 PAVnAhUEFWId49N62slFq6jqBbCwbKVeA5/2L7ntvZY1BxugIEw0qaCmSiTlWAFE
 J1lrjUUrvH0bJLdGBZcSWLneXqEcQCnlLTMl42YPfvCyxXcdbEDoiVlkMpMVgmfd
 10dJVzsaumbTsQus/UIFDY5b2aUp4n9peULS1iSc5KLIpS2xPmY6trOwNvFi6GXU
 Z4QF9mHNn6zfN3rFfw8IpyqN2n7ixVQdbgdhkaYyTUoLmwt9Y5oMfbbJ9uP2U38H
 GnXDRoMWSq50u3q/y7KwB989yA9OjNfijKy5cuR2MaHtRL+FNlvpK9kvRHh6n2pz
 CZfSqvCZP/35WwSqGoxMa96zDmQrMTXr1Cjgo2l+Jutwv+sx7ZTtiasYWul5ovWQ
 GMO2NCFgHP25AYuY6rYYg5JmP1S85z7Y5Tcmy7Onb/3cuyzqGrk=
 =cFni
 -----END PGP SIGNATURE-----

Merge tag 'efi-2025-04-rc1-2' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request efi-2025-04-rc1-2

Documentation:

* describe creating a pflash file for qemu-system-riscv64

UEFI:

* correct logging StartImage()
* use LOGC_EFI consistently
* reduce UEFI size if HAS_BOARD_SIZE_LIMIT=y
* Update efi_run_image() to accept image and device path
* Add a version of efi_binary_run() with more parameters
* Move the fallback code from efi_run_image()
* Pass in the required parameters from EFI bootmeth
* bootmeth_efi: Support PXE booting

Other:

* Enable log filtering by function name
2025-01-26 08:10:28 -06:00
Simon Glass
21de624eb8 bootmeth_efi: Support PXE booting
Finish off the implementation so it is possible to boot an EFI app over
a network.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-26 11:06:57 +01:00
Simon Glass
a2338955fc efi_loader: Pass in the required parameters from EFI bootmeth
Rather than setting up the global variables and then making the call,
pass them into function directly. This cleans up the code and makes it
all a bit easier to understand.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-26 11:06:57 +01:00
Simon Glass
5f67c8800e efi_loader: Move the fallback code from efi_run_image()
This code is only needed if an invalid image/device path is passed in.
Move the code out to a caller where this can be dealt with. The normal
flow will provide these parameters.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-26 11:06:57 +01:00
Simon Glass
b9f42821af efi_loader: Add a version of efi_binary_run() with more parameters
This uses a few global variables at present. With the bootflow we have
the required parameters, so add a function which accepts these. Update
the existing function to call the new one with the globals.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2025-01-26 11:06:57 +01:00
Simon Glass
a70759898a efi_loader: Update efi_run_image() to accept image and device path
Provide these globals as parameters to this function, on the way to
making it possible to start an image without relying on the globals.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2025-01-26 11:06:57 +01:00
Heinrich Schuchardt
7a713ab1c6 doc: describe creating a pflash file for qemu-system-riscv64
U-Boot can be executed in place from a flash device.
Describe how this can be emulated on RISC-V QEMU.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2025-01-26 11:06:56 +01:00
Heinrich Schuchardt
e20349a38c efi_loader: reduce UEFI size if HAS_BOARD_SIZE_LIMIT=y
If a board has a strict size limit, disable

* Unicode capitalization and
* HII protocols

by default to reduce the image size.

Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2025-01-26 11:06:56 +01:00
Heinrich Schuchardt
e9c34fab18 efi_loader: use LOGC_EFI consistently
The log category should be LOGC_EFI all over the EFI sub-system.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2025-01-26 11:06:56 +01:00
Heinrich Schuchardt
01b35b3e38 test/log: test function filters
Add unit tests for function filters.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2025-01-26 11:06:56 +01:00
Heinrich Schuchardt
cb43e3e427 log: enable filtering on functions
Up to now we could only use log level, category, and file for filtering.
Allow filtering on a list of functions.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2025-01-26 11:06:56 +01:00
Heinrich Schuchardt
1daacb9275 log: make log_has_file() static
Function log_has_file() is not used externally. Make it static.

Rename the function to log_has_member() as we can reuse for filtering
other strings.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2025-01-26 11:06:56 +01:00
Heinrich Schuchardt
9f00d38ce7 efi_loader: correct logging StartImage()
When logging running an image, e.g. `bootefi hello` the indent is not
correctly reset.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2025-01-26 11:06:56 +01:00
Tom Rini
292278d682 Merge patch series "gitlab: Fixes to get StarFive VisionFive2 into the sjg lab"
Simon Glass <sjg@chromium.org> says:

This board fought valiantly against attempts to add it to my lab. After
several hours of debugging, I found problems in the Labgrid integration
(not included here), test.py and buildman

This series fixes these and the board now seems to be reliable enough.

Note that the board fails test_dm_compat

Link: https://github.com/labgrid-project/labgrid/pull/1411
Link: https://lore.kernel.org/r/20241214182024.1954974-1-sjg@chromium.org
2025-01-25 16:28:27 -06:00
Simon Glass
1135dc50a3 gitlab: Add a StarFive VisionFive2 to the sjg lab
I have one of these boards loaded with Ubuntu 24.10 (64-bit). Add an
entry for it so that it can be used for testing.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-By: Heinrich Schuchardt <xypron.glpk@gmx.de>
2025-01-25 16:28:27 -06:00
Simon Glass
bd7883f346 buildman: Record an error if a toolchain is missing
Buildman has always treated the lack of a toolchain as an infrastructure
problem rather than a build failure.

However the logic for this is not correct, since it does not write a
'done' file in this case.

As a result, one of two things can happen.

1. If a previous build ran in the same (output) directory, the outcome
   of *that* build is recorded as the outcome of this one
2. Otherwise, no outcome is recorded

Obviously this inconsistency is not ideal. While (2) is rare, it can be
very confusing as the build sort-of fails but does not produce any
summary output with 'buildman -s'

Overall it seems better to attribute a toolchain issue to the boards
that it affects. This results in clear failures which can be examined,
no matter what happened in the .bm-work directory previously.

So write a 'done' file for each build when a toolchain is missing.

The end result of this patch is to make missing toolchains much more
obvious. It should be things a bit easier for novice users.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-25 16:27:24 -06:00
Simon Glass
dd7138dde7 buildman: Drop unused OUTPUT_FILE constant
This is not actually used but its presence suggests that it is the
filename for the board database. Drop it to avoid confusion.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-25 16:27:24 -06:00
Simon Glass
64d5a0550a test/py: Handle u-boot-test-getrole failure
This script can fail if there is no toolchain available for the board.
At present this is not handled very nicely, in that only the error
output is reported. It is much more useful to see everything, so
combine stdout and stderr and report them both.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-25 16:27:24 -06:00
Simon Glass
ba87a2fcfb test/py: Provide the correct U_BOOT_SOURCE_DIR to getrole
The u-boot-test-getrole script runs before the normal environment
variables have been set up. This is unavoidable since the script is
providing necessary information to test.py

This means that U_BOOT_SOURCE_DIR is not set in the environment.

As a result, Labgrid uses its default source path, configured in its
environment variable. While this may happen to work, it is not correct.
Also, it causes problems when running from Gitlab, where the runner may
not have access to that source path.

Provide the required source path in U_BOOT_SOURCE_DIR so that Labgrid
does the right thing.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: bf89a8f1fc ("test: Introduce the concept of a role")

[1] https://patchwork.ozlabs.org/project/uboot/patch/20241211131858.520639-1-sjg@chromium.org/
2025-01-25 16:27:24 -06:00
Tom Rini
0e198ff1a9 configs: Resync with savedefconfig
Resync all defconfig files using qconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
2025-01-24 16:35:58 -06:00
Tom Rini
8162f35a10 Merge patch series "test: Improvements to ut command and test-suite running"
Simon Glass <sjg@chromium.org> says:

The current method of running unit tests relies on subcommands of the
ut command. Only the code in each subcommand knows how to find the tests
related to that subcomand.

This is not ideal and we now have quite a few subcommands which do
nothing but locate the relevant tests in a linker list, then call a
common function to run them.

This series adds a list of test suites, so that these subcommands can be
removed.

An issue with 'ut all' is that it doesn't record how many tests failed
overall, so it is necessary to examine copious amounts of output to look
for failures. This series adds a new 'total' feature allow recording the
total number of failed tests.

To help with 'ut all' a new pytest is created which runs it (as well as
'ut info') and makes sure that all is well. Due to the 'ut all' failures
this does not pass, so the test is disabled for now. It is here because
it provides security against misnaming a test suite and causing it not
to run.

Future work may:
- get 'ut all' passing
- enable test_suite() in CL, to ensure that 'ut all' keeps passing
- record duration of each suite
- allow running the tests in random order to tease out dependencies
- tweak the output to remove common prefixes
- getting rid of bootstd, optee and seame 'ut' subcommands

Link: https://lore.kernel.org/r/20250120212613.516664-1-sjg@chromium.org
2025-01-24 14:35:37 -06:00
Simon Glass
229d145f26 doc: Update ut documentation
Update documentation for the 'ut' command, since it has changed a
little.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24 14:34:41 -06:00
Simon Glass
fc7968c118 test: Move help into the suite declaration
Rather than having the help in the longhelp, put it in the suite info
so 'ut info -s' can show it. This is tidier, particular due to the
removal of #ifdefs

This means that the help text is present in the image (although not
displayed with 'ut info -s') so the image-size increases. But with
UNIT_TEST enabled, we expect large images so this doesn't seem
important.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24 14:34:41 -06:00
Simon Glass
39d2bb062e test: Disable test_suite
This fails at present, so disable it until it can pass.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24 14:34:41 -06:00
Simon Glass
18aa9913a1 test: Sort the test suites
Put the suites in order by name, for easier code-maintenance. This also
helps find test results for a particular swuit in the 'ut all' output.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24 14:34:41 -06:00
Simon Glass
6d97c98095 test: Record and show the totals for all test runs
With 'ut all' multiple test suites are run. Add a way to collect totals
and show them at the end.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24 14:34:41 -06:00
Simon Glass
15c39587cf test: Move stat-printing into its own function
Add a function to show the stats, so we can decide when to print it.

This slightly adjusts the output, so that any 'test not found' message
appears on its own line after all other output.

The 'failures' message now appears in lower case so update pytest
accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24 14:34:41 -06:00
Simon Glass
561320beff test: Keep a track of the numbers of tests run
This is useful information and is not always the same as the 'count' arg
to ut_run_list() so add it as a separate stat.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24 14:34:41 -06:00
Simon Glass
0925659a52 test: Move stats into a struct
Use a struct to hold the stats, since we also want to have the same
stats for all runs as we have for each suite.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24 14:34:41 -06:00
Simon Glass
bbff0b165c test: Pass the test state to cmd_ut_category()
Update this function to access a unit-test state, so that the caller can
collect results from running multiple suites.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24 14:34:41 -06:00
Simon Glass
374203bd2e test: Drop conditional compilation for suites
This is not needed anymore. If a test suite is not built, then it will
have no linker-list entries. So we can just check for that and know that
the suite is not present.

This allows removal of the #ifdefs and the need to keep them in sync
with the associated Makefile rules, which has actually failed, since the
help does not match what commands are actually present.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24 14:34:41 -06:00
Simon Glass
81c5434f49 test: Drop the info test from the list
The 'info' test is not a real test. With the new suite array we can drop
this and the associated special-case code.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24 14:34:41 -06:00
Simon Glass
0af17462b9 test: Drop the function for running upl tests
Use the new suite-runner to run these tests instead.

It is not clear that these actually work, since they are not enabled on
sandbox for some reason.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24 14:34:40 -06:00
Simon Glass
b073d8a272 test: Drop the function for running seama tests
Use the new suite-runner to run these tests instead.

It is not clear that these actually work, since they are not enabled on
sandbox for some reason.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
2025-01-24 14:34:40 -06:00
Simon Glass
a2cf88d807 test: Drop the function for running pci_mps tests
Use the new suite-runner to run these tests instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24 14:34:40 -06:00
Simon Glass
822cb558e1 test: Drop the function for running loadm tests
Use the new suite-runner to run these tests instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24 14:34:40 -06:00
Simon Glass
d5e5cb48e6 test: Drop the function for running hush tests
Use the new suite-runner to run these tests instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24 14:34:40 -06:00
Simon Glass
e6959512b6 test: Drop the function for running addrmap tests
Use the new suite-runner to run these tests instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24 14:34:40 -06:00
Simon Glass
1ca67c3f04 test: Drop the function for running bootm tests
Use the new suite-runner to run these tests instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24 14:34:40 -06:00
Simon Glass
28b32858aa test: Drop the function for running bloblist tests
Use the new suite-runner to run these tests instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24 14:34:40 -06:00
Simon Glass
446e6f9cd3 test: Drop the function for running measurement tests
Use the new suite-runner to run these tests instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24 14:34:40 -06:00
Simon Glass
cebdc5376f test: Drop the function for running setexpr tests
Use the new suite-runner to run these tests instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24 14:34:40 -06:00
Simon Glass
bda212bad5 test: Drop the function for running mem tests
Use the new suite-runner to run these tests instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24 14:34:40 -06:00
Simon Glass
1ade3afa2d test: Drop the function for running mbr tests
Use the new suite-runner to run these tests instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24 14:34:40 -06:00
Simon Glass
87cf479fdb test: Drop the function for running log tests
Use the new suite-runner to run these tests instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24 14:34:40 -06:00
Simon Glass
d824e20fc2 test: Drop the function for running lib tests
Use the new suite-runner to run these tests instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24 14:34:40 -06:00