summaryrefslogtreecommitdiff
path: root/tools
AgeCommit message (Collapse)AuthorFilesLines
2022-02-11Merge tag 'efi-2022-04-rc2-4' of ↵Tom Rini4-56/+532
https://source.denx.de/u-boot/custodians/u-boot-efi Pull request for efi-2022-04-rc2-4 Documentation: * mkeficapsule man-page UEFI changes: * add support for signing images to mkeficapsule * add support for user define capsule GUID * adjust unit tests for capsules * fix UEFI image signature validation in case of multiple signatures
2022-02-11tools: mkeficapsule: allow for specifying GUID explicitlyAKASHI Takahiro2-24/+63
The existing options, "--fit" and "--raw," are only used to put a proper GUID in a capsule header, where GUID identifies a particular FMP (Firmware Management Protocol) driver which then would handle the firmware binary in a capsule. In fact, mkeficapsule does the exact same job in creating a capsule file whatever the firmware binary type is. To prepare for the future extension, the command syntax will be a bit modified to allow users to specify arbitrary GUID for their own FMP driver. OLD: [--fit <image> | --raw <image>] <capsule file> NEW: [--fit | --raw | --guid <guid-string>] <image> <capsule file> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-02-11tools: mkeficapsule: add firmware image signingAKASHI Takahiro3-34/+464
With this enhancement, mkeficapsule will be able to sign a capsule file when it is created. A signature added will be used later in the verification at FMP's SetImage() call. To do that, we need specify additional command parameters: -monotonic-cout <count> : monotonic count -private-key <private key file> : private key file -certificate <certificate file> : certificate file Only when all of those parameters are given, a signature will be added to a capsule file. Users are expected to maintain and increment the monotonic count at every time of the update for each firmware image. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org> Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2022-02-11tools: build mkeficapsule with tools-only_defconfigAKASHI Takahiro2-2/+9
Add CONFIG_TOOLS_MKEFICAPSULE. Then we want to always build mkeficapsule if tools-only_defconfig is used. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-02-11fw_env: simplify logic & code paths in the fw_env_open()Rafał Miłecki1-46/+31
Environment variables can be stored in two formats: 1. Single entry with header containing CRC32 2. Two entries with extra flags field in each entry header For that reason fw_env_open() has two main code paths and there are pointers for CRC32/flags/data. Previous implementation was a bit hard to follow: 1. It was checking for used format twice (in reversed order each time) 2. It was setting "environment" global struct fields to some temporary values that required extra comments explaining it This change simplifies that code: 1. It introduces two clear code paths 2. It sets "environment" global struct fields values only once it really knows them To be fair there are *two* crc32() calls now and an extra pointer variable but that should be cheap enough and worth it. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2022-02-11fw_env: make flash_io() take buffer as an argumentRafał Miłecki1-16/+16
It's usually easier to understand code & follow it if all arguments are passed explicitly. Many coding styles also discourage using global variables. Behaviour of flash_io() was a bit unintuitive as it was writing to a buffer referenced in a global struct. That required developers to remember how it works and sometimes required hacking "environment" global struct variable to read data into a proper buffer. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2022-02-11mkimage: Improve documentation of algo-name parameterJan Kiszka1-1/+3
Addresses the feedback provided on 5902a397d029 ("mkimage: Allow to specify the signature algorithm on the command line") which raced with the merge. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-02-10Merge tag 'dm-pull-8feb22-take3' of ↵Tom Rini75-1063/+1142
https://gitlab.denx.de/u-boot/custodians/u-boot-dm patman snake-case conversion binman fit improvements ACPI fixes and making MCFG available to ARM [trini: Update scripts/pylint.base] Signed-off-by: Tom Rini <trini@konsulko.com>
2022-02-10tools: kwboot: Allow to use -b without image path as the last getopt() optionPali Rohár1-1/+1
Currently it is possible to call "kwboot -b -t /dev/ttyUSB0" but not to call "kwboot -b /dev/ttyUSB0". Fix it by not trying to process the last argv[], which is non-getopt() option (tty path) as the image path for -b. Fixes: c513fe47dca2 ("tools: kwboot: Allow to use option -b without image path") Reported-by: Marcel Ziswiler <marcel@ziswiler.com> Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Marcel Ziswiler <marcel@ziswiler.com> Tested-by: Marcel Ziswiler <marcel@ziswiler.com>
2022-02-10tools: kwboot: Fix detection of quit esc sequencePali Rohár1-8/+11
Quit esc sequence may be also in the middle of the read buffer. Fix the detection for that case. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de>
2022-02-09binman: Convert FIT entry type to a subclass of Section entry typeAlper Nebi Yasak2-51/+30
The binman FIT entry type shares some code with the Section entry type. This shared code is bound to grow, since FIT entries are conceptually a variation of Section entries. Make FIT entry type a subclass of Section entry type, simplifying it a bit and providing us the features that Section implements. Also fix the subentry alignment test which now attempts to write symbols to a nonexistent SPL ELF test file by creating it first. Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Avoid AddMissingProperties() and SetCalculatedProperties() with FIT: Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-09binman: Check missing bintools of Section subclassesAlper Nebi Yasak1-0/+1
Binman can check for missing binary tools and prints warnings if anything required for an image is missing. The implementation of this for the Section entry only checks the subentries, presumably because Section does not use any binary tools itself. However, this means the check is also skipped for subclasses of Section which might need binary tools. Make sure missing binary tools are checked for subclasses of the Section entry type as well, by calling the parent class' implementation in the relevant Section method. Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-02-09binman: Register and check bintools from FIT subentriesAlper Nebi Yasak3-0/+78
Binman keeps track of binary tools each entry wants to use. The implementation of this for the FIT entry only adds "mkimage", but not the tools that would be used by its subentries. Register the binary tools that FIT subentries will use in addition to the one FIT itself uses, and check their existence by copying the appropriate method from Section entry type. Also add tests that check if these subentries can use and warn about binary tools. Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-02-09binman: Fix subentry expansion for FIT entry typeAlper Nebi Yasak2-9/+29
Binman tries to expand some entries into parts that make it up, e.g. 'u-boot' into a 'u-boot-expanded' section that contains 'u-boot-nodtb' and 'u-boot-dtb'. Entries with child entries must call ExpandEntries() on them to build a correct image, as it's possible that unexpanded child entries have no data of their own. The FIT entry type doesn't currently do this, which means putting a "u-boot" entry inside it doesn't work as expected. Implement ExpandEntries() for FIT and add a copy of a simple FIT image test that checks subentry expansion in FIT entries. Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-02-09patman: Convert camel case in terminal.pySimon Glass8-82/+82
Convert this file to snake case and update all files which use it. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-09patman: Rename Color() method to build()Simon Glass11-71/+71
This method has the same name as its class which is confusing. It is also annoying when searching the code. It builds a string with a colour, so rename it to build(). Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-09patman: Rename Print() to Tprint()Simon Glass5-41/+41
Rename this function so that when we convert it to snake case it will not conflict with the built-in print() function. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-09patman: Convert camel case in tout.pySimon Glass15-91/+91
Convert this file to snake case and update all files which use it. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-09patman: Convert camel case in test_util.pySimon Glass6-15/+15
Convert this file to snake case and update all files which use it. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-09patman: Convert camel case in test_checkpatch.pySimon Glass1-34/+34
Convert this file to snake case and update all files which use it. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-09patman: Convert camel case in project.pySimon Glass2-2/+2
Convert this file to snake case and update all files which use it. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-09patman: Convert camel case in gitutil.pySimon Glass12-99/+99
Convert this file to snake case and update all files which use it. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-09patman: Convert camel case in get_maintainer.pySimon Glass2-4/+4
Convert this file to snake case and update all files which use it. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-09patman: Convert camel case in func_test.pySimon Glass1-25/+25
Convert this file to snake case and update all files which use it. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-09patman: Convert camel case in cros_subprocess.pySimon Glass2-30/+31
Convert this file to snake case and update all files which use it. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-09patman: Convert camel case in commit.pySimon Glass3-10/+10
Convert this file to snake case and update all files which use it. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-09patman: Convert camel case in checkpatch.pySimon Glass3-18/+18
Convert this file to snake case and update all files which use it. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-09patman: Convert camel case in command.pySimon Glass18-70/+70
Convert this file to snake case and update all files which use it. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-09patman: Convert camel case in tools.pySimon Glass50-473/+473
Convert this file to snake case and update all files which use it. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-09buildman: Allow adjusting board config on the flySimon Glass5-8/+93
Add a -a option to specify changes to the config before the build commences. For example buildman -a ~CONFIG_CMDLINE disables CONFIG_CMDLINE before doing the build. This makes it easier to try things out as well as to write tests without creating a new board or manually manging the .config file. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-09buildman: Provide a hint on how to debug thread crashesSimon Glass2-2/+4
If a thread crashes it is helpful to try the operation again with threading disabled. Add a hint about that. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-09buildman: Add helper functions for updating .config filesSimon Glass3-2/+360
At present the only straightforward way to write tests that need a slightly different configuration is to create a new board with its own configuration. This is cumbersome. It would be useful if buildman could adjust the configuration of a build on the fly. In preparation for this, add a utility library which can modify a .config file according to various parameters passed to it. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-09buildman: Make use of test_utilSimon Glass1-15/+11
Use test_util to run the tests, with the ability to select a single test to run, if desired. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-09buildman: Add a flag to control the tracebackSimon Glass2-0/+5
At present the full horror of the Python traceback is shown by default. It is normally only useful for debugging. Turn it off by default and add a --debug flag to enable it. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-09patman: Update test_util to run doc testsSimon Glass3-23/+16
At present this function does not run the doctests. Allow the caller to pass these modules in as strings. Update patman to use this. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-07Merge tag 'u-boot-imx-20220207' of ↵Tom Rini1-8/+5
https://gitlab.denx.de/u-boot/custodians/u-boot-imx u-boot-imx-20211022 ------------------- CI: https://source.denx.de/u-boot/custodians/u-boot-imx/-/pipelines/10887 - imx8 : Toradex Verdin MX8M Plus Kontron pitx-imx8m - imx8ulp: several fixes and improvements - imx6ull fixes - switching to binman
2022-02-05tools: mkeficapsule: dont use malloc.hHeinrich Schuchardt1-1/+0
malloc() functions are declared via stdlib.h. Including malloc.h can lead to build errors e.g. on OS-X. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-02-05tools/mxsimage: Remove fclose on empty FILE pointerMattias Hansson1-8/+5
If `sb_load_cmdfile()` fails to open the configuration file it will jump to error handling where the code will try to `fclose()` the FILE pointer which is NULL causing `mkimage` to segfault. This patch removes the label for error handling and instead returns immediately which skips the `fclose()` and prevents the segfault. The errno is also described in the error message to guide users. Signed-off-by: Mattias Hansson <hansson.mattias@gmail.com> Reviewed-by: Wolfgang Denk <wd@denx.de>
2022-02-03Dockfile, CI: Update to latest focal tag and buildTom Rini1-1/+1
- Latest focal tag - Add libgnutls to image Signed-off-by: Tom Rini <trini@konsulko.com>
2022-02-03Dockerfile: Add libgnutls package for building mkeficapsule commandAKASHI Takahiro1-0/+2
For adding signing feature for capsule authentication to the host tool, mkeficapsule, we will link gnutls library for crypto operation. Since we need this command to complete the capsule authentication test on sandbox in CI loop, necessary packages must be installed on the host. See my patch, "tools: mkeficapsule: add firmware image signing." Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2022-01-31mkimage: fix segfault on MacOS arm64Sergey V. Lobanov1-0/+2
mkimage segfaults due to the ASLR mechanism on MacOS arm64 It is required to use _dyld_get_image_vmaddr_slide() to prevent segfault on MacOS arm64 This patch is based on the discussion https://github.com/u-boot/u-boot/commit/3b142045e8a7f0ab17b6099e9226296af45967d0 Thanks to Jessica Clarke, Ronny Kotzschmar and ptpt52 github user Reviewed-by: Jessica Clarke <jrtc27@jrtc27.com> Signed-off-by: Sergey V. Lobanov <sergey@lobanov.in>
2022-01-31Merge tag 'dm-pull-30jan22' of ↵Tom Rini5-16/+65
https://source.denx.de/u-boot/custodians/u-boot-dm moveconfig fix binman support for listing files with generated entries
2022-01-31tools: kwboot: Set debug flag to 1Pali Rohár1-0/+1
This should enable BootROM output on UART. (At least on A385 BootROM this is broken, BootROM ignores this debug flag and does not enable its output on UART if some valid image is available in SPI-NOR.) Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
2022-01-31tools: kwboot: Fix usage of -D without -tPali Rohár1-1/+1
When -D is specified then both bootmsg and debugmsg are not set, but imgpath is set. Fix this check for valid and required parameters. Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
2022-01-31tools: kwboot: Handle EINTR in kwboot_tty_recv()Pali Rohár1-3/+7
The select() and read() syscalls may be interrupted. Handle EINTR and retry them. Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
2022-01-31tools: kwboot: Handle EINTR in kwboot_write()Pali Rohár1-3/+5
The write() syscall may be interrupted. Handle EINTR and retry it. Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
2022-01-31tools: kwboot: Remove 2s delay before sending first xmodem packetPali Rohár1-4/+0
This delay is not needed anymore since kwboot already handles retrying logic for incomplete xmodem packets and also forces BootROM to flush its input queue. Removing it decreases total transfer time. Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
2022-01-31tools: kwboot: Force BootROM to flush input queue after boot patternPali Rohár1-1/+35
Force the BootROM to flush its input queue after sending boot pattern. This ensures that after function kwboot_bootmsg() finishes, BootROM is able to start receiving xmodem packets without any specific delay or setup. Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
2022-01-31tools: kwboot: Allow to use option -b without image pathPali Rohár1-5/+17
Allow option -b without image path parameter, to send boot pattern and wait for response but not send any image. This allows to use kwboot just for processing boot pattern and user can use any other xmodem tool for transferring the image itself (e.g. sx). Useful for debugging purposes. Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
2022-01-31tools: kwboot: Show 'E' in progress output when error occursPali Rohár1-2/+6
When kwboot is unable to resend current xmodem packet, show an 'E' in the progress output instead of a '+'. This allows to distinguish between the state when kwboot is retrying sending the packet and when retry is not possible. Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>