platform/kernel/u-boot.git
13 months agobuildman: Create a function to get number of built commits
Simon Glass [Wed, 19 Jul 2023 23:49:00 +0000 (17:49 -0600)]
buildman: Create a function to get number of built commits

Move this code into a function. This removes the last pylint error in
the control module.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobuildman: Use get_alow_missing() directly to avoid var
Simon Glass [Wed, 19 Jul 2023 23:48:59 +0000 (17:48 -0600)]
buildman: Use get_alow_missing() directly to avoid var

Avoid an unnecessary local variable by moving this code to a function.
This fixes the pylint warning about too many local variables.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobuildman: Move getting the adjust_cfg into run_builder()
Simon Glass [Wed, 19 Jul 2023 23:48:58 +0000 (17:48 -0600)]
buildman: Move getting the adjust_cfg into run_builder()

Move this into its own function to reduce the size of do_buildman().

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobuildman: Move checking for make into run_builder()
Simon Glass [Wed, 19 Jul 2023 23:48:57 +0000 (17:48 -0600)]
buildman: Move checking for make into run_builder()

This is not needed until the builder is run. Move it there to reduce the
size of the do_buildman() function.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobuildman: Adjust show_toolchain_prefix() to not return
Simon Glass [Wed, 19 Jul 2023 23:48:56 +0000 (17:48 -0600)]
buildman: Adjust show_toolchain_prefix() to not return

This function does not need to return. Simplify the code by exiting
immediately.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobuildman: Drop some unnecessary variables
Simon Glass [Wed, 19 Jul 2023 23:48:55 +0000 (17:48 -0600)]
buildman: Drop some unnecessary variables

Drop some variables at the end of the do_bulidman() function.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobuildman: Moving running of the builder into a function
Simon Glass [Wed, 19 Jul 2023 23:48:54 +0000 (17:48 -0600)]
buildman: Moving running of the builder into a function

Move this code into a new function. This removes the pylint warning about
too many branches.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobuildman: Tweak commits and show_bloat
Simon Glass [Wed, 19 Jul 2023 23:48:53 +0000 (17:48 -0600)]
buildman: Tweak commits and show_bloat

Move setting of show_bloat to adjust_options() and adjust how the commits
variable is set. Together these remove the pylint warning about too many
statements.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobuildman: Move remaining builder properties to constructor
Simon Glass [Wed, 19 Jul 2023 23:48:52 +0000 (17:48 -0600)]
buildman: Move remaining builder properties to constructor

Do these all in the constructor, so it is consistent.

Move the stray builder comment into the correct place.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobuildman: Avoid too many returns in do_buildman()
Simon Glass [Wed, 19 Jul 2023 23:48:51 +0000 (17:48 -0600)]
buildman: Avoid too many returns in do_buildman()

Fix the pylint warning by using a variable instead of lots of 'return'
statements.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobuildman: Move commit numbering into determine_series()
Simon Glass [Wed, 19 Jul 2023 23:48:50 +0000 (17:48 -0600)]
buildman: Move commit numbering into determine_series()

Commits are numbered for use in tests. Do this in determine_series() since
it is already dealing with the series.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobuildman: Move setting up the output dir into a function
Simon Glass [Wed, 19 Jul 2023 23:48:49 +0000 (17:48 -0600)]
buildman: Move setting up the output dir into a function

Move this code into a separate function to reduce the size of the main
do_buildman() directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobuildman: Move counting of commits into a function
Simon Glass [Wed, 19 Jul 2023 23:48:48 +0000 (17:48 -0600)]
buildman: Move counting of commits into a function

Move this code into a separate function to avoid a pylint warning in
determine_series().

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobuildman: Build option-adjusting into a function
Simon Glass [Wed, 19 Jul 2023 23:48:47 +0000 (17:48 -0600)]
buildman: Build option-adjusting into a function

Create a separate function to adjust options. Also move show_actions() up
as far as we can in the function.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobuildman: Pass option values to show_actions()
Simon Glass [Wed, 19 Jul 2023 23:48:46 +0000 (17:48 -0600)]
buildman: Pass option values to show_actions()

Pass in the individual values rather than the whole options object, so we
can see what is needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobuildman: Pass option values to get_action_summary()
Simon Glass [Wed, 19 Jul 2023 23:48:45 +0000 (17:48 -0600)]
buildman: Pass option values to get_action_summary()

Pass in the individual values rather than the whole options object, so we
can see what is needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobuildman: Move output-file setup into one place
Simon Glass [Wed, 19 Jul 2023 23:48:44 +0000 (17:48 -0600)]
buildman: Move output-file setup into one place

Collect the two parts of the output-file handling into single place.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobulldman: Set up output_dir earlier
Simon Glass [Wed, 19 Jul 2023 23:48:43 +0000 (17:48 -0600)]
bulldman: Set up output_dir earlier

