aboutsummaryrefslogtreecommitdiff
path: root/tools
AgeCommit message (Collapse)AuthorFilesLines
2018-08-07tools: kwboot: properly quit when read() returns 0Willy Tarreau1-2/+2
When kwboot is attached to a terminal which disappears such as one connected via an unplugged USB cable, read() returns 0, making kwboot loop until a key is pressed in the terminal. The only case where read() may return 0 here is when the terminal is closed anyway, so let's properly handle this one and report is similar to other errors. Signed-off-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Stefan Roese <sr@denx.de>
2018-08-07tools: kwboot: unbreak terminal-only modeWilly Tarreau1-1/+1
Commit 84899e2 ("tools/kwboot: Sync with latest barebox version to support Armada XP") accidently broke the terminal-only mode (-t) by removing the test on the bootmsg. Thus even when trying to use kwboot as a plain terminal, it asks to reboot the target. This commit simply reintroduces the lost test so that it is possible again to use kwboot to attach to the target system's console. Signed-off-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Stefan Roese <sr@denx.de>
2018-08-01binman: Adjust _GetPropTree() parametersSimon Glass1-9/+5
At present this function takes a filename, but it is better to use an Fdt object so that the caller can control this, perhaps obtainint the device tree from a bytearray. Update the method accordingly and also fix a confusing parameter name. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-08-01binman: Add a test to catch use of the old 'pos' propertySimon Glass3-0/+19
This property has been changed to 'offset'. To help downstream users who might still be using 'pos', add a check that this is not used by mistake. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-08-01binman: Rename ReadContents() to ReadBlobContents()Simon Glass3-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>
2018-08-01binman: Show the image position in the mapSimon Glass4-19/+23
At present the map only shows the offset and size for each region. The image position provides the actual position of each entry in the image, regardless of the section hierarchy. Add the image position to the map. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-08-01binman: Add support for adding TPL binariesSimon Glass7-6/+137
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>
2018-08-01binman: Add an entry for a Chromium vblockSimon Glass9-1/+259
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>
2018-08-01dtoc: Add a function to obtain a list of phandlesSimon Glass3-0/+57
Add a function which can decode a property containing a list of phandles. This is useful for finding nodes linked to a property. Also provide a way to look up a single phandle and get the Fdt object from a Node. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-08-01patman: Show the current directory in GetInputFilename()Simon Glass1-2/+2
When this fails it is useful to see the current directory, since U-Boot's build system will typically change into the output directory during the build. Add this information to the error. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-08-01binman: Add support for Chromium GBBSimon Glass6-0/+221
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>
2018-08-01patman: Add a few more helpers to the tools librarySimon Glass1-1/+75
Add functions to read and write a file, looking through a list of search paths to find it. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-08-01patman: Allow test commands to fall back to real onesSimon Glass1-2/+6
Tests use the 'test_result' feature to return a predetermined command result for particular commands. The avoids needing to have the real command available just to run a test. It works by calling the function provided by the test, to get the value. However sometimes the test does need to run the real command. Allow it to fall back to do this when the function does not return a result. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-08-01dtoc: Export the _FindNode() functionSimon Glass2-6/+6
This is useful for clients that want to find a node. Export it so it can be used by others. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-08-01binman: Add an entry filled with a repeating byteSimon Glass7-1/+127
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>
2018-08-01binman: Add support for a cros_ec imageSimon Glass5-0/+108
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>
2018-08-01binman: Add support for flashrom FMAPSimon Glass7-2/+265
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>
2018-08-01binman: Create README.entriesSimon Glass2-0/+457
Create a new README containing documentation for the entry types supported by binman. This provides an easy reference in one place. It is automatically generated from the source-code documentation. Add a reference to this from the binman README. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-08-01binman: Allow creation of entry documentationSimon Glass6-22/+118
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>
2018-08-01binman: Expand documentation for entriesSimon Glass24-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>
2018-08-01binman: Allow help to work without libfdtSimon Glass1-2/+5
At present binman needs libfdt.py to be available before it will do anything, even print help. Import those modules later to avoid this, as it is bad practice to fail to even show help on startup. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-08-01binman: Support an entry that holds textSimon Glass3-0/+94
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>
2018-08-01binman: Add support for passing arguments to entriesSimon Glass12-4/+293
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>
2018-08-01dtoc: Add missing comments to fdt_utilSimon Glass1-0/+34
This module has a few missing comments. Add them. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-08-01binman: Add a new 'image-pos' propertySimon Glass9-6/+57
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>
2018-08-01binman: Enhance the map and fdt-update outputSimon Glass6-23/+65
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>
2018-08-01binman: Tidy up some comments in the testsSimon Glass1-2/+4
A few lines are commented out and can be removed. Also fix return-value docs for _DoReadFile() and _DoReadFileDtb(). Signed-off-by: Simon Glass <sjg@chromium.org>
2018-08-01binman: Add comments to elf_testSimon Glass1-0/+33
The purpose of some of the tests is not obvious from the function names. Add a few comments to help with understanding. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-08-01binman: Rename 'position' to 'offset'Simon Glass38-243/+247
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>
2018-08-01binman: Don't depend on dict order in ELF testOutsideFile()Simon Glass1-1/+3
At present this test assumes that the symbols are returned in address order. However, objdump can list symbols in any order and dictionaries do not guarantee any particular order when iterating through item. Update elf.GetSymbols() to return an OrderedDict, sorted by address, to avoid any problems. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-07-30tools: genboardscfg: move buildman path to firstPeng Fan1-1/+1
To system which has kconfiglib installed, genboardscfg will use system kconfiglib, we need it use U-Boot owned version, so move the buildman path to first. Signed-off-by: Peng Fan <peng.fan@nxp.com> Cc: Masahiro Yamada <yamada.m@jp.panasonic.com> Cc: Simon Glass <sjg@chromium.org> Cc: Tom Rini <trini@konsulko.com> Acked-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-07-26Merge git://git.denx.de/u-boot-dmTom Rini1-1/+1
2018-07-26patman: Split alias entries on arbitrary whitespaceAdam Sampson1-1/+1
Previously the first three words in a git-mailrc alias entry could only be separated by spaces. git-send-email and Mutt both allow arbitrary whitespace here. Signed-off-by: Adam Sampson <ats@offog.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-07-24mkimage: fit_image: Use macros from image.hMichal Simek1-24/+29
There is no reason not to use macros which are already defined. It is also much easier for grepping. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-07-23tools/imximage: get HAB information from headerHolger Dengler1-4/+9
Signing parts of a u-boot imximage for image verification in High Assurance Boot (HAB) in a post-build process, requires some information from the imximage header. Currently, this information is only provided during the image build, which makes the transfer of this information to the post-build process harder than necessary. The i.MX HAB information (start and length) can be calculated either by using information from the image-configuration file, or from the information in the flash header of the imximage. The advantage of using information from flash header is, that they are not only available during image creation, but also available if existing images are processed. Example: $ tools/mkimage -l u-boot.imx Image Type: Freescale IMX Boot Image Image Ver: 2 (i.MX53/6/7 compatible) Mode: DCD Data Size: 483328 Bytes = 472.00 KiB = 0.46 MiB Load Address: 877ff420 Entry Point: 87800000 HAB Blocks: 0x877ff400 0x00000000 0x00071c00 DCD Blocks: 0x00910000 0x0000002c 0x00000208 Signed-off-by: Holger Dengler <dengler@linutronix.de> Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
2018-07-19lib: fdtdec: Rename routine fdtdec_setup_memory_size()Siva Durga Prasad Paladugu4-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>
2018-07-10mkimage: fit_image: Add support for SOURCE_DATE_EPOCH in signaturesAlex Kiernan2-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>
2018-07-10mkimage: Refactor imagetool_get_source_date to take command nameAlex Kiernan4-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>
2018-07-10vboot: Do not use hashed-strings offsetTeddy Reed1-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>
2018-07-10vboot: Add FIT_SIGNATURE_MAX_SIZE protectionTeddy Reed1-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>
2018-07-09binman: Support updating the device tree with calc'd infoSimon Glass6-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>
2018-07-09binman: Add a SetCalculatedProperties() methodSimon Glass7-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>
2018-07-09binman: Add a ProcessFdt() methodSimon Glass9-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>
2018-07-09binman: Complete documentation of stagesSimon Glass1-2/+4
At present one of the stages is badly numbered and not described. Fix this. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-07-09dtoc: Add functions to add integer propertiesSimon Glass2-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>
2018-07-09dtoc: Avoid unwanted output during testsSimon Glass2-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>
2018-07-09dtoc: Increase code coverage to 100%Simon Glass10-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>
2018-07-09binman: Move capture_sys_output() to test_utilSimon Glass3-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>
2018-07-09dtoc: Add a test for code coverageSimon Glass1-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>
2018-07-09dtoc: Fix some minor errorsSimon Glass3-4/+5
Fix some comments and a printf string which is incorrect. Signed-off-by: Simon Glass <sjg@chromium.org>