summaryrefslogtreecommitdiff
path: root/tools
Commit message (Collapse)AuthorAgeFilesLines
* lib: fdtdec: Rename routine fdtdec_setup_memory_size()Siva Durga Prasad Paladugu2018-07-194-5/+5
| | | | | | | | | | | This patch renames the routine fdtdec_setup_memory_size() to fdtdec_setup_mem_size_base() as it now fills the mem base as well along with size. Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Tom Rini <trini@konsulko.com>
* mkimage: fit_image: Add support for SOURCE_DATE_EPOCH in signaturesAlex Kiernan2018-07-102-15/+22
| | | | | | | | | When generating timestamps in signatures, use imagetool_get_source_date() so we can be overridden by SOURCE_DATE_EPOCH to generate reproducible images. Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Reviewed-by: Simon Glass <sjg@chromum.org>
* mkimage: Refactor imagetool_get_source_date to take command nameAlex Kiernan2018-07-104-6/+7
| | | | | | | | | So we can use imagetool_get_source_date() from callers who do not have the image tool params struct, just pass in the command name for the error message. Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Reviewed-by: Simon Glass <sjg@chromum.org>
* vboot: Do not use hashed-strings offsetTeddy Reed2018-07-101-0/+1
| | | | | | | | | | | | The hashed-strings signature property includes two uint32_t values. The first is unneeded as there should never be a start offset into the strings region. The second, the size, is needed because the added signature node appends to this region. See tools/image-host.c, where a static 0 value is used for the offset. Signed-off-by: Teddy Reed <teddy.reed@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* vboot: Add FIT_SIGNATURE_MAX_SIZE protectionTeddy Reed2018-07-101-0/+1
| | | | | | | | | | | | | | | | | This adds a new config value FIT_SIGNATURE_MAX_SIZE, which controls the max size of a FIT header's totalsize field. The field is checked before signature checks are applied to protect from reading past the intended FIT regions. This field is not part of the vboot signature so it should be sanity checked. If the field is corrupted then the structure or string region reads may have unintended behavior, such as reading from device memory. A default value of 256MB is set and intended to support most max storage sizes. Suggested-by: Simon Glass <sjg@chromium.org> Signed-off-by: Teddy Reed <teddy.reed@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* binman: Support updating the device tree with calc'd infoSimon Glass2018-07-096-14/+144
| | | | | | | | It is useful to write the position and size of each entry back to the device tree so that U-Boot can access this at runtime. Add a feature to support this, along with associated tests. Signed-off-by: Simon Glass <sjg@chromium.org>
* binman: Add a SetCalculatedProperties() methodSimon Glass2018-07-097-9/+67
| | | | | | | | | | | | Once binman has packed the image, the position and size of each entry is known. It is then possible for binman to update the device tree with these positions. Since placeholder values have been added, this does not affect the size of the device tree and therefore the packing does not need to be performed again. Add a new SetCalculatedProperties method to handle this. Signed-off-by: Simon Glass <sjg@chromium.org>
* binman: Add a ProcessFdt() methodSimon Glass2018-07-099-37/+117
| | | | | | | | | | | | | | | | Some entry types modify the device tree, e.g. to remove microcode or add a property. So far this just modifies their local copy and does not affect a 'shared' device tree. Rather than doing this modification in the ObtainContents() method, and a new ProcessFdt() method which is specifically designed to modify this shared device tree. Move the existing device-tree code over to use this method, reducing ObtainContents() to the goal of just obtaining the contents without any processing, even for device tree. Signed-off-by: Simon Glass <sjg@chromium.org>
* binman: Complete documentation of stagesSimon Glass2018-07-091-2/+4
| | | | | | | At present one of the stages is badly numbered and not described. Fix this. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Add functions to add integer propertiesSimon Glass2018-07-092-0/+47
| | | | | | | Add a few simple functions to add a placeholder integer property, and set its value. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Avoid unwanted output during testsSimon Glass2018-07-092-6/+11
| | | | | | | At present some warnings are printed to indicate failures which are a known part of running the tests. Suppress these. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Increase code coverage to 100%Simon Glass2018-07-0910-2/+285
| | | | | | | | Add more tests to increase dtoc code coverage to 100%. Correct a whitespace error in some test .dts files at the same time. Signed-off-by: Simon Glass <sjg@chromium.org>
* binman: Move capture_sys_output() to test_utilSimon Glass2018-07-093-21/+24
| | | | | | | This function is useful in various tests. Move it into the common test utility module. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Add a test for code coverageSimon Glass2018-07-091-0/+15
| | | | | | | Add a -T option to run a code-coverage test on dtoc. At present this is about 96%. Future work will increase it to 100%. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Fix some minor errorsSimon Glass2018-07-093-4/+5
| | | | | | Fix some comments and a printf string which is incorrect. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Fix properties with a single zero-arg phandleSimon Glass2018-07-094-5/+27
| | | | | | | | | At present a property with a single phandle looks like an integer value to dtoc. Correct this by adjusting it in the phandle-processing code. Add a test for this. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Fix Fdt.GetNode() to handle a missing nodeSimon Glass2018-07-092-1/+7
| | | | | | | | At present the algortihm is not correct since it will return the root node if the requested node is not found and there are no slashes in the requested node name. Fix this and add a test. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Keep track of property offsetsSimon Glass2018-07-092-7/+78
| | | | | | | | At present the Fdt class does not keep track of property offsets if they change due to removal of properties. Update the code to handle this, and add a test. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Update fdt tests to increase code coverageSimon Glass2018-07-095-24/+150
| | | | | | | | At present only some of the fdt functionality is tested. Add more tests to cover the rest of it. Also turn on test coverage, which is now 100% with a small exclusion for a Python 3 feature. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Drop use of a local dtb bufferSimon Glass2018-07-092-10/+10
| | | | | | | | | | | At present the Fdt class has its own copy of the device tree. This is confusing an unnecessary now that pylibfdt has its own. Drop it and provide access functions to the buffer. This allows us to move the rest of the implementation to use pylibfdt methods instead of directly calling libfdt stubs. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Make use of the new pylibfdt methodsSimon Glass2018-07-091-12/+14
| | | | | | | | | | Now that pylibfdt supports a fuller API we don't need to directly call the libfdt stubs. Update the code to use the Fdt methods instead. Some other cases remain which will be tidied up in a later commit, since they need larger changes. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Update tests to write failures to /tmpSimon Glass2018-07-091-14/+42
| | | | | | | | | | | | When a test fails due to an output mismatch (e.g. due to a new property being adding to a test file) it is currently hard to update the test to the new output. In particular the tabs in the file are written as \t in the Python tests. To make this easier, write both the expected and actual results to /tmp to allow use of meld, and copying into the test. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Add some tests for the fdt moduleSimon Glass2018-07-093-2/+257
| | | | | | | | | | At present this module is tested via the dtoc tests. This is a bit painful since the tests are at a higher level and so failures are more difficult to diagnose. Add some tests that exercise the fdt module directly. Signed-off-by: Simon Glass <sjg@chromium.org>
* binman: Move coverage logic into a new test_util fileSimon Glass2018-07-092-25/+68
| | | | | | | | At present only binman has the logic for determining Python test coverage but this is useful for other tools also. Move it out into a separate file so it can be used by other tools. Signed-off-by: Simon Glass <sjg@chromium.org>
* libfdt: Bring in proposed pylibfdt changesSimon Glass2018-07-093-7/+19
| | | | | | | | | | | | | | | This provides various patches sent to the devicetree-compiler mailing list to enhance the Python bindings. A final version of this patch may be created once upstreaming is complete, but if it takes too long, this can act as a placeholder. New pylibfdt features: - Support for most remaining, relevant libfdt functions - Support for sequential-write functions Changes are applied to existing U-Boot tools as needed. Signed-off-by: Simon Glass <sjg@chromium.org>
* binman: Tidy up setting of entry contentsSimon Glass2018-07-097-6/+62
| | | | | | | | | | | At present the contents of an entry are set in subclasses simply by assigning to the data and content_size properties. Add some methods to do this, so that we have more control. In particular, add a method to set the contents without changing its size, so we can validate that case. Add a test case for trying to change the size when this is not allowed. Signed-off-by: Simon Glass <sjg@chromium.org>
* binman: Tidy up execution of testsSimon Glass2018-07-091-5/+3
| | | | | | | | Move all the test execution into the same mechanism so that we can request a particular test (from any suite) by passing it as an argument to 'binman -t'. Signed-off-by: Simon Glass <sjg@chromium.org>
* binman: Correct operation of ObtainContents()Simon Glass2018-07-098-14/+114
| | | | | | | | | | | | | | This method is supposed to return the contents of an entry. However at present there is no check that it actually does. Also some implementations do not return 'True' to indicate success, as required. Add a check for things working as expected, and correct the implementations. This requires some additional test cases to cover things which were missed originally. Add these at the same time. Signed-off-by: Simon Glass <sjg@chromium.org>
* binman: Tidy up variables in _RunMicrocodeTest()Simon Glass2018-07-091-7/+18
| | | | | | | At present we call the three entries first, second and third. Rename them to reflect their contents instead, for clarity. Signed-off-by: Simon Glass <sjg@chromium.org>
* binman: Make the operation of Entry__testing explicitSimon Glass2018-07-092-4/+11
| | | | | | | | | | | | | | This fake entry is used for testing. At present it only has one behaviour which is to return an invalid set of entry positions, to cause an error. The fake entry will need to be used for other things too. Allow the test .dts file to specify the behaviour of the fake entry, so we can control its behaviour easily. While we are here, drop the ReadContents() method, since this only applies to subclasses of Entry_blob, which Entry__testing is not. Signed-off-by: Simon Glass <sjg@chromium.org>
* binman: Switch to 'python-coverage'Tom Rini2018-07-092-6/+6
| | | | | | | | | The most portable way to get access to coverage is to invoke it as 'python-coverage'. Cc: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com> Signed-off-by: Simon Glass <sjg@chromium.org>
* Revert "fw_printenv: Don't bail out directly after one env read error"Tom Rini2018-07-011-15/+9
| | | | | | | | | As pointed out by Wolfgang Denk, the problem with this fix is that while interactive users will see that we have found one part of the environment failed and are using the other, progmatic use will not see this and can lead to problems. Signed-off-by: Tom Rini <trini@konsulko.com>
* fw_printenv: Don't bail out directly after one env read errorJoe Hershberger2018-06-271-9/+15
| | | | | | | | | When using a redundant environment a read error should simply mean to not use that copy instead of giving up completely. The other copy may be just fine. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Signed-off-by: Ioan-Adrian Ratiu <adrian.ratiu@ni.com>
* patman: Support using a particular SMTP serverSimon Glass2018-06-233-2/+10
| | | | | | | Some environments require providing the '--smtp-server' argument to 'git send-email'. Add support for this. Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: add test for SPDX licenseChris Packham2018-06-231-2/+16
| | | | | | | Add a test to exercise the check for a valid SPDX license. Signed-off-by: Chris Packham <judge.packham@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* patman: add option for limiting the Cc listChris Packham2018-06-233-3/+9
| | | | | | | | | | | | | Many mailing-lists consider a long Cc list a sign of spam and will either drop the message or mark it for moderation. Because patman automatically invokes get_maintainer.pl the Cc list can expand unexpectedly. Allow the user to specify a limit for the Cc list. This limit is applied after removing any known bouncing addresses. By default no limit is applied. Signed-off-by: Chris Packham <judge.packham@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* fdtgrep: Separate out checking of two allocationsSimon Glass2018-06-191-4/+7
| | | | | | | | | | | | | The current code might succeed on the first allocation and fail on the second. Separate the checks to avoid this problem. Of course, free() will never fail and the chances that (when allocating two small areas) one will succeed and one will fail are just as remote. But this keeps coverity happy. Reported-by: Coverity (CID: 131226) Signed-off-by: Simon Glass <sjg@chromium.org>
* fdtgrep: Fix logic of free() in do_fdtgrep()Simon Glass2018-06-191-2/+5
| | | | | | | | | | This loop never actually exits, but the way the code is written this is not obvious. Add an explicit error check. Reported-by: Coverity (CID: 131280) Signed-off-by: Simon Glass <sjg@chromium.org> [trini: Add explicit init of region to NULL per LLVM warning] Signed-off-by: Tom Rini <trini@konsulko.com>
* u-boot: Fix several typosShyam Saini2018-06-131-2/+2
| | | | | | | 's/environemnt/environment/' and 's/Environemnt/Environment/' Signed-off-by: Shyam Saini <shyam@amarulasolutions.com>
* tools: env: Use getline rather than fgets when reading config/scriptAlex Kiernan2018-06-131-19/+21
| | | | | | | | | | When reading the config file, or a script file, use getline rather than fgets so line lengths aren't limited by the size of a compiled in buffer (128 characters for config, 1024 for scripts). Rename 'dump' to 'line' so it's clear we're working with a line of text. Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
* binman: Mark 'align-end' as implementedSimon Glass2018-06-071-4/+3
| | | | | | | The documentation says this is not implemented, but it is. Update the documentation, and clarify its operation. Signed-off-by: Simon Glass <sjg@chromium.org>
* binman: Add support for adding a name prefix to entriesSimon Glass2018-06-075-3/+66
| | | | | | | | | | | Sometimes we have several sections which repeat the same entries (e.g. for a read-only and read-write version of the same section). It is useful to be able to tell these entries apart by name. Add a new 'name-prefix' property for sections, which causes all entries within that section to have a given name prefix. Signed-off-by: Simon Glass <sjg@chromium.org>
* binman: Add support for outputing a map fileSimon Glass2018-06-078-6/+88
| | | | | | | | It is useful to be able to see a list of regions in each image produced by binman. Add a -m option to output this information in a '.map' file alongside the image file. Signed-off-by: Simon Glass <sjg@chromium.org>
* binman: Tidy up some docs and commentsSimon Glass2018-06-073-13/+27
| | | | | | Fix a few missing comments and tidy up some existing ones. Signed-off-by: Simon Glass <sjg@chromium.org>
* binman: Allow a single test to be executedSimon Glass2018-06-071-4/+17
| | | | | | | Provide an easy way to execute a single binman test by specifying it on the command line. Signed-off-by: Simon Glass <sjg@chromium.org>
* binman: Add documentation for pos-unset propertySimon Glass2018-06-071-0/+7
| | | | | | This property is not documented. Add a note to the README. Signed-off-by: Simon Glass <sjg@chromium.org>
* binman: Add support for sectionsSimon Glass2018-06-076-2/+132
| | | | | | | | | | It is useful to be able to split an image into multiple sections, each with its own size and position, for cases where a flash device has read-only and read-write portions. Add support for this. Signed-off-by: Simon Glass <sjg@chromium.org>
* binman: Avoid setting sys.path globallySimon Glass2018-06-072-3/+10
| | | | | | | | | | | | At present we set the Python path at the start of binman so we can read modules in the 'etype' directory. This is a bit messy since it affects 'import' statements through binman. Adjust the code to set the path locally, just where it is needed. Move the 'entry' module in with the other base modules to help with this. It makes more sense here anyway since it does not implement an entry type. Signed-off-by: Simon Glass <sjg@chromium.org>
* binman: Rename Entry property to 'section'Simon Glass2018-06-0725-75/+77
| | | | | | | Entries are now passed a Section object rather than an Image. Rename this property to avoid confusion. Signed-off-by: Simon Glass <sjg@chromium.org>
* binman: Rename ELF parameters to 'section'Simon Glass2018-06-074-23/+23
| | | | | | | We now pass a Section object to these functions rather than an Image. Rename the parameters to avoid confusion. Signed-off-by: Simon Glass <sjg@chromium.org>