Set up output_dir at the start of the main function, instead of updating
the options.output_dir option.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobulidman: Move toolchain handling to a function
Simon Glass [Wed, 19 Jul 2023 23:48:42 +0000 (17:48 -0600)]
bulidman: Move toolchain handling to a function

Move the code for dealing with toolchains out into its own function, to
reduce the size of the main function.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobuildman: Move Boards-object code into a function
Simon Glass [Wed, 19 Jul 2023 23:48:41 +0000 (17:48 -0600)]
buildman: Move Boards-object code into a function

Move the code which obtains a Boards object into its own function, to
reduce the size of the main function.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobulidman: Move more code to determine_series()
Simon Glass [Wed, 19 Jul 2023 23:48:40 +0000 (17:48 -0600)]
bulidman: Move more code to determine_series()

Move some more series-related code here, to reduce the size of the main
function.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobuildman: Move board-selection code into a function
Simon Glass [Wed, 19 Jul 2023 23:48:39 +0000 (17:48 -0600)]
buildman: Move board-selection code into a function

Create a new determine_boards() function to hold the code which selects
which boards to build.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobuildman: Add tests for excluding things
Simon Glass [Wed, 19 Jul 2023 23:48:38 +0000 (17:48 -0600)]
buildman: Add tests for excluding things

Add some tests for the -x flag.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobuildman: Move dry-run handling higher in do_buildman()
Simon Glass [Wed, 19 Jul 2023 23:48:37 +0000 (17:48 -0600)]
buildman: Move dry-run handling higher in do_buildman()

Move this up above where the builder is created, since it no-longer makes
use of the builder.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobuildman: Drop use of builder in show_actions()
Simon Glass [Wed, 19 Jul 2023 23:48:36 +0000 (17:48 -0600)]
buildman: Drop use of builder in show_actions()

This function only needs the output directory from the builder. This is
passed into the builder, so just pass the same value to show_actions().
The avoids needing a builder to call show_actions().

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobuildman: Add a test for the -A option
Simon Glass [Wed, 19 Jul 2023 23:48:35 +0000 (17:48 -0600)]
buildman: Add a test for the -A option

This lacks a test at present. Add one.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobuildman: Move fetch-arch code into a separate function
Simon Glass [Wed, 19 Jul 2023 23:48:34 +0000 (17:48 -0600)]
buildman: Move fetch-arch code into a separate function

Reduce the size of the do_buildman() function a little by moving the code
that handles --fetch-arch into a separate function.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobuildman: Move series calculations into a separate function
Simon Glass [Wed, 19 Jul 2023 23:48:33 +0000 (17:48 -0600)]
buildman: Move series calculations into a separate function

Reduce the size of the do_buildman() function a little by moving the code
that figures out the series into a separate function.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobuildman: Move full-help processing to main
Simon Glass [Wed, 19 Jul 2023 23:48:32 +0000 (17:48 -0600)]
buildman: Move full-help processing to main

This does not need any of the control features. Move it out of main to
reduce the size of the do_buildman() function.

For Python 3.6 the -H feature will not work, but this does not seem to be
a huge problem, as it dates from 2016.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobuildman: Fix most pylint warnings in control
Simon Glass [Wed, 19 Jul 2023 23:48:31 +0000 (17:48 -0600)]
buildman: Fix most pylint warnings in control

Tidy up the easier-to-fix pylint warnings in module 'control'.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobuildman: Convert camel case in control.py
Simon Glass [Wed, 19 Jul 2023 23:48:30 +0000 (17:48 -0600)]
buildman: Convert camel case in control.py

Convert this file to snake case and update all files which use it.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobuildman: Tidy up pylint warnings in main
Simon Glass [Wed, 19 Jul 2023 23:48:29 +0000 (17:48 -0600)]
buildman: Tidy up pylint warnings in main

Tidy up the various pylint warnings in module 'main'.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobuildman: Provide an argument to the -R option
Simon Glass [Wed, 19 Jul 2023 23:48:28 +0000 (17:48 -0600)]
buildman: Provide an argument to the -R option

Allow writing the file to a selected location, since otherwise this is
controlled by the buildman configuration, so cannot be determined by the
caller.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: https://source.denx.de/u-boot/u-boot/-/issues/17

13 months agobuildman: Add an option to check maintainers
Simon Glass [Wed, 19 Jul 2023 23:48:27 +0000 (17:48 -0600)]
buildman: Add an option to check maintainers

Rather than using the -R option to get this report as a side effect, add
a dedicated option for it.

Disable CI for now as there are some missing maintainers, unfortunately.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobuildman: Correct logic for missing maintainers
Simon Glass [Wed, 19 Jul 2023 23:48:26 +0000 (17:48 -0600)]
buildman: Correct logic for missing maintainers

