summaryrefslogtreecommitdiff
path: root/tools
Commit message (Collapse)AuthorAgeFilesLines
* Merge tag 'efi-2022-04-rc2-4' of ↵Tom Rini2022-02-114-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
| * tools: mkeficapsule: allow for specifying GUID explicitlyAKASHI Takahiro2022-02-112-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>
| * tools: mkeficapsule: add firmware image signingAKASHI Takahiro2022-02-113-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>
| * tools: build mkeficapsule with tools-only_defconfigAKASHI Takahiro2022-02-112-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>
* | fw_env: simplify logic & code paths in the fw_env_open()Rafał Miłecki2022-02-111-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>
* | fw_env: make flash_io() take buffer as an argumentRafał Miłecki2022-02-111-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>
* | mkimage: Improve documentation of algo-name parameterJan Kiszka2022-02-111-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>
* Merge tag 'dm-pull-8feb22-take3' of ↵Tom Rini2022-02-1075-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>
| * binman: Convert FIT entry type to a subclass of Section entry typeAlper Nebi Yasak2022-02-092-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>
| * binman: Check missing bintools of Section subclassesAlper Nebi Yasak2022-02-091-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>
| * binman: Register and check bintools from FIT subentriesAlper Nebi Yasak2022-02-093-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>
| * binman: Fix subentry expansion for FIT entry typeAlper Nebi Yasak2022-02-092-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>
| * patman: Convert camel case in terminal.pySimon Glass2022-02-098-82/+82
| | | | | | | | | | | | Convert this file to snake case and update all files which use it. Signed-off-by: Simon Glass <sjg@chromium.org>
| * patman: Rename Color() method to build()Simon Glass2022-02-0911-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>
| * patman: Rename Print() to Tprint()Simon Glass2022-02-095-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>
| * patman: Convert camel case in tout.pySimon Glass2022-02-0915-91/+91
| | | | | | | | | | | | Convert this file to snake case and update all files which use it. Signed-off-by: Simon Glass <sjg@chromium.org>
| * patman: Convert camel case in test_util.pySimon Glass2022-02-096-15/+15
| | | | | | | | | | | | Convert this file to snake case and update all files which use it. Signed-off-by: Simon Glass <sjg@chromium.org>
| * patman: Convert camel case in test_checkpatch.pySimon Glass2022-02-091-34/+34
| | | | | | | | | | | | Convert this file to snake case and update all files which use it. Signed-off-by: Simon Glass <sjg@chromium.org>
| * patman: Convert camel case in project.pySimon Glass2022-02-092-2/+2
| | | | | | | | | | | | Convert this file to snake case and update all files which use it. Signed-off-by: Simon Glass <sjg@chromium.org>
| * patman: Convert camel case in gitutil.pySimon Glass2022-02-0912-99/+99
| | | | | | | | | | | | Convert this file to snake case and update all files which use it. Signed-off-by: Simon Glass <sjg@chromium.org>
| * patman: Convert camel case in get_maintainer.pySimon Glass2022-02-092-4/+4
| | | | | | | | | | | | Convert this file to snake case and update all files which use it. Signed-off-by: Simon Glass <sjg@chromium.org>
| * patman: Convert camel case in func_test.pySimon Glass2022-02-091-25/+25
| | | | | | | | | | | | Convert this file to snake case and update all files which use it. Signed-off-by: Simon Glass <sjg@chromium.org>
| * patman: Convert camel case in cros_subprocess.pySimon Glass2022-02-092-30/+31
| | | | | | | | | | | | Convert this file to snake case and update all files which use it. Signed-off-by: Simon Glass <sjg@chromium.org>
| * patman: Convert camel case in commit.pySimon Glass2022-02-093-10/+10
| | | | | | | | | | | | Convert this file to snake case and update all files which use it. Signed-off-by: Simon Glass <sjg@chromium.org>
| * patman: Convert camel case in checkpatch.pySimon Glass2022-02-093-18/+18
| | | | | | | | | | | | Convert this file to snake case and update all files which use it. Signed-off-by: Simon Glass <sjg@chromium.org>
| * patman: Convert camel case in command.pySimon Glass2022-02-0918-70/+70
| | | | | | | | | | | | Convert this file to snake case and update all files which use it. Signed-off-by: Simon Glass <sjg@chromium.org>
| * patman: Convert camel case in tools.pySimon Glass2022-02-0950-473/+473
| | | | | | | | | | | | Convert this file to snake case and update all files which use it. Signed-off-by: Simon Glass <sjg@chromium.org>
* | tools: kwboot: Allow to use -b without image path as the last getopt() optionPali Rohár2022-02-101-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>
* | tools: kwboot: Fix detection of quit esc sequencePali Rohár2022-02-101-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>
* buildman: Allow adjusting board config on the flySimon Glass2022-02-085-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>
* buildman: Provide a hint on how to debug thread crashesSimon Glass2022-02-082-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>
* buildman: Add helper functions for updating .config filesSimon Glass2022-02-083-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>
* buildman: Make use of test_utilSimon Glass2022-02-081-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>
* buildman: Add a flag to control the tracebackSimon Glass2022-02-082-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>
* patman: Update test_util to run doc testsSimon Glass2022-02-083-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>
* Merge tag 'u-boot-imx-20220207' of ↵Tom Rini2022-02-071-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
| * tools/mxsimage: Remove fclose on empty FILE pointerMattias Hansson2022-02-051-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>
* | tools: mkeficapsule: dont use malloc.hHeinrich Schuchardt2022-02-051-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>
* Dockfile, CI: Update to latest focal tag and buildTom Rini2022-02-031-1/+1
| | | | | | | - Latest focal tag - Add libgnutls to image Signed-off-by: Tom Rini <trini@konsulko.com>
* Dockerfile: Add libgnutls package for building mkeficapsule commandAKASHI Takahiro2022-02-031-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>
* mkimage: fix segfault on MacOS arm64Sergey V. Lobanov2022-01-311-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>
* Merge tag 'dm-pull-30jan22' of ↵Tom Rini2022-01-315-16/+65
|\ | | | | | | | | | | | | https://source.denx.de/u-boot/custodians/u-boot-dm moveconfig fix binman support for listing files with generated entries
| * binman: Skip node generation for images read from filesJan Kiszka2022-01-304-3/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We can and should run the node generator only when creating a new image. When we read it back, there is no need to generate nodes - they already exits, and binman does not dive that deep into the image - and there is no way to provide the required fdt-list. So store the mode in the image object so that Entry_fit can simply skip generator nodes when reading them from an fdtmap. This unbreaks all read-backs of images that contain generator nodes in their fdtmap. To confirm this, add a corresponding test case. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org> Add SPDX to dts file: Signed-off-by: Simon Glass <sjg@chromium.org>
| * moveconfig: Fix code relying on now-stripped newline charactersAlper Nebi Yasak2022-01-301-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 37f815cad07d ("moveconfig: Use a function to read files") adds a helper function that can read a file as lines, but strips the newline characters. This change broke parts of moveconfig code that relied on their existence, resulting in a few issues: Configs that are defined as empty aren't removed from header files (e.g. "#define CONFIG_REMAKE_ELF"). Make regex patterns use '\b' to match word boundaries instead of '\W' (which matched the newlines) so these lines still match and get removed. All changes in defconfig are considered removed by savedefconfig even if they weren't, and line continuations in the headers aren't recognized and removed properly, because their checks explicitly look for a newline character. Remove the character from both comparisons. The printed diff of header files is wrongly formatted and raises an IndexError if a blank line was removed. Let print() print the new lines, and use size-independent ways to check strings to fix the diff output. Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
* | tools: kwboot: Set debug flag to 1Pali Rohár2022-01-311-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>
* | tools: kwboot: Fix usage of -D without -tPali Rohár2022-01-311-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>
* | tools: kwboot: Handle EINTR in kwboot_tty_recv()Pali Rohár2022-01-311-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>
* | tools: kwboot: Handle EINTR in kwboot_write()Pali Rohár2022-01-311-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>
* | tools: kwboot: Remove 2s delay before sending first xmodem packetPali Rohár2022-01-311-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>
* | tools: kwboot: Force BootROM to flush input queue after boot patternPali Rohár2022-01-311-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>