X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=tools%2Frkcommon.h;h=8790f1ceab070b3a4bd9c1d2f4df069d7e80e54a;hb=5de0b5a36a173e7fe311951ba115dec569cc0c8d;hp=b4f6f327dc17f85be0933dc927336ca153b5de33;hpb=02ccab1908c405fe1449457d4a0d343784a30acb;p=people%2Fms%2Fu-boot.git diff --git a/tools/rkcommon.h b/tools/rkcommon.h index b4f6f327dc..8790f1ceab 100644 --- a/tools/rkcommon.h +++ b/tools/rkcommon.h @@ -10,6 +10,7 @@ enum { RK_BLK_SIZE = 512, + RK_INIT_SIZE_ALIGN = 2048, RK_INIT_OFFSET = 4, RK_MAX_BOOT_SIZE = 512 << 10, RK_SPL_HDR_START = RK_INIT_OFFSET * RK_BLK_SIZE, @@ -55,6 +56,25 @@ int rkcommon_get_spl_size(struct image_tool_params *params); int rkcommon_set_header(void *buf, uint file_size, struct image_tool_params *params); +/** + * rkcommon_verify_header() - verify the header for a Rockchip boot image + * + * @buf: Pointer to the image file + * @file_size: Size of entire bootable image file (incl. all padding) + * @return 0 if OK + */ +int rkcommon_verify_header(unsigned char *buf, int size, + struct image_tool_params *params); + +/** + * rkcommon_print_header() - print the header for a Rockchip boot image + * + * This prints the header, spl_name and whether this is a SD/MMC or SPI image. + * + * @buf: Pointer to the image (can be a read-only file-mapping) + */ +void rkcommon_print_header(const void *buf); + /** * rkcommon_need_rc4_spl() - check if rc4 encoded spl is required * @@ -77,4 +97,20 @@ bool rkcommon_need_rc4_spl(struct image_tool_params *params); */ void rkcommon_rc4_encode_spl(void *buf, unsigned int offset, unsigned int size); +/** + * rkcommon_vrec_header() - allocate memory for the header + * + * @params: Pointer to the tool params structure + * @tparams: Pointer tot the image type structure (for setting + * the header and header_size) + * @alignment: Alignment (a power of two) that the image should be + * padded to (e.g. 512 if we want to align with SD/MMC + * blocksizes or 2048 for the SPI format) + * + * @return bytes of padding required/added (does not include the header_size) + */ +int rkcommon_vrec_header(struct image_tool_params *params, + struct image_type_params *tparams, + unsigned int alignment); + #endif