An orphaned board should produce a warning, as should a missing name for
the maintainer (when '-' is provided). Add these cases.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobuildman: Sort the maintainer warnings
Simon Glass [Wed, 19 Jul 2023 23:48:25 +0000 (17:48 -0600)]
buildman: Sort the maintainer warnings

Sort the warnings into alphabetical order, for easier reading. Also make
sure that the buildman test files are ignored.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobuildman: Just display a single line for missing maintainers
Simon Glass [Wed, 19 Jul 2023 23:48:24 +0000 (17:48 -0600)]
buildman: Just display a single line for missing maintainers

At present we get multiple lines of output when a board has no MAINTAINERS
entry:

   WARNING: no status info for 'bananapi-m2-pro'
   WARNING: no maintainers for 'bananapi-m2-pro'

Suppress the 'status' one since it is implied by the other.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobuildman: Correct operation of MAINTAINERS N:
Simon Glass [Wed, 19 Jul 2023 23:48:23 +0000 (17:48 -0600)]
buildman: Correct operation of MAINTAINERS N:

This doesn't work as intended. Instead it scans every defconfig file
in the source tree.

Fix it and add a test.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobuildman: Detect boards with no CONFIG_TARGET defined
Simon Glass [Wed, 19 Jul 2023 23:48:22 +0000 (17:48 -0600)]
buildman: Detect boards with no CONFIG_TARGET defined

We generally expected exactly one of these. Add a check for it.

Note: This warning is not displayed by default. An option will be added
to enable it.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobuildman: Detect boards with multiple CONFIG_TARGETs defined
Simon Glass [Wed, 19 Jul 2023 23:48:21 +0000 (17:48 -0600)]
buildman: Detect boards with multiple CONFIG_TARGETs defined

The TARGET_xxx options are special in that they refer to a single target.
Exactly one should be enabled for each target, corresponding to a
defconfig file.

Detect configs which result in two TARGET_xxx options being set. For
example, at present, TARGET_POLEG and TARET_POLEG_EVB are enabled for the
same board.

Note: This warning is not displayed by default. An option will be added
to enable it.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobuildman: Refactor target handling in Boards.scan()
Simon Glass [Wed, 19 Jul 2023 23:48:20 +0000 (17:48 -0600)]
buildman: Refactor target handling in Boards.scan()

Move the assert to the top of the function and provide an explicit
variables for the target name and base name.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobuildman: Warn about dangling maintainer entries
Simon Glass [Wed, 19 Jul 2023 23:48:19 +0000 (17:48 -0600)]
buildman: Warn about dangling maintainer entries

Other than the top-level MAINTAINERS file, all maintainer entries should
actually reference a target. Add a warning to detect those that do not.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobuildman: Tidy up common code in parse_file()
Simon Glass [Wed, 19 Jul 2023 23:48:18 +0000 (17:48 -0600)]
buildman: Tidy up common code in parse_file()

Use a function to add to the maintainers database, to avoid duplicating
the same code twice.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobuildman: Add a partial test for ensure_board_list()
Simon Glass [Wed, 19 Jul 2023 23:48:17 +0000 (17:48 -0600)]
buildman: Add a partial test for ensure_board_list()

Create a new function which has the non-UI parts of ensure_board_list().
Add some tests for everything except the N: tag.

While we are here, fix the confusing usage of fname inside a loops that
also uses fname.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobuildman: Add a test for Boards.output_is_new()
Simon Glass [Wed, 19 Jul 2023 23:48:16 +0000 (17:48 -0600)]
buildman: Add a test for Boards.output_is_new()

Add a test for this code, adjusting the timestamp on various files to
check each use case.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobuildman: Add a test for Boards.scan_defconfigs()
Simon Glass [Wed, 19 Jul 2023 23:48:15 +0000 (17:48 -0600)]
buildman: Add a test for Boards.scan_defconfigs()

Add a test for this code. It requires some defconfig files and a test
Kconfig to work with, so copy these into the temporary directory at the
start.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobuildman: Avoid globals in leaf functions
Simon Glass [Wed, 19 Jul 2023 23:48:14 +0000 (17:48 -0600)]
buildman: Avoid globals in leaf functions

Rather than using the global thoughout each function, pass in these
values. This allows tests to use different values when testing the same
functions.

Improve a few comments while we are here.

No functional change is intended.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobuildman: Drop dead code to handle :CONFIG_ construct
Simon Glass [Wed, 19 Jul 2023 23:48:13 +0000 (17:48 -0600)]
buildman: Drop dead code to handle :CONFIG_ construct

This is not needed anymore, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: 252ed872 ("kconfig: remove meaningless prefixes in defconfig files")

13 months agobuildman: Rename the ARM boards
Simon Glass [Wed, 19 Jul 2023 23:48:12 +0000 (17:48 -0600)]
buildman: Rename the ARM boards

