4368 Commits

Author SHA1 Message Date
Tom Rini
184e7d0bb2 Merge tag 'v2025.07-rc5' into next
Prepare v2025.07-rc5

With this merge, tighten up the LTO_FLAGS removal we added to not
trigger on ARMv7 (which is Thumb-2 and should be fine).
2025-06-23 16:15:23 -06:00
Shiji Yang
1989eb65c5 tools/fit_check_sign: make the module dependent on CONFIG_FIT_SIGNATURE
The function definition of fit_check_sign() is guarded by
"#ifdef CONFIG_FIT_SIGNATURE" in "tools/image-host.c". If we try
to build it without CONFIG_FIT_SIGNATURE, we will get an error:

/usr/bin/ld: tools/fit_check_sign.o: in function `main':
fit_check_sign.c:(.text.startup+0x165): undefined reference to `fit_check_sign'
collect2: error: ld returned 1 exit status

Fixes: 9c79c8fe70 ("tools/fit_check_sign: make key optional")
Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
2025-06-22 10:16:39 -06:00
Shiji Yang
961e260cdc lib: rsa: fix compilation error without openssl
The symbol TOOLS_IMAGE_PRE_LOAD doesn't depend on TOOLS_LIBCRYPTO.
If we choose to build tools without openssl, rsa_verify_openssl()
will attempt to call the unavailable openssl library functions.

Fixes: 942c8c8e66 ("rsa: Add rsa_verify_openssl() to use openssl for host builds")
Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
2025-06-22 10:16:39 -06:00
Tom Rini
dbf7fd557a Merge patch series "Consistent Kconfig environment options CONFIG_ENV_ prefix"
Marek Vasut <marek.vasut+renesas@mailbox.org> says:

Rename the environment related variables and add ENV_ prefix, so that
all configuration options which are related to environment would have
an CONFIG_ENV_ prefix. No functional change.

Link: https://lore.kernel.org/r/20250609192701.20260-1-marek.vasut+renesas@mailbox.org
2025-06-20 12:57:47 -06:00
Marek Vasut
5fb88fa725 env: Rename SYS_REDUNDAND_ENVIRONMENT to ENV_REDUNDANT
Rename the variable and add ENV_ prefix, so that all configuration
options which are related to environment would have an CONFIG_ENV_
prefix. No functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
2025-06-20 12:15:08 -06:00
Tom Rini
03817a2a80 Merge patch series "Hex value prefix case cleanup"
E Shattow <e@freeshell.de> says:

Make consistent use of lowercase hexadecimal prefix '0x' throughout U-Boot.

There are a few remaining uses of uppercase 'X' to denote hexadecimal prefix
or placeholder in documentation and error messages.

External devicetree-rebasing dts/upstream and the generated code of
xilinx/zynq are ignored for the series.

