Commit graph

3663 commits

Author SHA1 Message Date
Simon Glass
48d4c0a85d buildman: Drop warning about orphaned defconfigs
Some boards use a MAINTAINERS entry to specify common files without
referencing any defconfigs. This is allowed and should not result in a
warning.

Drop the warning in this case.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-05 11:39:23 -06:00
Simon Glass
1c81e0808b buildman: Exit after reading toolchain
Recent refactoring changed buildman to continue operation after fetching
a toolchain. Fix this.

Fixes: b868064652 ("bulidman: Move toolchain handling to a function")

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-05 11:39:23 -06:00
Lukas Funke
d8a2d3b290 binman: ftest: Add test for xilinx-bootgen etype
Add test for the 'xilinx-bootgen' etype

Signed-off-by: Lukas Funke <lukas.funke@weidmueller.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Allow missing bootgen tool; comment testXilinxBootgenMissing() comment:
Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-05 11:38:59 -06:00
Lukas Funke
7fcfa9d930 binman: etype: Add xilinx-bootgen etype
This adds a new etype 'xilinx-bootgen'. By using this etype it is
possible to created an signed SPL (FSBL in Xilinx terms) for
ZynqMP boards.

The etype uses Xilinx Bootgen tools in order to transform the SPL into
a bootable image and sign the image with a given primary and secondary
public key. For more information to signing the FSBL please refer to the
Xilinx Bootgen documentation.

Here is an example of the etype in use:

    spl {
        filename = "boot.signed.bin";

        xilinx-bootgen {
            pmufw-filename = "pmu-firmware.elf";
            psk-key-name-hint = "psk0";
            ssk-key-name-hint = "ssk0";
            auth-params = "ppk_select=0", "spk_id=0x00000000";

            u-boot-spl-nodtb {
            };
            u-boot-spl-dtb {
            };
        };
    };

For this to work the hash of the primary public key has to be fused
into the ZynqMP device and authentication (RSA_EN) has to be set.

For testing purposes: if ppk hash check should be skipped one can add
the property 'fsbl_config = "bh_auth_enable";' to the etype. However,
this should only be used for testing(!).

Signed-off-by: Lukas Funke <lukas.funke@weidmueller.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-08-05 11:33:18 -06:00
Lukas Funke
7f51fe5c6d binman: btool: Add Xilinx Bootgen btool
Add the Xilinx Bootgen as bintool. Xilinx Bootgen is used to create
bootable SPL (FSBL in Xilinx terms) images for Zynq/ZynqMP devices. The
btool creates a signed version of the SPL. Additionally to signing the
key source for the decryption engine can be passend to the boot image.

Signed-off-by: Lukas Funke <lukas.funke@weidmueller.com>
2023-08-05 11:31:59 -06:00
Simon Glass
93a203d38b binman: Renumber 291 and 292 test files
These have ended up with the same numbers as earlier files. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-05 11:31:59 -06:00
Weijie Gao
2bff97ad5a tools: mtk_image: use uint32_t for ghf header magic and version
This patch converts magic and version fields of ghf common header
to one field with the type of uint32_t to make this header flexible
for futher updates.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2023-08-03 09:40:50 -04:00
Simon Glass
288ae53cb7 binman: Add a temporary hack for duplicate phandles
Three boards use a phandle in a FIT generator and the maintainer is
away. For now, add a hack to allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-02 12:05:57 -06:00
Simon Glass
d4d97661d2 binman: Support templates containing phandles
This provides support for phandles to be copied over from templates. This
is not quite safe, since if the template is instantiated twice (i.e. in
two different nodes), then duplicate phandles will be found. This will
result in an error.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-02 12:05:57 -06:00
Simon Glass
af41b24eba binman: Remove templates after use
It is not necessary to keep templates around after they have been
processed. They can cause confusion and potentially duplicate phandles.

Remove them.

Use the same means of detecting a template node in _ReadImageDesc so that
the two places are consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-02 12:05:57 -06:00
Simon Glass
589c2d9e51 fdt: Allow copying phandles into templates
Allow phandles to be copied over from a template. This can potentially
cause duplicate phandles, so detect this and report an error.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-02 12:05:57 -06:00
Simon Glass
8df8b6d670 dtoc: Add some debugging when copying nodes
Show the operations being performed, when debugging is enabled.

