aboutsummaryrefslogtreecommitdiff
path: root/tools/binman
AgeCommit message (Collapse)AuthorFilesLines
2021-10-03iot2050: Enable watchdog support, but do not auto-start itJan Kiszka1-0/+5
This allows to use the watchdog in custom scripts but does not enforce that the OS has to support it as well. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2021-09-24tools: Refactor full help printingPaul Barker1-6/+3
Collect the code for printing the full help message of patman, buildman and binman into a single function in patman.tools. Signed-off-by: Paul Barker <paul.barker@sancloud.com>
2021-07-21binman: Add basic support for debugging performanceSimon Glass4-0/+88
One of binman's attributes is that it is extremely fast, at least for a Python program. Add some simple timing around operations that might take a while, such as reading an image and compressing it. This should help to maintain the performance as new features are added. This is for debugging purposes only. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-07-21binman: Use bytearray instead of stringSimon Glass2-3/+3
This is faster if data is being concatenated. Update the section and collection etypes. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-07-21binman: Split node-reading out from constructor in filesSimon Glass1-0/+3
The constructor should not read the node information. Move it to the ReadNode() method instead. This allows this etype to be subclassed. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-07-21binman: Support multithreading for building imagesSimon Glass8-6/+136
Some images may take a while to build, e.g. if they are large and use slow compression. Support compiling sections in parallel to speed things up. Signed-off-by: Simon Glass <sjg@chromium.org> (fixed to use a separate test file to fix flakiness)
2021-05-19binman: Support packaging U-Boot for scenarios like OF_BOARD or OF_PRIOR_STAGEBin Meng1-0/+24
For scenarios like OF_BOARD or OF_PRIOR_STAGE, no device tree blob is provided in the U-Boot build phase hence the binman node information is not available. In order to support such use case, a new Kconfig option BINMAN_STANDALONE_FDT is introduced, to tell the build system that a device tree blob containing binman node is explicitly required when using binman to package U-Boot. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-05-19binman: Add support for RISC-V OpenSBI fw_dynamic blobBin Meng4-0/+57
Add an entry for RISC-V OpenSBI's 'fw_dynamic' firmware payload. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Rick Chen <rick@andestech.com> Reviewed-by: Rick Chen <rick@andestech.com>
2021-05-19binman: test: Rename 172_fit_fdt.dts to 170_fit_fdt.dtsBin Meng2-5/+5
Currently there are 2 binman test cases using the same 172 number. It seems that 172_fit_fdt.dts was originally named as 170_, but commit c0f1ebe9c1b9 ("binman: Allow selecting default FIT configuration") changed its name to 172_ for no reason. Let's change it back. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-05-19binman: Correct the comment for ATF entry typeBin Meng1-1/+1
This is wrongly referring to Intel ME, which should be ATF. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-05-19binman: Correct '-a' description in the docBin Meng1-2/+2
It needs a space around '-a'. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Rick Chen <rick@andestech.com>
2021-04-29binman: Support adding sections to FMAPsSimon Glass4-9/+50
When used with hierarchical images, use the Chromium OS convention of adding a section before all the subentries it contains. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-04-29binman: Tweak implementation of fmapSimon Glass1-31/+38
Use an interator in two of the fmap tests so it is easier to add new items. Also check the name first since that is the first indication that something is wrong. Use a variable for the expected size of the fmap to avoid repeating the code. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-04-29binman: Correct testSplNoDtb() and Tpl alsoSimon Glass1-0/+2
These two tests require an ELF image so that symbol information can be written into the SPL/TPL binary. At present they rely on other tests having set it up first, but every test must run independently. This can cause occasional errors in CI. Fix this by setting up the required files, as other tests do. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2021-03-27binman: Support default alignment for sectionsSimon Glass8-0/+58
Sometimes it is useful to specify the default alignment for all entries in a section, such as when word-alignment is necessary, for example. It is tedious and error-prone to specify this individually for each section. Add a property to control this for a section. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-03-27binman: Support obtaining section contents immediatelySimon Glass6-19/+95
Generally the content of sections is not built until the final assembly of the image. This is partly to avoid wasting time, since the entries within sections may change multiple times as binman works through its various stages. This works quite well since sections exist in a strict hierarchy, so they can be processed in a depth-first manner. However the 'collection' entry type does not have this luxury. If it contains a section within its 'content' list, then it must produce the section contents, if available. That section is typically a sibling node, i.e. not part oc the collection's hierarchy. Add a new 'required' argument to section.GetData() to support this. When required is True, any referenced sections are immediately built. If this is not possible (because one of the subentries does not have its data yet) then an error is produced. The test for this uses a 'collection' entry type, referencing a section as its first member. This forces a call to _BuildSectionData() with required set to False, at first, then True later, when the image is assembled. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-03-27binman: Add support for a collection of entriesSimon Glass6-14/+128
The vblock entry type includes code to collect the data from a number of other entries (not necessarily subentries) and concatenating it. This is a useful feature for other entry types. Make it a base class, so that vblock can use it, along with other entry types. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-03-27binman: Allow disabling expanding an entrySimon Glass8-9/+56
At present there is a command-line flag to disable substitution of expanded entries. Add an option to the entry node as well, so it can be controlled at the node level. Add a test to cover this. Fix up the comment to the checkSymbols() function it uses, while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-03-27binman: Use a unique number for the symbols test fileSimon Glass2-1/+1
Two test devicetree files currently have 192 as their unique number. Fix this by separating them out. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-03-26binman: Update various pieces of the documentationSimon Glass1-39/+44
A few sections are a little out of date now. Update them. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-03-26binman: Drop repetitive heading for each entrySimon Glass20-57/+57
Many entries start 'Entry containing a'. This looks fine in the source code but is annoying when viewed in the htmldocs table of contents. Drop these unnecessary words. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-03-26binman: Incorporate entry documentationSimon Glass10-77/+87
Update this to avoid sphinx warnings and incorporate it into the new documentaiton tree. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-03-26binman: Rearrange documentation into headingsSimon Glass1-257/+266
Collect the material into different top-level headings to make it easier to read. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-03-26binman: doc: Add documentation to htmldocsSimon Glass6-245/+257
Add a link to binman's documentation and adjust the files so that it is accessible. Use the name README.rst so it is easy to discover when binman is installed without U-Boot. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-03-26binman: Automatically expand phase binaries into sectionsSimon Glass16-18/+571
When creating an entry, check for an expanded version of that entry, then use it instead. This allows, for example use of: u-boot { }; instead of having to write out in full: u-boot { type = "section"; u-boot-nodtb { }; u-boot-dtb { }; }; Add an implementaion of this and associated documentation. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-03-26binman: Plumb expanded entries through fullySimon Glass3-8/+36
Add support for this feature in the control, image and section modules, so that expanded entries will be selected by default. So far there are no expanded entry types, so this is a nop. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-03-26binman: Allow a way to select expanded entriesSimon Glass2-6/+16
Add a new command-line option to disable expanded entries. This is needed for most tests, since it is much easier to 'factor out' this function into a separate test and keep the existing packing tests simple. Add the option and select it by default from tests. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-03-26binman: Allow using an an 'expanded' entry typeSimon Glass2-9/+63
As the first step in supporting expanded entries, add a way for binman to automatically select an 'expanded' version of an entry type, if requested. This is controlled by a class method. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-03-26binman: Use standard filenames for SPL/TPL devicetreeSimon Glass1-11/+10
At present, before any entry expansion is done (such as a 'files' entry expanding out to individual entries for each file it contains), we check the binman definition (i.e. '/binman' node) to find out what devicetree files are used in the images. This is a pain, since the definition may change during expansion. For example if there is no u-boot-spl-dtb entry in the definition at the start, we assume that the SPL devicetree is not used. But if an entry later expands to include this, then we don't notice. In fact the flexibility provided by the current approach of checking the definition is not really useful. We know that we can have SPL and TPL devicetrees. We know the pathname to each, so we can simply check if the files are present. If they are present, we can prepare them and update them regardless of whether they are actually used. If they are not present, we cannot prepare/update them anyway, i.e. an error will be generated. Simplify state.Prepare() so it uses a hard-coded list of devicetree files. Note that state.PrepareFromLoadedData() is left untouched, since in that case we have a complete definition from the loaded file, but cannot of course rely on the devicetree files that created it still being present. So in that case we still check the image defitions. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-03-26binman: Move the comment for GetFdts() to the base classSimon Glass2-10/+1
Like with other methods this comment should be in the base class. Move it. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-03-26binman: Drop unnecessary field in output_fdt_infoSimon Glass1-12/+10
At present we store an entry as the third field in output_fdt_info[]. This is only used to get the type of the entry. Of course multiple entries may have this same type. Also the entry type is the key to this dict, so we can use that instead. Drop the field and update GetUpdateNodes() to suit. Improve the comment for output_fdt_info a little while here. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-03-26binman: Use the fake SPL/TPL only if requestedSimon Glass1-8/+15
At present we always use the main devicetree for SPL/TPL as well when setting up the state. But this it not needed if there is a real devicetree for SPL or TPL. In fact it confuses things since we cannot distinguish between one being provided and using the fake one. Update the code to create the fakes only when requested. Put the mapping in a constant so we can use it elsewhere. Rename 'other_fname' to 'fname' while we are here since there is nothing 'other' about it. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-03-26binman: Drop unnecessary 'type' property in testsSimon Glass2-2/+0
A few tests declare a type when this can be inferred from the node name. Drop these lines, since it might cause confusion. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-03-26binman: Add support for u-boot-tpl-bss-badSimon Glass4-0/+101
This entry holds the padding between the end of of TPL binary and the end of BSS. This region must be left empty so that the devicetree can be appended correctly and remain accessible without interfering with BSS. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-03-26binman: Add support for u-boot-tpl-nodtbSimon Glass4-0/+83
Allow this entry type to be placed in an image. This is the TPL binary, without a devicetree appended. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-03-26binman: Support symbols in u-boot-spl-nodtbSimon Glass6-21/+81
Since this is an execuable we should be able insert symbol values into it. Add support for this. Use common code for this test and the original testSymbols. Use hex consistently for the values and add some more comments. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-03-26binman: Correct the documentation for u-boot-spl-bss-padSimon Glass2-14/+20
The documentation for this entry indicates that the SPL binary is included along with the padding. It is not, so update it to correct the error. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-03-26binman: Tidy up underscores in entry documentationSimon Glass7-24/+22
Several entries currently use an underscore in the entry-type name, but in fact a hyphen is used. Update the docs to fix this as it might be confusing. Also simplify the 'filename' comment and fix the 'operation' typo. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-03-26binman: Update entry help for files-alignSimon Glass1-0/+1
Regenerate the entry documentation, which step was missed when the files-align feature was added. Fixes: 6eb9932668f ("binman: Support alignment of files") Signed-off-by: Simon Glass <sjg@chromium.org>
2021-03-26binman: Document ExpandEntries() in the base classSimon Glass2-6/+11
Move the documentation to the base method as it is with other methods. Also update it a little while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-03-26binman: Allow extracting to current directorySimon Glass1-1/+1
Extracting files to the current directory is not normally a very friendly thing to do, but it can be warranted, e.g. in a new temporary dir. At present binman reports an error when such an attempt is made. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-03-02binman: Indicate how to make binman verboseSimon Glass1-1/+3
Add notes about how to make binman produce verbose logging when building. Add a comment on how to do this. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-01-30binman: Allow for skip_at_start when reading entriesSimon Glass3-4/+48
The offset of an entry needs to be adjusted by its skip-at-start value. This is currently missing when reading entry data. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-01-30binman: Support alignment of filesSimon Glass5-1/+35
When packing files it is sometimes useful to align the start of each file, e.g. if the flash driver can only access 32-bit-aligned data. Provides a new property to support this. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-01-30binman: Allow vblock to include devicetree blobsSimon Glass5-10/+96
At present if a devicetree blob is included in a vblock it does not deal with updates. This is because the vblock is created once at the start and does not have a method to update itself later, after all the entry contents are finalised. Fix this by adjusting how the vblock is created. Also simplify Image.ProcessEntryContents() since it effectively duplicates the code in Section.ProcessContents(). Signed-off-by: Simon Glass <sjg@chromium.org>
2021-01-30binman: Support reading an image with entry argsSimon Glass5-4/+64
Normally when an entry is created, any entry arguments it has are required to be provided, so it can actually generate its contents correctly. However when an existing image is read, Entry objects are created for each of the entries in the image. This happens as part of the process of reading the image into binman. In this case we don't need the entry arguments, since we do not intend to regenerate the entries, or at least not unless requested. So there is no sense in reporting an error for missing entry arguments. Add a new property for the Image to handle this case. Update the error reporting to be conditional on this property. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-01-30binman: Support finding symbols in sub-sectionsSimon Glass6-7/+123
At present binman only supports resolving symbols in the same section as the binary that uses it. This is quite limited because we often need to group entries into different sections. Enhance the algorithm to search the entire image for symbols. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-01-30binman: Fix a few file commentsSimon Glass2-2/+1
Two files have the wrong comment at the top of them. Fix this. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-01-30binman: Show the size when writing entriesSimon Glass1-1/+2
Update the log output to show the size, since this is useful information. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-01-30binman: Update the TODO listSimon Glass1-2/+1
Two of the items have been completed and I thought of another one. Update the list. Signed-off-by: Simon Glass <sjg@chromium.org>