aboutsummaryrefslogtreecommitdiff
path: root/tools/binman
AgeCommit message (Collapse)AuthorFilesLines
2020-04-26patman: Tidy up sys.path changesSimon Glass1-2/+3
Now that we are using absolute paths we can remove some of the sys.path mangling that appears in the tools. We only need to add the path to 'tools/' so that everything can find modules relative to that directory. The special paths for finding pylibfdt remain. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-26patman: Move to absolute importsSimon Glass30-53/+53
At present patman sets the python path on startup so that it can access the libraries it needs. If we convert to use absolute imports this is not necessary. Move patman to use absolute imports. This requires changes in tools which use the patman libraries (which is most of them). Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-26binman: Move to absolute importsSimon Glass69-203/+188
At present binman sets the python path on startup so that it can access the libraries it needs. If we convert to use absolute imports this is not necessary. Move binman to use absolute imports. This enables removable of the path adjusting in Entry also. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-26patman: Move test running/reporting to test_utilSimon Glass1-70/+8
This code is useful in other tools. Move it into a common file so it can be shared. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-26binman: Rename the main moduleSimon Glass3-6/+6
Python does not like the module name being the same as the module directory. To allow buildman modules to be used from other tools, rename it. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-26patman: Drop references to __future__Simon Glass9-18/+0
We don't need these now that the tools using Python 3. Drop them. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-01-07binman: fix default filename of u-boot-with-ucode-ptr in documentationMasahiro Yamada2-2/+2
The suffix should be ".bin" instead of ".dtb" . Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2019-12-03cosmetic: Fix spelling and whitespace errorsThomas Hebb2-3/+3
Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>
2019-11-11binman: tegra: Adjust symbol calculation depending on end-at-4gbSimon Glass10-26/+134
A recent change adjusted the symbol calculation to work on x86 but broke it for Tegra. In fact this is because they have different needs. On x86 devices the code is linked to a ROM address and the end-at-4gb property is used for the image. In this case there is no need to add the base address of the image, since the base address is already built into the offset and image-pos properties. On other devices we must add the base address since the offsets start at zero. In addition the base address is currently added to the 'offset' and 'size' values. It should in fact only be added to 'image-pos', since 'offset' is relative to its parent and 'size' is not actually an address. This code should have been adjusted when support for 'image-pos' and 'size' was added, but it was not. To correct these problems: - move the code that handles adding the base address to section.py, which can check the end-at-4gb property and which property (offset/size/image-pos) is being read - add the base address only when needed (only for image-pos and not if the image uses end-at-4gb) - add a note to the documentation - add a separate test to cover x86 behaviour Fixes: 15c981cc (binman: Correct symbol calculation with non-zero image base) Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Stephen Warren <swarren@nvidia.com>
2019-11-04binman: Move to use Python 3Simon Glass1-1/+1
Update this tool to use Python 3 to meet the 2020 deadline. Unfortunately this introduces a test failure due to a problem in pylibfdt on Python 3. I will investigate. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-11-04binman: Convert a few tests to Python 3Simon Glass1-7/+7
Some tests have crept in with Python 2 strings and constructs. Convert then. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-11-04binman: Remember the pre-reset entry sizeSimon Glass1-1/+8
When preparing to possible expand or contract an entry we reset the size to the original value from the binman device-tree definition, which is often None. This causes binman to forget the original size of the entry. Remember this so that it can be used when needed. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-11-04pylibfdt: Convert to Python 3Simon Glass3-30/+3
Build this swig module with Python 3. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-11-04patman: Adjust 'command' to return strings instead of bytesSimon Glass2-2/+2
At present all the 'command' methods return bytes. Most of the time we actually want strings, so change this. We still need to keep the internal representation as bytes since otherwise unicode strings might break over a read() boundary (e.g. 4KB), causing errors. But we can convert the end result to strings. Add a 'binary' parameter to cover the few cases where bytes are needed. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-11-02binman: Fix up comment in intel-fsp-mSimon Glass1-1/+1
This comment references the wrong FSP component. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2019-11-02binman: Add support for Intel FSP-TSimon Glass4-0/+63
This entry is used to hold an Intel FSP-T (Firmware Support Package Temp-RAM init) binary. Add support for this in binman. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2019-11-02binman: Add support for Intel FSP-SSimon Glass4-0/+64
This entry is used to hold an Intel FSP-S (Firmware Support Package Silicon init) binary. Add support for this in binman. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2019-11-02binman: Correct symbol calculation with non-zero image baseSimon Glass2-4/+2
At present binman adds the image base address to the symbol value before it writes it to the binary. This is not correct since the symbol value itself (e.g. image position) has no relationship to the image base. Fix this and update the tests to cover this case. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2019-10-15binman: Drop comment-out code in testUpdateFdtOutput()Simon Glass1-2/+0
This code is not needed so drop it. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15binman: Add logging for the number of pack passesSimon Glass1-0/+1
Sometimes binman takes multiple passes to complete packing an image. Add logging to indicate this. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15binman: Write symbol info before image inclusionSimon Glass1-1/+1
At present the symbol information is written to binaries just before binman exits. This is fine for entries within sections since the section contents is calculated when it is needed, so the updated symbol values are included in the image that is written. However some binaries are inside entries which have already generated their contents and do not notice that the entries have changed (e.g. Intel IFWI). Move the symbol writing earlier to cope with this. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15binman: Support writing symbols into entries within an IFWISimon Glass1-0/+5
The Intel IFWI (Integrated Firmware Image) is effectively a section with other entries inside it. Support writing symbol information into entries within it. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15binman: Update IFWI entry to support updatesSimon Glass1-18/+28
Add support for the ProcessContents() method in this entry so that it is possible to support entries which change after initial creation. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15binman: Update IFWI entry to read entries outside constructorSimon Glass1-0/+3
At present this class reads its entries in the constructor. This is not how things should be done now. Update it. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15binman: Fix entry comment for Intel descriptorSimon Glass1-1/+1
This comment references another entry type. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15binman: Add support for Intel FSP meminitSimon Glass4-0/+66
The Intel FSP supports initialising memory early during boot using a binary blob called 'fspm'. Add support for this. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15binman: Allow support for writing a size symbol to binariesSimon Glass4-9/+12
It is useful to be able to access the size of an image in SPL, with something like: binman_sym_declare(unsigned long, u_boot_any, size); ... ulong u_boot_size = binman_sym(ulong, u_boot_any, size); Add support for this and update the tests. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15binman: Increase size of TPL and SPL test dataSimon Glass7-14/+14
At present these are large enough to hold 20 bytes of symbol data. Add four more bytes so we can add another test. Unfortunately at present this involves changing a few test files to make room. We could adjust the test files to not specify sizes for entries. Then we could make the tests check the actual sizes. But for now, leave it as it is, since the effort is minor. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15binman: Avoid needing the section size in advanceSimon Glass3-4/+49
Entries which include a section and need to obtain its contents call GetData(), as with any other entry. But the current implementation of this method in entry_Section requires the size of the section to be known. If it is unknown, an error is produced, since size is None: TypeError: can't multiply sequence by non-int of type 'NoneType' There is no need to know the size in advance since the code can be adjusted to build up the section piece by piece, instead of patching each entry into an existing bytearray. Update the code to handle this and add a test. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15binman: Rename some two-digit test filesSimon Glass3-2/+2
Two of the test files somehow were not converted to three digits. Fix them, using the next available numbers. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15binman: Use underscore in test filenamesSimon Glass14-14/+14
At present a small number of test files use hyphens instead of underscores. Rename them for consistency. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15binman: Allow symbols to be resolved inside sectionsSimon Glass4-10/+67
At present we only support symbols inside binaries which are at the top level of an image. This restrictions seems unreasonable since more complex images may want to group binaries within different sections. Relax the restriction, adding a new _SetupTplElf() helper function. Also fix a typo in the comment for testTpl(). Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15binman: Clean up unnecessary code related to ELF test filesSimon Glass3-12/+4
We use the Makefile for all ELF test files now, so drop all the code that checks whether to get the test file from the Makefile or from the git repo. Also add a comment to the Makefile indicating that it is run from binman. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15binman: Use the Makefile for u_boot_binman_syms_badSimon Glass3-3/+3
Remove this file from git and instead build it using the Makefile. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15binman: Use the Makefile for u_boot_binman_syms_sizeSimon Glass3-3/+4
Remove this file from git and instead build it using the Makefile. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15binman: Use the Makefile for u_boot_binman_symsSimon Glass5-9/+13
Remove this file from git and instead build it using the Makefile. With this change a few things need to be adjusted: 1. The 'notes' section no-longer appears at the start of the ELF file (before the code), so update testSymbols to adjust the offsets. 2. The dynamic linker is disabled to avoid errors like: "Not enough room for program headers, try linking with -N" 3. The interpreter note is moved to the end of the image, so that the binman symbols appear first. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15binman: Use the Makefile for u_boot_no_ucode_ptrSimon Glass3-6/+6
Remove this file from git and instead build it using the Makefile. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15binman: Use the Makefile for u_boot_ucode_ptrSimon Glass5-13/+25
Remove this file from git and instead build it using the Makefile. Update tools.GetInputFilename() to support reading files from an absolute path, so that we can read the Elf test files easily. Also make sure that the temp directory is report in ELF tests as this was commented out. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15binman: Use the Makefile to build ELF test filesSimon Glass4-7/+43
At present the ELF test files are checked into the U-Boot tree. This is covenient since the files never change and can be used on non-x86 platforms. However it is not good practice to check in binaries and in this case it does not seem essential. Update the binman test-file Makefile to support having source in a different directory. Adjust binman to run it to build bss_data, as a start. We can add other files as needed. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15binman: Use tools.Run() to run objdumpSimon Glass1-1/+1
At present this command silently fails if something goes wrong. Use the tools.Run() function instead, since it reports errors. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15binman: Fix IFWI output when using an Intel FIT imageSimon Glass2-4/+4
At present this entry does not work correctly when a FIT image is used as the input. It updates the FIT instead of the output image. The test passed because the FIT image happened to have the right data already. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15binman: Add support for Intel FITSimon Glass6-0/+149
A Firmware Image Table (FIT) is a data structure defined by Intel which contains information about various things needed by the SoC, such as microcode. Add support for this entry as well as the pointer to it. The contents of FIT are fixed at present. Future work is needed to support adding microcode, etc. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15binman: x86: Separate out 16-bit reset and init codeSimon Glass5-48/+56
At present these two sections of code are linked together into a single 2KB chunk in a single file. Some Intel SoCs like to have a FIT (Firmware Interface Table) in the ROM and the pointer for this needs to go at 0xffffffc0 which is in the middle of these two sections. Make use of the new 'reset' entry and change the existing 16-bit entry to include just the 16-bit data. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15binman: Add support for an x86 'reset' sectionSimon Glass8-1/+203
At present binman has a single entry type for the 16-bit code code needed to start up an x86 processor. This entry is intended to include both the reset vector itself as well as the code to move to 32-bit mode. However this is not very flexible since in some cases other data needs to be included at the top of the SPI flash, in between these two pieces. For example Intel requires that a FIT (Firmware Image Table) pointer be placed 0x40 bytes before the end of the ROM. To deal with this, add a new reset entry for just the reset vector. A subsequent change will adjust the existing 'start16' entry. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15binman: Correct use of 'replace' in IFWI testsSimon Glass5-4/+16
At present the Intel IFWI entry uses 'replace' without the 'ifwi-' prefix. This is a fairly generic name which might conflict with the main Entry base class at some point, if more features are added. Add a prefix. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15binman: Handle hidden symbols in ELF filesSimon Glass1-1/+1
Some versions of binutils generate hidden symbols which are currently not parsed by binman. Correct this. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15binman: Drop .note section from ELFSimon Glass2-1/+4
Recent versions of binutils add a '.note.gnu.property' into the ELF file. This is not required and interferes with the expected output. Drop it. Also fix testMakeElf() to use a different file for input and output. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-15binman: Allow use of help and entry-docs without libfdtSimon Glass9-13/+44
At present if libfdt is not available binman can't do anything much. Improve the situation a little. Ideally there should be a test to cover this, but I'm not quite sure how to fake this. Signed-off-by: Simon Glass <sjg@chromium.org> (fixed up missing ReadChildData() enty test)
2019-10-15binman: Use cls instead of self for class methodsSimon Glass1-27/+27
It is more common to use the name 'cls' for the class object of a class method, to distinguish it from normal methods, which use 'self' Update the binman tests accordingly. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-11binman: Use qemu-x86_defconfig in the exampleBin Meng1-2/+2
The doc currently uses sandbox_defconfig as examples of enabling debug/verbose output of binman. However during a sandbox build it does not call binman at all. Change it to qemu-x86_defconfig. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>