summaryrefslogtreecommitdiff
path: root/tools/socfpgaimage.c
AgeCommit message (Collapse)Author
2021-01-15tools: socfpgaimage: update padding flowLey Foon Tan
The existing socfpgaimage always pads the image to the maximum size of OCRAM size. This will break in the encryption flow where it expects the image to be un-padded. The encryption tool will do the encryption for the whole image and append the signature key at end of the image. The signature key will append to beyond the size of OCRAM if the image is padded with the maximum size before encryption. Move the padding step from socfpgaimage to Makefile and pads with objcopy command. socfpgaimage will pad the image with 16 bytes aligned (including CRC word), this is a requirement in encryption flow. Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
2021-01-15tools: socfpgaimage: Print image header informationLey Foon Tan
Print image header information if the header is verified. Example output from mkimage "-l" option: $ ./tools/mkimage -l spl/u-boot-spl.sfp Image Type : Cyclone V / Arria V SoC Image Validation word : 0x31305341 Version : 0x00000000 Flags : 0x00000000 Program length : 0x00003a59 Header checksum : 0x00000188 $ ./tools/mkimage -l spl/u-boot-spl.sfp Image Type : Arria 10 SoC Image Validation word : 0x31305341 Version : 0x00000001 Flags : 0x00000000 Header length : 0x00000014 Program length : 0x000138e0 Program entry : 0x00000014 Header checksum : 0x00000237 Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
2020-10-09tools: socfpgaimage: Add param entry point (ep) support for Arria 10 (v1)Ley Foon Tan
Add param entry point (ep) support for Arria 10 header. User can pass in 'e' option to mkimage to set the entry point. This is an optional option. If not specified, default is 0x14. Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
2020-10-09tools: socfpgaimage: Add check params function for Arria 10 (v1)Ley Foon Tan
Add check params function for Arria 10 (header v1). From [1] page 42, entry point offset should be 4 bytes aligned and any value smaller than 0x14 is invalid. Rename existing socfpgaimage_check_params() for v0. [1]: https://www.intel.com/content/dam/www/programmable/us/en/pdfs/literature/ug/ug_soc_eds.pdf Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
2020-04-24tool: use ALIGN() to align the sizeKever Yang
Use the ALIGN() for size align so that the code is more readable. Signed-off-by: Kever Yang <kever.yang@rock-chips.com> Reviewed-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-12-02crc32: Use the crc.h header for crc functionsSimon Glass
Drop inclusion of crc.h in common.h and use the correct header directly instead. With this we can drop the conflicting definition in fw_env.h and rely on the crc.h header, which is already included. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2018-10-03tools: socfpga: fix sfp_verify_headerAtsushi Nemoto
Fix sfp_verify_header to return correct version number. This fixes "Not a sane SOCFPGA preloader" error message with v1 header. Signed-off-by: Atsushi Nemoto <atsushi.nemoto@sord.co.jp>
2018-05-08tools: socfpga: Add SFP image V1 supportMarek Vasut
Add support for the SoCFPGA header v1 , which is used on Arria 10. Thus far the mkimage-socfpga image only supported header format v0 used on Cyclone V and Arria V, but is not supported on Arria 10. The layout of the v0 and v1 header is similar, yet there are a few differences, see the patch body for details. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Dinh Nguyen <dinguyen@kernel.org> Cc: Chin Liang See <chin.liang.see@intel.com>
2018-05-08tools: socfpga: Stop using global struct socfpga_imageMarek Vasut
The structure is passed around correctly, create local instances where necessary and zap the global struct socfpga_image instance. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Dinh Nguyen <dinguyen@kernel.org> Cc: Chin Liang See <chin.liang.see@intel.com>
2018-05-07SPDX: Convert all of our single license tags to Linux Kernel styleTom Rini
When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
2015-01-29tools: do not print error messages in verify_header() functionsGuilherme Maciel Ferreira
default_image.c and socfpgaimage.c are the only image modules that print error messages during header verification. The verify_header() is used to query if a given image file is processed by the image format. Thus, if the image format can't handle the file, it must simply return an error. Otherwise we pollute the screen with errors messages until we find the image format that handle a given image file. Signed-off-by: Guilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>
2015-01-29imagetool: replace image registration function by linker_lists featureGuilherme Maciel Ferreira
The registration was introduced in commit f86ed6a8d52c99bb2d17d3cac1647edca0c4399c This commit also removes all registration functions, and the member "next" from image_type_params struct Signed-off-by: Guilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>
2014-10-27tools/socfpgaimage.c: fix build on darwinAndreas Bießmann
socfpgaimage utilizes htole32 and friends, unfortunately these functions are not available on darwin. Fix it by using the cpu_to_le32 and friends defined in compiler.h as other parts in mkimage do. This patch fixes the following error: ---8<--- HOSTCC tools/socfpgaimage.o tools/socfpgaimage.c:77:22: warning: implicit declaration of function 'htole32' is invalid in C99 [-Wimplicit-function-declaration] header.validation = htole32(VALIDATION_WORD); ^ tools/socfpgaimage.c:80:22: warning: implicit declaration of function 'htole16' is invalid in C99 [-Wimplicit-function-declaration] header.length_u32 = htole16(length_bytes/4); ^ tools/socfpgaimage.c:95:6: warning: implicit declaration of function 'le32toh' is invalid in C99 [-Wimplicit-function-declaration] if (le32toh(header.validation) != VALIDATION_WORD) ^ tools/socfpgaimage.c:97:6: warning: implicit declaration of function 'le16toh' is invalid in C99 [-Wimplicit-function-declaration] if (le16toh(header.checksum) != hdr_checksum(&header)) ^ 4 warnings generated. ... HOSTLD tools/dumpimage Undefined symbols for architecture x86_64: "_htole16", referenced from: _socfpgaimage_set_header in socfpgaimage.o "_htole32", referenced from: _socfpgaimage_set_header in socfpgaimage.o "_le16toh", referenced from: _verify_buffer in socfpgaimage.o "_le32toh", referenced from: _verify_buffer in socfpgaimage.o ld: symbol(s) not found for architecture x86_64 --->8--- Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com> Acked-by: Pavel Machek <pavel@denx.de>
2014-10-06tools: socfpga: Add socfpga preloader signing to mkimageCharles Manning
Like many platforms, the Altera socfpga platform requires that the preloader be "signed" in a certain way or the built-in boot ROM will not boot the code. This change automatically creates an appropriately signed preloader from an SPL image. The signed image includes a CRC which must, of course, be generated with a CRC generator that the SoCFPGA boot ROM agrees with otherwise the boot ROM will reject the image. Unfortunately the CRC used in this boot ROM is not the same as the Adler CRC in lib/crc32.c. Indeed the Adler code is not technically a CRC but is more correctly described as a checksum. Thus, the appropriate CRC generator is added to lib/ as crc32_alt.c. Signed-off-by: Charles Manning <cdhmanning@gmail.com> Signed-off-by: Marek Vasut <marex@denx.de> Cc: Chin Liang See <clsee@altera.com> Cc: Dinh Nguyen <dinguyen@altera.com> Cc: Albert Aribaud <albert.u.boot@aribaud.net> Cc: Tom Rini <trini@ti.com> Cc: Wolfgang Denk <wd@denx.de> Cc: Pavel Machek <pavel@denx.de> Acked-by: Pavel Machek <pavel@denx.de> V2: - Zap unused constant - Explicitly print an error message in case of error - Rework the hdr_checksum() function to take the *header directly instead of a plan buffer pointer