summaryrefslogtreecommitdiff
path: root/tools
AgeCommit message (Collapse)AuthorFilesLines
2020-09-25binman: Support adding a U-Boot environmentSimon Glass5-0/+132
In some cases it is useful to include a U-Boot environment region in an image. This allows the board to start up with an environment ready to go. Add a new entry type for this. The input is a text file containing the environment entries, one per line, in the format: var=value Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-09-25binman: Show an error when a file is missingSimon Glass3-2/+24
The recent support for missing external binaries does not show an error message when a file is genuinely missing (i.e. it is missing but not marked as 'external'). This means that when -m is passed to binman, it will never report a missing file. Fix this and add a test. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-09-22binman: sunxi: Add help message for missing sunxi ATF BL31Simon Glass1-0/+4
Add a special help message pointing to the relevant README. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-09-22binman: Support help messages for missing blobsSimon Glass6-3/+119
When an external blob is missing it can be quite confusing for the user. Add a way to provide a help message that is shown. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2020-09-22binman: Allow selecting default FIT configurationSimon Glass4-4/+69
Add a new entry argument to the fit entry which allows selection of the default configuration to use. This is the 'default' property in the 'configurations' node. Update the Makefile to pass in the value of DEVICE_TREE or CONFIG_DEFAULT_DEVICE_TREE to provide this information. Signed-off-by: Simon Glass <sjg@chromium.org> Suggested-by: Michal Simek <michal.simek@xilinx.com>
2020-09-22binman: Document how CROSS_COMPILE, CC, HOSTCC etc. are used in READMEAlper Nebi Yasak1-0/+24
Explain that binman interprets these environment variables in the "External tools" section to run target/host specific versions of the tools, and add a new section on how to use CROSS_COMPILE to run the tests on non-x86 machines. Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-09-22binman: Allow resolving host-specific tools from env varsAlper Nebi Yasak1-1/+49
This patch lets tools.Run() use host-specific versions with the for_host keyword argument, based on the host-specific environment variables (HOSTCC, HOSTOBJCOPY, HOSTSTRIP, etc.). Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-09-22binman: Use target-specific tools when cross-compilingAlper Nebi Yasak4-7/+89
Currently, binman always runs the compile tools like cc, objcopy, strip, etc. using their literal name. Instead, this patch makes it use the target-specific versions by default, derived from the tool-specific environment variables (CC, OBJCOPY, STRIP, etc.) or from the CROSS_COMPILE environment variable. For example, the u-boot-elf etype directly uses 'strip'. Trying to run the tests with 'CROSS_COMPILE=i686-linux-gnu- binman test' on an arm64 host results in the '097_elf_strip.dts' test to fail as the arm64 version of 'strip' can't understand the format of the x86 ELF file. This also adjusts some command.Output() calls that caused test errors or failures to use the target versions of the tools they call. After this, patch, an arm64 host can run all tests with no errors or failures using a correct CROSS_COMPILE value. Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-09-22binman: Support cross-compiling test files to x86Alper Nebi Yasak1-1/+14
These test files are currently "intended for use on x86 hosts", but most of the tests using them can still pass when cross-compiled to x86 on an arm64 host. This patch enables non-x86 hosts to run the tests by specifying a cross-compiler via CROSS_COMPILE. The list of variables it sets is taken from the top-level Makefile. It would be possible to automatically set an x86 cross-compiler with a few blocks like: ifneq ($(shell i386-linux-gnu-gcc --version 2> /dev/null),) CROSS_COMPILE = i386-linux-gnu- endif But it wouldn't propagate to the binman process calling this Makefile, so it's better just raise an error and expect 'binman test' to be run with a correct CROSS_COMPILE. Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-09-22buildman: Use git worktrees instead of git clones when possibleAlper Nebi Yasak3-8/+84
This patch makes buildman create linked working trees instead of clones of the source repository, but keeps updating the older clones of the repository that might already exist. These worktrees share "everything except working directory specific files such as HEAD, index, etc." with the source repository. See the git-worktree(1) manual page for more information. If git-worktree isn't available, silently falls back to cloning the repository. Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
2020-09-22binman: Support generating FITs with multiple dtbsSimon Glass5-11/+346
In some cases it is useful to generate a FIT which has a number of DTB images, selectable by configuration. Add support for this in binman, using a simple iterator and string substitution. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-09-22binman: Add support for ATF BL31Simon Glass4-0/+63
Add an entry for ARM Trusted Firmware's 'BL31' payload, which is the device's main firmware. Typically this is U-Boot. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-09-22binman: Move 'external' support into base classSimon Glass5-25/+24
At present we have an Entry_blob_ext which implement a blob which holds an external binary. We need to support other entry types that hold external binaries, e.g. Entry_blob_named_by_arg. Move the support into the base Entry class to allow this. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-09-22binman: Fix up a few missing commentsSimon Glass2-1/+26
Tidy up a few test functions which lack argument comments. Rename one that has the same name as a different test. Also fix up the comment for PrepareImagesAndDtbs(). Signed-off-by: Simon Glass <sjg@chromium.org>
2020-09-22binman: Allow entry args to be requiredSimon Glass4-11/+24
If an entry argument is needed by an entry but the entry argument is not present, then a strange error can occur when trying to read the file. Fix this by allowing arguments to be required. Select this option for the cros-ec-rw entry. If a filename is provided in the node, allow that to be used. Also tidy up a few related tests to make the error string easier to find, and fully ignore unused return values. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-09-22tools: Drop unnecessary use of __file__Simon Glass3-8/+0
There are few places where the path of the current modules is calculated but not used. Drop them. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-09-22binman: Use pkg_resources to find resourcesSimon Glass1-2/+4
At present we look for resources based on the path of the Python module that wants them. Instead we should use Python's pkg_resources feature which is designed for this purpose. Update binman to use this. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-09-22binman: Build FIT image subentries with the section etypeAlper Nebi Yasak4-17/+169
When reading subentries of each image, the FIT entry type directly concatenates their contents without padding them according to their offset, size, align, align-size, align-end, pad-before, pad-after properties. This patch makes sure these properties are respected by offloading this image-data building to the section etype, where each subnode of the "images" node is processed as a section. Alignments and offsets are respective to the beginning of each image. For example, the following fragment can end up having "u-boot-spl" start at 0x88 within the final FIT binary, while "u-boot" would then end up starting at e.g. 0x20088. fit { description = "example"; images { kernel-1 { description = "U-Boot with SPL"; type = "kernel"; arch = "arm64"; os = "linux"; compression = "none"; u-boot-spl { }; u-boot { align = <0x10000>; }; }; }; } Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reinstate check in testPadInSections(), squash in "binman: Allow FIT binaries to have missing external blobs" Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2020-09-22binman: Respect pad-before property of section subentriesAlper Nebi Yasak3-1/+35
Other relevant properties (pad-after, offset, size, align, align-size, align-end) already work since Pack() sets correct ranges for subentries' data (.offset, .size variables), but some padding here is necessary to align the data within this range to match the pad-before property. Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-09-22binman: Ignore hash*, signature* nodes in sectionsAlper Nebi Yasak3-1/+47
Switch to str.startswith for matching like the FIT etype does since the current version doesn't ignore 'hash-1', 'hash-2', etc. Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-08-26Merge tag 'u-boot-imx-20200825' of ↵Tom Rini1-1/+1
https://gitlab.denx.de/u-boot/custodians/u-boot-imx For 2020.10 ----------- - mx6: SOCs user selectable Fix for imx6q_logic Some DM conversion - mx7: introduce secondary boot device Travis: https://travis-ci.org/github/sbabic/u-boot-imx/builds/720918010 Signed-off-by: Tom Rini <trini@konsulko.com>
2020-08-23Merge tag 'dm-pull-22aug20' of ↵Tom Rini6-22/+45
https://gitlab.denx.de/u-boot/custodians/u-boot-dm replace devfdt_get_addr_ptr() with dev_read_addr_ptr() binman fixes for portage various minor fixes 'bind' command improvements
2020-08-23moveconfig: Skip binary and ELF filesSimon Glass1-1/+2
Add a few more file extensions to the list of files that should not be processed. This avoids unicode errors, for example. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-08-22binman: Add a setup script for PythonSimon Glass1-0/+12
Allow binman to be installed by adding a suitable setup.py script. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-08-22dtoc: Add a setup script for PythonSimon Glass1-0/+12
Allow dtoc to be installed by adding a suitable setup.py script. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-08-22binman: Correct some import statementsSimon Glass4-5/+4
Some of these were not converted when binman moved to use absolute paths. Fix them. Also drop the import of 'test' which is a directory, not a module. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-08-22binman: Move GetEntryModules() to controlSimon Glass3-17/+17
When binman is installed its main program is in a different directory to its modules. This means that __file__ is different and we cannot use it to obtain the path to etype/ from main.py To fix this, move the function to the 'control' module, since it is installed with all the other modules, including the etype/ directory. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-08-18tools/imximage: fix DCD Blocks message output orderMatthias Schiffer1-1/+1
The correct order is load address, offset, length. The order was accidentally switched a while ago; make it match the HAB Blocks output and what CST expects again. Fixes: e97bdfa5da70 ("tools/imximage: share DCD information via Kconfig") Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
2020-08-07mkimage: fit: fix import of external dataPatrick Oppenlander1-2/+2
The external data is located after the mmapped FDT pointed to by 'old_fdt', not in the newly created FDT we are importing into at 'fdt'. Signed-off-by: Patrick Oppenlander <patrick.oppenlander@gmail.com>
2020-08-07mkimage: fit: include image cipher in configuration signaturePatrick Oppenlander1-0/+17
This patch addresses issue #2 for signed configurations. -----8<----- Including the image cipher properties in the configuration signature prevents an attacker from modifying cipher, key or iv properties. Signed-off-by: Patrick Oppenlander <patrick.oppenlander@gmail.com> Reviewed-by: Philippe Reynes <philippe.reynes@softathome.com>
2020-08-07mkimage: fit: don't cipher ciphered dataPatrick Oppenlander1-1/+14
Previously, mkimage -F could be run multiple times causing already ciphered image data to be ciphered again. Signed-off-by: Patrick Oppenlander <patrick.oppenlander@gmail.com> Reviewed-by: Philippe Reynes <philippe.reynes@softathome.com>
2020-08-07mkimage: fit: handle FDT_ERR_NOSPACE when cipheringPatrick Oppenlander1-9/+10
Also replace fdt_delprop/fdt_setprop with fdt_setprop as fdt_setprop can replace an existing property value. Signed-off-by: Patrick Oppenlander <patrick.oppenlander@gmail.com> Reviewed-by: Philippe Reynes <philippe.reynes@softathome.com>
2020-08-07mkimage: fit: only process one cipher nodePatrick Oppenlander1-35/+22
Previously mkimage would process any node matching the regex cipher.* and apply the ciphers to the image data in the order they appeared in the FDT. This meant that data could be inadvertently ciphered multiple times. Switch to processing a single cipher node which exactly matches FIT_CIPHER_NODENAME. Signed-off-by: Patrick Oppenlander <patrick.oppenlander@gmail.com> Reviewed-by: Philippe Reynes <philippe.reynes@softathome.com>
2020-08-05tools: env: Avoid an uninited warning with was_lockedSimon Glass1-1/+1
Set this variable to 0 to avoid a warning about an unused variable. This happens on gcc 7.5.0 for me. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-08-05tools: env: Fix printf() warning in fw_envSimon Glass1-2/+2
The printf() string produces a warning about %d not matching size_t. Fix it and put the format string on one line to avoid a checkpatch warning. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-08-05fit_image: Use calloc() to fix reproducibility issueFabio Estevam1-4/+4
Vagrant Cascadian reported that mx6cuboxi target no longer builds reproducibility on Debian. One example of builds mismatches: 00096680: 696e 6700 736f 756e 642d 6461 6900 6465 ing.sound-dai.de -00096690: 7465 6374 2d67 7069 6f73 0000 tect-gpios.. +00096690: 7465 6374 2d67 7069 6f73 0061 tect-gpios.a This problem happens because all the buffers in fit_image.c are allocated via malloc(), which does not zero out the allocated buffer. Using calloc() fixes this unpredictable behaviour as it guarantees that the allocated buffer are zero initialized. Reported-by: Vagrant Cascadian <vagrant@reproducible-builds.org> Suggested-by: Tom Rini <trini@konsulko.com> Signed-off-by: Fabio Estevam <festevam@gmail.com> Tested-by: Vagrant Cascadian <vagrant@reproducible-builds.org>
2020-08-04checkpatch: Don't allow common.h and dm.h in headersSimon Glass1-0/+7
These headers should not be included in other header files. Add a checkpatch rule and test for this. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-08-04patman: Fix up the test commentsSimon Glass1-5/+5
Many of the tests have the same comment and two have the same name. Fix this. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-07-31fw_setenv: lock the flash only if it was locked beforeIvan Mikhaylov1-5/+19
With current implementation of fw_setenv, it is always locks u-boot-env region if lock interface is implemented for such mtd device. You can not control lock of this region with fw_setenv, there is no option for it in config or in application itself. Because of this situation may happen problems like in this thread on xilinx forum: https://forums.xilinx.com/t5/Embedded-Linux/Flash-be-locked-after-use-fw-setenv-from-user-space /td-p/1027851 A short summary of that link is: some person has issue with some spi chip which has lock interface but doesn't locks properly which leads to lock of whole flash memory on lock of u-boot-env region. As resulted solution hack was added into spi-nor.c driver for this chip with lock disablement. Instead fix this problem by adding logic to fw_setenv only lock the flash if it was already locked when we attempted to use it. Signed-off-by: Ivan Mikhaylov <fr0st61te@gmail.com>
2020-07-29dtoc: remove compatible string aliases supportWalter Lozano2-56/+0
After latest improvements in dtoc, compatible strings are checked against driver and driver alias list to get a valid driver name. With this new feature the list of compatible string aliases seems not useful any more. Signed-off-by: Walter Lozano <walter.lozano@collabora.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-07-29dtoc: look for compatible string aliases in driver listWalter Lozano3-26/+44
Currently dtoc checks if the first compatible string in a dtb node matches either a driver o driver alias name, without taking into account any other compatible string in the list. In the case that no driver matches the first compatible string a warning is printed and the U_BOOT_DEVICE is not being declared correctly. This patch adds dtoc's support for try all the compatible strings in the dtb node, in an effort to find the correct driver. Signed-off-by: Walter Lozano <walter.lozano@collabora.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-07-29Makefile: Rename ALL-y to INPUTS-ySimon Glass1-1/+1
When binman is in use, most of the targets built by the Makefile are inputs to binman. We then need a final rule to run binman to produce the final outputs. Rename the variable to indicate this, and add a new 'inputs' target. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2020-07-29buildman: Show the build rate at the endSimon Glass2-1/+15
It is interesting to note the number of builds completed per second to track machine performance and build speed. Add a 'rate' value at the end of the build to show this. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-07-29buildman: Correct the testOutputDir() unit testSimon Glass1-2/+1
This current fails with an error. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org> Fixes: 7664b03ffc5 ("buildman: Remove _of_#_ from results directory paths")
2020-07-29buildman: Allow using older versions of genboardscfg.pySimon Glass1-2/+8
Older versions of this script don't support the -q flag. Since buildman runs this script from when it starts, we may get the old version. Fix this in two ways: 1. Use the version from the same tree as buildman is run from, if available 2. Failing that, allow the -q flag to be missing Signed-off-by: Simon Glass <sjg@chromium.org>
2020-07-29dtoc: add coverage test for unicode errorWalter Lozano3-3/+42
Add an additional test to dtoc in order improve the coverage, specifically to take into account the case of unicode error when scanning drivers. Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
2020-07-27binman: Re-enable concurrent testsSimon Glass1-1/+3
With the change to absolute imports the concurrent tests feature unfortunately broke. Fix it. We cannot easy add a warning, since the output messes up tests which check the output. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-07-27binman: Don't change the descriptor in testsSimon Glass3-5/+47
At present testPackX86RomMeNoDesc removes the contents of the descriptor.bin file and testPackX86RomMeMissingDesc removes the file completely. If a test that relies on this file happens to run after it is removed, it will not work. Since we have no control over the selecting of tests that run in parallel and series, we must avoid changing the files. Update this tests to use separate files instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-07-25patman: When no tracking branch is provided, tell the userNicolas Boichat1-2/+3
The user can either count the number of patches, or provide a tracking branch. Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-07-25patman: Make sure sendemail.suppresscc is (un)set correctlyNicolas Boichat2-0/+27
Setting sendemail.suppresscc to all or cccmd leads to --cc-cmd parameter being ignored, and emails going either nowhere, or just to the To: line maintainer. Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>