summaryrefslogtreecommitdiff
path: root/tools
Commit message (Collapse)AuthorAgeFilesLines
* crc16-ccitt: Rename file with CRC-16-CCITT implementation to crc16-ccitt.cPali Rohár2022-04-211-1/+1
| | | | | | | | | U-Boot CRC-16 implementation uses polynomial x^16 + x^12 + x^5 + 1 which is not standard CRC-16 algorithm, but it is known as CRC-16-CCITT. Rename file crc16.c to crc16-ccitt.c to reduce confusion. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de>
* tools: kwboot: Replace fstat()+st_size by lseek()+SEEK_ENDPali Rohár2022-04-211-8/+11
| | | | | | | | | fstat()'s st_size works only for regular files. lseek() with SEEK_END works also for block or MTD devices. This replacement allows kwboot to load kwbimage from /dev/mtd0 for booting another device over /dev/ttyS0. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Marek Behún <marek.behun@nic.cz>
* tools/mrvl_uart.sh: Remove scriptPali Rohár2022-04-211-119/+0
| | | | | | | | | | | | | There are two tools for sending images over UART to Marvell SoCs: kwboot and mrvl_uart.sh. kwboot received lot of new features and improvements in last few months. There is no need to maintain two tools in U-Boot, so remove old mrvl_uart.sh tool. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Marcel Ziswiler <marcel@ziswiler.com> Tested-by: Marcel Ziswiler <marcel@ziswiler.com> Reviewed-by: Tony Dinh <mibodhi@gmail.com>
* tools: add boot/ to .gitignoreDu Huanpeng2022-04-191-0/+1
| | | | | | /tools/boot/ is a build product. Add it to .gitignore Signed-off-by: Du Huanpeng <dhu@hodcarrier.org>
* rockchip: tools: add rk3066 support to rkcommon.cJohan Jonker2022-04-181-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>
* mkeficapsule: Remove raw and FIT GUID typesSughosh Ganu2022-04-152-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>
* image: fit: Align hash output buffersSean Anderson2022-04-111-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>
* binman: Correct Chromium OS entry typesSimon Glass2022-04-062-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>
* tools: mkimage: Call verify_header after writing image to diskPali Rohár2022-04-061-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>
* tools: mkimage: No need to verify_header for header_v2Yi Liu2022-04-061-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>
* Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-sunxiTom Rini2022-04-055-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).
| * tools: mkimage: Add Allwinner TOC0 supportSamuel Holland2022-04-042-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>
| * mkimage: sunxi_egon: add support for riscvIcenowy Zheng2022-04-041-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>
| * mkimage: sunxi_egon: refactor for multi-architecture supportIcenowy Zheng2022-04-041-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>
| * mkimage: add a flag to describe whether -A is specifiedIcenowy Zheng2022-04-042-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>
* | Revert "global: Remove CONFIG_SYS_EXTRA_OPTIONS support"Tom Rini2022-04-022-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>
* | global: Remove CONFIG_SYS_EXTRA_OPTIONS supportTom Rini2022-04-012-76/+1
| | | | | | | | | | | | | | All options have now been migrated to Kconfig correctly so remove this support. Signed-off-by: Tom Rini <trini@konsulko.com>
* | tools: binman: add support for pre-load headerPhilippe Reynes2022-03-3111-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>
* | mkimage: add public key for image pre-load stagePhilippe Reynes2022-03-312-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>
* | Merge tag 'v2022.04-rc5' into nextTom Rini2022-03-281-1/+1
|\ \ | |/ | | | | Prepare v2022.04-rc5
| * tools: buildman: Fix doc path in warning messageJohannes Krottmayer2022-03-201-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>
* | binman: Support splitting an ELF file into multiple nodesSimon Glass2022-03-186-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>
* | binman: Keep a separate list of entries for fitSimon Glass2022-03-181-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>
* | binman: Update fit to use node instead of subnodeSimon Glass2022-03-181-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>
* | binman: Add a consistent way to report errors with fitSimon Glass2022-03-182-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>
* | binman: Fix some pylint warnings in fitSimon Glass2022-03-181-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>
* | binman: Update fit to move node reading into the ReadNode() methodSimon Glass2022-03-181-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>
* | binman: Read the fit entries only onceSimon Glass2022-03-181-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>
* | binman: Allow mkimage to use a non-zero fake-blob sizeSimon Glass2022-03-187-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>
* | binman: Make fake blobs zero-sized by defaultSimon Glass2022-03-181-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>
* | binman: Change how faked blobs are createdSimon Glass2022-03-184-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>
* | binman: Rename tools parameter to btoolsSimon Glass2022-03-187-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>
* | binman: Refactor fit to generate output at the endSimon Glass2022-03-183-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>
* | binman: Rename ExpandEntries to gen_entriesSimon Glass2022-03-185-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>
* | binman: Rename ExpandToLimit to extend_to_limitSimon Glass2022-03-1810-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>
* | binman: Tweak collect_contents_to_file() and docsSimon Glass2022-03-183-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>
* | elf: Rename load_segments() and module failureSimon Glass2022-03-182-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>
* | dtoc: Tidy up implementation of AddStringList()Simon Glass2022-03-183-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>
* | moveconfig: Use re.fullmatch() to avoid extra checkSimon Glass2022-03-181-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>
* | moveconfig: Remove remove_defconfig()Simon Glass2022-03-181-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>
* | dtoc: Make GetArgs() more flexibleSimon Glass2022-03-183-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>
* | patman: Define Commit.path in the constructorSimon Glass2022-03-181-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>
* | binman: Include also subnodes in generator nodesJan Kiszka2022-03-183-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>
* | tools: binman: main.py: add build-sandbox in sys.pathPhilippe Reynes2022-03-181-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>
* | binman: Complete elf test coverageSimon Glass2022-03-182-2/+50
| | | | | | | | | | | | | | Add coverage for the new elf functions needed for the event_dump.py script. Signed-off-by: Simon Glass <sjg@chromium.org>
* | test/py: Add tests for the erofsHuang Jianan2022-03-151-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>
* | CI, Docker: Update to latest focal tagTom Rini2022-03-151-1/+1
| | | | | | | | Signed-off-by: Tom Rini <trini@konsulko.com>
* | Merge tag 'v2022.04-rc4' into nextTom Rini2022-03-145-91/+432
|\ \ | |/ | | | | Prepare v2022.04-rc4
| * tools: kwboot: Allow to mix positional arguments with option -bPali Rohár2022-03-141-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>
| * tools: kwboot: Check if baudrate value is supported before sending imagePali Rohár2022-03-141-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>