Use names consistent with their target names.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobuildman: Exit with the return code consistently
Simon Glass [Wed, 19 Jul 2023 23:48:11 +0000 (17:48 -0600)]
buildman: Exit with the return code consistently

Test should return a suitable exit code when they fail. Fix this and tidy
up the code a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobuildman: Allow --debug to enable debugging
Simon Glass [Wed, 19 Jul 2023 23:48:10 +0000 (17:48 -0600)]
buildman: Allow --debug to enable debugging

The -D option is used, but plumb it through --debug to enable a full
traceback when something goes wrong.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobuildman: Fix verboose typo and add comment
Simon Glass [Wed, 19 Jul 2023 23:48:09 +0000 (17:48 -0600)]
buildman: Fix verboose typo and add comment

Fix the typo in the RunTests() function, adding comments while we are
here.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobinman: ftest: Add test for u_boot_spl_pubkey_dtb
Lukas Funke [Tue, 18 Jul 2023 11:53:13 +0000 (13:53 +0200)]
binman: ftest: Add test for u_boot_spl_pubkey_dtb

Add test for u_boot_spl_pubkey_dtb. The test adds a public key to the
dtb and checks if the required nodes will be added to the images dtb.

Signed-off-by: Lukas Funke <lukas.funke@weidmueller.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
13 months agobinman: doc: Add documentation for Xilinx Bootgen bintool
Lukas Funke [Tue, 18 Jul 2023 11:53:16 +0000 (13:53 +0200)]
binman: doc: Add documentation for Xilinx Bootgen bintool

Add documentation for the 'bootgen' bintool

Signed-off-by: Lukas Funke <lukas.funke@weidmueller.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
13 months agobinman: etype: Add u-boot-spl-pubkey-dtb etype
Lukas Funke [Tue, 18 Jul 2023 11:53:15 +0000 (13:53 +0200)]
binman: etype: Add u-boot-spl-pubkey-dtb etype

This adds a new etype 'u-boot-spl-pubkey-dtb'. The etype adds the public
key from a certificate to the dtb. This creates a '/signature' node which
is turn contains the fields which make up the public key. Usually this
is done by 'mkimage -K'. However, 'binman sign' does not add the public
key to the SPL. This is why the pubkey is added using this etype.

The etype calls the underlying 'fdt_add_pubkey' tool.

Signed-off-by: Lukas Funke <lukas.funke@weidmueller.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
13 months agobinman: btool: Add fdt_add_pubkey as btool
Lukas Funke [Tue, 18 Jul 2023 11:53:14 +0000 (13:53 +0200)]
binman: btool: Add fdt_add_pubkey as btool

Add btool which calls 'fdt_add_pubkey'

Signed-off-by: Lukas Funke <lukas.funke@weidmueller.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
13 months agobinman: doc: Add documentation for fdt_add_pubkey bintool
Lukas Funke [Tue, 18 Jul 2023 11:53:12 +0000 (13:53 +0200)]
binman: doc: Add documentation for fdt_add_pubkey bintool

Add documentation for btool which calls 'fdt_add_pubkey'

Signed-off-by: Lukas Funke <lukas.funke@weidmueller.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
13 months agobinman: blob_dtb: Add fake_size argument to ObtainContents()
Lukas Funke [Tue, 18 Jul 2023 11:53:11 +0000 (13:53 +0200)]
binman: blob_dtb: Add fake_size argument to ObtainContents()

The method 'connect_contents_to_file()' calls ObtainsContents() with
'fake_size' argument. Without providing the argument in the blob_dtb
we are not able to call this method without error.

Signed-off-by: Lukas Funke <lukas.funke@weidmueller.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
13 months agobinman: Don't decompress data while signing
Lukas Funke [Tue, 18 Jul 2023 11:53:10 +0000 (13:53 +0200)]
binman: Don't decompress data while signing

While signing a fit compressed data (i.e. 'blob-ext') is decompressed,
but never compressed again. When compressed data was wrapped in a
section, decompression leads to an error because the outer section had
the original compressed size but the inner entry has the
uncompressed size now.

While singing there is no reason to decompress data. Thus, decompression
should be disabled.

Furthermore, bintools should be collected before loading the data. This
way bintools are available if processing is required on a node.

Signed-off-by: Lukas Funke <lukas.funke@weidmueller.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
13 months agobinman: Add tests for etype encrypted
Christian Taedcke [Mon, 17 Jul 2023 07:05:54 +0000 (09:05 +0200)]
binman: Add tests for etype encrypted

Add tests to reach 100% code coverage for the added etype encrypted.

Signed-off-by: Christian Taedcke <christian.taedcke@weidmueller.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
13 months agobinman: Allow cipher node as special section
Christian Taedcke [Mon, 17 Jul 2023 07:05:53 +0000 (09:05 +0200)]
binman: Allow cipher node as special section

