summaryrefslogtreecommitdiff
path: root/tools/binman/etype
Commit message (Collapse)AuthorAgeFilesLines
* binman: Set the pathname correctly for ELF filesSimon Glass2018-11-201-3/+2
| | | | | | | At present, stripped files don't have the right pathname which means that blob compression cannot be used. Fix this. Signed-off-by: Simon Glass <sjg@chromium.org>
* binman: Drop an unnecessary comma in blob handlingSimon Glass2018-11-201-1/+1
| | | | | | This comma is not needed. Drop it. Signed-off-by: Simon Glass <sjg@chromium.org>
* binman: Add support for Intel reference codeSimon Glass2018-10-221-0/+27
| | | | | | | | | Some platforms use this instead of FSP to set up the platform, including memory. Add support for this in binman. This is needed for chromebook_samus, for example. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* Merge git://git.denx.de/u-boot-dmTom Rini2018-09-3021-61/+371
|\
| * binman: Support ELF files for U-Boot and SPLSimon Glass2018-09-292-0/+63
| | | | | | | | | | | | | | For sandbox we want to put ELF files in the image since that is what we need to execute. Add support for this. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Correct fmap output on x86Simon Glass2018-09-292-10/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | Normally x86 platforms use the end-at-4gb option. This currently produces an FMAP with positions which have a large offset. The use of end-at-4gb is a useful convenience within binman, but we don't really want to export a map with these offsets. Fix this by subtracting the 'skip at start' parameter. Also put the code which convers names to fmap format, for clarity. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Record the parent section of each sectionSimon Glass2018-09-291-1/+2
| | | | | | | | | | | | | | | | | | | | At present sections have no record of their parent so it is not possible to traverse up the tree to the root and figure out the position of a section within the image. Change the constructor to record this information. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Support x86 microcode in TPLSimon Glass2018-09-296-21/+83
| | | | | | | | | | | | | | | | When TPL is used on x86 we may want to program the microcode (at least for the first CPU) early in boot. Add support for this by refactoring the existing code to be more generic. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Support expanding entriesSimon Glass2018-09-292-1/+14
| | | | | | | | | | | | | | It is useful to have entries which can grow automatically to fill available space. Add support for this. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Support adding filesSimon Glass2018-09-291-0/+57
| | | | | | | | | | | | | | | | | | | | | | | | In some cases it is useful to add a group of files to the image and be able to access them at run-time. Of course it is possible to generate the binman config file with a set of blobs each with a filename. But for convenience, add an entry type which can do this. Add required support (for adding nodes and string properties) into the state module. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Support compressed entriesSimon Glass2018-09-291-9/+40
| | | | | | | | | | | | | | | | Add support for compressing blob entries. This can help reduce image sizes for many types of data. It requires that the firmware be able to decompress the data at run-time. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Support updating all device tree filesSimon Glass2018-09-286-13/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Binman currently supports updating the main device tree with things like the position of each entry. Extend this support to SPL and TPL as well, since they may need (a subset of) this information. Also adjust DTB output files to have a .out extension since this seems clearer than having a .dtb extension with 'out' in the name somwhere. Also add a few missing comments and update the DT setup code to use ReadFile and WriteFile(). Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Move state information into a new moduleSimon Glass2018-09-281-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | At present the control module has state information in it, since it is the primary user of this. But it is a bit odd to have entries and other modules importing control to obtain this information. It seems better to have a dedicated state module, which control can use as well. Create a new module using code from control and update other modules to use it. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Tidy up the vblock entrySimon Glass2018-09-281-3/+8
| | | | | | | | | | | | | | | | | | | | | | At present if there are two vblock entries an image their contents are written to the same file in the output directory. This prevents checking the contents of each separately. Fix this by adding part of the entry path to the filename, and add some missing comments. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Add x86 support for starting TPLSimon Glass2018-09-281-0/+30
| | | | | | | | | | | | | | | | Sometimes we want to include TPL for x86 platforms, such as when we want to select between different SPL images (e.g. for Chrome OS verified boot). Add support for this. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Generate an error when text is not providedSimon Glass2018-09-281-0/+3
| | | | | | | | | | | | | | | | When the value of a text entry is not provided an execption is generated talking about a None type. This is confusing. Add a more explanatory error and a test for this case. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Allow 'fill' entry to have a size of 0Simon Glass2018-09-281-1/+1
| | | | | | | | | | | | The check for this should be for None, not 0. Fix it and add a test. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Move 'special properties' docs to README.entriesSimon Glass2018-09-281-0/+3
| | | | | | | | | | | | | | This information should be in the entry it relates to, not in the main README. Move it. Signed-off-by: Simon Glass <sjg@chromium.org>
* | binman: Add support for PowerPC mpc85xx 'bootpg + resetvec' entryJagdish Gediya2018-09-271-0/+25
|/ | | | | | | | | | This entry contains the PowerPC mpc85xx boot page and resetvec sections. Signed-off-by: Jagdish Gediya <jagdish.gediya@nxp.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: York Sun <york.sun@nxp.com>
* binman: Rename ReadContents() to ReadBlobContents()Simon Glass2018-08-013-4/+4
| | | | | | | | This function name is too generic for its purpose and is therefore confusing. It actually only applies to blobs, so rename it to indicate this. Signed-off-by: Simon Glass <sjg@chromium.org>
* binman: Add support for adding TPL binariesSimon Glass2018-08-014-2/+70
| | | | | | | Add support for U-Boot's TPL and TPL device tree. Also fix a few comments in the other device-tree entries. Signed-off-by: Simon Glass <sjg@chromium.org>
* binman: Add an entry for a Chromium vblockSimon Glass2018-08-011-0/+74
| | | | | | | This adds support for a Chromium verified boot block, used to sign a read-write section of the image. Signed-off-by: Simon Glass <sjg@chromium.org>
* binman: Add support for Chromium GBBSimon Glass2018-08-011-0/+96
| | | | | | | This entry contains a Google Binary Block, used to store keys and bitmaps in a Chromium image. Signed-off-by: Simon Glass <sjg@chromium.org>
* binman: Add an entry filled with a repeating byteSimon Glass2018-08-011-0/+32
| | | | | | | | | | | It is sometimes useful to have an area of the image which is all zeroes, or all 0xff. This can often be achieved by padding the size of an an existing entry and setting the pad byte for an entry or image. But it is useful to have an explicit means of adding blocks of repeating data to the image. Add a 'fill' entry type to handle this. Signed-off-by: Simon Glass <sjg@chromium.org>
* binman: Add support for a cros_ec imageSimon Glass2018-08-012-0/+56
| | | | | | | | | Add an entry type which can hold a Chrome OS EC. To make this work a new entry type is created, which supports getting a blob filename from the command line. Signed-off-by: Simon Glass <sjg@chromium.org>
* binman: Add support for flashrom FMAPSimon Glass2018-08-012-2/+66
| | | | | | | | | Add an entry which can hold an FMAP region as used by flashrom, an open-source flashing tool used on Linux x86 machines. This provides a simplified non-hierarchical view of the entries in the image and has a signature at the start to allow flashrom to find it in the image. Signed-off-by: Simon Glass <sjg@chromium.org>
* binman: Allow creation of entry documentationSimon Glass2018-08-011-1/+3
| | | | | | | | | | | Binman supports quite a number of different entries now. The operation of these is not always obvious but at present the source code is the only reference for understanding how an entry works. Add a way to create documentation (from the source code) which can be put in a new 'README.entries' file. Signed-off-by: Simon Glass <sjg@chromium.org>
* binman: Expand documentation for entriesSimon Glass2018-08-0124-9/+305
| | | | | | | | | At present only the more complex entries are documented. It is useful to have documentation for all entries in one place. As a first step, add and expand the documentation to cover all entries. Signed-off-by: Simon Glass <sjg@chromium.org>
* binman: Support an entry that holds textSimon Glass2018-08-011-0/+50
| | | | | | | | | | It is useful to able to write an identifying string to the image within an entry. Add a 'text' entry type to handle this. The actual text is typically passed to binman on the command line. The text is not itself nul-terminated but this can be achieved if required by setting the size of the entry to something larger than the text. Signed-off-by: Simon Glass <sjg@chromium.org>
* binman: Add support for passing arguments to entriesSimon Glass2018-08-011-1/+18
| | | | | | | | | | | | | | | | | | Sometimes it is useful to pass binman the value of an entry property from the command line. For example some entries need access to files and it is not always convenient to put these filenames in the image definition (device tree). Add a -a option which can be used like this: -a<prop>=<value> where <prop> is the property to set <value> is the value to set it to Signed-off-by: Simon Glass <sjg@chromium.org>
* binman: Add a new 'image-pos' propertySimon Glass2018-08-011-0/+4
| | | | | | | | | | | | | | | | | At present each entry has an offset within its parent section. This is useful for figuring out how entries relate to one another. However it is sometimes necessary to locate an entry within an image, regardless of which sections it is nested inside. Add a new 'image-pos' property to provide this information. Also add some documentation for the -u option binman provides, which updates the device tree with final entry information. Since the image position is a better symbol to use for the position of U-Boot as obtained by SPL, update the SPL symbols to use this instead of offset, which might be incorrect if hierarchical sections are used. Signed-off-by: Simon Glass <sjg@chromium.org>
* binman: Enhance the map and fdt-update outputSimon Glass2018-08-011-3/+3
| | | | | | | | | | At present the .map file produced for each image does not include the overall image size. This is useful information. Update the code to generate it in the .map file as well as the updated FDT. Also fix a few comments while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
* binman: Rename 'position' to 'offset'Simon Glass2018-08-016-34/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After some thought, I believe there is an unfortunate naming flaw in binman. Entries have a position and size, but now that we support hierarchical sections it is unclear whether a position should be an absolute position within the image, or a relative position within its parent section. At present 'position' actually means the relative position. This indicates a need for an 'image position' for code that wants to find the location of an entry without having to do calculations back through parents to discover this image position. A better name for the current 'position' or 'pos' is 'offset'. It is not always an absolute position, but it is always an offset from its parent offset. It is unfortunate to rename this concept now, 18 months after binman was introduced. However I believe it is the right thing to do. The impact is mostly limited to binman itself and a few changes to in-tree users to binman: tegra sunxi x86 The change makes old binman definitions (e.g. downstream or out-of-tree) incompatible if they use the 'pos = <...>' property. Later work will adjust binman to generate an error when it is used. Signed-off-by: Simon Glass <sjg@chromium.org>
* binman: Support updating the device tree with calc'd infoSimon Glass2018-07-091-0/+10
| | | | | | | | 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-091-0/+8
| | | | | | | | | | | | 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-094-28/+30
| | | | | | | | | | | | | | | | 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: Tidy up setting of entry contentsSimon Glass2018-07-094-6/+12
| | | | | | | | | | | 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: Correct operation of ObtainContents()Simon Glass2018-07-094-3/+14
| | | | | | | | | | | | | | 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: Make the operation of Entry__testing explicitSimon Glass2018-07-091-4/+10
| | | | | | | | | | | | | | 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: Add support for outputing a map fileSimon Glass2018-06-071-0/+9
| | | | | | | | 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: Add support for sectionsSimon Glass2018-06-071-0/+50
| | | | | | | | | | 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-071-212/+0
| | | | | | | | | | | | 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-0724-74/+76
| | | | | | | 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-072-4/+4
| | | | | | | 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>
* binman: Allow unit addresses for binariesSimon Glass2018-06-071-0/+5
| | | | | | | Allow the same binary to appear multiple times in an image by using the device-tree unit-address feature (u-boot@0, u-boot@1). Signed-off-by: Simon Glass <sjg@chromium.org>
* SPDX: Convert all of our single license tags to Linux Kernel styleTom Rini2018-05-0724-50/+25
| | | | | | | | | | | | | | | | | | | | When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
* binman: Support accessing binman tables at run timeSimon Glass2017-12-122-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Binman construct images consisting of multiple binary files. These files sometimes need to know (at run timme) where their peers are located. For example, SPL may want to know where U-Boot is located in the image, so that it can jump to U-Boot correctly on boot. In general the positions where the binaries end up after binman has finished packing them cannot be known at compile time. One reason for this is that binman does not know the size of the binaries until everything is compiled, linked and converted to binaries with objcopy. To make this work, we add a feature to binman which checks each binary for symbol names starting with '_binman'. These are then decoded to figure out which entry and property they refer to. Then binman writes the value of this symbol into the appropriate binary. With this, the symbol will have the correct value at run time. Macros are used to make this easier to use. As an example, this declares a symbol that will access the 'u-boot-spl' entry to find the 'pos' value (i.e. the position of SPL in the image): binman_sym_declare(unsigned long, u_boot_spl, pos); This converts to a symbol called '_binman_u_boot_spl_prop_pos' in any binary that includes it. Binman then updates the value in that binary, ensuring that it can be accessed at runtime with: ulong u_boot_pos = binman_sym(ulong, u_boot_spl, pos); This assigns the variable u_boot_pos to the position of SPL in the image. Signed-off-by: Simon Glass <sjg@chromium.org>
* binman: Add support for including spl/u-boot-spl-nodtb.binSimon Glass2017-12-121-0/+17
| | | | | | | This file contains SPL image without a device tree. Add support for including this in images. Signed-off-by: Simon Glass <sjg@chromium.org>
* binman: Add support for including spl/u-boot-spl.dtbSimon Glass2017-12-121-0/+17
| | | | | | | This file contains the SPL device tree. Add support for including this by itself in images. Signed-off-by: Simon Glass <sjg@chromium.org>
* binman: Add a function to read ELF symbolsSimon Glass2017-12-122-8/+8
| | | | | | | | | | | | | In some cases we need to read symbols from U-Boot. At present we have a a few cases which does this via 'nm' and 'grep'. It is better to use objdump since that tells us the size of the symbols and also whether it is weak or not. Add a new module which reads ELF information from files. Update existing uses of 'nm' to use this module. Signed-off-by: Simon Glass <sjg@chromium.org>