summaryrefslogtreecommitdiff
path: root/tools
AgeCommit message (Collapse)Author
2023-03-08binman: Make the tooldir configurableSimon Glass
Add a command-line argument for setting the tooldir, so that the default can be overridden. Add this directory to the toolpath automatically. Create the directory if it does not already exist. Put the default in the argument parser instead of the class, so that it is more obvious. Update a few tests that expect the utility name to be provided without any path (e.g. 'futility'), so they can accept a path, e.g. /path/to/futility Update the documentation and add a few tests. Improve the help for --toolpath while we are here. Signed-off-by: Simon Glass <[email protected]>
2023-03-08binman: Use a private directory for bintoolsSimon Glass
At present binman writes tools into the ~/bin directory. This is convenient but some may be concerned about downloading unverified binaries and running them. Place then in a special ~/.binman-tools directory instead. Mention this in the documentation. Signed-off-by: Simon Glass <[email protected]> Reviewed-by: Tom Rini <[email protected]>
2023-03-08binman: Move the tools directory into the Bintool classSimon Glass
We want to be able to change this directory. Use a class member to hold the value, since changing a constant is not good. Signed-off-by: Simon Glass <[email protected]>
2023-03-08binman: Update bintools documentationSimon Glass
This was not regenerated with recent changes. Update it. Signed-off-by: Simon Glass <[email protected]>
2023-03-08binman: Correct an 'aot' typoSimon Glass
Fix this typo. Signed-off-by: Simon Glass <[email protected]>
2023-03-08buildman: Add a flag for reproducible buildsSimon Glass
This is quite a useful thing to use when building since it avoids small size changes between commits. Add a -r flag for it. Also undefine CONFIG_LOCALVERSION_AUTO since this appends the git hash to the version string, causing every build to be slightly different. Signed-off-by: Simon Glass <[email protected]>
2023-03-08buildman: Support disabling LTOSimon Glass
This cuts down build performance considerably and is not always needed, when checking for build errors, etc. Add a flag to disable it. Signed-off-by: Simon Glass <[email protected]>
2023-03-08buildman: Write out the build command usedSimon Glass
It is sometimes useful to see the exact 'make' command used by buildman for a commit. Add an output file for this. Signed-off-by: Simon Glass <[email protected]>
2023-03-08buildman: Add a note about the out-env fileSimon Glass
This file holds the environment used when doing a build. Add a note about it. Signed-off-by: Simon Glass <[email protected]>
2023-03-08binman: Use correct argument name in docstringsJonas Karlman
Use correct argument name in docstrings. Signed-off-by: Jonas Karlman <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2023-03-08binman: Fix spelling of nodes in code commentsJonas Karlman
Replace notes with nodes in code comments and docstrings. Signed-off-by: Jonas Karlman <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2023-03-08binman: Remove redundant SetAllowFakeBlob from blob-ext entryJonas Karlman
Entry_blob_ext contains an implementation of SetAllowFakeBlob that is identical to the one in the base Entry class, remove it. Signed-off-by: Jonas Karlman <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2023-03-08binman: Support marking FMAP areas as preservedSimon Glass
Add an entry flag called 'preserve' to indicate that an entry should be preserved by firmware updates. Propagate this to FMAP too. Signed-off-by: Simon Glass <[email protected]>
2023-03-08binman: Avoid requiring a home directory on startupSimon Glass
This is needed to download tools, but we may not need to do this. At present binman fails to start if HOME is not set. Use the current directory as a default to avoid this. Signed-off-by: Simon Glass <[email protected]>
2023-03-01tools: kwbimage: Add support for creating an image with no dataPali Rohár
This change add support for mkimage's -s option to kwbimage format. It will create an kwbimage with empty data part of image (data part would contain only required 32-bit checksum). mkimage's -s option is indicated by skipcpy flag and it is basically in conflict with mkimage's -d (datafile) option. "Empty" kwbimage with no data can still contain headers. For example it can contain binary executable header which is copied by BootROM into L2SRAM. This is useful for example for small images which can do not require DDR RAM and can be run in L2SRAM (which do not require any initialization). Signed-off-by: Pali Rohár <[email protected]>
2023-03-01tools: mkimage: Do not try to open datafile when it is skippedPali Rohár
When mkimage was instructed to skip datafile via option -s then do not try to validate or open datafile as it does not have to exist or to be specified via -d option. This change allows to use -s option for skipping datafile when -d option for datafile was not specified. Signed-off-by: Pali Rohár <[email protected]>
2023-03-01tools: mkimage: Print human readable error when -d is not specifiedPali Rohár
When asking mkimage to create a new image file and option -d is not specified then mkimage show human unfriendly error message: mkimage: Can't open (null): Bad address Without debugger it is hard to debug what is the issue. Function open() is being called with file name set to NULL. So add a check for this and if it happens then show human readable message that option -d was not specified. Signed-off-by: Pali Rohár <[email protected]>
2023-03-01tools: kwbimage: Add support for XIP SPI/NOR imagesPali Rohár
Marvell BootROM can execute SPI images directly from NOR (either SPI/serial or parallel) without copying them to DDR RAM. This is know at XIP - execute in place. To achieve that, destination address in kwbimage must be set to 0xFFFFFFFF and execute address to the offset in bytes from the beginning of NOR memory. Kirkwood and Dove which use kwbimage v0 format and have SPI address space mapped to physical memory at 0xE8000000-0xEFFFFFFF by BootROM. Armada SoCs use kwbimage v1 format and have SPI address space mapped to physical memory at 0xD4000000-0xD7FFFFFF and Device bus address space (used for parallel NOR) at 0xD8000000-0xDFFFFFFF. Add support for generating XIP kwbimages by mkimage -x flag and mark xflag as valid option in kwbimage.c. Signed-off-by: Pali Rohár <[email protected]>
2023-03-01tools: mkimage: Do not fill legacy_img_hdr for non-legacy XIP imagesPali Rohár
Skip filling legacy_img_hdr structure for XIP images which do not use legacy_img_hdr structure header. Adding unwanted header to other image formats, like kwbimage cause generation of broken image. Signed-off-by: Pali Rohár <[email protected]>
2023-03-01tools: kwbimage: Fix invalid secure boot header signaturePali Rohár
Secure boot header signature is calculated from the image header with zeroed header checksum. Calculation is done in add_secure_header_v1() function. So after calling this function no header member except main_hdr->checksum can be modified. Commit 2b0980c24027 ("tools: kwbimage: Fill the real header size into the main header") broke this requirement as final header size started to be filled into main_hdr->headersz_* members after the add_secure_header_v1() call. Fix this issue by following steps: - Split header size and image data offset into two variables (headersz and *dataoff). - Change image_headersz_v0() and add_binary_header_v1() functions to return real (unaligned) header size instead of image data offset. - On every place use correct variable (headersz or *dataoff) After these steps variable headersz is correctly filled into the main_hdr->headersz_* members and so overwriting them in the end of the image_create_v1() function is not needed anymore. Remove those overwriting which effectively reverts changes in problematic commit without affecting value in main_hdr->headersz_* members and makes secure boot header signature valid again. Fixes: 2b0980c24027 ("tools: kwbimage: Fill the real header size into the main header") Signed-off-by: Pali Rohár <[email protected]>
2023-03-01tools: kwbimage: Fix generating secure boot data image signaturePali Rohár
Secure boot data image signature is calculated from the data image without trailing 4-bit checksum. Commit 37cb9c15d70d ("tools: kwbimage: Simplify aligning and calculating checksum") unintentionally broke this calculation when it increased payloadsz variable by 4 bytes which was propagated also into the add_secure_header_v1() function. Fix this issue by decreasing size of buffer by 4 bytes from which is calculated secure boot data image signature. Fixes: 37cb9c15d70d ("tools: kwbimage: Simplify aligning and calculating checksum") Signed-off-by: Pali Rohár <[email protected]>
2023-03-01tools: kwbimage: Rename imagesz to dataoffPali Rohár
Variable imagesz in functions image_create_v0(), image_create_v1() and kwbimage_set_header() stores offset to data from the beginning of the main header. So it is not image size. Signed-off-by: Pali Rohár <[email protected]>
2023-03-01tools: kwbimage: Simplify add_secure_header_v1()Pali Rohár
To make add_secure_header_v1() function more readable, call it directly with arguments: header pointer with header size and data image pointer with data image size. No functional change. Signed-off-by: Pali Rohár <[email protected]>
2023-03-01tools: kwbimage: Print image data offset when printing kwbimage headerPali Rohár
For all images except SATA is data offset in bytes. For SATA it is in LBA format (number of sectors). This is how Marvell BootROM interprets it. Signed-off-by: Pali Rohár <[email protected]>
2023-03-01tools: kwbimage: Print binary image offset as sizePali Rohár
Use for it pretty print function: genimg_print_size(). This makes it more human readable, like other offset and sizes printed by this tool. Signed-off-by: Pali Rohár <[email protected]>
2023-03-01tools: kwbimage: Add support for dumping NAND_BLKSZ for v0 imagesPali Rohár
In Dove functional specification, which use kwbimage v0, is also defined nand block size field. So dump NAND_BLKSZ also for v0 images. In Kirkwood functional specification, which also use kwbimage v0, this field is not defined. So when it is zero and Kirkwood is detected, do not dump it. Fixes: f76ae2571fe0 ("tools: kwbimage: Add support for dumping extended and binary v0 headers") Signed-off-by: Pali Rohár <[email protected]>
2023-03-01tools: kwbimage: Reject mkimage -F optionPali Rohár
mkimage -F option (re-sign existing FIT image) signaled by fflag is not supported by kwbimage. So mark its usage as invalid parameter. Signed-off-by: Pali Rohár <[email protected]>
2023-03-01tools: kwbimage: Fix endianity when printing kwbimage headerPali Rohár
All fields in kwbimage header are in little endian format. Signed-off-by: Pali Rohár <[email protected]>
2023-03-01tools: kwbimage: Fix generating of kwbimage v0 header checksumPali Rohár
Checksum for v0 image must be generated after filling all fields in the main header. Otherwise it would be invalid. Exactly same problem for v1 images was already fixed in the past in commit 9203c73895ab ("tools: kwbimage: Fix checksum calculation for v1 images"). Fixes: 5c61710c9880 ("tools: kwbimage: Properly set srcaddr in kwbimage v0") Signed-off-by: Pali Rohár <[email protected]>
2023-03-01tools: kwbimage: Fix dumping NAND_BLKSZPali Rohár
kwbimage nandblocksize field is in 64 kB unit, but NAND_BLKSZ command expects it in bytes. So do required unit conversion. Also zero value in nandblocksize field has special meaning. When this field is set to zero, the default block size is used. This default size is defined by the NAND flash page size (16 KB for a 512B page or small page NAND and 64 KB for a large page NAND flash). Fixes: 1a8e6b63e24f ("tools: kwbimage: Dump kwbimage config file on '-p -1' option") Signed-off-by: Pali Rohár <[email protected]>
2023-03-01tools: kwbimage: Fix dumping NAND_BADBLK_LOCATIONPali Rohár
Value 0x0 for NAND_BADBLK_LOCATION/nandbadblklocation means that BBI is on the first or second page and value 0x1 means that BBI is on the last page. This indicates also NAND Flash Technology, value 0x0 is SLC NAND and value 0x1 is MLC NAND. Therefore we need to dump NAND_BADBLK_LOCATION also when it is zero. Note that in v0 images, nandbadblklocation field overlaps with ddrinitdelay field in one union. ddrinitdelay is used in Kirkwood and nandbadblklocation is used in Dove. For Dove images is_v0_ext should be set, so use it to distinguish if nandbadblklocation is available or not. In v1 images there is always nandbadblklocation field. Fixes: 1a8e6b63e24f ("tools: kwbimage: Dump kwbimage config file on '-p -1' option") Signed-off-by: Pali Rohár <[email protected]>
2023-03-01tools: kwbimage: Fix endianity when dumping NAND_PAGE_SIZEPali Rohár
Fixes: 1a8e6b63e24f ("tools: kwbimage: Dump kwbimage config file on '-p -1' option") Signed-off-by: Pali Rohár <[email protected]>
2023-03-01tools: kwbimage: Fix dumping register set / DATA commandsPali Rohár
Upper-bound for iterating for-loop over register set entries is incorrect. Fix it byt calculating correct number of entries. And fix also dumping the last entry DATA_DELAY, which is the last and not first (zero). Fixes: 1a8e6b63e24f ("tools: kwbimage: Dump kwbimage config file on '-p -1' option") Signed-off-by: Pali Rohár <[email protected]>
2023-03-01tools: kwboot: Show image type and error parsing reasonsPali Rohár
Show image type and version during parsing of kwbimage. And show reasons in error messages when parsing failed. This can help to debug issues with invalid images. Signed-off-by: Pali Rohár <[email protected]>
2023-03-01tools: kwboot: Fix patching of SPI/NOR XIP imagesPali Rohár
Marvell BootROM interprets execaddr of SPI/NOR XIP images as relative byte offset from the from the beginning of the flash device. So if data image offset and execute offset are not same then it is needed to adjust them also in DDR RAM. Fixes: f2c644e0b8bc ("tools: kwboot: Patch destination address to DDR area for SPI image") Signed-off-by: Pali Rohár <[email protected]>
2023-03-01tools: kwboot: Add check that kwbimage contains DDR init codePali Rohár
Some NOR images may be execute-in-place and do not contain DDR init code in its kwbimage header. Such images cannot be booted over UART as BootROM loads them to RAM. Add check that kwbimage contains DDR init code in its header (either as binary code header or as the simple register-value set). In some cases it is possible to load very small image into L2SRAM and when DDR init code is not required. So check for L2SRAM load address and skip DDR init code check in this case. Signed-off-by: Pali Rohár <[email protected]>
2023-03-01tools: kwboot: Validate optional kwbimage v1 headersPali Rohár
Before starting parsing of kwbimage, first validate that all optional v1 headers and correct. This prevents kwboot crashes on invalid input. Signed-off-by: Pali Rohár <[email protected]>
2023-03-01tools: kwboot: Fix parsing UART image without data checksumPali Rohár
The 32-bit data checksum in UART image is not checked by the BootROM and also Marvell tools do not generate it. So if data checksum stored in UART image does not match calculated checksum from the image then treat those checksum bytes as part of the executable image code (and not as the checksum) and for compatibility with the rest of the code manually insert data checksum into the in-memory image after the executable code, without overwriting it. This should allow to boot UART images generated by Marvell tools. Signed-off-by: Pali Rohár <[email protected]>
2023-03-01tools: kwboot: Add image type documentationPali Rohár
Add information of all available image types and where they should be stored. Storage location offsets where documented from the disassembly of the A385 BootROM image dump. Signed-off-by: Pali Rohár <[email protected]>
2023-03-01tools: kwboot: Add more documentation referencesPali Rohár
Add reference to Avanta Boot Flow documentation, BobCat2, AlleyCat3 and PONCat3 BootROM Firmware documentation and links to public Marvell tools: hdrparser.c and doimage.c Signed-off-by: Pali Rohár <[email protected]>
2023-03-01tools: kwboot: Fix parsing SATA kwbimagePali Rohár
Despite the official specification, Marvell BootROM does not interpret srcaddr from SATA image as number of sectors the beginning of the hard drive, but as number of sectors relative to the main header. To parse SATA kwbimage in the same way as Marvell BootROM, it is needed to interpret srcaddr as relative offset to the main header. This change fixes loading of SATA images via kwboot over UART. Fixes: 792e42355083 ("tools: kwboot: Patch source address in image header") Signed-off-by: Pali Rohár <[email protected]>
2023-03-01tools: kwbimage: Fix generating, verifying and extracting SATA kwbimagePali Rohár
Despite the official specification, Marvell BootROM does not interpret srcaddr from SATA image as number of sectors the beginning of the hard drive, but as number of sectors relative to the main header. The main header is stored at absolute sector number 1. So do not add or subtract it when calculating with relative offsets to the main header. Fixes: 501a54a29cc2 ("tools: kwbimage: Fix generation of SATA, SDIO and PCIe images") Fixes: 5c61710c9880 ("tools: kwbimage: Properly set srcaddr in kwbimage v0") Fixes: e0c243c398a7 ("tools: kwbimage: Validate data checksum of v1 images") Fixes: aa6943ca3122 ("kwbimage: Add support for extracting images via dumpimage tool") Signed-off-by: Pali Rohár <[email protected]>
2023-03-01tools: kwboot: Fix parsing SDIO kwbimagePali Rohár
Despite the official specification, Marvell BootROM does not interpret srcaddr from SDIO image as offset in number of sectors (like for SATA image), but as offset in bytes (like for all other images except SATA). To parse SDIO kwbimage in the same way as Marvell BootROM, it is needed to interpret srcaddr in bytes. This change fixes loading of SDIO images via kwboot over UART. Fixes: 792e42355083 ("tools: kwboot: Patch source address in image header") Signed-off-by: Pali Rohár <[email protected]>
2023-03-01tools: kwbimage: Fix generating, verifying and extracting SDIO kwbimagePali Rohár
Despite the official specification, Marvell BootROM does not interpret srcaddr from SDIO image as offset in number of sectors (like for SATA image), but as offset in bytes (like for all other images except SATA). To generate SDIO kwbimage compatible with Marvell BootROM, it is needed to have srcaddr in bytes. This change fixes SDIO images for Armada 38x SoCs. Fixes: 501a54a29cc2 ("tools: kwbimage: Fix generation of SATA, SDIO and PCIe images") Fixes: 5c61710c9880 ("tools: kwbimage: Properly set srcaddr in kwbimage v0") Fixes: e0c243c398a7 ("tools: kwbimage: Validate data checksum of v1 images") Fixes: aa6943ca3122 ("kwbimage: Add support for extracting images via dumpimage tool") Signed-off-by: Pali Rohár <[email protected]>
2023-02-27Merge tag 'v2023.04-rc3' into nextTom Rini
Prepare v2023.04-rc3
2023-02-27Dockerfile: Add missing "chmod" of u-boot-gen-combinedTom Rini
I had added this line locally, rebuild the image, but didn't ensure that I had committed the correct version of the patch as well. Fixes: 75b031ee4a96 ("Dockerfile: download binaries for Nokia RX-51") Signed-off-by: Tom Rini <[email protected]>
2023-02-24Dockerfile: build qemu for Nokia n900Heinrich Schuchardt
Using a pre-built QEMU saves a lot of time when testing. Signed-off-by: Heinrich Schuchardt <[email protected]>
2023-02-24Dockerfile: download binaries for Nokia RX-51Heinrich Schuchardt
Downloading files for a test may fail if the server is offline. It is preferable to provide the files in our Docker image. Signed-off-by: Heinrich Schuchardt <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2023-02-17riscv: binman: Add help message for missing blobsRick Chen
Add the 'missing-msg' for more detailed output on missing system firmware. Signed-off-by: Rick Chen <[email protected]> Reviewed-by: Leo Yu-Chi Liang <[email protected]> Reviewed-by: Yu Chien Peter Lin <[email protected]>
2023-02-14checkpatch: Add a warning for pre-schema driver model tagsSimon Glass
Help ensure that these don't creep into development by adding a check in checkpatch for them. Signed-off-by: Simon Glass <[email protected]>