aboutsummaryrefslogtreecommitdiff
path: root/tools/binman
AgeCommit message (Collapse)AuthorFilesLines
2022-03-18binman: Tweak collect_contents_to_file() and docsSimon Glass3-15/+20
Update the return value of this function, fix the 'create' typo and update the documentation for clarity. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Suggested-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-03-18elf: Rename load_segments() and module failureSimon Glass2-12/+12
Rename this function to make it clear that it only reads loadable segments. Also update the error for missing module to better match the message emitted by Python. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Suggested-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-03-18binman: Include also subnodes in generator nodesJan Kiszka3-0/+8
This allows to prefill fdt and config nodes with hash and signature subnodes. It's just important to place the child nodes last so that hashes do not come before the data - would be disliked by mkimage. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-03-18tools: binman: main.py: add build-sandbox in sys.pathPhilippe Reynes1-0/+1
Adds build-sandbox in sys.path to look for libfdt, otherwise py_test can't use binman. Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-03-18binman: Complete elf test coverageSimon Glass2-2/+50
Add coverage for the new elf functions needed for the event_dump.py script. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-03-10binman: Expand elf support a littleSimon Glass1-7/+51
Allow finding a symbol by its address. Also export the function to get the file offset of a particular address, so it can be used by a script to be added. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-03-02binman: Correct pylint errorsSimon Glass13-32/+39
Fix pylint errors that can be fixed and mask those that seem to be incorrect. A complication with binman is that it tries to avoid importing libfdt (or anything that imports it) unless needed, so that things like help still work if it is missing. Note that two tests are duplicated in binman and two others have duplicate names, so both of these issues are fixed also. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-22binman: Allow different operations in FIT generator nodesSimon Glass5-49/+274
At present we only support expanding out FDT nodes. Make the operation into an @operation property, so that others can be supported. Re-arrange and tidy up the documentation so that it has separate headings for each topic. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-22binman: Tidy up the docs a little with fitSimon Glass2-14/+16
Add a few quotes and clarify the data property. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-22binman: fit: Refactor to reduce function sizeSimon Glass1-43/+71
Split subnode and property processing into separate functions to make the _AddNode() function a little smaller. Tweak a few comments. This does not change any functionality. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-22binman: Move entry-data collection into a Entry methodSimon Glass3-10/+118
Collecting the data from a list of entries and putting it in a file is a useful operation that will be needed by other entry types. Put this into a method in the Entry class. Add some documentation about how to collect data for an entry type. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-22binman: Add a ELF test file with disjoint text sectionsSimon Glass3-1/+56
Add a file that has two text sections at different addresses, so we can test this behaviour in binman, once added. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-22binman: Support a list of strings with the mkimage etypeSimon Glass3-4/+26
At present the 'args' property of the mkimage entry type is a string. This makes it difficult to include CONFIG options in that property. In particular, this does not work: args = "-n CONFIG_SYS_SOC -E" since the preprocessor does not operate within strings, nor does this: args = "-n" CONFIG_SYS_SOC" "-E" since the device tree compiler does not understand string concatenation. With this new feature, we can do: args = "-n", CONFIG_SYS_SOC, "-E"; Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-22binman: Add to the TODOSimon Glass1-0/+8
Add some ideas that have come to mind recently. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-22binman: Add support for TEE BL32Roger Quadros5-0/+61
Add an entry for OP-TEE Trusted OS 'BL32' payload. This is required by platforms using Cortex-A cores with TrustZone technology. Signed-off-by: Roger Quadros <rogerq@kernel.org> Reviewed-by: Simon Glass <sjg@chromium.org> Add missing-blob-help, renumber the test file, update entry-docs: Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-22elf: Add a way to read segment information from an ELF fileSimon Glass2-2/+66
Add a function which reads the segments and the entry address. Also fix a comment nit in the tests while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-22binman: Update docs to indicate mkimage is supportedSimon Glass1-2/+2
Now that there is a mkimage entry-type, update the docs to remove the future reference. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-22binman: Correct the error message for a bad hash algorithmSimon Glass2-2/+2
This shows an internal type at present, rather than the algorithm name. Fix it and update the test to catch this. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-02-22binman: Update image positions of FIT subentriesAlper Nebi Yasak2-0/+163
Binman keeps track of positions of each entry in the final image, but currently this data is wrong for things included in FIT entries, especially since a previous patch makes FIT a subclass of Section and inherit its implementation. There are three ways to put data into a FIT image. It can be directly included as a "data" property, or it can be external to the FIT image represented by an offset-size pair of properties. This external offset is either "data-position" from the start of the FIT or "data-offset" from the end of the FIT, and the size is "data-size" for both. However, binman doesn't use the "data-offset" method while building FIT entries. According to the Section docstring, its subclasses should calculate and set the correct offsets and sizes in SetImagePos() method. Do this for FIT subentries for the three ways mentioned above, and add tests for the two ways binman can pack them in. Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-02-22binman: Skip processing "hash" subnodes of FIT subsectionsAlper Nebi Yasak4-14/+97
Binman's FIT entry type can have image subentries with "hash" subnodes intended to be processed by mkimage, but not binman. However, the Entry class and any subclass that reuses its implementation tries to process these unconditionally. This can lead to an error when boards specify hash algorithms that binman doesn't support, but mkimage supports. Let entries skip processing these "hash" subnodes based on an instance variable, and set this instance variable for FIT subsections. Also re-enable processing of calculated and missing properties of FIT entries which was disabled to mitigate this issue. Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
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: Rename Color() method to build()Simon Glass1-4/+4
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: Convert camel case in tout.pySimon Glass12-57/+57
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 Glass1-3/+3
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 Glass4-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 tools.pySimon Glass38-360/+360
Convert this file to snake case and update all files which use it. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-30binman: Skip node generation for images read from filesJan Kiszka4-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>
2022-01-25binman: doc: fix typo for u-boot-tplHeiko Thiery1-1/+1
Cc: Simon Glass <sjg@chromium.org> Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-01-25binman: Document the __bss_size symbol errorSimon Glass1-0/+29
Add a note about the message so it is clear why it occurs. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25binman: Add documentation for bintoolsSimon Glass2-0/+186
Add this documention to explain how bintools are used and which ones are available. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25binman: Add a command to generate bintool docsSimon Glass5-1/+80
Each bintool has some documentation which can be useful for the user. Add a new command that collects this and writes it into a .rst file. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25binman: Complete test coverage of comp_utilSimon Glass2-14/+11
Drop the unused gzip code, update comments and add a test for an invalid algorithm. The temporary file is not needed now, so drop that also. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25binman: Plumb in support for missing bintoolsSimon Glass5-2/+103
Bintools can be missing, in which case binman continues operation but reports an invalid image. Plumb in support for this and add tests for entry types which use bintools. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25binman: Convert to using the lzma_alone bintoolSimon Glass1-8/+5
Update the code to use this bintool, instead of running lzma_alone directly. This simplifies the code and provides more consistency. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25binman: Add a bintool implementation for lzma_aloneSimon Glass1-0/+126
Add a Bintool for this, which is used to compress and decompress data. It supports the features needed by binman as well as installing via the lzma-alone package. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25binman: Convert to using the lz4 bintoolSimon Glass3-16/+10
Update the code to use this bintool, instead of running lz4 directly. This simplifies the code and provides more consistency. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25binman: Add a bintool implementation for lz4Simon Glass1-0/+140
Add a Bintool for this, which is used to compress and decompress data. It supports the features needed by binman as well as installing via the lz4 package. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25binman: Tidy up pylint warnings in comp_utilSimon Glass5-20/+19
Tweak some naming and comments to resolve these. Use WriteFile() to write the file. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25binman: Move compression into binmanSimon Glass5-10/+102
The compression functions are not actually used by patman, so we don't need then in the tools module. Also we want to change them to use bintools, which patman will not support. Move these into a new comp_util module, within binman. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25binman: Convert to using the mkimage bintoolSimon Glass2-6/+27
Update the fit and mkimage entry types to use this bintool, instead of running mkimage directly. This simplifies the code and provides more consistency as well as supporting missing bintools. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25binman: Convert to using the ifwitool bintoolSimon Glass2-8/+21
Update the ifwi entry type to use this bintool, instead of running ifwitool directly. This simplifies the code and provides more consistency as well as supporting missing bintools. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25binman: Convert to using the futility bintoolSimon Glass2-28/+41
Update the GBB and vblock entry types to use this bintool, instead of running futility directly. This simplifies the code and provides more consistency as well as supporting missing bintools. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25binman: Convert to using the FIP bintoolSimon Glass2-41/+8
Update the FIP tests to use this bintool, instead of running fiptool directly. This simplifies the code and provides more consistency as well as supporting missing bintools. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25binman: Convert to using the CBFS bintoolSimon Glass2-56/+19
Update the CBFS tests to use this bintool, instead of running cbfstool directly. This simplifies the overall code and provides more consistency, as well as supporting missing bintools. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25binman: Enable bintool tests including cmdline processingSimon Glass2-3/+36
The tests rely on having at least 5 bintool implementions. Now that we have this, enable them. Add tests for the binman 'tool' subcommand. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25binman: Add a bintool implementation for mkimageSimon Glass1-0/+80
Add a Bintool for this, which is used to build images for use by U-Boot. It supports the features needed by binman as well as installing via the u-boot-tools packages. Although this is built in the U-Boot tree, it is still useful to install a binary on the system. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25binman: Add a bintool implementation for ifwitoolSimon Glass1-0/+166
Add a Bintool for this, which is used to build Intel IFWI images. It supports the features needed by the tests as well as downloading a binary from Google Drive. Although this is built in the U-Boot tree, it is not currently included with u-boot-tools, so it may be useful to install a binary on the system. Signed-off-by: Simon Glass <sjg@chromium.org>