summaryrefslogtreecommitdiff
path: root/tools
AgeCommit message (Collapse)Author
2025-03-12binman: build_from_git: Add argument specifying branchLeonard Anderweit
Add optional argument git_branch to build_from_git. The new argument allows specifying which branch of the repo to use. Signed-off-by: Leonard Anderweit <l.anderweit@phytec.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2025-03-10Merge tag 'v2025.04-rc4' into nextTom Rini
This uses Heinrich's merge of lib/efi_loader/efi_net.c which results in no changes.
2025-03-04Merge patch series "tools: Minor clean-ups for the command library"Tom Rini
Simon Glass <sjg@chromium.org> says: This series adds comments and fixes pylint warnings in the command library. It also introduces a new, simpler way of running a single command. Link: https://lore.kernel.org/r/20250203162704.627469-1-sjg@chromium.org
2025-03-04u_boot_pylib: Add a function to run a single commandSimon Glass
Add a helper to avoid needing to use a list within a list for this simple case. Update existing users of runpipe() to use this where possible. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-03-04u_boot_pylib: Fix pylint warnings in commandSimon Glass
This file has a lot of warnings. Before adding any more features, fix those which are straightforward to resolve. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-03-04u_boot_pylib: Add an exception-class for errorsSimon Glass
Throwing an Exception is not very friendly since it is the top-level class of all exceptions. Declare a new class instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-03-04u_boot_pylib: Correct case for test_resultSimon Glass
This should be in capitals and defined at the start of the file. Update it. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-03-04binman: Honour the skip-at-start property more faithfullySimon Glass
A discussion on the mailing list about dealing with block offsets and binman symbols made me think that something is wrong with how Binman deals with the skip-at-start property. The feature was originally designed to handle x86 ROMs, which are mapped at the top of the address space. That seemed too specific, whereas skipping some space at the start seemed more generally useful. It has proved useful. For example, rockchip images start at block 64, so a skip-at-start of 0x8000 deals with this. But it doesn't actually work correctly, since the image_pos value does not give the actual position on the media. Fix this and update the documentation, moving it into the 'section' section. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-03-04binman: Rename Entry.end_4gbSimon Glass
The property is named end_at_4gb so name the variable the same, to avoid confusion. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-02-28Merge patch series "rsa: Add rsa_verify_openssl() to use openssl for host ↵Tom Rini
builds" Paul HENRYS <paul.henrys_ext@softathome.com> says: This serie of patches adds a new tool to authenticate files signed with a preload header. This tool is also used in the tests to actually verify the authenticity of the file signed with such a preload header. Link: https://lore.kernel.org/r/20250224212055.2992852-1-paul.henrys_ext@softathome.com
2025-02-28binman: Authenticate the image when testing the preload signaturePaul HENRYS
Use preload_check_sign to authenticate the generated image when testing the preload signature in testPreLoad(). Signed-off-by: Paul HENRYS <paul.henrys_ext@softathome.com>
2025-02-28tools: Add preload_check_sign to authenticate images with a pre-loadPaul HENRYS
preload_check_sign is added so that it can be used to authenticate images signed with the pre-load signature supported by binman and U-Boot. It could also be used to test the signature in binman tests signing images with the pre-load. Signed-off-by: Paul HENRYS <paul.henrys_ext@softathome.com>
2025-02-28image: Add an inline declaration of unmap_sysmem()Paul HENRYS
Add an empty inline declaration when compiling tools for a host where unmap_sysmem() is not defined. Signed-off-by: Paul HENRYS <paul.henrys_ext@softathome.com>
2025-02-28rsa: Add rsa_verify_openssl() to use openssl for host buildsPaul HENRYS
rsa_verify_openssl() is used in lib/rsa/rsa-verify.c to authenticate data when building host tools. Signed-off-by: Paul HENRYS <paul.henrys_ext@softathome.com>
2025-02-27tools: imx8mimage: Fix potential memory leakMaks Mishin
Dynamic memory, referenced by 'line', is allocated at imx8mimage.c:187 by calling function 'getline' and lost at imx8mimage.c:210. Signed-off-by: Maks Mishin <maks.mishinFZ@gmail.com>
2025-02-27tools: imx8image: Fix potential memory leakMaks Mishin
Dynamic memory, referenced by 'line', is allocated at imx8image.c:270 by calling function 'getline' and lost at imx8image.c:294. Signed-off-by: Maks Mishin <maks.mishinFZ@gmail.com>
2025-02-27tools: imximage: Fix potential memory leakMaks Mishin
Dynamic memory, referenced by 'line', is allocated at imximage.c:761 by calling function 'getline' and lost at imximage.c:793. Signed-off-by: Maks Mishin <maks.mishinFZ@gmail.com>
2025-02-24Merge tag 'v2025.04-rc3' into nextTom Rini
Prepare v2025.04-rc3
2025-02-24Revert "Merge patch series "Add preload_check_sign tool""Tom Rini
This reverts commit c8750efe02c20725388dd4279896aaf306acfad4, reversing changes made to 8c6cf8aeea7e57ca686de8b765e4baf3a7ef1fa7. Unfortunately these changes do not build on macOS hosts. Signed-off-by: Tom Rini <trini@konsulko.com>
2025-02-21buildman: Update tests for newer filelock moduleSimon Glass
Recent versions of this module call time.perf_counter() so add a patch for this also. Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Tom Rini <trini@konsulko.com>
2025-02-21Merge patch series "Add preload_check_sign tool"Tom Rini
Paul HENRYS <paul.henrys_ext@softathome.com> says: This serie of patches adds a new tool to authenticate files signed with a preload header. This tool is also used in the tests to actually verify the authenticity of the file signed with such a preload header. Link: https://lore.kernel.org/r/20250212093126.3722186-1-paul.henrys_ext@softathome.com
2025-02-21binman: Authenticate the image when testing the preload signaturePaul HENRYS
Use preload_check_sign to authenticate the generated image when testing the preload signature in testPreLoad(). Signed-off-by: Paul HENRYS <paul.henrys_ext@softathome.com>
2025-02-21tools: Add preload_check_sign to authenticate images with a pre-loadPaul HENRYS
preload_check_sign is added so that it can be used to authenticate images signed with the pre-load signature supported by binman and U-Boot. It could also be used to test the signature in binman tests signing images with the pre-load. Signed-off-by: Paul HENRYS <paul.henrys_ext@softathome.com>
2025-02-21image: Add an inline declaration of unmap_sysmem()Paul HENRYS
Add an empty inline declaration when compiling tools for a host where unmap_sysmem() is not defined. Signed-off-by: Paul HENRYS <paul.henrys_ext@softathome.com>
2025-02-21rsa: Add rsa_verify_openssl() to use openssl for host buildsPaul HENRYS
rsa_verify_openssl() is used in lib/rsa/rsa-verify.c to authenticate data when building host tools. Signed-off-by: Paul HENRYS <paul.henrys_ext@softathome.com>
2025-02-21tools: Fix pylint 3.3.4 errorsSimon Glass
This newer pylint produces errors about variables possibly being used before being set. Adjust the code to pass these checks. Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Tom Rini <trini@konsulko.com>
2025-02-21tools/patman: Don't call a non-existent suiteTom Rini
With a newer pylint we get a warning that gitutil.RunTests does not exist, so remove the line. Signed-off-by: Tom Rini <trini@konsulko.com>
2025-02-21tools: binman: ti_board_cfg: Fix pylint error over 'br'Tom Rini
With a newer pylint, we get a warning that 'br' could be used before assignment. Fix this by declaring br first as an empty bytearray. Reviewed-by: Neha Malcom Francis <n-francis@ti.com> Signed-off-by: Tom Rini <trini@konsulko.com>
2025-02-21binman: Switch to setuptoolsTom Rini
With the distutils module having been removed with Python 3.12, switch to using setuptools instead. Signed-off-by: Tom Rini <trini@konsulko.com>
2025-02-21dtoc: Switch to setuptoolsTom Rini
With the distutils module having been removed with Python 3.12, switch to using setuptools instead. Signed-off-by: Tom Rini <trini@konsulko.com>
2025-02-18tools: Fix potential null-deref with result of strtok_rMaks Mishin
Return value of a function 'strtok_r' is dereferenced at kwbimage.c:1655 without checking for NULL, but it is usually checked for this function. Signed-off-by: Maks Mishin <maks.mishinFZ@gmail.com>
2025-02-18tools: use cryptographically safe RNGHeinrich Schuchardt
The PRNG implementing the random() function only has 2^31 states and therefore is unsafe to use for cryptography. Use arc4random() instead. Fixes: cc34f04efd63 ("tools: image-host.c: use random instead of rand") Addresses-Coverity-ID: 312953 Calling risky function Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2025-02-17u_boot_pylib: Move gitutil into the librarySimon Glass
Move this file into U-Boot's Python library, so that it is no-longer part of patman. This makes a start on: https://source.denx.de/u-boot/custodians/u-boot-dm/-/issues/35 Signed-off-by: Simon Glass <sjg@chromium.org>
2025-02-14Merge patch series "Rework requirements.txt files"Tom Rini
Tom Rini <trini@konsulko.com> says: A challenge we've run in to is making it easier for more people to use various python tools that we include in the tree. Part of the problem is that when we have a requirements.txt file, aside from the doc one we share with the kernel, I created it using "pip freeze". And while this might have been a best (or at least OK) practice at the time, that's no longer the case and is why our files have so many things in them. What this series does is create multiple files, one per project/tool and then has CI install them as needed. There's a few places here where this means that we update the requirements as well, but we keep a few big things where they are currently. This is because updating them introduces problems of their own and delaing with that would best be a follow up series. I've put this through GitLab and Azure to make sure everything is still going fine on both platforms. Link: https://lore.kernel.org/r/20250205000743.949790-1-trini@konsulko.com
2025-02-14Dockerfile: Update for having more requirements.txt filesTom Rini
Now that we have more requirements.txt files we need to grab all of them for creating our cache. Also, we do longer should install python3-pyelftools on the host as it's not used. Signed-off-by: Tom Rini <trini@konsulko.com>
2025-02-14python: Recreate test/py and tools/buildman requirements.txt filesTom Rini
Use the "pipreqs" tool to re-create these files, with a few manual corrections. We still need to include pytest-xdist which the tool does not detect. We also for now don't upgrade most of the required tools as that creates problems with various tests, which should be resolved independently. Signed-off-by: Tom Rini <trini@konsulko.com>
2025-02-14python: Create requirements.txt files for each "project"Tom Rini
Rather than have a requirements.txt file that's shared between multiple python projects within U-Boot, create one for each using "pipreqs". Signed-off-by: Tom Rini <trini@konsulko.com>
2025-02-11tools: proftool: Fix potential memory leaksMaks Mishin
Dynamic memory, referenced by 'line', is allocated by calling function 'calloc' and lost when the function terminates with code -1. Signed-off-by: Maks Mishin <maks.mishinFZ@gmail.com>
2025-02-11tools: ublimage: Fix memory leak in parse_cfg_file()Maks Mishin
Dynamic memory, referenced by 'line', is allocated at ublimage.c:159 by calling function 'getline' and lost at ublimage.c:184. Signed-off-by: Maks Mishin <maks.mishinFZ@gmail.com>
2025-02-11tools: fix NULL_AFTER_DEREF in image-host.cAnton Moryakov
Report of the static analyzer: 1. NULL_AFTER_DEREF Pointer 'str', which is dereferenced at image-host.c:688 by calling function 'strdup', is compared to a NULL value at image-host.c:691. 2. NULL_AFTER_DEREF Pointer 'list', which is dereferenced at image-host.c:689, is compared to a NULL value at image-host.c:691. Corrections explained: 1. Checking for NULL before using pointers: The if (!list || !str) check is now performed before calling strdup and realloc, which prevents null pointer dereferences. 2. Checking the result of strdup: strdup can return NULL if memory allocation fails. This also needs to be checked. 3. Checking the result of realloc: If realloc returns NULL, then memory has not been allocated and dup must be freed to avoid memory leaks. Triggers found by static analyzer Svace. Signed-off-by: Anton Moryakov <ant.v.moryakov@gmail.com>
2025-02-10tools: mkenvimage: List -V parameter in help textMarek Vasut
The -V version parameter is missing in the optional list of parameters in help text. Add it. Signed-off-by: Marek Vasut <marex@denx.de>
2025-02-03lib: Allow crc16 code to be droppedSimon Glass
This code is not necessarily needed in VPL, even if SPL uses it, so adjust the rules to allow it to be dropped. Do the same for the hash API. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2025-01-26tools: check result of lseekMaks Mishin
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-25buildman: Record an error if a toolchain is missingSimon Glass
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-25buildman: Drop unused OUTPUT_FILE constantSimon Glass
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-22Merge patch series "upl: Prerequite patches for updated spec"Tom Rini
Simon Glass <sjg@chromium.org> says: The current UPL spec[1] has been tidied up and improved over the last year, since U-Boot's original UPL support was written. This series includes some prerequisite patches needed for the real UPL patches. It is split from [2] [1] https://github.com/UniversalPayload/spec/tree/3f1450d [2] https://patchwork.ozlabs.org/project/uboot/list/?series=438574&state=* Link: https://lore.kernel.org/r/20250111000029.245022-1-sjg@chromium.org
2025-01-22boot: Rename fit_image_get_data_and_size()Simon Glass
This function is really just getting the data. The size comes along for the ride. In fact this function is only reliable way to obtain the data for an image in a FIT, since the FIT may use external data. Rename it to fit_image_get_data() Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-22boot: Rename fit_image_get_data()Simon Glass
This function can only be used with FITs that use embedded data. Rename it so this is clear. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2025-01-22mkimage: Update map_to_sysmem() to match its prototypeSimon Glass
Update the version of this function in mkimage so that it uses a const pointer, as is done in the mapmem.h header file. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-18Merge patch series "add the support of sha256_hmac and sha256_hkdf"Tom Rini
Philippe Reynes <philippe.reynes@softathome.com> says: This serie adds the support of sha256_hmac and sha256_hkdf. A first version was sent several months ago just before the integration of mbedtls. This new version is based on mbedtls. The first patch of this serie add the support of hkdf using mbedtls. Link: https://lore.kernel.org/r/20241219130554.49825-1-philippe.reynes@softathome.com