The new encrypted etype generates a cipher node in the device tree
that should not be evaluated by binman, but still be kept in the
output device tree.

Signed-off-by: Christian Taedcke <christian.taedcke@weidmueller.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
13 months agobinman: Add support for externally encrypted blobs
Christian Taedcke [Mon, 17 Jul 2023 07:05:52 +0000 (09:05 +0200)]
binman: Add support for externally encrypted blobs

This adds a new etype encrypted.

It creates a new cipher node in the related image similar to the
cipher node used by u-boot, see boot/image-cipher.c.

Signed-off-by: Christian Taedcke <christian.taedcke@weidmueller.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
13 months agobinman: Add missing ssl documentation
Simon Glass [Mon, 24 Jul 2023 15:20:00 +0000 (09:20 -0600)]
binman: Add missing ssl documentation

Rerun 'binman bintool-docs' to regenerate bintools.rst

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobinman: Renumber 277...289 TI test files
Simon Glass [Mon, 24 Jul 2023 15:19:59 +0000 (09:19 -0600)]
binman: Renumber 277...289 TI test files

These have ended up with the same numbers as earlier files. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobinman: Renumber 277_rockchip and 278_mkimage test files
Simon Glass [Mon, 24 Jul 2023 15:19:58 +0000 (09:19 -0600)]
binman: Renumber 277_rockchip and 278_mkimage test files

These have ended up with the same numbers as earlier files. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agobinman: Tidy up tests for pre-load entry type
Simon Glass [Mon, 24 Jul 2023 15:19:57 +0000 (09:19 -0600)]
binman: Tidy up tests for pre-load entry type

Drop the use of a numbered key file since numbering is just for the test
devicetree files. Also adjust the tests to avoid putting a hard-coded
path to binman in the file, using the entry arg instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agoMerge tag 'u-boot-at91-fixes-2023.10-a' of https://source.denx.de/u-boot/custodians...
Tom Rini [Mon, 24 Jul 2023 14:58:25 +0000 (10:58 -0400)]
Merge tag 'u-boot-at91-fixes-2023.10-a' of https://source.denx.de/u-boot/custodians/u-boot-at91

First set of u-boot-atmel fixes for the 2023.07 cycle:

This small fixes set includes the LTO configs for the boards that had
the SPL size up to the limit (sama5d2-based), such that more code can be
added.  It also includes a fix for mmc non-removable.