Link: https://lore.kernel.org/r/20250606224558.1117422-1-e@freeshell.de
2025-06-14 09:10:48 -06:00
E Shattow
c5824a1b3d tools: use lowercase hex prefix style
Use consistent lowercase hex prefix style in tools/*

Signed-off-by: E Shattow <e@freeshell.de>
2025-06-14 09:09:40 -06:00
Bryan Brattlof
52c0290526 binman: add atf-bl1 to etypes
Some SoCs require a Trusted Firmware-A (TF-A) AP Trusted ROM (BL1) to
initialize the SoC before U-Boot can run properly. Add an atf-bl1 etype
so we can properly package BL1 into a final binary

Signed-off-by: Bryan Brattlof <bb@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>
2025-06-12 13:22:23 -06:00
Marek Vasut
3f2eb09c22 tools: stm32image: Add support for STM32 Image V2.0
Add support for generating STM32 Image V2.0, which is used by STM32MP13xx.
The image header layout is similar to STM32MP15xx STM32 Image V1.0, but is
different enough to justify duplicate functions to generate the v2 image.
This code at least attempts to align the V1 and V2 image handling where
possible.

Signed-off-by: Marek Vasut <marek.vasut@mailbox.org>
2025-06-11 09:42:56 +02:00
Anton Moryakov
a4fb99ce4e tools: fix handle leak in ifdtool.c
Prevent file descriptor leaks by properly closing 'fd' and 'new_fd'
when fstat() or write() operations fail.

- Added close(fd) before return in open_for_read() if fstat() fails.
- Added close(new_fd) before return in write_image() if write() fails.
- No close needed if open() fails (fd == -1 is invalid).

Signed-off-by: Anton Moryakov <ant.v.moryakov@gmail.com>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
2025-06-03 17:18:02 -06:00
Simon Glass
ec2482a24a patman: Add basic documentation for new features
Describe the new subcommands and how they should be used in a normal
workflow.

Note that the naming of branches is very rigid, or 'opinionated' in
marketing terms. Patman can track a single branch for each version of a
series and they must all be named the same, except for the
version-number suffix. Version 1 series have no suffix.

This description is fairly bare-bones but should be enough for some
initial testing and comments.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27 10:07:43 +01:00
Simon Glass
a593f84d51 patman: Add tests for Cseries
Add various tests for the Cseries functionality, including both direct
and via-cmdline variants.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27 10:07:43 +01:00
Simon Glass
cc6ce7157a patman: Implement the upstream subcommand
Add a command to allow managing the upstream tree. This is very basic
so far, only allowing setting the name and URL. Further work may allow
checking whether series apply cleaning on the upstream tree, etc.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27 10:07:43 +01:00
Simon Glass
d1b6d855ac patman: Implement the series subcommand
Add a command to support management of series. These are local branches
which may have been sent to the mailing list, so may appear on the
patchwork server.

The new functionality uses a database, stored in a local file.

Various operations are supported:
   - add a new series
   - send a series and automatically link it with patchwork
   - 'increment' the version, to prepare to send an updated series
   - gather review/test tags from patchwork
   - check on progress, i.e. patches which are received new tags or
     comments
   - show comments on patches and cover letters

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27 10:07:43 +01:00
Simon Glass
32d29f7fe4 patman: Update send function to return whether it sent
Indicate whether 'git send-email' was actually called, so that we don't
bother waiting for patchwork to receive our series if it wasn't.

The 'git send-email' seems to always return a code of 0 even if nothing
was sent, so we cannot use clues there. Ideally we would watch the
output to determine which patches were sent and which not, but that is
left for another day.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27 10:07:43 +01:00
Simon Glass
d6c3f45878 patman: Support aliases for commands and subcommands
It is laborious to type long commands, so add some aliases to speed up
use of patman. For now, allow 'pw' for patchwork and 'st' for status.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27 10:07:43 +01:00
Simon Glass
3f2b3f96e8 patman: Implement the patchwork subcommand
Add a command to allow setting and getting the patchwork project. This
is needed so that patman can use the correct ID when talking to the
patchwork server.

To support testing, allow passing in the test database, patchwork
object and Cseries object. Fake versions can then easily be provided for
certain test cases.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27 10:07:43 +01:00
Simon Glass
e8b64cfdbb patman: Improve Series support for patchwork links
Update Series with a way to better manage the Series-links lines in
patches. Use this in the 'status' subcommand instead of the existing
primitive method of expecting a link without a version prefix.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27 10:07:42 +01:00
Simon Glass
dcf630b3be patman: Introduce basic database support in Series
This class manages a series, i.e. a group of patches with a possible
cover letter. Add some properties for recording basic patchwork info,
including the database ID.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27 10:07:42 +01:00
Simon Glass
dff62ec8b4 patman: Support returning the parsers to use
The parsing tests need to be able to try invalid arguments to make sure
that these are handled correctly. Provide a way to return the parsers
being used, as well as to pass in the parsers to use. This feature is
needed in test_series_no_subcmd(), for example.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27 10:07:42 +01:00
Simon Glass
56d33104e1 patman: Use -c to show patch comments
We chose -C as the flag to enable showing comments because -c was used
in 'patman send' to specify the patch count. Now that the 'send' parser
is separated we don't need to do this and it is OK to use the same flag
in a different subcommand.

We want to have a flag for cover-letter comments, so it makes most sense
to have -C for that and -c for patch comments. Update the latter.

Put this in a function since the new 'series' command will add this flag
too.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27 10:07:42 +01:00
Simon Glass
0ab5e441e7 patman: Enhance implementation of file-based defaults
Patman allows defaults for its command-line flags to be read from a
file. The implementation of this does not fully work with subcommands,
since we don't want a default for those.

Also, it relies on being able to parse any sort of cmdline in order to
figure out the options that are available. But in some cases, the
cmdline may not parse, e.g. if there are required options, or
conflicting options.

Add a class which can be safely used to parse any cmdline, since it
allows execution to continue even when errors are obtained. Use this to
determine the defaults, being careful to skip sub/commands.

Another way to handle all of this would be to maintain the defaults
separately and insert them into the parser manually. For now, I'm not
sure which is best.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27 10:07:42 +01:00
Simon Glass
42588591e2 patman: Enhance patchwork interface to support Cseries
Add various new requests to the Patchwork class, so we can obtain the
required information. This includes cover letters and comments.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27 10:07:42 +01:00
Simon Glass
2610699420 patman: Update status command support cover-letter info
Add support to the status module for reading and supporting cover
letters, including comments. Plumb this through to the patchwork module.
The actual support in the latter is not yet integrated.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27 10:07:42 +01:00
Simon Glass
ce785fd9b7 patman: Add a Cseries class
This is the main class for dealing with series, across branches and the
database.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27 10:07:42 +01:00
Simon Glass
24e7625085 patman: Add a helper for managing cseries
Add a module which includes helper functions for dealing with Cseries
objects.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27 10:07:42 +01:00
Simon Glass
ba0c4008f2 patman: Add a simple database implementation
For recording series information, patman needs a database. Add a module
which uses sqlite3 for this. It has a basic schema, enough to support a
series subcommand.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27 10:07:42 +01:00
Simon Glass
c9efedfc2f patman: Avoid touching the system or local config
Set the git variables to ensure that any local gitconfig is not used or
affected by the tests.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27 10:07:42 +01:00
Simon Glass
dd16f0e262 patman: Add a fourth series for testing
Create one more series to use for testing. This one has four separate
patches.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27 10:07:42 +01:00
Simon Glass
1be26d78cf patman: Move common test code into a new module
The func_test file is quite large. In order to allow new tests to be
added to a separate file, move the common test code into a separate
class, to be inherited by other classes.

Drop unnecessary imports in func_test

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27 10:07:42 +01:00
Simon Glass
d5675b84c4 patman: Add a test for collecting a PATCH prefix
Add one more test for completeness, since this occurs commonly.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27 10:07:42 +01:00
Simon Glass
77177ba82f patman: Use python3 with /usr/bin/env
If python2 is available then we must specify python3 here. Update the
test to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27 10:07:42 +01:00
Simon Glass
31a1c4c9d8 u_boot_pylib: Add more functions to gitutil
Add functions for checking a branch, showing a commit, etc. to support
the new functionality.

Git version 2.34.1 ignores --stat if --quiet is given, so adjust the
args so that this performs as expected.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27 10:07:42 +01:00
Simon Glass
212ed6bdb7 patman: Deal with git safe-directory warning
When running tests where the .git directory is not owned by the current
user, various warnings are produced and the tests fail. This happens in
CI.

For patman itself, modify the gitutil.get_top_level() function to return
None in this case. Ensure that the warning is not shown, since it creates
about 1000 lines of output.

For checkpatch, the same warning is produced even though --no-tree is
given. Suppress that as well.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27 10:07:42 +01:00
Simon Glass
45f239afa1 u_boot_pylib: Correct pylint warnings in gitutil
Correct various pylint warnings in this file.

The remaining ones are three functions with too many arguments (R0913
and R0918) and use of global (W0603).

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27 10:07:42 +01:00
Simon Glass
2e680f6765 patman: Support collecting all lines in the commit message
In some cases we want to collect all lines in the commit message so that
the commit can be recreated with the same message as before, or perhaps
with light filtering.

Add support for this.

Series-to: u-boot
Cover-letter:
patman: Minor improvements to prepare for series handling
This series includes a number of internal improvements to patman:
- Tidy-up of parsing
- Adjust how tests create the git tree
- Support for creating patches in a different git directory
- Faster determination of the upstream branch
- Ability to collect the body of a commit message as a series of lines
END

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27 10:07:42 +01:00
Simon Glass
07dcd1f9b7 patman: Tidy up function comments in the series module
This module is missing some comments, so add them.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27 10:07:42 +01:00
Simon Glass
2bdb98a282 patman: Move -H out of the send command
This is the help for the whole of patman, so move it to the start of the
control function, rather than being inside 'patman send'.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27 10:07:42 +01:00
Simon Glass
9126e16e63 patman: Move arguments for sent into the correct parser
Most of the arguments for the main parser are actually arguments for the
'send' parser. Move them there, in a separate function.

Fix a pylint warning for -D and the imports while here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27 10:07:42 +01:00
Simon Glass
828e84ac37 patman: Split subparsers into their own functions
Simplify the main parser by moving subparser code into separate
functions. Fix a few pylint warnings while here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27 10:07:42 +01:00
Simon Glass
b77a42bc75 patman: Add tests for help
Add a few tests to make sure that help is provided when requested.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27 10:07:42 +01:00
Simon Glass
79addcc904 patman: Split parser creation from parsing
Tests may want to parse their own arguments. Refactor the parser code to
support this and allow settings to receive arguments as well.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27 10:07:42 +01:00
Simon Glass
a52e80aee7 patman: Correct some pylint and asyncio issues
Correct some pylint warnings in this file. Make use of the existing
asyncio event loop, instead of creating a new one, since this also
destroys it afterwards, making it unavailable for tests which want to
share an event loop. Use tools.write_file() to avoid a warning about
encoding.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27 10:07:42 +01:00
Simon Glass
8465b44cb5 patman: Use git to set up the test config
At present the branch information is dropped when writing the
configuration. It is easier to get git to set up the config anyway, so
update the test to do this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27 10:07:42 +01:00
Simon Glass
3724cbade4 patman: Clean up creation of the git tree
The test starts with the HEAD pointing to the wrong place, so that the
created files appear to be deleted. Fix this by resetting the tree
before tests start. Add a check that the tree is clean.

Update pygit2 so that the enums are available.
2025-05-27 10:07:42 +01:00
Simon Glass
9302d672a5 patman: Use variables for series ID and title
Rather than hard-coding these values in the sample patches, use
variables so that we can refer to these in tests.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27 10:07:42 +01:00
Simon Glass
6961eb7e5b patman: Use .git as the git directory
In tests, the 'git' directory is a subdirectory of the temporary
directory. Rename it to '.git' so that git will automatically find it
when git operations are done in the temporary directory. Set up the
config before the first git operation, so that this works correctly.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27 10:07:42 +01:00
Simon Glass
8e737d41c0 patman: Use itr instead of lines for iterator
The variables 'lines' is used to hold a list of output lines within a
test, but also to hold an iterator through those lines. Use 'itr' for
the latter, to avoid confusion.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27 10:07:42 +01:00
Simon Glass
8896247b58 patman: Correct use of str in code
Since str() is a reserved function we should not use it as a variable.
Fix this in the send module.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27 10:07:42 +01:00
Simon Glass
a5afb75c6d patman: Allow setting a git directory when sending
Support specifying the git-directory when creating and sending patches.
This will allow better testing of this functionality, since we can use a
test directory.

For count_commits_to_branch() support an end commit while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27 10:07:42 +01:00