summaryrefslogtreecommitdiff
path: root/tools
AgeCommit message (Collapse)AuthorFilesLines
2022-04-19tools: add boot/ to .gitignoreDu Huanpeng1-0/+1
/tools/boot/ is a build product. Add it to .gitignore Signed-off-by: Du Huanpeng <dhu@hodcarrier.org>
2022-04-18rockchip: tools: add rk3066 support to rkcommon.cJohan Jonker1-0/+1
Add rk3066 support to rkcommon.c Signed-off-by: Johan Jonker <jbx6244@gmail.com> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2022-04-15mkeficapsule: Remove raw and FIT GUID typesSughosh Ganu2-33/+1
While building a capsule, the GUID value of that specific image is to be passed through the --guid command option to the mkeficapsule tool instead of using one of --raw or --fit options, where the GUID value passed through the command line option is the image GUID. This renders the EFI_FIRMWARE_IMAGE_TYPE_UBOOT_FIT_GUID and EFI_FIRMWARE_IMAGE_TYPE_UBOOT_RAW_GUID values superfluous. Remove the --raw and --fit command line options as well. Also modify the mkeficapsule man page to reflect this change. Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
2022-04-11image: fit: Align hash output buffersSean Anderson1-0/+3
Hardware-accelerated hash functions require that the input and output buffers be aligned to the minimum DMA alignment. memalign.h helpfully provides a macro just for this purpose. It doesn't exist on the host, but we don't need to be aligned there either. Fixes: 5dfb521386 ("[new uImage] New uImage low-level API") Signed-off-by: Sean Anderson <sean.anderson@seco.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-04-06binman: Correct Chromium OS entry typesSimon Glass2-3/+3
The conversion to bintools broke the invocation of the utility, since the arguments are not correct. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-06tools: mkimage: Call verify_header after writing image to diskPali Rohár1-0/+41
If image backend provides verify_header callback then call it after writing image to disk. This ensures that written image is correct. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-04-06tools: mkimage: No need to verify_header for header_v2Yi Liu1-0/+4
rockchip header_v2 do not have a spl_hdr, so remove the verify. Signed-off-by: Yi Liu <liuyi@rock-chips.com> Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2022-04-05Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-sunxiTom Rini5-10/+979
A big part is the DM pinctrl driver, which allows us to get rid of quite some custom pinmux code and make the whole port much more robust. Many thanks to Samuel for that nice contribution! There are some more or less cosmetic warnings about missing clocks right now, I will send the trivial fixes for that later. Another big chunk is the mkimage upgrade, which adds RISC-V and TOC0 (secure images) support. Both features are unused at the moment, but I have an always-secure board that will use that once the DT lands in the kernel. On top of those big things we have some smaller fixes, improving the I2C DM support, fixing some H6/H616 early clock setup and improving the eMMC boot partition support. The gitlab CI completed successfully, including the build test for all 161 sunxi boards. I also boot tested on a A64, A20, H3, H6, and F1C100 board. USB, SD card, eMMC, and Ethernet all work there (where applicable).
2022-04-05tools: mkimage: Add Allwinner TOC0 supportSamuel Holland2-3/+911
Most Allwinner sunxi SoCs have separate boot ROMs in non-secure and secure mode. The "non-secure" or "normal" boot ROM (NBROM) uses the existing sunxi_egon image type. The secure boot ROM (SBROM) uses a completely different image type, known as TOC0. A TOC0 image is composed of a header and two or more items. One item is the firmware binary. The others form a chain linking the firmware signature to the root-of-trust public key (ROTPK), which has its hash burned in the SoC's eFuses. Signatures are made using RSA-2048 + SHA256. The pseudo-ASN.1 structure is manually assembled; this is done to work around bugs/quirks in the boot ROM, which vary between SoCs. This TOC0 implementation has been verified to work with the A50, A64, H5, H6, and H616 SBROMs, and it may work with other SoCs. Signed-off-by: Samuel Holland <samuel@sholland.org> Acked-by: Andre Przywara <andre.przywara@arm.com> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2022-04-05mkimage: sunxi_egon: add support for riscvIcenowy Zheng1-0/+23
There's now a sun20i family in sunxi, which uses RISC-V CPU. Add support for making eGON.BT0 image for RISC-V. Reviewed-by: Andre Przywara <andre.przywara@arm.com> Signed-off-by: Icenowy Zheng <icenowy@aosc.io> Signed-off-by: Samuel Holland <samuel@sholland.org> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2022-04-05mkimage: sunxi_egon: refactor for multi-architecture supportIcenowy Zheng1-7/+43
Refactor some functions in mkimage sunxi_egon type, in order to prepare for adding support for more CPU architectures (e.g. RISC-V). In addition, compatibility for operation w/o specified architecture is kept, in this case the architecture is assumed as ARM. Reviewed-by: Andre Przywara <andre.przywara@arm.com> Signed-off-by: Icenowy Zheng <icenowy@aosc.io> Signed-off-by: Samuel Holland <samuel@sholland.org> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2022-04-05mkimage: add a flag to describe whether -A is specifiedIcenowy Zheng2-0/+2
The sunxi_egon type used to take no -A argument (because we assume sunxi targets are all ARM). However, as Allwinner D1 appears as the first RISC-V sunxi target, we need to support -A; in addition, as external projects rely on U-Boot mkimage to generate sunxi eGON.BT0 header, we need to keep compatibility with command line without -A. As the default value of arch in mkimage is not proper (IH_ARCH_PPC instead of IH_ARCH_INVALID), to keep more compatibility, add an Aflag field to image parameters to describe whether an architecture is explicitly specified. Reviewed-by: Tom Rini <trini@konsulko.com> Signed-off-by: Icenowy Zheng <icenowy@aosc.io> Signed-off-by: Samuel Holland <samuel@sholland.org> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2022-04-03Revert "global: Remove CONFIG_SYS_EXTRA_OPTIONS support"Tom Rini2-1/+76
Unfortunately, we require additional logic to buildman to support this removal and still use SYS_SOC, etc, for build targets. This reverts commit eeec00072d7a0b5b91896d014618e558ce438738. Signed-off-by: Tom Rini <trini@konsulko.com>
2022-04-01global: Remove CONFIG_SYS_EXTRA_OPTIONS supportTom Rini2-76/+1
All options have now been migrated to Kconfig correctly so remove this support. Signed-off-by: Tom Rini <trini@konsulko.com>
2022-03-31tools: binman: add support for pre-load headerPhilippe Reynes11-0/+439
Adds the support of the pre-load header with the image signature to binman. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
2022-03-31mkimage: add public key for image pre-load stagePhilippe Reynes2-0/+117
This commit enhances mkimage to update the node /image/pre-load/sig with the public key. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
2022-03-28Merge tag 'v2022.04-rc5' into nextTom Rini1-1/+1
Prepare v2022.04-rc5
2022-03-20tools: buildman: Fix doc path in warning messageJohannes Krottmayer1-1/+1
Fix documentation path in deprecated warning message about device driver. Signed-off-by: Johannes Krottmayer <krjdev@gmail.com> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-03-19binman: Support splitting an ELF file into multiple nodesSimon Glass6-10/+597
Some boards need to load an ELF file using the 'loadables' property, but the file has segments at different memory addresses. This means that it cannot be supplied as a flat binary. Allow generating a separate node in the FIT for each segment in the ELF, with a different load address for each. Also add checks that the fit,xxx directives are valid. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-03-19binman: Keep a separate list of entries for fitSimon Glass1-5/+28
The current implementation sets up the FIT entries but then deletes the 'generator' ones so they don't appear in the final image. This is a bit clumsy. We cannot build the image more than once, since the generator entries are lost during the first build. Binman requires that calling BuildSectionData() multiple times returns a valid result each time. Keep a separate, private list which includes the generator nodes and use that where needed, to correct this problem. Ensure that the missing list includes removed generator entries too. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-03-19binman: Update fit to use node instead of subnodeSimon Glass1-8/+8
It doesn't make sense to use 'subnode' as a function parameter since it is just a 'node' so far as the function is concerned. Update two functions to use 'node' instead. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-03-19binman: Add a consistent way to report errors with fitSimon Glass2-9/+24
Add a new function to handling reporting errors within a particular subnode of the FIT description. This can be used to make the format of these errors consistent. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-03-19binman: Fix some pylint warnings in fitSimon Glass1-25/+25
Some warnings have crept in, so fix those that are easy to fix. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-03-19binman: Update fit to move node reading into the ReadNode() methodSimon Glass1-6/+4
This should not be done in the constructor. Move it. Signed-off-by: Simon Glass <sjg@chromium.org> Suggested-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-03-19binman: Read the fit entries only onceSimon Glass1-1/+0
At present the entries are read twice, once by the entry_Section class and once by the FIT implementation. This is harmless but can be confusing when debugging. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-03-19binman: Allow mkimage to use a non-zero fake-blob sizeSimon Glass7-8/+53
Unfortunately mkimage gets upset with zero-sized files. Update the ObtainContents() method to support specifying the size, if a fake blob is created. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-03-19binman: Make fake blobs zero-sized by defaultSimon Glass1-2/+3
On x86 devices having even a small amount of data can cause an overlap between regions. For example, bayleybay complains when the intel-vga region overlaps with u-boot-ucode: ImagePos Offset Size Name <none> 00000000 00800000 main-section <none> ff800000 00000080 intel-descriptor <none> ff800400 00000080 intel-me <none> fff00000 00098f24 u-boot-with-ucode-ptr <none> fff98f24 00001aa0 u-boot-dtb-with-ucode <none> fff9a9d0 0002a000 u-boot-ucode <none> fffb0000 00000080 intel-vga ... It is safer to use an empty file in most cases. Add an option to set the size for those uses that need it. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-03-19binman: Change how faked blobs are createdSimon Glass4-8/+13
At present fake blobs are created but internally an empty blob is used. Change it to use the contents of the faked file. Also return whether the blob was faked, in case the caller needs to know that. Add a TODO to put fake blobs in their own directory. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-03-19binman: Rename tools parameter to btoolsSimon Glass7-15/+15
This shadows the patman.tools library so rename it to avoid a pylint warning. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-03-19binman: Refactor fit to generate output at the endSimon Glass3-84/+109
At present the fit implementation creates the output tree while scanning the FIT description. Then it updates the tree later when the data is known. This works, but is a bit confusing, since it requires mixing the scanning code with the generation code, with a fix-up step at the end. It is actually possible to do this in two phases, one to scan everything and the other to generate the FIT. Thus the FIT is generated in one pass, when everything is known. Update the code accordingly. The only functional change is that the 'data' property for each node are now last instead of first, which is really a more natural position. Update the affected test to deal with this. One wrinkle is that the calculated properties (image-pos, size and offset) are now added before the FIT is generated. so we must filter these out when copying properties from the binman description to the FIT. Most of the change here is splitting out some of the code from the ReadEntries() implementation into _BuildInput(). So despite the large diff, most of the code is the same. It is not feasible to split this patch up, so far as I can tell. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-03-19binman: Rename ExpandEntries to gen_entriesSimon Glass5-8/+8
Leave the 'expand' term for use by entry types which have an expanded version of themselves. Rename this method to indicate that it generates subentries. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-03-19binman: Rename ExpandToLimit to extend_to_limitSimon Glass10-31/+51
The word 'expand' is used for entries which generate subentries. It is also used for entries that can have an '_expanded' version which is used to break out its contents. Rather than talking about expanding an entry's size, use the term 'extending'. It is slightly more precise and avoids the above conflicts. This change renders the old 'expand-size' property invalid, so add an error check for that. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-03-19binman: Tweak collect_contents_to_file() and docsSimon Glass3-15/+20
Update the return value of this function, fix the 'create' typo and update the documentation for clarity. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Suggested-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-03-19elf: Rename load_segments() and module failureSimon Glass2-12/+12
Rename this function to make it clear that it only reads loadable segments. Also update the error for missing module to better match the message emitted by Python. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Suggested-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-03-19dtoc: Tidy up implementation of AddStringList()Simon Glass3-3/+13
Refactor this to avoid a loop. Also add a test for an empty string. Signed-off-by: Simon Glass <sjg@chromium.org> Suggested-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-03-19moveconfig: Use re.fullmatch() to avoid extra checkSimon Glass1-2/+1
Simplify the code by using the available function. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-03-19moveconfig: Remove remove_defconfig()Simon Glass1-12/+1
This is not necessary if simpler code is used. Use the split function and drop the unnecessary [] Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Suggested-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-03-19dtoc: Make GetArgs() more flexibleSimon Glass3-3/+13
At present it is not possible to have arguments which include spaces. Update the function to only split the args if the property is a single string. This is a bit inconsistent, but might still be useful. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Suggested-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-03-19patman: Define Commit.path in the constructorSimon Glass1-0/+2
It is good practice to init all variables in the constructor and pylint sometimes checks this. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Tom Rini <trini@konsulko.com>
2022-03-19binman: Include also subnodes in generator nodesJan Kiszka3-0/+8
This allows to prefill fdt and config nodes with hash and signature subnodes. It's just important to place the child nodes last so that hashes do not come before the data - would be disliked by mkimage. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-03-19tools: binman: main.py: add build-sandbox in sys.pathPhilippe Reynes1-0/+1
Adds build-sandbox in sys.path to look for libfdt, otherwise py_test can't use binman. Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-03-19binman: Complete elf test coverageSimon Glass2-2/+50
Add coverage for the new elf functions needed for the event_dump.py script. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-03-15test/py: Add tests for the erofsHuang Jianan1-0/+1
Add Python scripts to test 'ls' and 'load' commands, as well as test related filesystem functions. Signed-off-by: Huang Jianan <jnhuang95@gmail.com>
2022-03-15CI, Docker: Update to latest focal tagTom Rini1-1/+1
Signed-off-by: Tom Rini <trini@konsulko.com>
2022-03-15Merge tag 'v2022.04-rc4' into nextTom Rini5-91/+432
Prepare v2022.04-rc4
2022-03-14tools: kwboot: Allow to mix positional arguments with option -bPali Rohár1-4/+14
Commit 9e6d71d2b55f ("tools: kwboot: Allow to use -b without image path as the last getopt() option") broke usage of kwboot with following arguments: kwboot -t -B 115200 /dev/ttyUSB0 -b u-boot-spl.kwb Fix parsing of option -b with optional argument again. Fixes: 9e6d71d2b55f ("tools: kwboot: Allow to use -b without image path as the last getopt() option") Signed-off-by: Pali Rohár <pali@kernel.org> Reported-by: Tony Dinh <mibodhi@gmail.com> Tested-by: Tony Dinh <mibodhi at gmail.com> Reviewed-by: Stefan Roese <sr@denx.de>
2022-03-14tools: kwboot: Check if baudrate value is supported before sending imagePali Rohár1-1/+13
Call kwboot_open_tty() which baudrate value which was specified at the command line by option -B. This function returns error if baudrate is not supported by selected tty device. Initial baudrate for image transfer is always 115200, so call kwboot_tty_change_baudrate() with value 115200 immediately after kwboot_open_tty() if baudrate specified by option -B is different than 115200. This makes kwboot fail immediately, informing that baudrate is unsupported, instead of failing only after the first part of image is already sent. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de>
2022-03-14tools: kwboot: Allow to specify custom baudrate only in supported operationsPali Rohár1-0/+6
Custom baudrate different than 115200 may be specified only when kwboot is not going to send boot/debug message pattern or when it is going to send boot message pattern with image file (in which case baudrate change happens after sending kwbimage header). BootROM detects boot/debug message pattern only at baudrate 115200. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de>
2022-03-10binman: Expand elf support a littleSimon Glass1-7/+51
Allow finding a symbol by its address. Also export the function to get the file offset of a particular address, so it can be used by a script to be added. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-03-04mkimage: error handling for FIT imageHeinrich Schuchardt1-1/+6
If parameter -F is given but FIT support is missing, a NULL pointer might dereferenced (Coverity CID 350249). If incorrect parameters are given, provide a message and show usage. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>