summaryrefslogtreecommitdiff
path: root/tools
AgeCommit message (Collapse)Author
2022-01-25binman: Move compression into binmanSimon Glass
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 <[email protected]>
2022-01-25binman: Convert to using the mkimage bintoolSimon Glass
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 <[email protected]>
2022-01-25binman: Convert to using the ifwitool bintoolSimon Glass
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 <[email protected]>
2022-01-25binman: Convert to using the futility bintoolSimon Glass
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 <[email protected]>
2022-01-25binman: Convert to using the FIP bintoolSimon Glass
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 <[email protected]>
2022-01-25binman: Convert to using the CBFS bintoolSimon Glass
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 <[email protected]>
2022-01-25binman: Enable bintool tests including cmdline processingSimon Glass
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 <[email protected]>
2022-01-25binman: Add a bintool implementation for mkimageSimon Glass
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 <[email protected]>
2022-01-25binman: Add a bintool implementation for ifwitoolSimon Glass
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 <[email protected]>
2022-01-25binman: Add a bintool implementation for futilitySimon Glass
Add a Bintool for this, which is used to sign Chrome OS images and build the Google Binary Block (GBB). It supports the features needed by binman as well as fetching a binary from Google Drive. Building it from source is possible but is left for another time, as it requires at least one other library. Signed-off-by: Simon Glass <[email protected]>
2022-01-25binman: Add a bintool implementation for fiptoolSimon Glass
Add a Bintool for this, which is used to run FIP tests. It supports the features needed by the tests as well as building a binary from the git tree. Signed-off-by: Simon Glass <[email protected]>
2022-01-25binman: Add a bintool implementation for cbfstoolSimon Glass
Add a Bintool for this, which is used to run CBFS tests. It supports the features needed by the tests as well as fetching a binary from Google Drive. Building it from source is very slow since it is not separately supported by the coreboot build system and it builds an entire gcc toolchain before starting. Signed-off-by: Simon Glass <[email protected]>
2022-01-25binman: Add tests for bintoolSimon Glass
Add tests to cover the bintool functionality. Signed-off-by: Simon Glass <[email protected]>
2022-01-25binman: Plumb in support for bintoolsSimon Glass
Support collecting the available bintools needed by an image, by scanning the entries in the image. Also add a command-line interface to access the basic bintool features, such as listing the bintools and fetching them if needed. Signed-off-by: Simon Glass <[email protected]>
2022-01-25binman: Add support for bintoolsSimon Glass
Binman requires various tools to actually work, such as 'lz4' to compress data and 'futility' to sign Chrome OS firmware. At present these are handled in an ad-hoc manner and there is no easy way to find out what tools are needd to build an image, nor where to obtain them. Add an implementation of 'bintool', a base class which implements this functionality. When a bintool is required, it can be requested from this module, then executed. When the tool is missing, it can provide a way to obtain it. Note that this uses Command directly, not the tools.Run() function. This allows proper handling of missing tools and avoids needing to catch and re-raise exceptions. Signed-off-by: Simon Glass <[email protected]>
2022-01-25binman: Add installation instructionsSimon Glass
Explain how to install binman, since it is not obvious. Signed-off-by: Simon Glass <[email protected]>
2022-01-25binman: Correct path for fip_utilSimon Glass
This should be imported from the binman module. Fix it. Signed-off-by: Simon Glass <[email protected]>
2022-01-25binman: Allow faked blobs in blob-ext-listSimon Glass
Since this is a list of blobs, each blob should have the ability to be faked, as with blob-ext. Update the Entry base class to set allow_fake and use the base class in the section code also, so that this propagagtes to blob-ext-list, which is not a section. Signed-off-by: Simon Glass <[email protected]>
2022-01-25binman: Drop the image name from the fake-blob messageSimon Glass
This is not really needed and it makes the message different from the missing-blob message. Update it. Signed-off-by: Simon Glass <[email protected]>
2022-01-25patman: Add a function to find a tool on the pathSimon Glass
The Run() function automatically uses the PATH variable to locate a tool when running it. Add a function that does this manually, so we don't have to run a tool to find out if it is present. This is needed by the new Bintool class, which wants to check which tools are present. Signed-off-by: Simon Glass <[email protected]>
2022-01-25patman: Tidy up the download function a littleSimon Glass
Reverse the order of the return tuple, so that the filename is first. This seems more obvious than putting the temporary directory first. Correct a bug that leaves a space on the final line. Allow the caller to control the name of the temporary directory. Signed-off-by: Simon Glass <[email protected]>
2022-01-25buildman: Move the download function to toolsSimon Glass
This function is handy for binman as well. Move it into the shared 'tools' module. Signed-off-by: Simon Glass <[email protected]>
2022-01-25patman: Allow running a tool and returning the full resultSimon Glass
Add a new function which returns the entire result from running a tool, not just stdout. Update Run() to use this and to return stdout on error, if stderr is empty, since some unfortunate tools write their error output to stdout rather than stderr. Move building of the PATH to a separate function. Make the exception catching more specific, to catch just ValueError, since broad exceptions are a pain to debug. Signed-off-by: Simon Glass <[email protected]>
2022-01-25binman: Expand the external FIT test a littleSimon Glass
At present this does not check that the external data is in the expected place. Use a non-zero offset for the external data and check it. Signed-off-by: Simon Glass <[email protected]>
2022-01-25mkimage: Show the external-offset errorSimon Glass
This is a debug message at present, which is not very helpful. Print out the error so that action can be taken. Signed-off-by: Simon Glass <[email protected]>
2022-01-25binman: Tweak elf tests for a toolchain changeSimon Glass
Some newer toolchains do not create a symbol for the .ucode section that this test relies on. Update the test to use the symbol that is explicitly created, instead. Signed-off-by: Simon Glass <[email protected]>
2022-01-24moveconfig: Fix some pylint errorsSimon Glass
There are over 200 errors in this file. Fix some of them, starting at the beginning of the file. Future work can continue this effort. Signed-off-by: Simon Glass <[email protected]>
2022-01-24moveconfig: Use a function to read filesSimon Glass
At present there is quite a bit of ad-hoc code reading from files. The most common case is to read the file as lines. Put it in a function and set the unicode encoding correctly. Avoid writing back to a file when there are obviously no changes as this speeds things up slightly. Signed-off-by: Simon Glass <[email protected]>
2022-01-24moveconfig: Use a function to write filesSimon Glass
At present there is quite a bit of ad-hoc code writing to files. The treatment of newlines is different in some of them. Put it in a function and set the unicode encoding correctly. Signed-off-by: Simon Glass <[email protected]>
2022-01-24moveconfig: Drop check for old PythonSimon Glass
Python 2 is not supported anymore and Python 3 has had subprocess.DEVNULL since version 3.3 which was released in 2012. Drop the unnecessary check. Signed-off-by: Simon Glass <[email protected]> Reviewed-by: Heinrich Schuchardt <[email protected]>
2022-01-24moveconfig: Convert to ArgumentParserSimon Glass
This is a newer library and is now preferred for Python scripts. Update the code to use it instead of optparse Use 'args' instead of 'options' throughout, since this is the term used in that module. Also it helps to avoid confusion with CONFIG options, a term that is used in this file. Signed-off-by: Simon Glass <[email protected]>
2022-01-24moveconfig: Use single quotesSimon Glass
Quite a few places use double quotes. Fix this to be consistent with other Python code in U-Boot. Signed-off-by: Simon Glass <[email protected]> Reviewed-by: Heinrich Schuchardt <[email protected]>
2022-01-24moveconfig: Allow querying board configurationSimon Glass
It is useful to be able to find out which boards define a particular option, or combination of options. This is not as easy as grepping the defconfig files since many options are implied by others. Add a -f option to the moveconfig tool to permit this. Update the documentation to cover this, including a better title for the doc page. Signed-off-by: Simon Glass <[email protected]>
2022-01-24moveconfig: Allow adding unit testsSimon Glass
Add a -t option to run unit tests in this program. So far, there is none. Signed-off-by: Simon Glass <[email protected]>
2022-01-24moveconfig: Sort the optionsSimon Glass
Put the options in sorted order by their short name so it is easier to find an option. Signed-off-by: Simon Glass <[email protected]>
2022-01-24moveconfig: Read the database in a separate functionSimon Glass
Move this code out into a function so it can be used elsewhere. Signed-off-by: Simon Glass <[email protected]>
2022-01-24moveconfig: Correct operation of the 'imply' featureSimon Glass
This doesn't work anymore, since the Kconfig update. The script has no tests so we did not notice. Fix it. Signed-off-by: Simon Glass <[email protected]>
2022-01-24tools: Add init files for Python toolsSimon Glass
Add some empty __init__ files for binman, buildman and dtoc so that pylint is able to recognise these as Python modules and produce more useful pylint output. Signed-off-by: Simon Glass <[email protected]>
2022-01-24patman: Update the list of modulesSimon Glass
Update the __init__ file to include recently added files. Add a license header while we are here. Signed-off-by: Simon Glass <[email protected]>
2022-01-24dtoc: Fix up a code comment that confuses pylintSimon Glass
This produces a pylint error at present. Fix it. Signed-off-by: Simon Glass <[email protected]>
2022-01-24mkimage: struct stat.st_size may not be longHeinrich Schuchardt
The component st_size of struct stat is of type off_t. Depending on the system printing it using %ld leads to a warning: tools/mkimage.c:438:54: warning: format '%ld' expects argument of type 'long int', but argument 5 has type 'off_t' {aka 'long long int'} [-Wformat=] 438 | "%s: Bad size: \"%s\" is not valid image: size %ld < %u\n", | ~~^ | | | long int | %lld When comparing an off_t value to a 32bit integer we should not convert to uint32_t but to off_t which may be wider. Reported-by: Milan P. Stanić <[email protected]> Fixes: 331f0800f1a3 ("mkimage: allow -l to work on block devices on Linux") Signed-off-by: Heinrich Schuchardt <[email protected]> Reviewed-by: Mark Kettenis <[email protected]>
2022-01-24mkimage: Allow to specify the signature algorithm on the command lineJan Kiszka
This permits to prepare FIT image description that do not hard-code the final choice of the signature algorithm, possibly requiring the user to patch the sources. When -o <algo> is specified, this information is used in favor of the 'algo' property in the signature node. Furthermore, that property is set accordingly when writing the image. Signed-off-by: Jan Kiszka <[email protected]>
2022-01-24mkimage: Drop unused OPT_STRING constantJan Kiszka
The actual opt string is inlined - and different. Seems this was a left-over from older versions of 603e26f76346. Signed-off-by: Jan Kiszka <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2022-01-24image-fit: Make string of algo parameter constantJan Kiszka
Modifications would be invalid. Signed-off-by: Jan Kiszka <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2022-01-24tools/fitimage: make sure dumpimage still works when "@" are detectedStefan Eichenberger
fit_verify_header fails if it detects unit addresses "@". However, this will break tools like dumpimage on fit images which worked with previous versions of the tool (e.g. 2020.04 vs 2021.07). As an example the output of: dumpimage -l <fit image> is: FIT description: U-Boot fitImage for Linux Distribution Created: Thu Jan 1 01:00:00 1970 Image 0 (kernel@1) Description: Linux kernel Created: Thu Jan 1 01:00:00 1970 Type: Kernel Image Compression: gzip compressed Data Size: 6442456 Bytes = 6291.46 KiB = 6.14 MiB Architecture: AArch64 OS: Linux Load Address: 0x80080000 Entry Point: 0x80080000 Hash algo: sha256 Hash value: ... Image 1 (fdt@freescale_fsl-s32g274a-evb.dtb) Description: Flattened Device Tree blob Created: Thu Jan 1 01:00:00 1970 Type: Flat Device Tree Compression: uncompressed Data Size: 39661 Bytes = 38.73 KiB = 0.04 MiB Architecture: AArch64 Hash algo: sha256 Hash value: ... Default Configuration: 'conf@freescale_fsl-s32g274a-evb.dtb' Configuration 0 (conf@freescale_fsl-s32g274a-evb.dtb) Description: 1 Linux kernel, FDT blob Kernel: kernel@1 FDT: fdt@freescale_fsl-s32g274a-evb.dtb Hash algo: sha256 Hash value: unavailable But with newer version it shows: dumpimage -l <fit image> GP Header: Size d00dfeed LoadAddr 62f0a4 This commit will output a warning that unit addresses were detected but will not fail: dumpimage -l <fit image> Image contains unit addresses @, this will break signing ... Signed-off-by: Stefan Eichenberger <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2022-01-24tools/fitimage: remove redundant format checkStefan Eichenberger
fit_extract_contents does a fit_check_format even thought it was already checked during imagetool_verify_print_header. Therefore, this check is not necessary. This commit removes the redundancy. Signed-off-by: Stefan Eichenberger <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2022-01-19doc: replace @return by Return:Heinrich Schuchardt
Sphinx expects Return: and not @return to indicate a return value. find . -name '*.c' -exec \ sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \; find . -name '*.h' -exec \ sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \; Signed-off-by: Heinrich Schuchardt <[email protected]>
2022-01-14tools: kwbimage: Fix mkimage/dumpimage -l argumentPali Rohár
Do not check for kwbimage configuration file when just showing information about existing kwbimage file. The check for kwbimage configuration file is required only when creating kwbimage, not when showing information about image or when extracting data from image. With this change, it is possible to call mkimage -l and dumpimage -l also for existing kwbimage file. Signed-off-by: Pali Rohár <[email protected]> Reviewed-by: Marek Behún <[email protected]> Reviewed-by: Stefan Roese <[email protected]>
2022-01-14tools: kwbimage: Extract main data image without -p arg for dumpimagePali Rohár
When there is no -p argument for dumpimage tool specified, extract the main data image from kwbimage file. This makes dumpimage consistent with other image formats. Signed-off-by: Pali Rohár <[email protected]> Reviewed-by: Marek Behún <[email protected]> Reviewed-by: Stefan Roese <[email protected]>
2022-01-14tools: kwbimage/kwboot: Check ext field for non-zero valuePali Rohár
Despite the official specification, BootROM does not look at the lowest bit of ext field but rather checks if ext field is non-zero. Moreover original Marvell doimage tool puts into the mhdr->ext field the number of extended headers, so basically it sets ext filed to non-zero value if some extended header is present. Fix U-Boot dumpimage and kwboot tools to parse correctly also kwbimage files created by Marvell doimage tool, in the same way as the BootROM is doing it when booting these images. Signed-off-by: Pali Rohár <[email protected]> Reviewed-by: Marek Behún <[email protected]> Reviewed-by: Stefan Roese <[email protected]>