13 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-riscv
Tom Rini [Mon, 24 Jul 2023 14:58:07 +0000 (10:58 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-riscv

- Set up per-hart stack before any function call
- Sync visionfive2 board DTS with Linux
- Define cache line size for USB 3.0 driver for RISC-V CPU

13 months agoatmel_sdhci: Force card-detect if MMC_CAP_NONREMOVABLE.
Zixun LI [Wed, 17 May 2023 13:49:45 +0000 (15:49 +0200)]
atmel_sdhci: Force card-detect if MMC_CAP_NONREMOVABLE.

If the device attached to the MMC bus is not removable, set force card-detect
bit to bypass card detection procedure, so card detection pin can be used for
other purposes.

It's also a workaround for SAMA5D2 who doesn't drive CMD if using GPIO for card
detection.

Signed-off-by: Zixun LI <zli@ogga.fr>
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com>
13 months agoconfigs: sama5d2: enable CONFIG_LTO
Eugen Hristev [Mon, 24 Jul 2023 10:05:13 +0000 (13:05 +0300)]
configs: sama5d2: enable CONFIG_LTO

arm-none-linux-gnueabihf-ld.bfd: u-boot-spl section `__u_boot_list' will not fit in region `.sram'
arm-none-linux-gnueabihf-ld.bfd: region `.sram' overflowed by 100 bytes

SPL is at limit so to stop seeing above error in built, enable
link time optimizations CONFIG_LTO.

Signed-off-by: Eugen Hristev <eugen.hristev@collabora.com>
Tested-by: Mihai Sain <mihai.sain@microchip.com>
13 months agoconfigs: at91: sama5d2_icp_mmc: Enable CONFIG_LTO
Stefan Roese [Thu, 27 Apr 2023 08:59:45 +0000 (10:59 +0200)]
configs: at91: sama5d2_icp_mmc: Enable CONFIG_LTO

Adding just a tiny bit more code for sama5d2_icp_mmc leads to a SRAM
image overflow. Fix this by enabling LTO for this board, so that such
changes still can be made to the common U-Boot code.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Pali Rohár <pali@kernel.org>
Tested-by: Mihai Sain <mihai.sain@microchip.com>
[eugen.hristev@microchip.com: restrict patch just to CONFIG_LTO]
Signed-off-by: Eugen Hristev <eugen.hristev@collabora.com>
13 months agoriscv: define a cache line size for the generic CPU
Heinrich Schuchardt [Fri, 21 Jul 2023 16:01:18 +0000 (18:01 +0200)]
riscv: define a cache line size for the generic CPU

The USB 3.0 driver xhci-mem.c requires CONFIG_SYS_CACHELINE_SIZE to be set.

Define the cache line size for QEMU on RISC-V to be 64 bytes.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Bin Meng <bmeng@tinylab.org>
13 months agodoc: visionfive2: apply a trailing space to the prompt
Chanho Park [Fri, 14 Jul 2023 09:41:09 +0000 (18:41 +0900)]
doc: visionfive2: apply a trailing space to the prompt

Apply the trailing space changes in the guide document.

Signed-off-by: Chanho Park <chanho61.park@samsung.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
13 months agoconfigs: visionfive2: add a trailing space to prompt
Chanho Park [Fri, 14 Jul 2023 09:41:08 +0000 (18:41 +0900)]
configs: visionfive2: add a trailing space to prompt

Adds a trailing space to SYS_PROMPT to make it easier to distinguish
between commands and the prompt.

Signed-off-by: Chanho Park <chanho61.park@samsung.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
13 months agoclk: starfive: jh7110: Add of_xlate ops and macros for clock id conversion
Xingyu Wu [Fri, 7 Jul 2023 10:50:11 +0000 (18:50 +0800)]
clk: starfive: jh7110: Add of_xlate ops and macros for clock id conversion

Modify the drivers to add of_xlate ops and transform clock id.

Signed-off-by: Xingyu Wu <xingyu.wu@starfivetech.com>
Signed-off-by: Hal Feng <hal.feng@starfivetech.com>
Reviewed-by: Torsten Duwe <duwe@suse.de>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
13 months agodt-bindings: clock: jh7110: Modify clock id to be same with Linux
Xingyu Wu [Fri, 7 Jul 2023 10:50:10 +0000 (18:50 +0800)]
dt-bindings: clock: jh7110: Modify clock id to be same with Linux

The clock id needs to be changed to be consistent with Linux.

Signed-off-by: Xingyu Wu <xingyu.wu@starfivetech.com>
Signed-off-by: Hal Feng <hal.feng@starfivetech.com>
Reviewed-by: Torsten Duwe <duwe@suse.de>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
13 months agoriscv: dts: jh7110: Add clock source from PLL
Xingyu Wu [Fri, 7 Jul 2023 10:50:09 +0000 (18:50 +0800)]
riscv: dts: jh7110: Add clock source from PLL

Change the PLL clock source from syscrg to sys_syscon child node.

Signed-off-by: Xingyu Wu <xingyu.wu@starfivetech.com>
Signed-off-by: Hal Feng <hal.feng@starfivetech.com>
Reviewed-by: Torsten Duwe <duwe@suse.de>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
13 months agoriscv: dts: jh7110: Add PLL clock controller node
Xingyu Wu [Fri, 7 Jul 2023 10:50:08 +0000 (18:50 +0800)]
riscv: dts: jh7110: Add PLL clock controller node

Add child node about PLL clock controller in sys_syscon node.

Signed-off-by: Xingyu Wu <xingyu.wu@starfivetech.com>
Signed-off-by: Hal Feng <hal.feng@starfivetech.com>
Reviewed-by: Torsten Duwe <duwe@suse.de>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
13 months agoclk: starfive: jh7110: Separate the PLL driver
Xingyu Wu [Fri, 7 Jul 2023 10:50:07 +0000 (18:50 +0800)]
clk: starfive: jh7110: Separate the PLL driver

Drop the PLL part in SYSCRG driver and separate to be a single
PLL driver of which the compatible is "starfive,jh7110-pll".

Signed-off-by: Xingyu Wu <xingyu.wu@starfivetech.com>
Signed-off-by: Hal Feng <hal.feng@starfivetech.com>
Reviewed-by: Torsten Duwe <duwe@suse.de>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
13 months agoriscv: setup per-hart stack earlier
Bo Gan [Sun, 11 Jun 2023 23:54:17 +0000 (16:54 -0700)]
riscv: setup per-hart stack earlier

Harts need to use per-hart stack before any function call, even if that
function is a simple one. When the callee uses stack for register save/
restore, especially RA, if nested call, concurrent access by multiple
harts on the same stack will cause data-race.

This patch sets up SP before `board_init_f_alloc_reserve`. A side effect
of this is that the memory layout has changed as the following:

+----------------+        +----------------+ <----- SPL_STACK/
|  ......        |        |  hart 0 stack  |        SYS_INIT_SP_ADDR
|  malloc_base   |        +----------------+
+----------------+        |  hart 1 stack  |
|  GD            |        +----------------+ If not SMP, N=1
+----------------+        |  ......        |
|  hart 0 stack  |        +----------------+
+----------------+   ==>  |  hart N-1 stack|
|  hart 1 stack  |        +----------------+
+----------------+        |  ......        |
|  ......        |        |  malloc_base   |
+----------------+        +----------------+
|  hart N-1 stack|        |  GD            |
+----------------+        +----------------+
|                |        |                |

Signed-off-by: Bo Gan <ganboing@gmail.com>
Cc: Rick Chen <rick@andestech.com>
Cc: Leo <ycliang@andestech.com>
Cc: Sean Anderson <seanga2@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
13 months agoMerge branch '2023-07-22-TI-binman-and-K3-improvements'
Tom Rini [Mon, 24 Jul 2023 01:46:05 +0000 (21:46 -0400)]
Merge branch '2023-07-22-TI-binman-and-K3-improvements'

- Migrate TI K3 platforms to using binman to generate all images, and
  then improve the platform slightly.

13 months agoconfigs: am64: Fix booting of fitImage on AM64x
Kamlesh Gurudasani [Fri, 14 Jul 2023 05:52:41 +0000 (11:22 +0530)]
configs: am64: Fix booting of fitImage on AM64x

Do not limit the maximum size of the buffer that is used to decompress
the OS image in to, this causes issue while inflating the image, if image
size is greater than the buffer.
Remove CONFIG_SYS_BOOTM_LEN

Signed-off-by: Kamlesh Gurudasani <kamlesh@ti.com>
Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
13 months agoKconfig: Enable FIT_SIGNATURE if ARM64
Manorit Chawdhry [Fri, 14 Jul 2023 05:52:40 +0000 (11:22 +0530)]
Kconfig: Enable FIT_SIGNATURE if ARM64

Enabling FIT_SIGNATURE required the old authentication method to be
disabled so disable this for K3 SOCs and enable FIT_SIGNATURE for K3
Platforms.

Signed-off-by: Kamlesh Gurudasani <kamlesh@ti.com>
[ cleanup the patch ]
Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
13 months agolib: Kconfig: k3: Enable SHA512 for fit signature
Manorit Chawdhry [Fri, 14 Jul 2023 05:52:39 +0000 (11:22 +0530)]
lib: Kconfig: k3: Enable SHA512 for fit signature

We are using our custMpk for signing that is a 4096 bit key, 4096 bit
rsa key requires a SHA512 hashing algorithm to be enabled as per the
source. Even though it is not mandated but this is how it works and is
tested.

Enables SHA512 if fit signature is enabled on K3 platforms.

Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
13 months agok3-*-binman: dts: Pack u-boot.dtb instead of soc specific dtb
Manorit Chawdhry [Fri, 14 Jul 2023 05:52:38 +0000 (11:22 +0530)]
k3-*-binman: dts: Pack u-boot.dtb instead of soc specific dtb

FIT signature requires the updates to u-boot.dtb and the DTB that we
pack don't get updates with the changes of the signature node.

Pack u-boot.dtb as the default DTB so that the signature node changes
can be reflected in them.

(Note, this is only packaging the primary platform and the secondary
 platform will require manual changes for the FIT signature enablement)

Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
[ add additional boards that were missing ]
Signed-off-by: Kamlesh Gurudasani <kamlesh@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
13 months agoboard: ti: keys: add .key and .crt for fit signature signing
Manorit Chawdhry [Fri, 14 Jul 2023 05:52:37 +0000 (11:22 +0530)]
board: ti: keys: add .key and .crt for fit signature signing

Fit signature mechanism through the standards require the presence of
.key and .crt in the folder with the same name, since we are using our
custMpk only for the signing, update the format to that of standards to
be compatible for packaging easily.

Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
13 months agoconfigs: k3: make consistent bootcmd across all k3 socs
Kamlesh Gurudasani [Fri, 14 Jul 2023 05:52:36 +0000 (11:22 +0530)]
configs: k3: make consistent bootcmd across all k3 socs

Default to common bootcmd that is set across all k3 devices.

Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
Signed-off-by: Kamlesh Gurudasani <kamlesh@ti.com>
13 months agoinclude: armv7: Enable distroboot across all configs
Manorit Chawdhry [Fri, 14 Jul 2023 05:52:35 +0000 (11:22 +0530)]
include: armv7: Enable distroboot across all configs

Since K3 devices are moving towards distroboot, remove duplicates and
add it in common file to import from.

Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
[trini: Add am65x_evm to this patch]
Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agoenv: Make common bootcmd across all k3 devices
Manorit Chawdhry [Fri, 14 Jul 2023 05:52:34 +0000 (11:22 +0530)]
env: Make common bootcmd across all k3 devices

This is helpful to go forward with distro_bootcmd as default boot.

Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
13 months agoarm: k3: Add regex/gsub command handling
Andrew Davis [Fri, 14 Jul 2023 05:52:33 +0000 (11:22 +0530)]
arm: k3: Add regex/gsub command handling

The 'gsub' setexpr sub command is using when creating the FIT image
configuration string on K3 devices. Enable this for K3.

Signed-off-by: Andrew Davis <afd@ti.com>
Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
13 months agoconfigs: Enable setexpr command on TI devices
Andrew Davis [Fri, 14 Jul 2023 05:52:32 +0000 (11:22 +0530)]
configs: Enable setexpr command on TI devices

This is used when building the FIT image configuration string. Enable
it for all FIT using TI platforms.

Signed-off-by: Andrew Davis <afd@ti.com>
[ extend to other k3 boards ]
Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
13 months agoenvironment: ti: Make get_fdt_mmc common
Andrew Davis [Fri, 14 Jul 2023 05:52:31 +0000 (11:22 +0530)]
environment: ti: Make get_fdt_mmc common

Since get_fdt_mmc is common, factor it out into mmc.env and remove
it from each platform env file along with changing the directory path to
reflect the standards. Use it in mmcloados but keep loadfdt
defined in case it is still used by some external uEnv.txt script.

Signed-off-by: Andrew Davis <afd@ti.com>
Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
13 months agoenvironment: ti: Prefix ARM64 DTB names with directory
Andrew Davis [Fri, 14 Jul 2023 05:52:30 +0000 (11:22 +0530)]
environment: ti: Prefix ARM64 DTB names with directory

In Linux the ARM64 DTSs are stored in vendor directories to help organize
the files and prevent naming collisions. The deployed DTBs will mirror
this and so the vendor prefix should be added to the variable used to
locate these files.

Suggested-by: Ryan Eatmon <reatmon@ti.com>
Signed-off-by: Andrew Davis <afd@ti.com>
Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
Reviewed-by: Nikhil M Jain <n-jain1@ti.com>
13 months agoconfigs: k3: Remove saved environments
Manorit Chawdhry [Fri, 14 Jul 2023 05:52:29 +0000 (11:22 +0530)]
configs: k3: Remove saved environments

Having saved environments usually causes inconsistencies while in
development workflow. The saved environments conflict with the
default ones that U-boot should be updating during development
but that doesn't happen and the saved environments need to be
reset during bootups to test the changes causing extra debugs.

Remove the saved environments as a default. Environments can always
be re-enabled locally if one does like them or needs them for
some production environment. Optionally, Uenv.txt can also be used on
some of the boot media.

Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
13 months agoinclude: j7*_evm.h: Cleanups to be done
Manorit Chawdhry [Fri, 14 Jul 2023 05:52:28 +0000 (11:22 +0530)]
include: j7*_evm.h: Cleanups to be done

Some miscellaneous cleanups for boards.

Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
13 months agomach-k3: common: correct the calculations for determining firewalls
Manorit Chawdhry [Fri, 14 Jul 2023 05:52:27 +0000 (11:22 +0530)]
mach-k3: common: correct the calculations for determining firewalls

The background firewall calculations were wrong, fix that to determine
both the background and foreground correctly.

Fixes: 8bfce2f9989f ("arm: mach-k3: common: reorder removal of firewalls")

Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
13 months agoboard: ti: am64x: am64x.env: set fdtfile env variable
Kamlesh Gurudasani [Fri, 14 Jul 2023 05:52:26 +0000 (11:22 +0530)]
board: ti: am64x: am64x.env: set fdtfile env variable

Set fdtfile env variable similar to other k3 socs.

Signed-off-by: Kamlesh Gurudasani <kamlesh@ti.com>
Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
Reviewed-by: Nikhil M Jain <n-jain1@ti.com>
13 months agoKconfig: j721s2: Fix the scratchpad base
Manorit Chawdhry [Fri, 14 Jul 2023 05:52:25 +0000 (11:22 +0530)]
Kconfig: j721s2: Fix the scratchpad base

Fix the regression that occurred during the alignment of binman series
merges along with these HS fixes that caused silent regression in this.

Fixes: 30a7ee87fd1a ("Kconfig: j721s2: Change K3_MCU_SCRATCHPAD_BASE to non firewalled region")

Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
13 months agoarch: mach-k3: security: fix the check for authentication
Manorit Chawdhry [Fri, 14 Jul 2023 05:52:24 +0000 (11:22 +0530)]
arch: mach-k3: security: fix the check for authentication

Fix regression occurred during refactoring for the mentioned commit.

Fixes: bd6a24759374 ("arm: mach-k3: security: separate out validating binary logic")

Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
13 months agoCI: Make use of buildman requirements.txt
Tom Rini [Fri, 21 Jul 2023 18:44:46 +0000 (00:14 +0530)]
CI: Make use of buildman requirements.txt

Now that buildman has a requirements.txt file we need to make use of it.

Reviewed-by: Simon Glass <sjg@chromium.org>
[n-francis@ti.com: Adding missing command from .azure-pipelines.yml]
Signed-off-by: Neha Malcom Francis <n-francis@ti.com>
Signed-off-by: Tom Rini <trini@konsulko.com>