X-Git-Url: https://git.librecmc.org/?p=oweals%2Fu-boot.git;a=blobdiff_plain;f=tools%2Frkcommon.h;h=93518824a513c5f3a857b5a635c43988fae61752;hp=cc161a647ca3b46d75e3aafb8ba44d6d167ce378;hb=35c2683f46bdea96f1dfce404aee4369a824b68e;hpb=308277569229137e38420dbaa1190ef1f9d4be76 diff --git a/tools/rkcommon.h b/tools/rkcommon.h index cc161a647c..93518824a5 100644 --- a/tools/rkcommon.h +++ b/tools/rkcommon.h @@ -1,8 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* * (C) Copyright 2015 Google, Inc * Written by Simon Glass - * - * SPDX-License-Identifier: GPL-2.0+ */ #ifndef _RKCOMMON_H @@ -10,12 +9,11 @@ enum { RK_BLK_SIZE = 512, + RK_SIZE_ALIGN = 2048, RK_INIT_OFFSET = 4, RK_MAX_BOOT_SIZE = 512 << 10, RK_SPL_HDR_START = RK_INIT_OFFSET * RK_BLK_SIZE, RK_SPL_HDR_SIZE = 4, - RK_SPL_START = RK_SPL_HDR_START + RK_SPL_HDR_SIZE, - RK_IMAGE_HEADER_LEN = RK_SPL_START, }; /** @@ -49,11 +47,28 @@ int rkcommon_get_spl_size(struct image_tool_params *params); * This sets up a 2KB header which can be interpreted by the Rockchip boot ROM. * * @buf: Pointer to header place (must be at least 2KB in size) - * @file_size: Size of the file we want the boot ROM to load, in bytes - * @return 0 if OK, -ENOSPC if too large */ -int rkcommon_set_header(void *buf, uint file_size, - struct image_tool_params *params); +void rkcommon_set_header(void *buf, struct stat *sbuf, int ifd, + 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 @@ -83,8 +98,10 @@ void rkcommon_rc4_encode_spl(void *buf, unsigned int offset, unsigned int size); * @params: Pointer to the tool params structure * @tparams: Pointer tot the image type structure (for setting * the header and header_size) + * + * @return 0 (always) */ -void rkcommon_vrec_header(struct image_tool_params *params, - struct image_type_params *tparams); +int rkcommon_vrec_header(struct image_tool_params *params, + struct image_type_params *tparams); #endif