Blame view
tools/rkcommon.h
3.1 KB
83d290c56 SPDX: Convert all... |
1 |
/* SPDX-License-Identifier: GPL-2.0+ */ |
a131c1f44 rockchip: Add the... |
2 3 4 |
/* * (C) Copyright 2015 Google, Inc * Written by Simon Glass <sjg@chromium.org> |
a131c1f44 rockchip: Add the... |
5 6 7 8 9 10 11 |
*/ #ifndef _RKCOMMON_H #define _RKCOMMON_H enum { RK_BLK_SIZE = 512, |
eea6cd8d7 rockchip: mkimage... |
12 |
RK_SIZE_ALIGN = 2048, |
3641339ef rockchip: Add sup... |
13 14 |
RK_INIT_OFFSET = 4, RK_MAX_BOOT_SIZE = 512 << 10, |
7bf274b9c rockchip: mkimage... |
15 16 |
RK_SPL_HDR_START = RK_INIT_OFFSET * RK_BLK_SIZE, RK_SPL_HDR_SIZE = 4, |
a131c1f44 rockchip: Add the... |
17 18 19 |
}; /** |
7bf274b9c rockchip: mkimage... |
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
* rkcommon_check_params() - check params * * @return 0 if OK, -1 if ERROR. */ int rkcommon_check_params(struct image_tool_params *params); /** * rkcommon_get_spl_hdr() - get 4-bytes spl hdr for a Rockchip boot image * * Rockchip's bootrom requires the spl loader to start with a 4-bytes * header. The content of this header depends on the chip type. */ const char *rkcommon_get_spl_hdr(struct image_tool_params *params); /** * rkcommon_get_spl_size() - get spl size for a Rockchip boot image * * Different chip may have different sram size. And if we want to jump * back to the bootrom after spl, we may need to reserve some sram space * for the bootrom. * The spl loader size should be sram size minus reserved size(if needed) */ int rkcommon_get_spl_size(struct image_tool_params *params); /** |
a131c1f44 rockchip: Add the... |
45 46 47 48 49 |
* rkcommon_set_header() - set up the header for a Rockchip boot image * * 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) |
a131c1f44 rockchip: Add the... |
50 |
*/ |
eea6cd8d7 rockchip: mkimage... |
51 52 |
void rkcommon_set_header(void *buf, struct stat *sbuf, int ifd, struct image_tool_params *params); |
a131c1f44 rockchip: Add the... |
53 |
|
cfbcdade7 rockchip: mkimage... |
54 |
/** |
2fb371ff6 rockchip: mkimage... |
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
* 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); /** |
cfbcdade7 rockchip: mkimage... |
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
* rkcommon_need_rc4_spl() - check if rc4 encoded spl is required * * Some socs cannot disable the rc4-encryption of the spl binary. * rc4 encryption is disabled normally except on socs that cannot * handle unencrypted binaries. * @return true or false depending on rc4 being required. */ bool rkcommon_need_rc4_spl(struct image_tool_params *params); /** * rkcommon_rc4_encode_spl() - encode the spl binary * * Encrypts the SPL binary using the generic rc4 key as required * by some socs. * * @buf: Pointer to the SPL data (header and SPL binary) * @offset: offset inside buf to start at * @size: number of bytes to encode */ void rkcommon_rc4_encode_spl(void *buf, unsigned int offset, unsigned int size); |
111bcc4fb rockchip: mkimage... |
94 95 96 97 98 99 |
/** * 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) |
366aad4d9 rockchip: mkimage... |
100 |
* |
eea6cd8d7 rockchip: mkimage... |
101 |
* @return 0 (always) |
111bcc4fb rockchip: mkimage... |
102 |
*/ |
366aad4d9 rockchip: mkimage... |
103 |
int rkcommon_vrec_header(struct image_tool_params *params, |
eea6cd8d7 rockchip: mkimage... |
104 |
struct image_type_params *tparams); |
111bcc4fb rockchip: mkimage... |
105 |
|
a131c1f44 rockchip: Add the... |
106 |
#endif |