Convert a mistaken 'print' in test_copy_subnodes_from_phandles() while we
are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-02 12:05:57 -06:00
Simon Glass
7155646b22 dtoc: Make properties dirty when purging them
Without the 'dirty' flag properties are not written back to the
devicetree when synced. This means that new properties copied over to a
node are not always written out.

Fix this and add a test.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-02 12:05:57 -06:00
Simon Glass
b2f47a599c binman: Produce a template-file after processing
This file aids debugging when binman fails to get far enough to write out
the final devicetree file. Write it immediate after template processing.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-02 12:05:57 -06:00
Jonas Karlman
8f452bc557 binman: Show filename in missing blob help message
Show the filename next to the node path in missing blob help messages,
also show a generic missing blob message when there was no help message
for the help tag.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-08-02 12:05:57 -06:00
Jonas Karlman
c2600155af binman: Fix blank line usage for invalid images warning text
There is no blank line between last missing blob help message and the
header line for optional blob help messages.

  Image 'simple-bin' is missing external blobs and is non-functional: atf-bl31

  /binman/simple-bin/fit/images/@atf-SEQ/atf-bl31:
     See the documentation for your board. You may need to build ARM Trusted
     Firmware and build with BL31=/path/to/bl31.bin
  Image 'simple-bin' is missing external blobs but is still functional: tee-os

  /binman/simple-bin/fit/images/@tee-SEQ/tee-os:
     See the documentation for your board. You may need to build Open Portable
     Trusted Execution Environment (OP-TEE) and build with TEE=/path/to/tee.bin

  Some images are invalid

With this a blank line is inserted to make the text more readable.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-08-02 12:05:57 -06:00
Jonas Karlman
49dcd1c0bb binman: Override CheckOptional in fit entry
Missing optional blobs was not reported for generated entries, e.g.
tee-os on rockchip targets. Implement a CheckOptional to fix this.

After this the following can be shown:

  Image 'simple-bin' is missing optional external blobs but is still functional: tee-os

  /binman/simple-bin/fit/images/@tee-SEQ/tee-os (tee-os):
     See the documentation for your board. You may need to build Open Portable
     Trusted Execution Environment (OP-TEE) and build with TEE=/path/to/tee.bin

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-08-02 12:05:57 -06:00
Jonas Karlman
d92c4dd27d binman: Report missing external blobs using error level
Print missing external blobs using error level and missing optional
external blobs using warning level. Also change to only print the header
line in color, red for missing and yellow for optional.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-08-02 12:05:57 -06:00
Jonas Karlman
05dec37488 binman: Update missing optional external blob warning text
Make it more clear that the missing external blob is optional in the
printed warning message.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-08-02 12:05:57 -06:00
Jonas Karlman
321f256c9b binman: Update tee-os missing blob help text
Make it a little bit more clear that it is U-Boot that should be built
with TEE=/path/to/tee.bin and not OP-TEE itself.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-08-02 12:05:57 -06:00
Lukas Funke
43176ed86d binman: elf: Check for ELF_TOOLS availability and remove extra semicolon
Check if elf tools are available when running DecodeElf(). Also
remove superfuous semicolon at line ending.

Signed-off-by: Lukas Funke <lukas.funke@weidmueller.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Revert part of patch to make binman test pass
Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-02 07:51:09 -06:00
Jan Kiszka
badaa1f6a7 boards: siemens: iot2050: Unify PG1 and PG2/M.2 configurations again
This avoids having to maintain to defconfigs that are 99% equivalent.
The approach is to use binman to generate two flash images,
flash-pg1.bin and flash-pg2.bin. With the help of a template dtsi, we
can avoid duplicating the common binman image definitions.

Suggested-by: Andrew Davis <afd@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2023-07-28 10:11:01 -04:00
Jan Kiszka
35ae06fb86 iot2050: Use binman in signing script
The underlying issue was fixed in the meantime. Also signing the U-Boot
proper fit image now works. Just supporting custom cert templates
remains a todo.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2023-07-28 10:11:01 -04:00
Simon Glass
ad1c9b26a8 buildman: Specify the output directory in tests
The default output directory is generally '../' in tests so we end up
trying to create '../.bm-work'. This does not work with azure, so update
these tests to use the temporary directory instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-25 11:39:38 -04:00
Simon Glass
407a1413e3 buildman: Enable test coverage
Enable measuring test coverage for buildman so we can see the gaps. It is
currently at 68%.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24 09:34:11 -06:00
Simon Glass
ba8d099b95 buildman: Add an option to check maintainers and targets
In poking around it seems that many boards don't define a CONFIG_TARGET
Kconfig variable. This is not strictly necessary, but add an option to
buildman so these can be viewed.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24 09:34:11 -06:00
Simon Glass
39dbcaa1ad buildman: Use -D for --debug
Change -D to mean --debug for consistency with other tools. This is not a
commonly used option, so the impact should be minimal.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24 09:34:11 -06:00
Simon Glass
ad0378748e buildman: Add a way to print the architecture for a board
This is useful for some tools and is easily available for buildman. Add
a new --print-arch option.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24 09:34:11 -06:00
Simon Glass
2ecc5805ac buildman: Move copy_files() out ot BuilderThread class
This does not need to be in the class. Move it out to avoid a pylint
warning.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24 09:34:11 -06:00
Simon Glass
236f959386 buildman: Tidy up some comments in builderthread
Make sure all functions have full argument documentation.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24 09:34:11 -06:00
Simon Glass
57686d3379 buildman: Tidy up reporting of a toolchain error
Provide the text of the exception when something goes wrong.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24 09:34:11 -06:00
Simon Glass
5e5044b04c buildman: Avoid passing result into _read_done_file()
Move the creating of the result object into the function which sets it
up, to simplify the code.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24 09:34:11 -06:00
Simon Glass
335c1b9f81 buildman: Create a function to handle config and build
Move this code into a _config_and_build() function, so reduce the size of
run_commit().

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24 09:34:11 -06:00
Simon Glass
ad7181c797 buildman: Move checkout code to a separate function
Put this in its own function to reduce the size of the run_commit()
function

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24 09:34:11 -06:00
Simon Glass
9bdf02389c buildman: Move code to decide output dirs
Put this in its own function to reduce the size of the run_commit()
function.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24 09:34:11 -06:00
Simon Glass
e5490b7f46 buildman: Move code to remove old outputs
Put this in its own function to reduce the size of the run_commit()
function.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24 09:34:11 -06:00
Simon Glass
4981bd3dda buildman: Move reading of the done file into a function
Move this logic into its own function to reduce the size of the
run_commt() function.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24 09:34:11 -06:00
Simon Glass
14c152336f buildman: Move bulid code into its own function
Split this into its own function so reduce the size of run_commit().

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24 09:34:11 -06:00
Simon Glass
ec2f492e78 buildman: Move reconfigure code into its own function
Split this into its own function so reduce the size of run_commit().

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24 09:34:11 -06:00
Simon Glass
dab3a4a0e3 buildman: Convert config_out to string IO
This is probably a little more efficient and it allows passing the object
to another function to write data. Convert config_out to use a string I/O
device.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24 09:34:11 -06:00
Simon Glass
ed007bfa2f buildman: Move more things into _build_args()
Move more of the argument-building code into this function. Fix a missing
assignment for out_rel_dir too.

Rename the function since it now builds all the arguments.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24 09:34:11 -06:00
Simon Glass
a06ed7fbef buildman: Move setting of toolchain arguments to _build_args()
Move a few more pieces to this new function.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24 09:34:11 -06:00
Simon Glass
7524700061 buildman: Start a function to set up the make arguments
Move some of this code into a new funciion, to help reduce the size of the
run_commits() function.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24 09:34:11 -06:00
Simon Glass
8926025eab buildman: Drop unnecessary assignment of config_out
This is already set up earlier in the function, so drop the extra
assignment.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24 09:34:11 -06:00
Simon Glass
cc923fafbc buildman: Correct invalid use of out_dir variable
This variable has a different meaning in the outer scope. Use a different
name to avoid confusion, or bugs.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24 09:34:11 -06:00
Simon Glass
4a7419bfbb buildman: Export _get_output_dir() to avoid warnings
Make this a public memory since it is used outside the class.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24 09:34:11 -06:00
Simon Glass
606e54357f buildman: Correct most pylint warnings in builderthread
Fix the easy warnings in this file.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24 09:34:11 -06:00
Simon Glass
f06d333dc9 buildman: Convert camel case in builderthread.py
Convert this file to snake case and update all files which use it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24 09:34:11 -06:00
Simon Glass
17a75b9100 buildman: Split parser creation in two
Split this into two functions to avoid a warning about too many
statements.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24 09:34:11 -06:00
Simon Glass
37edf5fc03 buildman: Convert camel case in builder.py
Convert this file to snake case and update all files which use it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-24 09:34:11 -06:00